source,pass,cost "module { func.func @bar() { return } func.func @standalone_types(%arg0: !standalone.custom<""10"">) { return } }"," mlir-opt --load-dialect-plugin=tandalone_libs/StandalonePluginhlibext --pass-pipeline=""builtin.module(standalone-switch-bar-foo)"" ",1 "module { func.func @bar() { %0 = arith.constant 1 : i32 %res = standalone.foo %0 : i32 return } func.func @standalone_types(%arg0: !standalone.custom<""10"">) { return } }", standalone-opt | standalone-opt ,1 "module { func.func @bar() { return } func.func @abar() { return } }"," mlir-opt --load-pass-plugin=tandalone_libs/StandalonePluginhlibext --pass-pipeline=""builtin.module(standalone-switch-bar-foo)"" ",1 "func.func @emitc_constant() { %c0 = ""emitc.constant""(){value = #emitc.opaque<"""">} : () -> i32 %c1 = ""emitc.constant""(){value = 42 : i32} : () -> i32 %c2 = ""emitc.constant""(){value = -1 : i32} : () -> i32 %c3 = ""emitc.constant""(){value = -1 : si8} : () -> si8 %c4 = ""emitc.constant""(){value = 255 : ui8} : () -> ui8 %c5 = ""emitc.constant""(){value = #emitc.opaque<""CHAR_MIN"">} : () -> !emitc.opaque<""char""> return }", mlir-translate -mlir-to-cpp ,1 "func.func @emitc_constant() { %c0 = ""emitc.constant""(){value = #emitc.opaque<"""">} : () -> i32 %c1 = ""emitc.constant""(){value = 42 : i32} : () -> i32 %c2 = ""emitc.constant""(){value = -1 : i32} : () -> i32 %c3 = ""emitc.constant""(){value = -1 : si8} : () -> si8 %c4 = ""emitc.constant""(){value = 255 : ui8} : () -> ui8 %c5 = ""emitc.constant""(){value = #emitc.opaque<""CHAR_MIN"">} : () -> !emitc.opaque<""char""> return }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "func.func @std_constant() { %c0 = arith.constant 0 : i32 %c1 = arith.constant 2 : index %c2 = arith.constant 2.0 : f32 %c3 = arith.constant dense<0> : tensor %c4 = arith.constant dense<[0, 1]> : tensor<2xindex> %c5 = arith.constant dense<[[0.0, 1.0], [2.0, 3.0]]> : tensor<2x2xf32> return } func.func @std_call() { %0 = call @one_result () : () -> i32 %1 = call @one_result () : () -> i32 return } func.func @std_call_two_results() { %c = arith.constant 0 : i8 %0:2 = call @two_results () : () -> (i32, f32) %1:2 = call @two_results () : () -> (i32, f32) return } func.func @one_result() -> i32 { %0 = arith.constant 0 : i32 return %0 : i32 } func.func @two_results() -> (i32, f32) { %0 = arith.constant 0 : i32 %1 = arith.constant 1.0 : f32 return %0, %1 : i32, f32 } func.func @single_return_statement(%arg0 : i32) -> i32 { return %arg0 : i32 }", mlir-translate -mlir-to-cpp ,1 "func.func @std_constant() { %c0 = arith.constant 0 : i32 %c1 = arith.constant 2 : index %c2 = arith.constant 2.0 : f32 %c3 = arith.constant dense<0> : tensor %c4 = arith.constant dense<[0, 1]> : tensor<2xindex> %c5 = arith.constant dense<[[0.0, 1.0], [2.0, 3.0]]> : tensor<2x2xf32> return } func.func @std_call() { %0 = call @one_result () : () -> i32 %1 = call @one_result () : () -> i32 return } func.func @std_call_two_results() { %c = arith.constant 0 : i8 %0:2 = call @two_results () : () -> (i32, f32) %1:2 = call @two_results () : () -> (i32, f32) return } func.func @one_result() -> i32 { %0 = arith.constant 0 : i32 return %0 : i32 } func.func @two_results() -> (i32, f32) { %0 = arith.constant 0 : i32 %1 = arith.constant 1.0 : f32 return %0, %1 : i32, f32 } func.func @single_return_statement(%arg0 : i32) -> i32 { return %arg0 : i32 }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "func.func @test_for(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { %0 = emitc.call ""f""() : () -> i32 } return } func.func @test_for_yield() { %start = arith.constant 0 : index %stop = arith.constant 10 : index %step = arith.constant 1 : index %s0 = arith.constant 0 : i32 %p0 = arith.constant 1.0 : f32 %result:2 = scf.for %iter = %start to %stop step %step iter_args(%si = %s0, %pi = %p0) -> (i32, f32) { %sn = emitc.call ""add""(%si, %iter) : (i32, index) -> i32 %pn = emitc.call ""mul""(%pi, %iter) : (f32, index) -> f32 scf.yield %sn, %pn : i32, f32 } return }", mlir-translate -mlir-to-cpp ,1 "func.func @test_for(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { %0 = emitc.call ""f""() : () -> i32 } return } func.func @test_for_yield() { %start = arith.constant 0 : index %stop = arith.constant 10 : index %step = arith.constant 1 : index %s0 = arith.constant 0 : i32 %p0 = arith.constant 1.0 : f32 %result:2 = scf.for %iter = %start to %stop step %step iter_args(%si = %s0, %pi = %p0) -> (i32, f32) { %sn = emitc.call ""add""(%si, %iter) : (i32, index) -> i32 %pn = emitc.call ""mul""(%pi, %iter) : (f32, index) -> f32 scf.yield %sn, %pn : i32, f32 } return }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "func.func @emitc_variable() { %c0 = ""emitc.variable""(){value = #emitc.opaque<"""">} : () -> i32 %c1 = ""emitc.variable""(){value = 42 : i32} : () -> i32 %c2 = ""emitc.variable""(){value = -1 : i32} : () -> i32 %c3 = ""emitc.variable""(){value = -1 : si8} : () -> si8 %c4 = ""emitc.variable""(){value = 255 : ui8} : () -> ui8 %c5 = ""emitc.variable""(){value = #emitc.opaque<"""">} : () -> !emitc.ptr %c6 = ""emitc.variable""(){value = #emitc.opaque<""NULL"">} : () -> !emitc.ptr return }", mlir-translate -mlir-to-cpp ,1 "func.func @emitc_variable() { %c0 = ""emitc.variable""(){value = #emitc.opaque<"""">} : () -> i32 %c1 = ""emitc.variable""(){value = 42 : i32} : () -> i32 %c2 = ""emitc.variable""(){value = -1 : i32} : () -> i32 %c3 = ""emitc.variable""(){value = -1 : si8} : () -> si8 %c4 = ""emitc.variable""(){value = 255 : ui8} : () -> ui8 %c5 = ""emitc.variable""(){value = #emitc.opaque<"""">} : () -> !emitc.ptr %c6 = ""emitc.variable""(){value = #emitc.opaque<""NULL"">} : () -> !emitc.ptr return }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "func.func @opaque_types() { emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc.opaque<""std::vector"">]} : () -> () return } func.func @ptr_types() { emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () %0 = emitc.call ""f""() : () -> (!emitc.ptr) %1 = emitc.call ""f""(%0) : (!emitc.ptr) -> (!emitc.ptr>) emitc.call ""f""() {template_args = [!emitc.ptr>]} : () -> () return }", mlir-translate -mlir-to-cpp ,1 "func.func @emitc_call() { %0 = emitc.call ""func_a"" () : () -> i32 %1 = emitc.call ""func_b"" () : () -> i32 return } func.func @emitc_call_two_results() { %0 = arith.constant 0 : index %1:2 = emitc.call ""two_results"" () : () -> (i32, i32) return }", mlir-translate -mlir-to-cpp ,1 "func.func @emitc_call() { %0 = emitc.call ""func_a"" () : () -> i32 %1 = emitc.call ""func_b"" () : () -> i32 return } func.func @emitc_call_two_results() { %0 = arith.constant 0 : index %1:2 = emitc.call ""two_results"" () : () -> (i32, i32) return }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "func.func @cast(%arg0 : i32) { %1 = emitc.cast %arg0: i32 to ui32 %2 = emitc.cast %arg0: i32 to i64 %3 = emitc.cast %arg0: i32 to ui64 %4 = emitc.cast %arg0: i32 to f32 %5 = emitc.cast %arg0: i32 to f64 %6 = emitc.cast %arg0: i32 to i1 %7 = emitc.cast %arg0: i32 to !emitc.opaque<""mytype""> return } func.func @cast_ptr(%arg0 : !emitc.ptr>) { %1 = emitc.cast %arg0 : !emitc.ptr> to !emitc.ptr return }", mlir-translate -mlir-to-cpp ,1 "func.func @test_if(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = emitc.call ""func_const""(%arg1) : (f32) -> i32 } return } func.func @test_if_else(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = emitc.call ""func_true""(%arg1) : (f32) -> i32 } else { %0 = emitc.call ""func_false""(%arg1) : (f32) -> i32 } return } func.func @test_if_yield(%arg0: i1, %arg1: f32) { %0 = arith.constant 0 : i8 %x, %y = scf.if %arg0 -> (i32, f64) { %1 = emitc.call ""func_true_1""(%arg1) : (f32) -> i32 %2 = emitc.call ""func_true_2""(%arg1) : (f32) -> f64 scf.yield %1, %2 : i32, f64 } else { %1 = emitc.call ""func_false_1""(%arg1) : (f32) -> i32 %2 = emitc.call ""func_false_2""(%arg1) : (f32) -> f64 scf.yield %1, %2 : i32, f64 } return }", mlir-translate -mlir-to-cpp ,1 "func.func @test_if(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = emitc.call ""func_const""(%arg1) : (f32) -> i32 } return } func.func @test_if_else(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = emitc.call ""func_true""(%arg1) : (f32) -> i32 } else { %0 = emitc.call ""func_false""(%arg1) : (f32) -> i32 } return } func.func @test_if_yield(%arg0: i1, %arg1: f32) { %0 = arith.constant 0 : i8 %x, %y = scf.if %arg0 -> (i32, f64) { %1 = emitc.call ""func_true_1""(%arg1) : (f32) -> i32 %2 = emitc.call ""func_true_2""(%arg1) : (f32) -> f64 scf.yield %1, %2 : i32, f64 } else { %1 = emitc.call ""func_false_1""(%arg1) : (f32) -> i32 %2 = emitc.call ""func_false_2""(%arg1) : (f32) -> f64 scf.yield %1, %2 : i32, f64 } return }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "func.func @opaque_attrs() { emitc.call ""f""() {args = [#emitc.opaque<""OPAQUE_ENUM_VALUE"">]} : () -> () emitc.call ""f""() {args = [#emitc.opaque<""\""some string\"""">]} : () -> () return }", mlir-translate -mlir-to-cpp ,1 "func.func @simple(i64, i1) -> i64 { ^bb0(%a: i64, %cond: i1): cf.cond_br %cond, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%a: i64) ^bb2: %b = emitc.call ""add""(%a, %a) : (i64, i64) -> i64 cf.br ^bb3(%b: i64) ^bb3(%c: i64): cf.br ^bb4(%c, %a : i64, i64) ^bb4(%d : i64, %e : i64): %0 = emitc.call ""add""(%d, %e) : (i64, i64) -> i64 return %0 : i64 } func.func @block_labels0() { ^bb1: cf.br ^bb2 ^bb2: return } func.func @block_labels1() { ^bb1: cf.br ^bb2 ^bb2: return }", mlir-translate -mlir-to-cpp -declare-variables-at-top ,1 "emitc.include ""myheader.h"" emitc.include <""myheader.h""> func.func @test_foo_print() { %0 = emitc.call ""foo::constant""() {args = [dense<[0, 1]> : tensor<2xi32>]} : () -> (i32) %1 = emitc.call ""foo::op_and_attr""(%0) {args = [dense<[0, 1]> : tensor<2xi32>, 0 : index]} : (i32) -> (i32) %2 = emitc.call ""foo::op_and_attr""(%1) {args = [0 : index, dense<[0, 1]> : tensor<2xi32>]} : (i32) -> (i32) emitc.call ""foo::print""(%2): (i32) -> () return } func.func @test_single_return(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @test_multiple_return() -> (i32, i32) { %0:2 = emitc.call ""foo::blah""() : () -> (i32, i32) %1 = call @test_single_return(%0#0) : (i32) -> i32 return %1, %0#1 : i32, i32 } func.func @test_float() { %0 = emitc.call ""foo::constant""() {args = [dense<[0.000000e+00, 1.000000e+00]> : tensor<2xf32>]} : () -> f32 return } func.func @test_uint() { %0 = emitc.call ""foo::constant""() {args = [dense<[0, 1]> : tensor<2xui32>]} : () -> ui32 %1 = emitc.call ""foo::constant""() {args = [dense<[0, 1]> : tensor<2xui64>]} : () -> ui64 return } func.func @test_plus_int(%arg0 : i64) -> i64 { %0 = emitc.call ""mhlo::add""(%arg0, %arg0) {args = [0 : index, 1 : index]} : (i64, i64) -> i64 return %0 : i64 } func.func @mixed_types(%arg0: tensor<2xf64>) -> tensor<2xf32> { %0 = emitc.call ""foo::mixed_types""(%arg0) {args = [0 : index]} : (tensor<2xf64>) -> tensor<2xf32> return %0 : tensor<2xf32> } func.func @mhlo_convert(%arg0: tensor) -> tensor { %0 = emitc.call ""mhlo::convert""(%arg0) {args = [0 : index]} : (tensor) -> tensor return %0 : tensor } func.func @opaque_types(%arg0: !emitc.opaque<""bool"">, %arg1: !emitc.opaque<""char"">) -> !emitc.opaque<""status_t""> { %0 = emitc.call ""a""(%arg0, %arg1) : (!emitc.opaque<""bool"">, !emitc.opaque<""char"">) -> (!emitc.opaque<""int"">) %1 = emitc.call ""b""(%0): (!emitc.opaque<""int"">) -> (!emitc.opaque<""char"">) %2 = emitc.call ""c""(%0, %1): (!emitc.opaque<""int"">, !emitc.opaque<""char"">) -> (!emitc.opaque<""status_t"">) return %2 : !emitc.opaque<""status_t""> } func.func @apply(%arg0: i32) -> !emitc.ptr { %0 = emitc.apply ""&""(%arg0) : (i32) -> !emitc.ptr %1 = emitc.apply ""*""(%0) : (!emitc.ptr) -> (i32) return %0 : !emitc.ptr }", mlir-translate -mlir-to-cpp ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @foo spirv.ExecutionMode @foo ""LocalSizeHint"", 3, 4, 5 }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @linkage_attr_test_kernel() ""DontInline"" attributes {} { %uchar_0 = spirv.Constant 0 : i8 %ushort_1 = spirv.Constant 1 : i16 %uint_0 = spirv.Constant 0 : i32 spirv.FunctionCall @outside.func.with.linkage(%uchar_0):(i8) -> () spirv.Return } spirv.func @outside.func.with.linkage(%arg0 : i8) -> () ""Pure"" attributes { linkage_attributes=#spirv.linkage_attributes< linkage_name=""outside.func"", linkage_type= > } spirv.func @inside.func() -> () ""Pure"" attributes {} {spirv.Return} }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""Inline"" { spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @joint_matrix_load(%ptr : !spirv.ptr, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride : (!spirv.ptr, i32) -> !spirv.jointmatrix<16x8xi32, RowMajor, Workgroup> spirv.Return } spirv.func @joint_matrix_load_memaccess(%ptr : !spirv.ptr, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride {memory_access = #spirv.memory_access} : (!spirv.ptr, i32) -> !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup> spirv.Return } spirv.func @joint_matrix_store(%ptr : !spirv.ptr, %stride : i32, %m : !spirv.jointmatrix<16x8xi32, RowMajor, Workgroup>) ""None"" { spirv.INTEL.JointMatrixStore %ptr, %m, %stride : (!spirv.ptr, !spirv.jointmatrix<16x8xi32, RowMajor, Workgroup>, i32) spirv.Return } spirv.func @joint_matrix_store_memaccess(%ptr : !spirv.ptr, %m : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, %stride : i32) ""None"" { spirv.INTEL.JointMatrixStore %ptr, %m, %stride {memory_access = #spirv.memory_access} : (!spirv.ptr, !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, i32) spirv.Return } spirv.func @joint_matrix_length() -> i32 ""None"" { %0 = spirv.INTEL.JointMatrixWorkItemLength : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup> spirv.ReturnValue %0 : i32 } spirv.func @joint_matrix_muladd(%a : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, %b : !spirv.jointmatrix<16x8xi32, RowMajor, Subgroup>, %c : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>) ""None"" { %r = spirv.INTEL.JointMatrixMad %a, %b, %c : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, !spirv.jointmatrix<16x8xi32, RowMajor, Subgroup> -> !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 bind(0, 1) : !spirv.ptr spirv.func @arithmetic(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) ""None"" { %0 = spirv.FAdd %arg0, %arg1 : vector<4xf32> %1 = spirv.FNegate %arg0 : vector<4xf32> spirv.Return } spirv.func @atomic(%ptr: !spirv.ptr, %value: i32, %comparator: i32) ""None"" { %1 = spirv.AtomicAnd ""Device"" ""None"" %ptr, %value : !spirv.ptr spirv.Return } spirv.func @bitwiser(%arg0 : i32, %arg1 : i32) ""None"" { %0 = spirv.BitwiseAnd %arg0, %arg1 : i32 spirv.Return } spirv.func @convert(%arg0 : f32) ""None"" { %0 = spirv.ConvertFToU %arg0 : f32 to i32 spirv.Return } spirv.func @composite(%arg0 : !spirv.struct<(f32, !spirv.struct<(!spirv.array<4xf32>, f32)>)>, %arg1: !spirv.array<4xf32>, %arg2 : f32, %arg3 : f32) ""None"" { %0 = spirv.CompositeInsert %arg1, %arg0[1 : i32, 0 : i32] : !spirv.array<4xf32> into !spirv.struct<(f32, !spirv.struct<(!spirv.array<4xf32>, f32)>)> %1 = spirv.CompositeConstruct %arg2, %arg3 : (f32, f32) -> vector<2xf32> spirv.Return } spirv.func @group_non_uniform(%val: f32) ""None"" { %0 = spirv.GroupNonUniformFAdd ""Workgroup"" ""Reduce"" %val : f32 spirv.Return } spirv.func @local_var() ""None"" { %zero = spirv.Constant 0: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.Return } spirv.func @logical(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.IEqual %arg0, %arg1 : i32 spirv.Return } spirv.func @memory_accesses(%arg0 : !spirv.ptr>, StorageBuffer>, %arg1 : i32, %arg2 : i32) ""None"" { %2 = spirv.AccessChain %arg0[%arg1, %arg2] : !spirv.ptr>, StorageBuffer>, i32, i32 %3 = spirv.Load ""StorageBuffer"" %2 : f32 spirv.Store ""StorageBuffer"" %2, %3 : f32 spirv.Return } spirv.func @loop(%count : i32) -> () ""None"" { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %ivar = spirv.Variable init(%zero) : !spirv.ptr %jvar = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.loop { spirv.Branch ^header ^header: %ival0 = spirv.Load ""Function"" %ivar : i32 %icmp = spirv.SLessThan %ival0, %count : i32 spirv.BranchConditional %icmp, ^body, ^merge ^body: spirv.Store ""Function"" %jvar, %zero : i32 spirv.mlir.loop { spirv.Branch ^header ^header: %jval0 = spirv.Load ""Function"" %jvar : i32 %jcmp = spirv.SLessThan %jval0, %count : i32 spirv.BranchConditional %jcmp, ^body, ^merge ^body: spirv.Branch ^continue ^continue: %jval1 = spirv.Load ""Function"" %jvar : i32 %add = spirv.IAdd %jval1, %one : i32 spirv.Store ""Function"" %jvar, %add : i32 spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Branch ^continue ^continue: %ival1 = spirv.Load ""Function"" %ivar : i32 %add = spirv.IAdd %ival1, %one : i32 spirv.Store ""Function"" %ivar, %add : i32 spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } spirv.func @selection(%cond: i1) -> () ""None"" { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %two = spirv.Constant 2: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %cond [5, 10], ^then, ^else ^then: spirv.Store ""Function"" %var, %one : i32 spirv.Branch ^merge ^else: spirv.Store ""Function"" %var, %two : i32 spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip-debug -mlir-print-debuginfo -mlir-print-local-scope ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @selection(%cond: i1) -> () ""None"" { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %two = spirv.Constant 2: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.selection control(Flatten) { spirv.BranchConditional %cond [5, 10], ^then, ^else ^then: spirv.Store ""Function"" %var, %one : i32 spirv.Branch ^merge ^else: spirv.Store ""Function"" %var, %two : i32 spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main spirv.ExecutionMode @main ""LocalSize"", 1, 1, 1 }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @selection(%cond: i1) -> (i32) ""None"" { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: %zero = spirv.Constant 0 : i32 spirv.ReturnValue %zero : i32 ^merge: spirv.mlir.merge } %one = spirv.Constant 1 : i32 spirv.ReturnValue %one : i32 } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main spirv.ExecutionMode @main ""LocalSize"", 1, 1, 1 }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @selection_cf() -> () ""None"" { %true = spirv.Constant true %false = spirv.Constant false %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1 : i32 %var = spirv.Variable : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %true, ^then0, ^else0 ^then0: spirv.Store ""Function"" %var, %true : i1 spirv.Branch ^merge ^else0: spirv.Store ""Function"" %var, %false : i1 spirv.Branch ^merge ^merge: spirv.mlir.merge } %cond = spirv.Load ""Function"" %var : i1 spirv.BranchConditional %cond, ^then1(%one: i32), ^else1(%zero, %zero: i32, i32) ^then1(%arg0: i32): spirv.Return ^else1(%arg1: i32, %arg2: i32): spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 bind(0, 1) : !spirv.ptr [0])>, Input> spirv.GlobalVariable @var1 bind(0, 2) : !spirv.ptr [4])> [4])>, Input> spirv.GlobalVariable @var2 : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @var3 : !spirv.ptr [0])>, stride=512> [0])>, StorageBuffer> spirv.GlobalVariable @var4 : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @var5 : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @var6 : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @var7 : !spirv.ptr> [0, ColMajor, MatrixStride=16])>, StorageBuffer> spirv.GlobalVariable @empty : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @id_empty : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @id_var0 : !spirv.ptr [0])>, Input> spirv.GlobalVariable @recursive_simple : !spirv.ptr, StorageBuffer>)>, StorageBuffer> spirv.GlobalVariable @recursive_2 : !spirv.ptr, Uniform>)>, Uniform>)>, Uniform> spirv.GlobalVariable @recursive_3 : !spirv.ptr, Uniform>, !spirv.ptr, Uniform>)>, Uniform>)>, Uniform> spirv.func @kernel(%arg0: !spirv.ptr [0])>, Input>, %arg1: !spirv.ptr [0])>, Output>) -> () ""None"" { spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @matrix_access_chain(%arg0 : !spirv.ptr>, Function>, %arg1 : i32) -> !spirv.ptr, Function> ""None"" { %0 = spirv.AccessChain %arg0[%arg1] : !spirv.ptr>,Function>, i32 spirv.ReturnValue %0 : !spirv.ptr, Function> } spirv.func @matrix_times_scalar_1(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> !spirv.matrix<3 x vector<3xf32>> ""None"" { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f32 spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>> } spirv.func @matrix_times_scalar_2(%arg0 : !spirv.matrix<3 x vector<3xf16>>, %arg1 : f16) -> !spirv.matrix<3 x vector<3xf16>> ""None"" { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf16>>, f16 spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf16>> } spirv.func @matrix_times_scalar_3(%arg0 : !spirv.coopmatrix<16x16xf16, Subgroup>, %arg1 : f16) -> !spirv.coopmatrix<16x16xf16, Subgroup> ""None"" { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.coopmatrix<16x16xf16, Subgroup>, f16 spirv.ReturnValue %result : !spirv.coopmatrix<16x16xf16, Subgroup> } spirv.func @matrix_transpose_1(%arg0 : !spirv.matrix<3 x vector<2xf32>>) -> !spirv.matrix<2 x vector<3xf32>> ""None"" { %result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<2xf32>> -> !spirv.matrix<2 x vector<3xf32>> spirv.ReturnValue %result : !spirv.matrix<2 x vector<3xf32>> } spirv.func @matrix_times_matrix_1(%arg0: !spirv.matrix<3 x vector<3xf32>>, %arg1: !spirv.matrix<3 x vector<3xf32>>) -> !spirv.matrix<3 x vector<3xf32>> ""None""{ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>> spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>> } spirv.func @matrix_times_matrix_2(%arg0: !spirv.matrix<3 x vector<2xf32>>, %arg1: !spirv.matrix<2 x vector<3xf32>>) -> !spirv.matrix<2 x vector<2xf32>> ""None""{ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<2 x vector<2xf32>> spirv.ReturnValue %result : !spirv.matrix<2 x vector<2xf32>> } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 : !spirv.ptr>, StorageBuffer> spirv.GlobalVariable @var1 : !spirv.ptr>, StorageBuffer> spirv.GlobalVariable @var2 : !spirv.ptr>, StorageBuffer> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var1 : !spirv.ptr, Input> spirv.func @fmain() -> i32 ""None"" { %0 = spirv.Constant 16 : i32 %1 = spirv.mlir.addressof @var1 : !spirv.ptr, Input> %3 = spirv.FunctionCall @f_0(%0) : (i32) -> i32 spirv.FunctionCall @f_1(%3, %1) : (i32, !spirv.ptr, Input>) -> () %4 = spirv.FunctionCall @f_2(%1) : (!spirv.ptr, Input>) -> !spirv.ptr, Input> spirv.ReturnValue %3 : i32 } spirv.func @f_0(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } spirv.func @f_1(%arg0 : i32, %arg1 : !spirv.ptr, Input>) -> () ""None"" { spirv.Return } spirv.func @f_2(%arg0 : !spirv.ptr, Input>) -> !spirv.ptr, Input> ""None"" { spirv.ReturnValue %arg0 : !spirv.ptr, Input> } spirv.func @f_loop_with_function_call(%count : i32) -> () ""None"" { %zero = spirv.Constant 0: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.loop { spirv.Branch ^header ^header: %val0 = spirv.Load ""Function"" %var : i32 %cmp = spirv.SLessThan %val0, %count : i32 spirv.BranchConditional %cmp, ^body, ^merge ^body: spirv.Branch ^continue ^continue: spirv.FunctionCall @f_inc(%var) : (!spirv.ptr) -> () spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } spirv.func @f_inc(%arg0 : !spirv.ptr) -> () ""None"" { %one = spirv.Constant 1 : i32 %0 = spirv.Load ""Function"" %arg0 : i32 %1 = spirv.IAdd %0, %one : i32 spirv.Store ""Function"" %arg0, %1 : i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @array_stride(%arg0 : !spirv.ptr, stride=128>, StorageBuffer>, %arg1 : i32, %arg2 : i32) ""None"" { %2 = spirv.AccessChain %arg0[%arg1, %arg2] : !spirv.ptr, stride=128>, StorageBuffer>, i32, i32 spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -serialize-spirv -deserialize-spirv ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @var1 : !spirv.ptr>, Input> }", mlir-translate -no-implicit-module -split-input-file -serialize-spirv -deserialize-spirv ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 bind(0, 1) : !spirv.ptr, UniformConstant> spirv.GlobalVariable @var1 : !spirv.ptr, UniformConstant> spirv.GlobalVariable @var2 : !spirv.ptr, UniformConstant> }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @noop() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @noop spirv.ExecutionMode @noop ""ContractionOff"" }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var2 : !spirv.ptr spirv.GlobalVariable @var3 : !spirv.ptr spirv.func @noop(%arg0 : !spirv.ptr, %arg1 : !spirv.ptr) -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @noop, @var2, @var3 spirv.ExecutionMode @noop ""ContractionOff"" }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @cooperative_matrix_load(%ptr : !spirv.ptr, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b : !spirv.ptr as !spirv.coopmatrix<16x8xi32, Workgroup> spirv.Return } spirv.func @cooperative_matrix_load_memaccess(%ptr : !spirv.ptr, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b [""Volatile""] : !spirv.ptr as !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_store(%ptr : !spirv.ptr, %stride : i32, %m : !spirv.coopmatrix<16x8xi32, Workgroup>, %b : i1) ""None"" { spirv.NV.CooperativeMatrixStore %ptr, %m, %stride, %b : !spirv.ptr, !spirv.coopmatrix<16x8xi32, Workgroup> spirv.Return } spirv.func @cooperative_matrix_store_memaccess(%ptr : !spirv.ptr, %m : !spirv.coopmatrix<8x16xi32, Subgroup>, %stride : i32, %b : i1) ""None"" { spirv.NV.CooperativeMatrixStore %ptr, %m, %stride, %b [""Volatile""] : !spirv.ptr, !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_length() -> i32 ""None"" { %0 = spirv.NV.CooperativeMatrixLength : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.ReturnValue %0 : i32 } spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<16x8xi32, Subgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<8x16xi32, Subgroup>, !spirv.coopmatrix<16x8xi32, Subgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_add(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.IAdd %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_sub(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.ISub %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_sdiv(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.SDiv %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_udiv(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.UDiv %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_fadd(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<8x16xf32, Subgroup>) ""None"" { %r = spirv.FAdd %a, %b : !spirv.coopmatrix<8x16xf32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_fsub(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<8x16xf32, Subgroup>) ""None"" { %r = spirv.FSub %a, %b : !spirv.coopmatrix<8x16xf32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_fdiv(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<8x16xf32, Subgroup>) ""None"" { %r = spirv.FDiv %a, %b : !spirv.coopmatrix<8x16xf32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_access_chain(%a : !spirv.ptr, Function>) -> !spirv.ptr ""None"" { %0 = spirv.Constant 0: i32 %1 = spirv.AccessChain %a[%0] : !spirv.ptr, Function>, i32 spirv.ReturnValue %1 : !spirv.ptr } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { %zero = spirv.Constant 0 : i32 spirv.Branch ^bb1(%zero : i32) ^bb1(%arg0: i32): spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1.0 : f32 spirv.Branch ^bb1(%zero, %one : i32, f32) ^bb1(%arg0: i32, %arg1: f32): spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { %zero = spirv.Constant 0 : i32 spirv.Branch ^bb1(%zero : i32) ^bb1(%arg0: i32): %0 = spirv.IAdd %arg0, %arg0 : i32 spirv.Branch ^bb2(%zero, %0 : i32, i32) ^bb2(%arg1: i32, %arg2: i32): spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { spirv.Branch ^bb1 ^bb2(%arg0: i32, %arg1: f32): spirv.Return ^bb1: %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1.0 : f32 spirv.Branch ^bb2(%zero, %one : i32, f32) } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { %var = spirv.Variable : !spirv.ptr spirv.mlir.selection { %true = spirv.Constant true spirv.BranchConditional %true, ^true, ^false ^true: %zero = spirv.Constant 0 : i32 spirv.Branch ^phi(%zero: i32) ^false: %one = spirv.Constant 1 : i32 spirv.Branch ^phi(%one: i32) ^phi(%arg: i32): spirv.Store ""Function"" %var, %arg : i32 spirv.Return ^merge: spirv.mlir.merge } spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @__builtin_var_NumWorkgroups__ built_in(""NumWorkgroups"") : !spirv.ptr, Input> spirv.GlobalVariable @__builtin_var_WorkgroupId__ built_in(""WorkgroupId"") : !spirv.ptr, Input> spirv.func @fmul_kernel() ""None"" { %3 = spirv.Constant 12 : i32 %4 = spirv.Constant 32 : i32 %5 = spirv.Constant 4 : i32 %6 = spirv.mlir.addressof @__builtin_var_WorkgroupId__ : !spirv.ptr, Input> %7 = spirv.Load ""Input"" %6 : vector<3xi32> %8 = spirv.CompositeExtract %7[0 : i32] : vector<3xi32> %9 = spirv.mlir.addressof @__builtin_var_WorkgroupId__ : !spirv.ptr, Input> %10 = spirv.Load ""Input"" %9 : vector<3xi32> %11 = spirv.CompositeExtract %10[1 : i32] : vector<3xi32> %18 = spirv.mlir.addressof @__builtin_var_NumWorkgroups__ : !spirv.ptr, Input> %19 = spirv.Load ""Input"" %18 : vector<3xi32> %20 = spirv.CompositeExtract %19[0 : i32] : vector<3xi32> %21 = spirv.mlir.addressof @__builtin_var_NumWorkgroups__ : !spirv.ptr, Input> %22 = spirv.Load ""Input"" %21 : vector<3xi32> %23 = spirv.CompositeExtract %22[1 : i32] : vector<3xi32> %30 = spirv.IMul %11, %4 : i32 %31 = spirv.IMul %23, %4 : i32 spirv.mlir.loop { spirv.Branch ^bb1(%30 : i32) ^bb1(%32: i32): %33 = spirv.SLessThan %32, %3 : i32 spirv.BranchConditional %33, ^bb2, ^bb3 ^bb2: %34 = spirv.IMul %8, %5 : i32 %35 = spirv.IMul %20, %5 : i32 spirv.mlir.loop { spirv.Branch ^bb1(%34 : i32) ^bb1(%37: i32): %38 = spirv.SLessThan %37, %5 : i32 spirv.BranchConditional %38, ^bb2, ^bb3 ^bb2: %48 = spirv.IAdd %37, %35 : i32 spirv.Branch ^bb1(%48 : i32) ^bb3: spirv.mlir.merge } %36 = spirv.IAdd %32, %31 : i32 spirv.Branch ^bb1(%36 : i32) ^bb3: spirv.mlir.merge } spirv.Return } spirv.EntryPoint ""GLCompute"" @fmul_kernel, @__builtin_var_WorkgroupId__, @__builtin_var_NumWorkgroups__ spirv.ExecutionMode @fmul_kernel ""LocalSize"", 32, 1, 1 }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @fmul_kernel() ""None"" { %cst4 = spirv.Constant 4 : i32 %val1 = spirv.Constant 43 : i32 %val2 = spirv.Constant 44 : i32 spirv.mlir.loop { spirv.Branch ^bb1(%val1 : i32) ^bb1(%loop1_bb_arg: i32): %loop1_lt = spirv.SLessThan %loop1_bb_arg, %cst4 : i32 spirv.BranchConditional %loop1_lt, ^bb2, ^bb3 ^bb2: %loop1_add = spirv.IAdd %loop1_bb_arg, %cst4 : i32 spirv.Branch ^bb1(%loop1_add : i32) ^bb3: spirv.mlir.merge } spirv.mlir.loop { spirv.Branch ^bb1(%val2 : i32) ^bb1(%loop2_bb_arg: i32): %loop2_lt = spirv.SLessThan %loop2_bb_arg, %cst4 : i32 spirv.BranchConditional %loop2_lt, ^bb2, ^bb3 ^bb2: %loop2_add = spirv.IAdd %loop2_bb_arg, %cst4 : i32 spirv.Branch ^bb1(%loop2_add : i32) ^bb3: spirv.mlir.merge } spirv.Return } spirv.EntryPoint ""GLCompute"" @fmul_kernel spirv.ExecutionMode @fmul_kernel ""LocalSize"", 32, 1, 1 }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @cond_branch_true_argument() -> () ""None"" { %true = spirv.Constant true %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1 : i32 spirv.BranchConditional %true, ^true1(%zero, %zero: i32, i32), ^false1 ^true1(%arg0: i32, %arg1: i32): spirv.Return ^false1: spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @cond_branch_false_argument() -> () ""None"" { %true = spirv.Constant true %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1 : i32 spirv.BranchConditional %true, ^true1, ^false1(%zero, %zero: i32, i32) ^true1: spirv.Return ^false1(%arg0: i32, %arg1: i32): spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @cond_branch_true_and_false_argument() -> () ""None"" { %true = spirv.Constant true %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1 : i32 spirv.BranchConditional %true, ^true1(%one: i32), ^false1(%zero, %zero: i32, i32) ^true1(%arg0: i32): spirv.Return ^false1(%arg1: i32, %arg2: i32): spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @ret() -> () ""None"" { spirv.Return } spirv.func @ret_val() -> (i32) ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 : i32 spirv.ReturnValue %1 : i32 } spirv.func @unreachable() ""None"" { spirv.Return ^bb1: spirv.Unreachable } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @load_store(%arg0 : !spirv.ptr, %arg1 : !spirv.ptr) ""None"" { %1 = spirv.Load ""Input"" %arg0 : f32 spirv.Store ""Output"" %arg1, %1 : f32 spirv.Return } spirv.func @load_store_memory_operands(%arg0 : !spirv.ptr, %arg1 : !spirv.ptr) ""None"" { %1 = spirv.Load ""Input"" %arg0 [""Volatile|Aligned"", 4]: f32 spirv.Store ""Output"" %arg1, %1 [""Volatile|Aligned"", 4]: f32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @access_chain(%arg0 : !spirv.ptr>, Function>, %arg1 : i32, %arg2 : i32) ""None"" { %1 = spirv.AccessChain %arg0[%arg1] : !spirv.ptr>, Function>, i32 %2 = spirv.AccessChain %arg0[%arg1, %arg2] : !spirv.ptr>, Function>, i32, i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @load_store_zero_rank_float(%arg0: !spirv.ptr [0])>, StorageBuffer>, %arg1: !spirv.ptr [0])>, StorageBuffer>) ""None"" { %0 = spirv.Constant 0 : i32 %1 = spirv.AccessChain %arg0[%0, %0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %2 = spirv.Load ""StorageBuffer"" %1 : f32 %3 = spirv.Constant 0 : i32 %4 = spirv.AccessChain %arg1[%3, %3] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 spirv.Store ""StorageBuffer"" %4, %2 : f32 spirv.Return } spirv.func @load_store_zero_rank_int(%arg0: !spirv.ptr [0])>, StorageBuffer>, %arg1: !spirv.ptr [0])>, StorageBuffer>) ""None"" { %0 = spirv.Constant 0 : i32 %1 = spirv.AccessChain %arg0[%0, %0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %2 = spirv.Load ""StorageBuffer"" %1 : i32 %3 = spirv.Constant 0 : i32 %4 = spirv.AccessChain %arg1[%3, %3] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 spirv.Store ""StorageBuffer"" %4, %2 : i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @copy_memory_simple() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr spirv.CopyMemory ""Function"" %0, ""Function"" %1 : f32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @copy_memory_different_storage_classes(%in : !spirv.ptr, Input>, %out : !spirv.ptr, Output>) ""None"" { spirv.CopyMemory ""Output"" %out, ""Input"" %in : !spirv.array<4xf32> spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @copy_memory_with_access_operands() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr spirv.CopyMemory ""Function"" %0, ""Function"" %1 [""Aligned"", 4] : f32 spirv.CopyMemory ""Function"" %0, ""Function"" %1 [""Volatile""] : f32 spirv.CopyMemory ""Function"" %0, ""Function"" %1 [""Volatile""], [""Volatile""] : f32 spirv.CopyMemory ""Function"" %0, ""Function"" %1 [""Aligned"", 4], [""Volatile""] : f32 spirv.CopyMemory ""Function"" %0, ""Function"" %1 [""Volatile""], [""Aligned"", 4] : f32 spirv.CopyMemory ""Function"" %0, ""Function"" %1 [""Aligned"", 8], [""Aligned"", 4] : f32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @bit_cast(%arg0 : f32) ""None"" { %0 = spirv.Bitcast %arg0 : f32 to i32 %1 = spirv.Bitcast %0 : i32 to si32 %2 = spirv.Bitcast %1 : si32 to ui32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @convert_f_to_s(%arg0 : f32) -> i32 ""None"" { %0 = spirv.ConvertFToS %arg0 : f32 to i32 spirv.ReturnValue %0 : i32 } spirv.func @convert_f64_to_s32(%arg0 : f64) -> i32 ""None"" { %0 = spirv.ConvertFToS %arg0 : f64 to i32 spirv.ReturnValue %0 : i32 } spirv.func @convert_f_to_u(%arg0 : f32) -> i32 ""None"" { %0 = spirv.ConvertFToU %arg0 : f32 to i32 spirv.ReturnValue %0 : i32 } spirv.func @convert_f64_to_u32(%arg0 : f64) -> i32 ""None"" { %0 = spirv.ConvertFToU %arg0 : f64 to i32 spirv.ReturnValue %0 : i32 } spirv.func @convert_s_to_f(%arg0 : i32) -> f32 ""None"" { %0 = spirv.ConvertSToF %arg0 : i32 to f32 spirv.ReturnValue %0 : f32 } spirv.func @convert_s64_to_f32(%arg0 : i64) -> f32 ""None"" { %0 = spirv.ConvertSToF %arg0 : i64 to f32 spirv.ReturnValue %0 : f32 } spirv.func @convert_u_to_f(%arg0 : i32) -> f32 ""None"" { %0 = spirv.ConvertUToF %arg0 : i32 to f32 spirv.ReturnValue %0 : f32 } spirv.func @convert_u64_to_f32(%arg0 : i64) -> f32 ""None"" { %0 = spirv.ConvertUToF %arg0 : i64 to f32 spirv.ReturnValue %0 : f32 } spirv.func @f_convert(%arg0 : f32) -> f64 ""None"" { %0 = spirv.FConvert %arg0 : f32 to f64 spirv.ReturnValue %0 : f64 } spirv.func @s_convert(%arg0 : i32) -> i64 ""None"" { %0 = spirv.SConvert %arg0 : i32 to i64 spirv.ReturnValue %0 : i64 } spirv.func @u_convert(%arg0 : i32) -> i64 ""None"" { %0 = spirv.UConvert %arg0 : i32 to i64 spirv.ReturnValue %0 : i64 } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @ptr_cast_to_generic(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.PtrCastToGeneric %arg0 : !spirv.ptr to !spirv.ptr spirv.Return } spirv.func @generic_cast_to_ptr(%arg0 : !spirv.ptr, Generic>) ""None"" { %0 = spirv.GenericCastToPtr %arg0 : !spirv.ptr, Generic> to !spirv.ptr, CrossWorkgroup> spirv.Return } spirv.func @generic_cast_to_ptr_explicit(%arg0 : !spirv.ptr, Generic>) ""None"" { %0 = spirv.GenericCastToPtrExplicit %arg0 : !spirv.ptr, Generic> to !spirv.ptr, CrossWorkgroup> spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Physical64 OpenCL requires #spirv.vce { spirv.func @covert_ptr_to_u(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } spirv.func @covert_ptr_to_u_truncate(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } spirv.func @covert_ptr_to_u_extend(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i64 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce { spirv.func @covert_ptr_to_u_PhysicalStorageBuffer(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Physical64 OpenCL requires #spirv.vce { spirv.func @covert_u_to_ptr(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } spirv.func @covert_u_to_ptr_truncate(%arg0 : i64) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i64 to !spirv.ptr spirv.Return } spirv.func @covert_u_to_ptr_extend(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce { spirv.func @covert_u_to_ptr_PhysicalStorageBuffer(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 bind(0, 1) : !spirv.ptr>, UniformConstant> spirv.GlobalVariable @var1 bind(0, 0) : !spirv.ptr>, UniformConstant> spirv.GlobalVariable @var2 bind(0, 0) : !spirv.ptr>, UniformConstant> }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @composite_insert(%arg0 : !spirv.struct<(f32, !spirv.struct<(!spirv.array<4xf32>, f32)>)>, %arg1: !spirv.array<4xf32>) -> !spirv.struct<(f32, !spirv.struct<(!spirv.array<4xf32>, f32)>)> ""None"" { %0 = spirv.CompositeInsert %arg1, %arg0[1 : i32, 0 : i32] : !spirv.array<4xf32> into !spirv.struct<(f32, !spirv.struct<(!spirv.array<4xf32>, f32)>)> spirv.ReturnValue %0: !spirv.struct<(f32, !spirv.struct<(!spirv.array<4xf32>, f32)>)> } spirv.func @composite_construct_vector(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> ""None"" { %0 = spirv.CompositeConstruct %arg0, %arg1, %arg2 : (f32, f32, f32) -> vector<3xf32> spirv.ReturnValue %0: vector<3xf32> } spirv.func @vector_dynamic_extract(%vec: vector<4xf32>, %id : i32) -> f32 ""None"" { %0 = spirv.VectorExtractDynamic %vec[%id] : vector<4xf32>, i32 spirv.ReturnValue %0: f32 } spirv.func @vector_dynamic_insert(%val: f32, %vec: vector<4xf32>, %id : i32) -> vector<4xf32> ""None"" { %0 = spirv.VectorInsertDynamic %val, %vec[%id] : vector<4xf32>, i32 spirv.ReturnValue %0: vector<4xf32> } spirv.func @vector_shuffle(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> ""None"" { %0 = spirv.VectorShuffle [1: i32, 3: i32, 0xffffffff: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32> spirv.ReturnValue %0: vector<3xf32> } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @array_stride(%arg0 : !spirv.ptr, stride=128>, StorageBuffer>, %arg1 : i32, %arg2 : i32) ""None"" { %2 = spirv.AccessChain %arg0[%arg1, %arg2] : !spirv.ptr, stride=128>, StorageBuffer>, i32, i32 spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @var1 : !spirv.ptr>, Input> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @foo() -> () ""None"" { %0 = spirv.Undef : f32 %1 = spirv.Undef : f32 %2 = spirv.FAdd %0, %1 : f32 %3 = spirv.Undef : vector<4xi32> %4 = spirv.CompositeExtract %3[1 : i32] : vector<4xi32> %5 = spirv.Undef : !spirv.array<4x!spirv.array<4xi32>> %6 = spirv.CompositeExtract %5[1 : i32, 2 : i32] : !spirv.array<4x!spirv.array<4xi32>> %7 = spirv.Undef : !spirv.ptr, StorageBuffer> %8 = spirv.Constant 0 : i32 %9 = spirv.AccessChain %7[%8] : !spirv.ptr, StorageBuffer>, i32 spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @ignore_unused_undef() -> () ""None"" { %0 = spirv.Undef : f32 spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @bool_const() -> () ""None"" { %0 = spirv.Constant true %1 = spirv.Constant false %2 = spirv.Variable init(%0): !spirv.ptr %3 = spirv.Variable init(%1): !spirv.ptr spirv.Return } spirv.func @i32_const() -> () ""None"" { %0 = spirv.Constant 0 : i32 %1 = spirv.Constant 10 : i32 %2 = spirv.Constant -5 : i32 %3 = spirv.IAdd %0, %1 : i32 %4 = spirv.IAdd %2, %3 : i32 spirv.Return } spirv.func @si32_const() -> () ""None"" { %0 = spirv.Constant 0 : si32 %1 = spirv.Constant 10 : si32 %2 = spirv.Constant -5 : si32 %3 = spirv.IAdd %0, %1 : si32 %4 = spirv.IAdd %2, %3 : si32 spirv.Return } spirv.func @ui32_const() -> () ""None"" { %0 = spirv.Constant 0 : ui32 %1 = spirv.Constant 10 : ui32 %2 = spirv.Constant 4294967291 : ui32 %3 = spirv.IAdd %0, %1 : ui32 %4 = spirv.IAdd %2, %3 : ui32 spirv.Return } spirv.func @i64_const() -> () ""None"" { %0 = spirv.Constant 4294967296 : i64 %1 = spirv.Constant -4294967296 : i64 %2 = spirv.Constant 9223372036854775807 : i64 %3 = spirv.Constant -9223372036854775808 : i64 %4 = spirv.IAdd %0, %1 : i64 %5 = spirv.IAdd %2, %3 : i64 spirv.Return } spirv.func @i16_const() -> () ""None"" { %0 = spirv.Constant -32768 : i16 %1 = spirv.Constant 32767 : i16 %2 = spirv.IAdd %0, %1 : i16 spirv.Return } spirv.func @i8_const() -> () ""None"" { %0 = spirv.Constant 0 : i8 %1 = spirv.Constant 255 : i8 %2 = spirv.Constant 0 : si8 %3 = spirv.Constant 127 : si8 %4 = spirv.Constant -128 : si8 %5 = spirv.Constant 0 : ui8 %6 = spirv.Constant 255 : ui8 %10 = spirv.IAdd %0, %1: i8 %11 = spirv.IAdd %2, %3: si8 %12 = spirv.IAdd %3, %4: si8 %13 = spirv.IAdd %5, %6: ui8 spirv.Return } spirv.func @float_const() -> () ""None"" { %0 = spirv.Constant 0. : f32 %1 = spirv.Constant 1. : f32 %2 = spirv.Constant -0. : f32 %3 = spirv.Constant -1. : f32 %4 = spirv.Constant 0.75 : f32 %5 = spirv.Constant -0.25 : f32 %6 = spirv.FAdd %0, %1 : f32 %7 = spirv.FAdd %2, %3 : f32 %8 = spirv.FAdd %4, %5 : f32 spirv.Return } spirv.func @double_const() -> () ""None"" { %0 = spirv.Constant 1024. : f64 %1 = spirv.Constant -1024. : f64 %2 = spirv.FAdd %0, %1 : f64 spirv.Return } spirv.func @half_const() -> () ""None"" { %0 = spirv.Constant 512. : f16 %1 = spirv.Constant -512. : f16 %2 = spirv.FAdd %0, %1 : f16 spirv.Return } spirv.func @bool_vector_const() -> () ""None"" { %0 = spirv.Constant dense : vector<2xi1> %1 = spirv.Constant dense : vector<3xi1> %2 = spirv.Constant dense<[false, true]> : vector<2xi1> %3 = spirv.Variable init(%0): !spirv.ptr, Function> %4 = spirv.Variable init(%1): !spirv.ptr, Function> %5 = spirv.Variable init(%2): !spirv.ptr, Function> spirv.Return } spirv.func @int_vector_const() -> () ""None"" { %0 = spirv.Constant dense<0> : vector<3xi32> %1 = spirv.Constant dense<1> : vector<3xi32> %2 = spirv.Constant dense<[2, -3, 4]> : vector<3xi32> %3 = spirv.IAdd %0, %1 : vector<3xi32> %4 = spirv.IAdd %2, %3 : vector<3xi32> spirv.Return } spirv.func @fp_vector_const() -> () ""None"" { %0 = spirv.Constant dense<0.> : vector<4xf32> %1 = spirv.Constant dense<-15.> : vector<4xf32> %2 = spirv.Constant dense<[0.75, -0.25, 10., 42.]> : vector<4xf32> %3 = spirv.FAdd %0, %1 : vector<4xf32> %4 = spirv.FAdd %2, %3 : vector<4xf32> spirv.Return } spirv.func @ui64_array_const() -> (!spirv.array<3xui64>) ""None"" { %0 = spirv.Constant [5 : ui64, 6 : ui64, 7 : ui64] : !spirv.array<3 x ui64> spirv.ReturnValue %0: !spirv.array<3xui64> } spirv.func @si32_array_const() -> (!spirv.array<3xsi32>) ""None"" { %0 = spirv.Constant [5 : si32, 6 : si32, 7 : si32] : !spirv.array<3 x si32> spirv.ReturnValue %0 : !spirv.array<3xsi32> } spirv.func @float_array_const() -> (!spirv.array<2 x vector<2xf32>>) ""None"" { %0 = spirv.Constant [dense<3.0> : vector<2xf32>, dense<[4., 5.]> : vector<2xf32>] : !spirv.array<2 x vector<2xf32>> spirv.ReturnValue %0 : !spirv.array<2 x vector<2xf32>> } spirv.func @ignore_not_used_const() -> () ""None"" { %0 = spirv.Constant false spirv.Return } spirv.func @materialize_const_at_each_use() -> (i32) ""None"" { %0 = spirv.Constant 42 : i32 %1 = spirv.IAdd %0, %0 : i32 spirv.ReturnValue %1 : i32 } spirv.func @const_variable(%arg0 : i32, %arg1 : i32) -> () ""None"" { %0 = spirv.IAdd %arg0, %arg1 : i32 %1 = spirv.Constant 5 : i32 %2 = spirv.Variable init(%1) : !spirv.ptr %3 = spirv.Load ""Function"" %2 : i32 %4 = spirv.IAdd %0, %3 : i32 spirv.Return } spirv.func @multi_dimensions_const() -> (!spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32, stride=4>, stride=12>, stride=24>) ""None"" { %0 = spirv.Constant dense<[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]> : tensor<2x2x3xi32> : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32, stride=4>, stride=12>, stride=24> spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32, stride=4>, stride=12>, stride=24> } spirv.func @multi_dimensions_splat_const() -> (!spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32, stride=4>, stride=12>, stride=24>) ""None"" { %0 = spirv.Constant dense<1> : tensor<2x2x3xi32> : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32, stride=4>, stride=12>, stride=24> spirv.ReturnValue %0 : !spirv.array<2 x !spirv.array<2 x !spirv.array<3 x i32, stride=4>, stride=12>, stride=24> } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @fmul(%arg0 : f32, %arg1 : f32) ""None"" { %0 = spirv.FMul %arg0, %arg1 : f32 spirv.Return } spirv.func @fadd(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) ""None"" { %0 = spirv.FAdd %arg0, %arg1 : vector<4xf32> spirv.Return } spirv.func @fdiv(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) ""None"" { %0 = spirv.FDiv %arg0, %arg1 : vector<4xf32> spirv.Return } spirv.func @fmod(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) ""None"" { %0 = spirv.FMod %arg0, %arg1 : vector<4xf32> spirv.Return } spirv.func @fnegate(%arg0 : vector<4xf32>) ""None"" { %0 = spirv.FNegate %arg0 : vector<4xf32> spirv.Return } spirv.func @fsub(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) ""None"" { %0 = spirv.FSub %arg0, %arg1 : vector<4xf32> spirv.Return } spirv.func @frem(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) ""None"" { %0 = spirv.FRem %arg0, %arg1 : vector<4xf32> spirv.Return } spirv.func @iadd(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.IAdd %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @isub(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.ISub %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @imul(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.IMul %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @udiv(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.UDiv %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @umod(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.UMod %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @sdiv(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.SDiv %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @smod(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.SMod %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @snegate(%arg0 : vector<4xi32>) ""None"" { %0 = spirv.SNegate %arg0 : vector<4xi32> spirv.Return } spirv.func @srem(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) ""None"" { %0 = spirv.SRem %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @vector_times_scalar(%arg0 : vector<4xf32>, %arg1 : f32) ""None"" { %0 = spirv.VectorTimesScalar %arg0, %arg1 : (vector<4xf32>, f32) -> vector<4xf32> spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @math(%arg0 : f32, %arg1 : f32, %arg2 : i32) ""None"" { %0 = spirv.GL.Exp %arg0 : f32 %2 = spirv.GL.Sqrt %arg0 : f32 %3 = spirv.GL.Cos %arg0 : f32 %4 = spirv.GL.Sin %arg0 : f32 %5 = spirv.GL.Tan %arg0 : f32 %6 = spirv.GL.Acos %arg0 : f32 %7 = spirv.GL.Asin %arg0 : f32 %8 = spirv.GL.Atan %arg0 : f32 %9 = spirv.GL.Sinh %arg0 : f32 %10 = spirv.GL.Cosh %arg0 : f32 %11 = spirv.GL.Pow %arg0, %arg1 : f32 %12 = spirv.GL.Round %arg0 : f32 %13 = spirv.GL.FrexpStruct %arg0 : f32 -> !spirv.struct<(f32, i32)> %14 = spirv.GL.Ldexp %arg0 : f32, %arg2 : i32 -> f32 %15 = spirv.GL.FMix %arg0 : f32, %arg1 : f32, %arg0 : f32 -> f32 spirv.Return } spirv.func @maxmin(%arg0 : f32, %arg1 : f32, %arg2 : i32, %arg3 : i32) ""None"" { %1 = spirv.GL.FMax %arg0, %arg1 : f32 %2 = spirv.GL.SMax %arg2, %arg3 : i32 %3 = spirv.GL.UMax %arg2, %arg3 : i32 %4 = spirv.GL.FMin %arg0, %arg1 : f32 %5 = spirv.GL.SMin %arg2, %arg3 : i32 %6 = spirv.GL.UMin %arg2, %arg3 : i32 spirv.Return } spirv.func @fclamp(%arg0 : f32, %arg1 : f32, %arg2 : f32) ""None"" { %13 = spirv.GL.FClamp %arg0, %arg1, %arg2 : f32 spirv.Return } spirv.func @uclamp(%arg0 : ui32, %arg1 : ui32, %arg2 : ui32) ""None"" { %13 = spirv.GL.UClamp %arg0, %arg1, %arg2 : ui32 spirv.Return } spirv.func @sclamp(%arg0 : si32, %arg1 : si32, %arg2 : si32) ""None"" { %13 = spirv.GL.SClamp %arg0, %arg1, %arg2 : si32 spirv.Return } spirv.func @fma(%arg0 : f32, %arg1 : f32, %arg2 : f32) ""None"" { %13 = spirv.GL.Fma %arg0, %arg1, %arg2 : f32 spirv.Return } spirv.func @findumsb(%arg0 : i32) ""None"" { %2 = spirv.GL.FindUMsb %arg0 : i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var {location = 0 : i32} : !spirv.ptr, Input> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var {no_perspective} : !spirv.ptr, Input> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var {flat} : !spirv.ptr }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var1 bind(0, 0) {aliased} : !spirv.ptr[0])>, StorageBuffer> spirv.GlobalVariable @var2 bind(0, 0) {aliased} : !spirv.ptr[0])>, StorageBuffer> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var bind(0, 0) {non_readable} : !spirv.ptr[0])>, StorageBuffer> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var bind(0, 0) {non_writable} : !spirv.ptr[0])>, StorageBuffer> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var bind(0, 0) {restrict} : !spirv.ptr[0])>, StorageBuffer> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var {location = 0 : i32, relaxed_precision} : !spirv.ptr, Output> }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var1 { linkage_attributes=#spirv.linkage_attributes< linkage_name=""outSideGlobalVar1"", linkage_type= > } : !spirv.ptr }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @memory_barrier_0() -> () ""None"" { spirv.MemoryBarrier , spirv.Return } spirv.func @memory_barrier_1() -> () ""None"" { spirv.MemoryBarrier , spirv.Return } spirv.func @control_barrier_0() -> () ""None"" { spirv.ControlBarrier , , spirv.Return } spirv.func @control_barrier_1() -> () ""None"" { spirv.ControlBarrier , , spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> ""None"" { %0 = spirv.GroupNonUniformBallot %predicate : vector<4xi32> spirv.ReturnValue %0: vector<4xi32> } spirv.func @group_non_uniform_broadcast(%value: f32) -> f32 ""None"" { %one = spirv.Constant 1 : i32 %0 = spirv.GroupNonUniformBroadcast %value, %one : f32, i32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_elect() -> i1 ""None"" { %0 = spirv.GroupNonUniformElect : i1 spirv.ReturnValue %0: i1 } spirv.func @group_non_uniform_fadd_reduce(%val: f32) -> f32 ""None"" { %0 = spirv.GroupNonUniformFAdd ""Workgroup"" ""Reduce"" %val : f32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_fmax_reduce(%val: f32) -> f32 ""None"" { %0 = spirv.GroupNonUniformFMax ""Workgroup"" ""Reduce"" %val : f32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_fmin_reduce(%val: f32) -> f32 ""None"" { %0 = spirv.GroupNonUniformFMin ""Workgroup"" ""Reduce"" %val : f32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_fmul_reduce(%val: f32) -> f32 ""None"" { %0 = spirv.GroupNonUniformFMul ""Workgroup"" ""Reduce"" %val : f32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_iadd_reduce(%val: i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } spirv.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> ""None"" { %four = spirv.Constant 4 : i32 %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%four) : vector<2xi32> spirv.ReturnValue %0: vector<2xi32> } spirv.func @group_non_uniform_imul_reduce(%val: i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformIMul ""Workgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } spirv.func @group_non_uniform_smax_reduce(%val: i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformSMax ""Workgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } spirv.func @group_non_uniform_smin_reduce(%val: i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformSMin ""Workgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } spirv.func @group_non_uniform_umax_reduce(%val: i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformUMax ""Workgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } spirv.func @group_non_uniform_umin_reduce(%val: i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformUMin ""Workgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } spirv.func @group_non_uniform_shuffle(%val: f32, %id: i32) -> f32 ""None"" { %0 = spirv.GroupNonUniformShuffle %val, %id : f32, i32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_shuffle_up(%val: f32, %id: i32) -> f32 ""None"" { %0 = spirv.GroupNonUniformShuffleUp %val, %id : f32, i32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_shuffle_down(%val: f32, %id: i32) -> f32 ""None"" { %0 = spirv.GroupNonUniformShuffleDown %val, %id : f32, i32 spirv.ReturnValue %0: f32 } spirv.func @group_non_uniform_shuffle_xor(%val: f32, %id: i32) -> f32 ""None"" { %0 = spirv.GroupNonUniformShuffleXor %val, %id : f32, i32 spirv.ReturnValue %0: f32 } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @image(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) ""None"" { %0 = spirv.Image %arg0 : !spirv.sampled_image> %1 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xf32> spirv.Return } spirv.func @image_query_size(%arg0 : !spirv.image) ""None"" { %0 = spirv.ImageQuerySize %arg0 : !spirv.image -> vector<2xi32> spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.SpecConstant @sc_true = true spirv.SpecConstant @sc_false spec_id(1) = false spirv.SpecConstant @sc_int = -5 : i32 spirv.SpecConstant @sc_float spec_id(5) = 1. : f32 spirv.SpecConstantComposite @scc (@sc_int, @sc_int) : !spirv.array<2 x i32> spirv.func @use() -> (i32) ""None"" { %0 = spirv.mlir.referenceof @sc_int : i32 %1 = spirv.IAdd %0, %0 : i32 spirv.ReturnValue %1 : i32 } spirv.func @use_composite() -> (i32) ""None"" { %0 = spirv.mlir.referenceof @scc : !spirv.array<2 x i32> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.array<2 x i32> %2 = spirv.CompositeExtract %0[1 : i32] : !spirv.array<2 x i32> %3 = spirv.IAdd %1, %2 : i32 spirv.ReturnValue %3 : i32 } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.SpecConstant @sc_f32_1 = 1.5 : f32 spirv.SpecConstant @sc_f32_2 = 2.5 : f32 spirv.SpecConstant @sc_f32_3 = 3.5 : f32 spirv.SpecConstant @sc_i32_1 = 1 : i32 spirv.SpecConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spirv.array<3 x f32> spirv.SpecConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spirv.struct<(i32, f32, f32)> spirv.SpecConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32> }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.SpecConstant @sc_f32_1 = 1.5 : f32 spirv.SpecConstant @sc_f32_2 = 2.5 : f32 spirv.SpecConstant @sc_f32_3 = 3.5 : f32 spirv.SpecConstant @sc_i32_1 = 1 : i32 spirv.SpecConstantComposite @scc_array (@sc_f32_1, @sc_f32_2, @sc_f32_3) : !spirv.array<3 x f32> spirv.SpecConstantComposite @scc_struct (@sc_i32_1, @sc_f32_2, @sc_f32_3) : !spirv.struct<(i32, f32, f32)> spirv.SpecConstantComposite @scc_vector (@sc_f32_1, @sc_f32_2, @sc_f32_3) : vector<3 x f32> }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.SpecConstant @sc_i32_1 = 1 : i32 spirv.func @use_composite() -> (i32) ""None"" { %0 = spirv.mlir.referenceof @sc_i32_1 : i32 %1 = spirv.Constant 0 : i32 %2 = spirv.SpecConstantOperation wraps ""spirv.ISub""(%0, %1) : (i32, i32) -> i32 %3 = spirv.SpecConstantOperation wraps ""spirv.IMul""(%2, %2) : (i32, i32) -> i32 spirv.ReturnValue %3 : i32 } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @f32_to_bf16(%arg0 : f32) ""None"" { %0 = spirv.INTEL.ConvertFToBF16 %arg0 : f32 to i16 spirv.Return } spirv.func @f32_to_bf16_vec(%arg0 : vector<2xf32>) ""None"" { %0 = spirv.INTEL.ConvertFToBF16 %arg0 : vector<2xf32> to vector<2xi16> spirv.Return } spirv.func @bf16_to_f32(%arg0 : i16) ""None"" { %0 = spirv.INTEL.ConvertBF16ToF %arg0 : i16 to f32 spirv.Return } spirv.func @bf16_to_f32_vec(%arg0 : vector<2xi16>) ""None"" { %0 = spirv.INTEL.ConvertBF16ToF %arg0 : vector<2xi16> to vector<2xf32> spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @test_int_atomics(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 ""None"" { %0 = spirv.AtomicCompareExchangeWeak ""Workgroup"" ""Release"" ""Acquire"" %ptr, %value, %comparator: !spirv.ptr %1 = spirv.AtomicAnd ""Device"" ""None"" %ptr, %value : !spirv.ptr %2 = spirv.AtomicIAdd ""Workgroup"" ""Acquire"" %ptr, %value : !spirv.ptr %3 = spirv.AtomicIDecrement ""Workgroup"" ""Acquire"" %ptr : !spirv.ptr %4 = spirv.AtomicIIncrement ""Device"" ""Release"" %ptr : !spirv.ptr %5 = spirv.AtomicISub ""Workgroup"" ""Acquire"" %ptr, %value : !spirv.ptr %6 = spirv.AtomicOr ""Workgroup"" ""AcquireRelease"" %ptr, %value : !spirv.ptr %7 = spirv.AtomicSMax ""Subgroup"" ""None"" %ptr, %value : !spirv.ptr %8 = spirv.AtomicSMin ""Device"" ""Release"" %ptr, %value : !spirv.ptr %9 = spirv.AtomicUMax ""Subgroup"" ""None"" %ptr, %value : !spirv.ptr %10 = spirv.AtomicUMin ""Device"" ""Release"" %ptr, %value : !spirv.ptr %11 = spirv.AtomicXor ""Workgroup"" ""AcquireRelease"" %ptr, %value : !spirv.ptr %12 = spirv.AtomicCompareExchange ""Workgroup"" ""Release"" ""Acquire"" %ptr, %value, %comparator: !spirv.ptr %13 = spirv.AtomicExchange ""Workgroup"" ""Release"" %ptr, %value: !spirv.ptr spirv.ReturnValue %0: i32 } spirv.func @test_float_atomics(%ptr: !spirv.ptr, %value: f32) -> f32 ""None"" { %0 = spirv.EXT.AtomicFAdd ""Workgroup"" ""Acquire"" %ptr, %value : !spirv.ptr spirv.ReturnValue %0: f32 } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var0 bind(1, 0) : !spirv.ptr spirv.GlobalVariable @var1 bind(0, 1) : !spirv.ptr spirv.GlobalVariable @var2 {built_in = ""GlobalInvocationId""} : !spirv.ptr, Input> spirv.GlobalVariable @var3 built_in(""GlobalInvocationId"") : !spirv.ptr, Input> }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var1 : !spirv.ptr spirv.GlobalVariable @var2 initializer(@var1) bind(1, 0) : !spirv.ptr }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @globalInvocationID built_in(""GlobalInvocationId"") : !spirv.ptr, Input> spirv.func @foo() ""None"" { %0 = spirv.mlir.addressof @globalInvocationID : !spirv.ptr, Input> %1 = spirv.Constant 0: i32 %2 = spirv.AccessChain %0[%1] : !spirv.ptr, Input>, i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var1 { linkage_attributes=#spirv.linkage_attributes< linkage_name=""outSideGlobalVar1"", linkage_type= > } : !spirv.ptr }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> ""None"" { %0 = spirv.KHR.SubgroupBallot %predicate: vector<4xi32> spirv.ReturnValue %0: vector<4xi32> } spirv.func @group_broadcast_1(%value: f32, %localid: i32 ) -> f32 ""None"" { %0 = spirv.GroupBroadcast %value, %localid : f32, i32 spirv.ReturnValue %0: f32 } spirv.func @group_broadcast_2(%value: f32, %localid: vector<3xi32> ) -> f32 ""None"" { %0 = spirv.GroupBroadcast %value, %localid : f32, vector<3xi32> spirv.ReturnValue %0: f32 } spirv.func @subgroup_block_read_intel(%ptr : !spirv.ptr) -> i32 ""None"" { %0 = spirv.INTEL.SubgroupBlockRead ""StorageBuffer"" %ptr : i32 spirv.ReturnValue %0: i32 } spirv.func @subgroup_block_read_intel_vector(%ptr : !spirv.ptr) -> vector<3xi32> ""None"" { %0 = spirv.INTEL.SubgroupBlockRead ""StorageBuffer"" %ptr : vector<3xi32> spirv.ReturnValue %0: vector<3xi32> } spirv.func @subgroup_block_write_intel(%ptr : !spirv.ptr, %value: i32) -> () ""None"" { spirv.INTEL.SubgroupBlockWrite ""StorageBuffer"" %ptr, %value : i32 spirv.Return } spirv.func @subgroup_block_write_intel_vector(%ptr : !spirv.ptr, %value: vector<3xi32>) -> () ""None"" { spirv.INTEL.SubgroupBlockWrite ""StorageBuffer"" %ptr, %value : vector<3xi32> spirv.Return } spirv.func @group_iadd(%value: i32) -> i32 ""None"" { %0 = spirv.GroupIAdd %value : i32 spirv.ReturnValue %0: i32 } spirv.func @group_fadd(%value: f32) -> f32 ""None"" { %0 = spirv.GroupFAdd %value : f32 spirv.ReturnValue %0: f32 } spirv.func @group_fmin(%value: f32) -> f32 ""None"" { %0 = spirv.GroupFMin %value : f32 spirv.ReturnValue %0: f32 } spirv.func @group_umin(%value: i32) -> i32 ""None"" { %0 = spirv.GroupUMin %value : i32 spirv.ReturnValue %0: i32 } spirv.func @group_smin(%value: i32) -> i32 ""None"" { %0 = spirv.GroupSMin %value : i32 spirv.ReturnValue %0: i32 } spirv.func @group_fmax(%value: f32) -> f32 ""None"" { %0 = spirv.GroupFMax %value : f32 spirv.ReturnValue %0: f32 } spirv.func @group_umax(%value: i32) -> i32 ""None"" { %0 = spirv.GroupUMax %value : i32 spirv.ReturnValue %0: i32 } spirv.func @group_smax(%value: i32) -> i32 ""None"" { %0 = spirv.GroupSMax %value : i32 spirv.ReturnValue %0: i32 } spirv.func @group_imul(%value: i32) -> i32 ""None"" { %0 = spirv.KHR.GroupIMul %value : i32 spirv.ReturnValue %0: i32 } spirv.func @group_fmul(%value: f32) -> f32 ""None"" { %0 = spirv.KHR.GroupFMul %value : f32 spirv.ReturnValue %0: f32 } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Physical64 OpenCL requires #spirv.vce { spirv.func @float_insts(%arg0 : f32) ""None"" { %0 = spirv.CL.exp %arg0 : f32 %1 = spirv.CL.fabs %arg0 : f32 %2 = spirv.CL.sin %arg0 : f32 %3 = spirv.CL.cos %arg0 : f32 %4 = spirv.CL.log %arg0 : f32 %5 = spirv.CL.sqrt %arg0 : f32 %6 = spirv.CL.ceil %arg0 : f32 %7 = spirv.CL.floor %arg0 : f32 %8 = spirv.CL.pow %arg0, %arg0 : f32 %9 = spirv.CL.rsqrt %arg0 : f32 %10 = spirv.CL.erf %arg0 : f32 spirv.Return } spirv.func @integer_insts(%arg0 : i32) ""None"" { %0 = spirv.CL.s_abs %arg0 : i32 spirv.Return } spirv.func @vector_size16(%arg0 : vector<16xf32>) ""None"" { %0 = spirv.CL.fabs %arg0 : vector<16xf32> spirv.Return } spirv.func @fma(%arg0 : f32, %arg1 : f32, %arg2 : f32) ""None"" { %13 = spirv.CL.fma %arg0, %arg1, %arg2 : f32 spirv.Return } spirv.func @maxmin(%arg0 : f32, %arg1 : f32, %arg2 : i32, %arg3 : i32) ""None"" { %1 = spirv.CL.fmax %arg0, %arg1 : f32 %2 = spirv.CL.s_max %arg2, %arg3 : i32 %3 = spirv.CL.u_max %arg2, %arg3 : i32 %4 = spirv.CL.fmin %arg0, %arg1 : f32 %5 = spirv.CL.s_min %arg2, %arg3 : i32 %6 = spirv.CL.u_min %arg2, %arg3 : i32 spirv.Return } }", mlir-translate -no-implicit-module -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @bitcount(%arg: i32) -> i32 ""None"" { %0 = spirv.BitCount %arg : i32 spirv.ReturnValue %0 : i32 } spirv.func @bit_field_insert(%base: vector<3xi32>, %insert: vector<3xi32>, %offset: i32, %count: i16) -> vector<3xi32> ""None"" { %0 = spirv.BitFieldInsert %base, %insert, %offset, %count : vector<3xi32>, i32, i16 spirv.ReturnValue %0 : vector<3xi32> } spirv.func @bit_field_s_extract(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> ""None"" { %0 = spirv.BitFieldSExtract %base, %offset, %count : vector<3xi32>, i8, i8 spirv.ReturnValue %0 : vector<3xi32> } spirv.func @bit_field_u_extract(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> ""None"" { %0 = spirv.BitFieldUExtract %base, %offset, %count : vector<3xi32>, i8, i8 spirv.ReturnValue %0 : vector<3xi32> } spirv.func @bitreverse(%arg: i32) -> i32 ""None"" { %0 = spirv.BitReverse %arg : i32 spirv.ReturnValue %0 : i32 } spirv.func @not(%arg: i32) -> i32 ""None"" { %0 = spirv.Not %arg : i32 spirv.ReturnValue %0 : i32 } spirv.func @bitwise_scalar(%arg0 : i32, %arg1 : i32) ""None"" { %0 = spirv.BitwiseAnd %arg0, %arg1 : i32 %1 = spirv.BitwiseOr %arg0, %arg1 : i32 %2 = spirv.BitwiseXor %arg0, %arg1 : i32 spirv.Return } spirv.func @shift_left_logical(%arg0: i32, %arg1 : i16) -> i32 ""None"" { %0 = spirv.ShiftLeftLogical %arg0, %arg1: i32, i16 spirv.ReturnValue %0 : i32 } spirv.func @shift_right_arithmetic(%arg0: vector<4xi32>, %arg1 : vector<4xi8>) -> vector<4xi32> ""None"" { %0 = spirv.ShiftRightArithmetic %arg0, %arg1: vector<4xi32>, vector<4xi8> spirv.ReturnValue %0 : vector<4xi32> } spirv.func @shift_right_logical(%arg0: vector<2xi32>, %arg1 : vector<2xi8>) -> vector<2xi32> ""None"" { %0 = spirv.ShiftRightLogical %arg0, %arg1: vector<2xi32>, vector<2xi8> spirv.ReturnValue %0 : vector<2xi32> } }", mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @loop(%count : i32) -> () ""None"" { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.loop { spirv.Branch ^header ^header: %val0 = spirv.Load ""Function"" %var : i32 %cmp = spirv.SLessThan %val0, %count : i32 spirv.BranchConditional %cmp [1, 1], ^body, ^merge ^body: spirv.Branch ^continue ^continue: %val1 = spirv.Load ""Function"" %var : i32 %add = spirv.IAdd %val1, %one : i32 spirv.Store ""Function"" %var, %add : i32 spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @GV1 bind(0, 0) : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @GV2 bind(0, 1) : !spirv.ptr [0])>, StorageBuffer> spirv.func @loop_kernel() ""None"" { %0 = spirv.mlir.addressof @GV1 : !spirv.ptr [0])>, StorageBuffer> %1 = spirv.Constant 0 : i32 %2 = spirv.AccessChain %0[%1] : !spirv.ptr [0])>, StorageBuffer>, i32 %3 = spirv.mlir.addressof @GV2 : !spirv.ptr [0])>, StorageBuffer> %5 = spirv.AccessChain %3[%1] : !spirv.ptr [0])>, StorageBuffer>, i32 %6 = spirv.Constant 4 : i32 %7 = spirv.Constant 42 : i32 %8 = spirv.Constant 2 : i32 spirv.mlir.loop { spirv.Branch ^header(%6 : i32) ^header(%9: i32): %10 = spirv.SLessThan %9, %7 : i32 spirv.BranchConditional %10, ^body, ^merge ^body: %11 = spirv.AccessChain %2[%9] : !spirv.ptr, StorageBuffer>, i32 %12 = spirv.Load ""StorageBuffer"" %11 : f32 %13 = spirv.AccessChain %5[%9] : !spirv.ptr, StorageBuffer>, i32 spirv.Store ""StorageBuffer"" %13, %12 : f32 %14 = spirv.IAdd %9, %8 : i32 spirv.Branch ^header(%14 : i32) ^merge: spirv.mlir.merge } spirv.Return } spirv.EntryPoint ""GLCompute"" @loop_kernel spirv.ExecutionMode @loop_kernel ""LocalSize"", 1, 1, 1 }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @loop(%count : i32) -> () ""None"" { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %ivar = spirv.Variable init(%zero) : !spirv.ptr %jvar = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.loop control(Unroll) { spirv.Branch ^header ^header: %ival0 = spirv.Load ""Function"" %ivar : i32 %icmp = spirv.SLessThan %ival0, %count : i32 spirv.BranchConditional %icmp, ^body, ^merge ^body: spirv.Store ""Function"" %jvar, %zero : i32 spirv.mlir.loop control(DontUnroll) { spirv.Branch ^header ^header: %jval0 = spirv.Load ""Function"" %jvar : i32 %jcmp = spirv.SLessThan %jval0, %count : i32 spirv.BranchConditional %jcmp, ^body, ^merge ^body: spirv.Branch ^continue ^continue: %jval1 = spirv.Load ""Function"" %jvar : i32 %add = spirv.IAdd %jval1, %one : i32 spirv.Store ""Function"" %jvar, %add : i32 spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Branch ^continue ^continue: %ival1 = spirv.Load ""Function"" %ivar : i32 %add = spirv.IAdd %ival1, %one : i32 spirv.Store ""Function"" %ivar, %add : i32 spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } spirv.func @main() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @main }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Physical64 OpenCL requires #spirv.vce { spirv.func @kernel(%input: i64) ""None"" { %cst0_i64 = spirv.Constant 0 : i64 %true = spirv.Constant true %false = spirv.Constant false spirv.mlir.loop { spirv.Branch ^loop_header(%input : i64) ^loop_header(%arg1: i64): %gt = spirv.SGreaterThan %arg1, %cst0_i64 : i64 %var = spirv.Variable : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %gt, ^then, ^else ^then: spirv.Store ""Function"" %var, %true : i1 spirv.Branch ^selection_merge ^else: spirv.Store ""Function"" %var, %false : i1 spirv.Branch ^selection_merge ^selection_merge: spirv.mlir.merge } %load = spirv.Load ""Function"" %var : i1 spirv.BranchConditional %load, ^continue(%arg1 : i64), ^loop_merge ^continue(%arg2: i64): %lt = spirv.SLessThan %arg2, %cst0_i64 : i64 spirv.Store ""Function"" %var, %lt : i1 spirv.Branch ^loop_header(%arg2 : i64) ^loop_merge: spirv.mlir.merge } spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @iequal_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.IEqual %arg0, %arg1 : i32 spirv.Return } spirv.func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.INotEqual %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.SGreaterThan %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.SGreaterThanEqual %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.SLessThan %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.SLessThanEqual %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.UGreaterThan %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.UGreaterThanEqual %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.ULessThan %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @ulte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.ULessThanEqual %arg0, %arg1 : vector<4xi32> spirv.Return } spirv.func @cmpf(%arg0 : f32, %arg1 : f32) ""None"" { %1 = spirv.FOrdEqual %arg0, %arg1 : f32 %2 = spirv.FOrdGreaterThan %arg0, %arg1 : f32 %3 = spirv.FOrdGreaterThanEqual %arg0, %arg1 : f32 %4 = spirv.FOrdLessThan %arg0, %arg1 : f32 %5 = spirv.FOrdLessThanEqual %arg0, %arg1 : f32 %6 = spirv.FOrdNotEqual %arg0, %arg1 : f32 %7 = spirv.FUnordEqual %arg0, %arg1 : f32 %8 = spirv.FUnordGreaterThan %arg0, %arg1 : f32 %9 = spirv.FUnordGreaterThanEqual %arg0, %arg1 : f32 %10 = spirv.FUnordLessThan %arg0, %arg1 : f32 %11 = spirv.FUnordLessThanEqual %arg0, %arg1 : f32 %12 = spirv.FUnordNotEqual %arg0, %arg1 : f32 %13 = spirv.Ordered %arg0, %arg1 : f32 %14 = spirv.Unordered %arg0, %arg1 : f32 %15 = spirv.IsNan %arg0 : f32 %16 = spirv.IsInf %arg1 : f32 spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.SpecConstant @condition_scalar = true spirv.func @select() -> () ""None"" { %0 = spirv.Constant 4.0 : f32 %1 = spirv.Constant 5.0 : f32 %2 = spirv.mlir.referenceof @condition_scalar : i1 %3 = spirv.Select %2, %0, %1 : i1, f32 %4 = spirv.Constant dense<[2.0, 3.0, 4.0, 5.0]> : vector<4xf32> %5 = spirv.Constant dense<[6.0, 7.0, 8.0, 9.0]> : vector<4xf32> %6 = spirv.Select %2, %4, %5 : i1, vector<4xf32> %7 = spirv.Constant dense<[true, true, true, true]> : vector<4xi1> %8 = spirv.Select %7, %4, %5 : vector<4xi1>, vector<4xf32> spirv.Return } }", mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip ,1 "module attributes {omp.is_device = true} { llvm.func @omp_target_region_() { %0 = llvm.mlir.constant(20 : i32) : i32 %1 = llvm.mlir.constant(10 : i32) : i32 %2 = llvm.mlir.constant(1 : i64) : i64 %3 = llvm.alloca %2 x i32 {bindc_name = ""a"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEa""} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(1 : i64) : i64 %5 = llvm.alloca %4 x i32 {bindc_name = ""b"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEb""} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 %7 = llvm.alloca %6 x i32 {bindc_name = ""c"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEc""} : (i64) -> !llvm.ptr llvm.store %1, %3 : !llvm.ptr llvm.store %0, %5 : !llvm.ptr omp.target { %8 = llvm.load %3 : !llvm.ptr %9 = llvm.load %5 : !llvm.ptr %10 = llvm.add %8, %9 : i32 llvm.store %10, %7 : !llvm.ptr omp.terminator } llvm.return } }", mlir-translate -mlir-to-llvmir ,1 "module { llvm.func @printf(!llvm.ptr, ...) -> i32 llvm.mlir.global internal constant @str0(""WG size of kernel = %d X %d\0A\00"") llvm.func @main(%arg0: i32, %arg1: !llvm.ptr>) -> i32 { omp.parallel { %0 = llvm.mlir.constant(1 : index) : i64 %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(0 : index) : i64 %4 = llvm.mlir.constant(0 : i32) : i32 %12 = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr omp.wsloop for (%arg2) : i64 = (%2) to (%1) step (%0) { omp.parallel { omp.wsloop for (%arg3) : i64 = (%2) to (%0) step (%0) { llvm.store %2, %12 : !llvm.ptr omp.yield } omp.terminator } %19 = llvm.load %12 : !llvm.ptr %20 = llvm.trunc %19 : i64 to i32 %5 = llvm.mlir.addressof @str0 : !llvm.ptr> %6 = llvm.getelementptr %5[%4, %4] : (!llvm.ptr>, i32, i32) -> !llvm.ptr %21 = llvm.call @printf(%6, %20, %20) : (!llvm.ptr, i32, i32) -> i32 omp.yield } omp.terminator } %a4 = llvm.mlir.constant(0 : i32) : i32 llvm.return %a4 : i32 } }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @callee() { llvm.return } loc(""calleesource.cc"":1:1) llvm.func @func_with_empty_named_info() { llvm.call @callee() : () -> () loc(""named with no line info"") llvm.return } llvm.func @func_no_debug() { llvm.return loc(unknown) } loc(unknown) #file = #llvm.di_file<""foo.mlir"" in ""/test/""> #si64 = #llvm.di_basic_type< tag = DW_TAG_base_type, name = ""si64"" > #si32 = #llvm.di_basic_type< tag = DW_TAG_base_type, name = ""si32"", sizeInBits = 32, encoding = DW_ATE_signed > #ptr = #llvm.di_derived_type< tag = DW_TAG_pointer_type, baseType = #si32, sizeInBits = 64, alignInBits = 32, offsetInBits = 8 > #named = #llvm.di_derived_type< tag = DW_TAG_pointer_type, name = ""named"", baseType = #si32 > #cu = #llvm.di_compile_unit< sourceLanguage = DW_LANG_C, file = #file, producer = ""MLIR"", isOptimized = true, emissionKind = Full > #composite = #llvm.di_composite_type< tag = DW_TAG_structure_type, name = ""composite"", file = #file, line = 42, sizeInBits = 64, alignInBits = 32, elements = #llvm.di_subrange > #vector = #llvm.di_composite_type< tag = DW_TAG_array_type, name = ""array"", file = #file, baseType = #si64, flags = Vector, elements = #llvm.di_subrange > #null = #llvm.di_null_type #spType0 = #llvm.di_subroutine_type #toplevel_namespace = #llvm.di_namespace< name = ""toplevel"", exportSymbols = true > #nested_namespace = #llvm.di_namespace< name = ""nested"", scope = #toplevel_namespace, exportSymbols = false > #sp0 = #llvm.di_subprogram< compileUnit = #cu, scope = #nested_namespace, name = ""func_with_debug"", linkageName = ""func_with_debug"", file = #file, line = 3, scopeLine = 3, subprogramFlags = ""Definition|Optimized"", type = #spType0 > #calleeType = #llvm.di_subroutine_type< types = #si64, #si64> #callee = #llvm.di_subprogram< compileUnit = #cu, scope = #composite, name = ""callee"", file = #file, subprogramFlags = ""Definition"", type = #calleeType > #fileScope = #llvm.di_lexical_block_file #blockScope = #llvm.di_lexical_block #variable = #llvm.di_local_variable #variableAddr = #llvm.di_local_variable #noNameVariable = #llvm.di_local_variable #spType1 = #llvm.di_subroutine_type #sp1 = #llvm.di_subprogram< compileUnit = #cu, scope = #file, name = ""empty_types"", file = #file, subprogramFlags = ""Definition"", type = #spType1 > llvm.func @func_with_debug(%arg: i64) { %allocCount = llvm.mlir.constant(1 : i32) : i32 %alloc = llvm.alloca %allocCount x i64 : (i32) -> !llvm.ptr llvm.intr.dbg.value #variable = %arg : i64 llvm.intr.dbg.declare #variableAddr = %alloc : !llvm.ptr llvm.intr.dbg.value #noNameVariable= %arg : i64 llvm.call @func_no_debug() : () -> () loc(callsite(""mysource.cc"":3:4 at ""mysource.cc"":5:6)) llvm.call @func_no_debug() : () -> () loc(""foo.mlir"":1:2) llvm.call @func_no_debug() : () -> () loc(""named""(""foo.mlir"":10:10)) llvm.call @func_no_debug() : () -> () loc(fused[callsite(""mysource.cc"":5:6 at ""mysource.cc"":1:1), ""mysource.cc"":1:1]) %sum = llvm.add %arg, %arg : i64 loc(fused<#callee>[callsite(""foo.mlir"":2:4 at fused<#sp0>[""foo.mlir"":28:5])]) llvm.return } loc(fused<#sp0>[""foo.mlir"":1:1]) llvm.func @empty_types() { llvm.return } loc(fused<#sp1>[""foo.mlir"":2:1])", mlir-translate -mlir-to-llvmir --split-input-file ,1 "#di_basic_type = #llvm.di_basic_type #di_file = #llvm.di_file<""foo.mlir"" in ""/test/""> #di_compile_unit = #llvm.di_compile_unit< sourceLanguage = DW_LANG_C, file = #di_file, producer = ""MLIR"", isOptimized = true, emissionKind = Full > #di_subprogram = #llvm.di_subprogram< compileUnit = #di_compile_unit, scope = #di_file, name = ""outer_func"", file = #di_file, subprogramFlags = ""Definition|Optimized"" > #di_subprogram1 = #llvm.di_subprogram< compileUnit = #di_compile_unit, scope = #di_file, name = ""inner_func"", file = #di_file, subprogramFlags = ""LocalToUnit|Definition|Optimized"" > #di_local_variable0 = #llvm.di_local_variable #di_lexical_block_file = #llvm.di_lexical_block_file #di_local_variable1 = #llvm.di_local_variable #loc0 = loc(""foo.mlir"":0:0) #loc1 = loc(callsite(#loc0 at fused<#di_subprogram>[""foo.mlir"":4:2])) llvm.func @func_with_inlined_dbg_value(%arg0: i32) -> (i32) { llvm.intr.dbg.value #di_local_variable0 = %arg0 : i32 loc(fused<#di_subprogram>[#loc0]) llvm.intr.dbg.value #di_local_variable1 = %arg0 : i32 loc(fused<#di_lexical_block_file>[#loc1]) llvm.return %arg0 : i32 } loc(fused<#di_subprogram>[""caller""])", mlir-translate -mlir-to-llvmir --split-input-file ,1 "llvm.func @opaque_ptr_load(%arg0: !llvm.ptr) -> i32 { %0 = llvm.load %arg0 : !llvm.ptr -> i32 llvm.return %0 : i32 } llvm.func @opaque_ptr_store(%arg0: i32, %arg1: !llvm.ptr){ llvm.store %arg0, %arg1 : i32, !llvm.ptr llvm.return } llvm.func @opaque_ptr_ptr_store(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { llvm.store %arg0, %arg1 : !llvm.ptr, !llvm.ptr llvm.return } llvm.func @opaque_ptr_alloca(%arg0: i32) -> !llvm.ptr { %0 = llvm.alloca %arg0 x f32 : (i32) -> !llvm.ptr llvm.return %0 : !llvm.ptr } llvm.func @opaque_ptr_gep(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr { %0 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i32) -> !llvm.ptr, f32 llvm.return %0 : !llvm.ptr } llvm.func @opaque_ptr_gep_struct(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr { %0 = llvm.getelementptr %arg0[%arg1, 0, 1] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<(struct<(f32, f64)>, struct<(i32, i64)>)> llvm.return %0 : !llvm.ptr } llvm.func @opaque_ptr_matrix_load_store(%ptr: !llvm.ptr, %stride: i64) -> vector<48 x f32> { %0 = llvm.intr.matrix.column.major.load %ptr, { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} : vector<48 x f32> from !llvm.ptr stride i64 llvm.intr.matrix.column.major.store %0, %ptr, { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} : vector<48 x f32> to !llvm.ptr stride i64 llvm.return %0 : vector<48 x f32> } llvm.func @opaque_ptr_masked_load(%arg0: !llvm.ptr, %arg1: vector<7xi1>) -> vector<7xf32> { %0 = llvm.intr.masked.load %arg0, %arg1 { alignment = 1: i32} : (!llvm.ptr, vector<7xi1>) -> vector<7xf32> llvm.return %0 : vector<7 x f32> } llvm.func @opaque_ptr_gather(%M: !llvm.vec<7 x ptr>, %mask: vector<7xi1>) -> vector<7xf32> { %a = llvm.intr.masked.gather %M, %mask { alignment = 1: i32} : (!llvm.vec<7 x ptr>, vector<7xi1>) -> vector<7xf32> llvm.return %a : vector<7xf32> }", mlir-translate -mlir-to-llvmir -opaque-pointers ,1 "module attributes {omp.is_device = false} { llvm.func @omp_target_region_() { %0 = llvm.mlir.constant(20 : i32) : i32 %1 = llvm.mlir.constant(10 : i32) : i32 %2 = llvm.mlir.constant(1 : i64) : i64 %3 = llvm.alloca %2 x i32 {bindc_name = ""a"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEa""} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(1 : i64) : i64 %5 = llvm.alloca %4 x i32 {bindc_name = ""b"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEb""} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 %7 = llvm.alloca %6 x i32 {bindc_name = ""c"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEc""} : (i64) -> !llvm.ptr llvm.store %1, %3 : !llvm.ptr llvm.store %0, %5 : !llvm.ptr omp.target { %8 = llvm.load %3 : !llvm.ptr %9 = llvm.load %5 : !llvm.ptr %10 = llvm.add %8, %9 : i32 llvm.store %10, %7 : !llvm.ptr omp.terminator } llvm.return } }", mlir-translate -mlir-to-llvmir ,1 "func.func @arm_neon_sdot2d_4x4_i8i8(%a: vector<4xi32>, %b: vector<4x4xi8>, %c: vector<4x4xi8>) -> vector<4xi32> { %0 = arm_neon.2d.sdot %a, %b, %c : vector<4x4xi8>, vector<4x4xi8> to vector<4xi32> return %0 : vector<4xi32> } func.func @arm_neon_sdot2d_2x4_i8i8(%a: vector<2xi32>, %b: vector<2x4xi8>, %c: vector<2x4xi8>) -> vector<2xi32> { %0 = arm_neon.2d.sdot %a, %b, %c : vector<2x4xi8>, vector<2x4xi8> to vector<2xi32> return %0 : vector<2xi32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(arm-neon-2d-to-intr))"" ",1 "llvm.func @rocdl_special_regs() -> i32 { %1 = rocdl.workitem.id.x : i32 %2 = rocdl.workitem.id.y : i32 %3 = rocdl.workitem.id.z : i32 %4 = rocdl.workgroup.id.x : i32 %5 = rocdl.workgroup.id.y : i32 %6 = rocdl.workgroup.id.z : i32 %7 = rocdl.workgroup.dim.x : i64 %8 = rocdl.workgroup.dim.y : i64 %9 = rocdl.workgroup.dim.z : i64 %10 = rocdl.grid.dim.x : i64 %11 = rocdl.grid.dim.y : i64 %12 = rocdl.grid.dim.z : i64 %13 = rocdl.workitem.id.x {range = array} : i32 llvm.return %1 : i32 } llvm.func @kernel_func() attributes {rocdl.kernel} { llvm.return } llvm.func @kernel_func_workgroups() attributes {rocdl.kernel, rocdl.max_flat_work_group_size = 1024 : index} { llvm.return } llvm.func @known_block_sizes() attributes {rocdl.kernel, rocdl.flat_work_group_size = ""128,128"", rocdl.reqd_work_group_size = array} { llvm.return } llvm.func @rocdl.barrier() { rocdl.barrier llvm.return } llvm.func @rocdl.xdlops(%arg0 : f32, %arg1 : f32, %arg2 : vector<32 x f32>, %arg3: i32, %arg4 : vector<16 x f32>, %arg5 : vector<4xf32>, %arg6 : vector<4xf16>, %arg7 : vector<32 x i32>, %arg8 : vector<16 x i32>, %arg9 : vector<4xi32>, %arg10 : vector<2xi16>, %arg11 : i64) -> vector<32 x f32> { %csti32 = llvm.mlir.constant(42 : i32) : i32 %r0 = rocdl.mfma.f32.32x32x1f32 %arg0, %arg1, %arg2, %csti32, %csti32, %csti32 : (f32, f32, vector<32 x f32>, i32, i32, i32) -> vector<32 x f32> %r1 = rocdl.mfma.f32.16x16x1f32 %arg0, %arg1, %arg4, %csti32, %csti32, %csti32 : (f32, f32, vector<16 x f32>, i32, i32, i32) -> vector<16 x f32> %r2 = rocdl.mfma.f32.16x16x4f32 %arg0, %arg1, %arg5, %csti32, %csti32, %csti32 : (f32, f32, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r3 = rocdl.mfma.f32.4x4x1f32 %arg0, %arg1, %arg5, %csti32, %csti32, %csti32 : (f32, f32, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r4= rocdl.mfma.f32.32x32x2f32 %arg0, %arg1, %arg4, %csti32, %csti32, %csti32 : (f32, f32, vector<16 x f32>, i32, i32, i32) -> vector<16 x f32> %r5 = rocdl.mfma.f32.32x32x4f16 %arg6, %arg6, %arg2, %csti32, %csti32, %csti32 : (vector<4xf16>, vector<4xf16>, vector<32 x f32>, i32, i32, i32) -> vector<32 x f32> %r6 = rocdl.mfma.f32.16x16x4f16 %arg6, %arg6, %arg4, %csti32, %csti32, %csti32 : (vector<4xf16>, vector<4xf16>, vector<16 x f32>, i32, i32, i32) -> vector<16 x f32> %r7 = rocdl.mfma.f32.4x4x4f16 %arg6, %arg6, %arg5, %csti32, %csti32, %csti32 : (vector<4xf16>, vector<4xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r8 = rocdl.mfma.f32.32x32x8f16 %arg6, %arg6, %arg4, %csti32, %csti32, %csti32 : (vector<4xf16>, vector<4xf16>, vector<16 x f32>, i32, i32, i32) -> vector<16 x f32> %r9 = rocdl.mfma.f32.16x16x16f16 %arg6, %arg6, %arg5, %csti32, %csti32, %csti32 : (vector<4xf16>, vector<4xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r10 = rocdl.mfma.i32.32x32x4i8 %arg3, %arg3, %arg7, %csti32, %csti32, %csti32 : (i32, i32, vector<32 x i32>, i32, i32, i32) -> vector<32 x i32> %r11 = rocdl.mfma.i32.16x16x4i8 %arg3, %arg3, %arg8, %csti32, %csti32, %csti32 : (i32, i32, vector<16 x i32>, i32, i32, i32) -> vector<16 x i32> %r12 = rocdl.mfma.i32.4x4x4i8 %arg3, %arg3, %arg9, %csti32, %csti32, %csti32 : (i32, i32, vector<4xi32>, i32, i32, i32) -> vector<4xi32> %r13 = rocdl.mfma.i32.32x32x8i8 %arg3, %arg3, %arg8, %csti32, %csti32, %csti32 : (i32, i32, vector<16 x i32>, i32, i32, i32) -> vector<16 x i32> %r14 = rocdl.mfma.i32.16x16x16i8 %arg3, %arg3, %arg9, %csti32, %csti32, %csti32 : (i32, i32, vector<4xi32>, i32, i32, i32) -> vector<4xi32> %r15 = rocdl.mfma.f32.32x32x2bf16 %arg10, %arg10, %arg2, %csti32, %csti32, %csti32 : (vector<2xi16>, vector<2xi16>, vector<32 x f32>, i32, i32, i32) -> vector<32 x f32> %r16 = rocdl.mfma.f32.16x16x2bf16 %arg10, %arg10, %arg4, %csti32, %csti32, %csti32 : (vector<2xi16>, vector<2xi16>, vector<16 x f32>, i32, i32, i32) -> vector<16 x f32> %r17 = rocdl.mfma.f32.4x4x2bf16 %arg10, %arg10, %arg5, %csti32, %csti32, %csti32 : (vector<2xi16>, vector<2xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r18 = rocdl.mfma.f32.32x32x4bf16 %arg10, %arg10, %arg4, %csti32, %csti32, %csti32 : (vector<2xi16>, vector<2xi16>, vector<16 x f32>, i32, i32, i32) -> vector<16 x f32> %r19 = rocdl.mfma.f32.16x16x8bf16 %arg10, %arg10, %arg5, %csti32, %csti32, %csti32 : (vector<2xi16>, vector<2xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r20 = rocdl.mfma.f32.16x16x32.bf8.bf8 %arg11, %arg11, %arg5, %csti32, %csti32, %csti32 : (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r21 = rocdl.mfma.f32.16x16x32.bf8.fp8 %arg11, %arg11, %arg5, %csti32, %csti32, %csti32 : (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r22 = rocdl.mfma.f32.16x16x32.fp8.bf8 %arg11, %arg11, %arg5, %csti32, %csti32, %csti32 : (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r23 = rocdl.mfma.f32.16x16x32.fp8.fp8 %arg11, %arg11, %arg5, %csti32, %csti32, %csti32 : (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r24 = rocdl.mfma.f32.32x32x16.bf8.bf8 %arg11, %arg11, %arg4, %csti32, %csti32, %csti32 : (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r25 = rocdl.mfma.f32.32x32x16.bf8.fp8 %arg11, %arg11, %arg4, %csti32, %csti32, %csti32 : (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r26 = rocdl.mfma.f32.32x32x16.fp8.bf8 %arg11, %arg11, %arg4, %csti32, %csti32, %csti32 : (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r27 = rocdl.mfma.f32.32x32x16.bf8.bf8 %arg11, %arg11, %arg4, %csti32, %csti32, %csti32 : (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> llvm.return %r0 : vector<32 x f32> } llvm.func @rocdl.mubuf(%rsrc : vector<4xi32>, %vindex : i32, %offset : i32, %vdata1 : vector<1xf32>, %vdata2 : vector<2xf32>, %vdata4 : vector<4xf32>) { %glc = llvm.mlir.constant(false) : i1 %slc = llvm.mlir.constant(true) : i1 %r1 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32> %r2 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32> %r4 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32> rocdl.buffer.store %vdata1, %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32> rocdl.buffer.store %vdata2, %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32> rocdl.buffer.store %vdata4, %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32> llvm.return } llvm.func @rocdl.raw.buffer(%rsrc : vector<4xi32>, %offset : i32, %soffset : i32, %vdata1 : i32, %vdata2 : vector<2xi32>, %vdata4 : vector<4xi32>) { %aux = llvm.mlir.constant(0 : i32) : i32 %r1 = rocdl.raw.buffer.load %rsrc, %offset, %soffset, %aux : i32 %r2 = rocdl.raw.buffer.load %rsrc, %offset, %soffset, %aux : vector<2xi32> %r4 = rocdl.raw.buffer.load %rsrc, %offset, %soffset, %aux : vector<4xi32> rocdl.raw.buffer.store %vdata1, %rsrc, %offset, %soffset, %aux : i32 rocdl.raw.buffer.store %vdata2, %rsrc, %offset, %soffset, %aux : vector<2xi32> rocdl.raw.buffer.store %vdata4, %rsrc, %offset, %soffset, %aux : vector<4xi32> llvm.return } llvm.func @rocdl.raw.buffer.atomic.f32(%rsrc : vector<4xi32>, %offset : i32, %soffset : i32, %vdata1 : f32) { %aux = llvm.mlir.constant(0 : i32) : i32 rocdl.raw.buffer.atomic.fadd %vdata1, %rsrc, %offset, %soffset, %aux : f32 rocdl.raw.buffer.atomic.fmax %vdata1, %rsrc, %offset, %soffset, %aux : f32 llvm.return } llvm.func @rocdl.raw.buffer.atomic.i32(%rsrc : vector<4xi32>, %offset : i32, %soffset : i32, %vdata1 : i32) { %aux = llvm.mlir.constant(0 : i32) : i32 rocdl.raw.buffer.atomic.smax %vdata1, %rsrc, %offset, %soffset, %aux : i32 rocdl.raw.buffer.atomic.umin %vdata1, %rsrc, %offset, %soffset, %aux : i32 llvm.return } llvm.func @rocdl.raw.buffer.atomic.cmpswap(%rsrc : vector<4xi32>, %offset : i32, %soffset : i32, %src : i32, %cmp : i32) -> i32 { %aux = llvm.mlir.constant(0 : i32) : i32 %val = rocdl.raw.buffer.atomic.cmpswap(%src, %cmp, %rsrc, %offset, %soffset, %aux) : i32, vector<4xi32> llvm.return %val : i32 }", mlir-translate -mlir-to-llvmir ,1 "llvm.func @intrinsics(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: !llvm.ptr) { %c3 = llvm.mlir.constant(3 : i32) : i32 %c1 = llvm.mlir.constant(1 : i32) : i32 %c0 = llvm.mlir.constant(0 : i32) : i32 ""llvm.intr.fmuladd""(%arg0, %arg1, %arg0) : (f32, f32, f32) -> f32 ""llvm.intr.fmuladd""(%arg2, %arg2, %arg2) : (vector<8xf32>, vector<8xf32>, vector<8xf32>) -> vector<8xf32> ""llvm.intr.fma""(%arg0, %arg1, %arg0) : (f32, f32, f32) -> f32 ""llvm.intr.fma""(%arg2, %arg2, %arg2) : (vector<8xf32>, vector<8xf32>, vector<8xf32>) -> vector<8xf32> ""llvm.intr.prefetch""(%arg3, %c0, %c3, %c1) : (!llvm.ptr, i32, i32, i32) -> () llvm.return } llvm.func @fpclass_test(%arg0: f32) -> i1 { %checkNan = llvm.mlir.constant(0 : i32) : i32 %0 = ""llvm.intr.is.fpclass""(%arg0, %checkNan) : (f32, i32) -> i1 llvm.return %0 : i1 } llvm.func @exp_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.exp""(%arg0) : (f32) -> f32 ""llvm.intr.exp""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @exp2_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.exp2""(%arg0) : (f32) -> f32 ""llvm.intr.exp2""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @log_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.log""(%arg0) : (f32) -> f32 ""llvm.intr.log""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @log10_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.log10""(%arg0) : (f32) -> f32 ""llvm.intr.log10""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @log2_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.log2""(%arg0) : (f32) -> f32 ""llvm.intr.log2""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @fabs_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.fabs""(%arg0) : (f32) -> f32 ""llvm.intr.fabs""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @sqrt_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.sqrt""(%arg0) : (f32) -> f32 ""llvm.intr.sqrt""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @ceil_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.ceil""(%arg0) : (f32) -> f32 ""llvm.intr.ceil""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @floor_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.floor""(%arg0) : (f32) -> f32 ""llvm.intr.floor""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @cos_test(%arg0: f32, %arg1: vector<8xf32>) { ""llvm.intr.cos""(%arg0) : (f32) -> f32 ""llvm.intr.cos""(%arg1) : (vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @copysign_test(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: vector<8xf32>) { ""llvm.intr.copysign""(%arg0, %arg1) : (f32, f32) -> f32 ""llvm.intr.copysign""(%arg2, %arg3) : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @pow_test(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: vector<8xf32>) { ""llvm.intr.pow""(%arg0, %arg1) : (f32, f32) -> f32 ""llvm.intr.pow""(%arg2, %arg3) : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @rint_test(%arg0 : f32, %arg1 : f64, %arg2 : vector<8xf32>, %arg3 : vector<8xf64>) { ""llvm.intr.rint""(%arg0) : (f32) -> f32 ""llvm.intr.rint""(%arg1) : (f64) -> f64 ""llvm.intr.rint""(%arg2) : (vector<8xf32>) -> vector<8xf32> ""llvm.intr.rint""(%arg3) : (vector<8xf64>) -> vector<8xf64> llvm.return } llvm.func @nearbyint_test(%arg0 : f32, %arg1 : f64, %arg2 : vector<8xf32>, %arg3 : vector<8xf64>) { ""llvm.intr.nearbyint""(%arg0) : (f32) -> f32 ""llvm.intr.nearbyint""(%arg1) : (f64) -> f64 ""llvm.intr.nearbyint""(%arg2) : (vector<8xf32>) -> vector<8xf32> ""llvm.intr.nearbyint""(%arg3) : (vector<8xf64>) -> vector<8xf64> llvm.return } llvm.func @lround_test(%arg0 : f32, %arg1 : f64) { ""llvm.intr.lround""(%arg0) : (f32) -> i32 ""llvm.intr.lround""(%arg0) : (f32) -> i64 ""llvm.intr.lround""(%arg1) : (f64) -> i32 ""llvm.intr.lround""(%arg1) : (f64) -> i64 llvm.return } llvm.func @llround_test(%arg0 : f32, %arg1 : f64) { ""llvm.intr.llround""(%arg0) : (f32) -> i64 ""llvm.intr.llround""(%arg1) : (f64) -> i64 llvm.return } llvm.func @lrint_test(%arg0 : f32, %arg1 : f64) { ""llvm.intr.lrint""(%arg0) : (f32) -> i32 ""llvm.intr.lrint""(%arg0) : (f32) -> i64 ""llvm.intr.lrint""(%arg1) : (f64) -> i32 ""llvm.intr.lrint""(%arg1) : (f64) -> i64 llvm.return } llvm.func @llrint_test(%arg0 : f32, %arg1 : f64) { ""llvm.intr.llrint""(%arg0) : (f32) -> i64 ""llvm.intr.llrint""(%arg1) : (f64) -> i64 llvm.return } llvm.func @bitreverse_test(%arg0: i32, %arg1: vector<8xi32>) { ""llvm.intr.bitreverse""(%arg0) : (i32) -> i32 ""llvm.intr.bitreverse""(%arg1) : (vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @byteswap_test(%arg0: i32, %arg1: vector<8xi32>) { ""llvm.intr.bswap""(%arg0) : (i32) -> i32 ""llvm.intr.bswap""(%arg1) : (vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @ctlz_test(%arg0: i32, %arg1: vector<8xi32>) { %i1 = llvm.mlir.constant(false) : i1 ""llvm.intr.ctlz""(%arg0, %i1) : (i32, i1) -> i32 ""llvm.intr.ctlz""(%arg1, %i1) : (vector<8xi32>, i1) -> vector<8xi32> llvm.return } llvm.func @cttz_test(%arg0: i32, %arg1: vector<8xi32>) { %i1 = llvm.mlir.constant(false) : i1 ""llvm.intr.cttz""(%arg0, %i1) : (i32, i1) -> i32 ""llvm.intr.cttz""(%arg1, %i1) : (vector<8xi32>, i1) -> vector<8xi32> llvm.return } llvm.func @ctpop_test(%arg0: i32, %arg1: vector<8xi32>) { ""llvm.intr.ctpop""(%arg0) : (i32) -> i32 ""llvm.intr.ctpop""(%arg1) : (vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @fshl_test(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: vector<8xi32>, %arg4: vector<8xi32>, %arg5: vector<8xi32>) { ""llvm.intr.fshl""(%arg0, %arg1, %arg2) : (i32, i32, i32) -> i32 ""llvm.intr.fshl""(%arg3, %arg4, %arg5) : (vector<8xi32>, vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @fshr_test(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: vector<8xi32>, %arg4: vector<8xi32>, %arg5: vector<8xi32>) { ""llvm.intr.fshr""(%arg0, %arg1, %arg2) : (i32, i32, i32) -> i32 ""llvm.intr.fshr""(%arg3, %arg4, %arg5) : (vector<8xi32>, vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @maximum_test(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: vector<8xf32>) { ""llvm.intr.maximum""(%arg0, %arg1) : (f32, f32) -> f32 ""llvm.intr.maximum""(%arg2, %arg3) : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @minimum_test(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: vector<8xf32>) { ""llvm.intr.minimum""(%arg0, %arg1) : (f32, f32) -> f32 ""llvm.intr.minimum""(%arg2, %arg3) : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @maxnum_test(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: vector<8xf32>) { ""llvm.intr.maxnum""(%arg0, %arg1) : (f32, f32) -> f32 ""llvm.intr.maxnum""(%arg2, %arg3) : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @minnum_test(%arg0: f32, %arg1: f32, %arg2: vector<8xf32>, %arg3: vector<8xf32>) { ""llvm.intr.minnum""(%arg0, %arg1) : (f32, f32) -> f32 ""llvm.intr.minnum""(%arg2, %arg3) : (vector<8xf32>, vector<8xf32>) -> vector<8xf32> llvm.return } llvm.func @smax_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.smax""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.smax""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @smin_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.smin""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.smin""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @umax_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.umax""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.umax""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @umin_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.umin""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.umin""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @vector_reductions(%arg0: f32, %arg1: vector<8xf32>, %arg2: vector<8xi32>) { ""llvm.intr.vector.reduce.add""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.and""(%arg2) : (vector<8xi32>) -> i32 llvm.intr.vector.reduce.fmax(%arg1) : (vector<8xf32>) -> f32 llvm.intr.vector.reduce.fmin(%arg1) : (vector<8xf32>) -> f32 ""llvm.intr.vector.reduce.mul""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.or""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.smax""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.smin""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.umax""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.umin""(%arg2) : (vector<8xi32>) -> i32 ""llvm.intr.vector.reduce.fadd""(%arg0, %arg1) : (f32, vector<8xf32>) -> f32 ""llvm.intr.vector.reduce.fmul""(%arg0, %arg1) : (f32, vector<8xf32>) -> f32 ""llvm.intr.vector.reduce.fadd""(%arg0, %arg1) {reassoc = true} : (f32, vector<8xf32>) -> f32 ""llvm.intr.vector.reduce.fmul""(%arg0, %arg1) {reassoc = true} : (f32, vector<8xf32>) -> f32 ""llvm.intr.vector.reduce.xor""(%arg2) : (vector<8xi32>) -> i32 llvm.return } llvm.func @matrix_intrinsics(%A: vector<64 x f32>, %B: vector<48 x f32>, %ptr: !llvm.ptr, %stride: i64) { %C = llvm.intr.matrix.multiply %A, %B { lhs_rows = 4: i32, lhs_columns = 16: i32 , rhs_columns = 3: i32} : (vector<64 x f32>, vector<48 x f32>) -> vector<12 x f32> %D = llvm.intr.matrix.transpose %B { rows = 3: i32, columns = 16: i32} : vector<48 x f32> into vector<48 x f32> %E = llvm.intr.matrix.column.major.load %ptr, { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} : vector<48 x f32> from !llvm.ptr stride i64 llvm.intr.matrix.column.major.store %E, %ptr, { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} : vector<48 x f32> to !llvm.ptr stride i64 llvm.return } llvm.func @get_active_lane_mask(%base: i64, %n: i64) -> (vector<7xi1>) { %0 = llvm.intr.get.active.lane.mask %base, %n : i64, i64 to vector<7xi1> llvm.return %0 : vector<7xi1> } llvm.func @masked_load_store_intrinsics(%A: !llvm.ptr>, %mask: vector<7xi1>) { %a = llvm.intr.masked.load %A, %mask { alignment = 1: i32} : (!llvm.ptr>, vector<7xi1>) -> vector<7xf32> %b = llvm.intr.masked.load %A, %mask, %a { alignment = 1: i32} : (!llvm.ptr>, vector<7xi1>, vector<7xf32>) -> vector<7xf32> llvm.intr.masked.store %b, %A, %mask { alignment = 1: i32} : vector<7xf32>, vector<7xi1> into !llvm.ptr> llvm.return } llvm.func @masked_gather_scatter_intrinsics(%M: !llvm.vec<7 x ptr>, %mask: vector<7xi1>) { %a = llvm.intr.masked.gather %M, %mask { alignment = 1: i32} : (!llvm.vec<7 x ptr>, vector<7xi1>) -> vector<7xf32> %b = llvm.intr.masked.gather %M, %mask, %a { alignment = 1: i32} : (!llvm.vec<7 x ptr>, vector<7xi1>, vector<7xf32>) -> vector<7xf32> llvm.intr.masked.scatter %b, %M, %mask { alignment = 1: i32} : vector<7xf32>, vector<7xi1> into !llvm.vec<7 x ptr> llvm.return } llvm.func @masked_expand_compress_intrinsics(%ptr: !llvm.ptr, %mask: vector<7xi1>, %passthru: vector<7xf32>) { %0 = ""llvm.intr.masked.expandload""(%ptr, %mask, %passthru) : (!llvm.ptr, vector<7xi1>, vector<7xf32>) -> (vector<7xf32>) ""llvm.intr.masked.compressstore""(%0, %ptr, %mask) : (vector<7xf32>, !llvm.ptr, vector<7xi1>) -> () llvm.return } llvm.func @trap_intrinsics() { ""llvm.intr.trap""() : () -> () ""llvm.intr.debugtrap""() : () -> () ""llvm.intr.ubsantrap""() {failureKind = 1 : i8} : () -> () llvm.return } llvm.func @memcpy_test(%arg0: i32, %arg2: !llvm.ptr, %arg3: !llvm.ptr) { %i1 = llvm.mlir.constant(false) : i1 ""llvm.intr.memcpy""(%arg2, %arg3, %arg0, %i1) : (!llvm.ptr, !llvm.ptr, i32, i1) -> () %sz = llvm.mlir.constant(10: i64) : i64 ""llvm.intr.memcpy.inline""(%arg2, %arg3, %sz, %i1) : (!llvm.ptr, !llvm.ptr, i64, i1) -> () llvm.return } llvm.func @memmove_test(%arg0: i32, %arg2: !llvm.ptr, %arg3: !llvm.ptr) { %i1 = llvm.mlir.constant(false) : i1 ""llvm.intr.memmove""(%arg2, %arg3, %arg0, %i1) : (!llvm.ptr, !llvm.ptr, i32, i1) -> () llvm.return } llvm.func @memset_test(%arg0: i32, %arg2: !llvm.ptr, %arg3: i8) { %i1 = llvm.mlir.constant(false) : i1 ""llvm.intr.memset""(%arg2, %arg3, %arg0, %i1) : (!llvm.ptr, i8, i32, i1) -> () llvm.return } llvm.func @sadd_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.sadd.with.overflow""(%arg0, %arg1) : (i32, i32) -> !llvm.struct<(i32, i1)> ""llvm.intr.sadd.with.overflow""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> !llvm.struct<(vector<8xi32>, vector<8xi1>)> llvm.return } llvm.func @uadd_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.uadd.with.overflow""(%arg0, %arg1) : (i32, i32) -> !llvm.struct<(i32, i1)> ""llvm.intr.uadd.with.overflow""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> !llvm.struct<(vector<8xi32>, vector<8xi1>)> llvm.return } llvm.func @ssub_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.ssub.with.overflow""(%arg0, %arg1) : (i32, i32) -> !llvm.struct<(i32, i1)> ""llvm.intr.ssub.with.overflow""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> !llvm.struct<(vector<8xi32>, vector<8xi1>)> llvm.return } llvm.func @usub_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.usub.with.overflow""(%arg0, %arg1) : (i32, i32) -> !llvm.struct<(i32, i1)> ""llvm.intr.usub.with.overflow""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> !llvm.struct<(vector<8xi32>, vector<8xi1>)> llvm.return } llvm.func @smul_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.smul.with.overflow""(%arg0, %arg1) : (i32, i32) -> !llvm.struct<(i32, i1)> ""llvm.intr.smul.with.overflow""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> !llvm.struct<(vector<8xi32>, vector<8xi1>)> llvm.return } llvm.func @umul_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.umul.with.overflow""(%arg0, %arg1) : (i32, i32) -> !llvm.struct<(i32, i1)> ""llvm.intr.umul.with.overflow""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> !llvm.struct<(vector<8xi32>, vector<8xi1>)> llvm.return } llvm.func @is_constant(%arg0: i32) { %0 = ""llvm.intr.is.constant""(%arg0) : (i32) -> i1 llvm.return } llvm.func @expect(%arg0: i32) { %0 = llvm.mlir.constant(42 : i32) : i32 %1 = llvm.intr.expect %arg0, %0 : i32 llvm.return } llvm.func @expect_with_probability(%arg0: i16) { %0 = llvm.mlir.constant(42 : i16) : i16 %1 = llvm.intr.expect.with.probability %arg0, %0, 5.000000e-01 : i16 llvm.return } llvm.func @threadlocal_test(%arg0 : !llvm.ptr) { ""llvm.intr.threadlocal.address""(%arg0) : (!llvm.ptr) -> !llvm.ptr llvm.return } llvm.func @sadd_sat_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.sadd.sat""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.sadd.sat""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @uadd_sat_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.uadd.sat""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.uadd.sat""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @ssub_sat_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.ssub.sat""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.ssub.sat""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @usub_sat_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.usub.sat""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.usub.sat""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @sshl_sat_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.sshl.sat""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.sshl.sat""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @ushl_sat_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) { ""llvm.intr.ushl.sat""(%arg0, %arg1) : (i32, i32) -> i32 ""llvm.intr.ushl.sat""(%arg2, %arg3) : (vector<8xi32>, vector<8xi32>) -> vector<8xi32> llvm.return } llvm.func @coro_id(%arg0: i32, %arg1: !llvm.ptr) { %null = llvm.mlir.null : !llvm.ptr llvm.intr.coro.id %arg0, %arg1, %arg1, %null : (i32, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> !llvm.token llvm.return } llvm.func @coro_begin(%arg0: i32, %arg1: !llvm.ptr) { %null = llvm.mlir.null : !llvm.ptr %token = llvm.intr.coro.id %arg0, %arg1, %arg1, %null : (i32, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> !llvm.token llvm.intr.coro.begin %token, %arg1 : (!llvm.token, !llvm.ptr) -> !llvm.ptr llvm.return } llvm.func @coro_size() { %0 = llvm.intr.coro.size : i64 %1 = llvm.intr.coro.size : i32 llvm.return } llvm.func @coro_align() { %0 = llvm.intr.coro.align : i64 %1 = llvm.intr.coro.align : i32 llvm.return } llvm.func @coro_save(%arg0: !llvm.ptr) { %0 = llvm.intr.coro.save %arg0 : (!llvm.ptr) -> !llvm.token llvm.return } llvm.func @coro_suspend(%arg0: i32, %arg1 : i1, %arg2 : !llvm.ptr) { %null = llvm.mlir.null : !llvm.ptr %token = llvm.intr.coro.id %arg0, %arg2, %arg2, %null : (i32, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> !llvm.token %0 = llvm.intr.coro.suspend %token, %arg1 : i8 llvm.return } llvm.func @coro_end(%arg0: !llvm.ptr, %arg1 : i1) { %0 = llvm.intr.coro.end %arg0, %arg1 : (!llvm.ptr, i1) -> i1 llvm.return } llvm.func @coro_free(%arg0: i32, %arg1 : !llvm.ptr) { %null = llvm.mlir.null : !llvm.ptr %token = llvm.intr.coro.id %arg0, %arg1, %arg1, %null : (i32, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> !llvm.token %0 = llvm.intr.coro.free %token, %arg1 : (!llvm.token, !llvm.ptr) -> !llvm.ptr llvm.return } llvm.func @coro_resume(%arg0: !llvm.ptr) { llvm.intr.coro.resume %arg0 : !llvm.ptr llvm.return } llvm.func @eh_typeid_for(%arg0 : !llvm.ptr) { %0 = llvm.intr.eh.typeid.for %arg0 : (!llvm.ptr) -> i32 llvm.return } llvm.func @stack_save() { %0 = llvm.intr.stacksave : !llvm.ptr llvm.return } llvm.func @stack_restore(%arg0: !llvm.ptr) { llvm.intr.stackrestore %arg0 : !llvm.ptr llvm.return } llvm.func @vector_predication_intrinsics(%A: vector<8xi32>, %B: vector<8xi32>, %C: vector<8xf32>, %D: vector<8xf32>, %E: vector<8xi64>, %F: vector<8xf64>, %G: !llvm.vec<8 x !llvm.ptr>, %i: i32, %f: f32, %iptr : !llvm.ptr, %fptr : !llvm.ptr, %mask: vector<8xi1>, %evl: i32) { ""llvm.intr.vp.add"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.sub"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.mul"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.sdiv"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.udiv"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.srem"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.urem"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.ashr"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.lshr"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.shl"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.or"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.and"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.xor"" (%A, %B, %mask, %evl) : (vector<8xi32>, vector<8xi32>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.fadd"" (%C, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fsub"" (%C, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fmul"" (%C, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fdiv"" (%C, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.frem"" (%C, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fneg"" (%C, %mask, %evl) : (vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fma"" (%C, %D, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fmuladd"" (%C, %D, %D, %mask, %evl) : (vector<8xf32>, vector<8xf32>, vector<8xf32>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.reduce.add"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.mul"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.and"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.or"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.xor"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.smax"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.smin"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.umax"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.umin"" (%i, %A, %mask, %evl) : (i32, vector<8xi32>, vector<8xi1>, i32) -> i32 ""llvm.intr.vp.reduce.fadd"" (%f, %C, %mask, %evl) : (f32, vector<8xf32>, vector<8xi1>, i32) -> f32 ""llvm.intr.vp.reduce.fmul"" (%f, %C, %mask, %evl) : (f32, vector<8xf32>, vector<8xi1>, i32) -> f32 ""llvm.intr.vp.reduce.fmax"" (%f, %C, %mask, %evl) : (f32, vector<8xf32>, vector<8xi1>, i32) -> f32 ""llvm.intr.vp.reduce.fmin"" (%f, %C, %mask, %evl) : (f32, vector<8xf32>, vector<8xi1>, i32) -> f32 ""llvm.intr.vp.select"" (%mask, %A, %B, %evl) : (vector<8xi1>, vector<8xi32>, vector<8xi32>, i32) -> vector<8xi32> ""llvm.intr.vp.merge"" (%mask, %A, %B, %evl) : (vector<8xi1>, vector<8xi32>, vector<8xi32>, i32) -> vector<8xi32> ""llvm.intr.vp.store"" (%A, %iptr, %mask, %evl) : (vector<8xi32>, !llvm.ptr, vector<8xi1>, i32) -> () ""llvm.intr.vp.load"" (%iptr, %mask, %evl) : (!llvm.ptr, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.experimental.vp.strided.store"" (%A, %iptr, %i, %mask, %evl) : (vector<8xi32>, !llvm.ptr, i32, vector<8xi1>, i32) -> () ""llvm.intr.experimental.vp.strided.load"" (%iptr, %i, %mask, %evl) : (!llvm.ptr, i32, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.trunc"" (%E, %mask, %evl) : (vector<8xi64>, vector<8xi1>, i32) -> vector<8xi32> ""llvm.intr.vp.zext"" (%A, %mask, %evl) : (vector<8xi32>, vector<8xi1>, i32) -> vector<8xi64> ""llvm.intr.vp.sext"" (%A, %mask, %evl) : (vector<8xi32>, vector<8xi1>, i32) -> vector<8xi64> ""llvm.intr.vp.fptrunc"" (%F, %mask, %evl) : (vector<8xf64>, vector<8xi1>, i32) -> vector<8xf32> ""llvm.intr.vp.fpext"" (%C, %mask, %evl) : (vector<8xf32>, vector<8xi1>, i32) -> vector<8xf64> ""llvm.intr.vp.fptoui"" (%F, %mask, %evl) : (vector<8xf64>, vector<8xi1>, i32) -> vector<8xi64> ""llvm.intr.vp.fptosi"" (%F, %mask, %evl) : (vector<8xf64>, vector<8xi1>, i32) -> vector<8xi64> ""llvm.intr.vp.ptrtoint"" (%G, %mask, %evl) : (!llvm.vec<8 x !llvm.ptr>, vector<8xi1>, i32) -> vector<8xi64> ""llvm.intr.vp.inttoptr"" (%E, %mask, %evl) : (vector<8xi64>, vector<8xi1>, i32) -> !llvm.vec<8 x !llvm.ptr> llvm.return } llvm.func @vector_insert_extract(%f256: vector<8xi32>, %f128: vector<4xi32>, %sv: vector<[4]xi32>) { %0 = llvm.intr.vector.insert %f256, %sv[0] : vector<8xi32> into vector<[4]xi32> %1 = llvm.intr.vector.insert %f128, %sv[0] : vector<4xi32> into vector<[4]xi32> %2 = llvm.intr.vector.insert %f128, %1[4] : vector<4xi32> into vector<[4]xi32> %3 = llvm.intr.vector.insert %f128, %f256[4] : vector<4xi32> into vector<8xi32> %4 = llvm.intr.vector.extract %2[0] : vector<8xi32> from vector<[4]xi32> %5 = llvm.intr.vector.extract %2[0] : vector<4xi32> from vector<[4]xi32> %6 = llvm.intr.vector.extract %f256[6] : vector<2xi32> from vector<8xi32> llvm.return } llvm.func @lifetime(%p: !llvm.ptr) { llvm.intr.lifetime.start 16, %p : !llvm.ptr llvm.intr.lifetime.end 16, %p : !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir ,1 "omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(0.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fadd %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } llvm.func @simple_reduction(%lb : i64, %ub : i64, %step : i64) { %c1 = llvm.mlir.constant(1 : i32) : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel { omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr) for (%iv) : i64 = (%lb) to (%ub) step (%step) { %1 = llvm.mlir.constant(2.0 : f32) : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 """llvm.mlir.global""() ({}) {sym_name = ""global_aligned32"", global_type = i64, value = 42 : i64, linkage = #llvm.linkage, alignment = 32} : () -> () llvm.mlir.global private @global_aligned64(42 : i64) {alignment = 64 : i64} : i64 llvm.mlir.global private @global_aligned64_native(42 : i64) { alignment = 64 } : i64 llvm.mlir.global internal @i32_global(42: i32) : i32 llvm.mlir.global internal constant @i32_const(52: i53) : i53 llvm.mlir.global internal @int_global_array(dense<62> : vector<3xi32>) : !llvm.array<3 x i32> llvm.mlir.global internal constant @int_global_array_zero_elements(dense<> : tensor<3x0x4xf32>) : !llvm.array<3 x array<0 x array<4 x f32>>> llvm.mlir.global internal constant @int_global_array_zero_elements_1d(dense<> : tensor<0xf32>) : !llvm.array<0 x f32> llvm.mlir.global internal @i32_global_addr_space(62: i32) {addr_space = 7 : i32} : i32 llvm.mlir.global internal @float_global(0.0: f32) : f32 llvm.mlir.global internal @float_global_array(dense<[-5.0]> : vector<1xf32>) : !llvm.array<1 x f32> llvm.mlir.global internal constant @string_const(""foobar"") : !llvm.array<6 x i8> llvm.mlir.global internal @int_global_undef() : i64 llvm.mlir.global external @explicit_undef() : i32 { %0 = llvm.mlir.undef : i32 llvm.return %0 : i32 } llvm.mlir.global internal constant @int_gep() : !llvm.ptr { %addr = llvm.mlir.addressof @i32_global : !llvm.ptr %_c0 = llvm.mlir.constant(2: i32) :i32 %gepinit = llvm.getelementptr %addr[%_c0] : (!llvm.ptr, i32) -> !llvm.ptr llvm.return %gepinit : !llvm.ptr } llvm.mlir.global internal @dense_float_vector(dense<[1.0, 2.0, 3.0]> : vector<3xf32>) : vector<3xf32> llvm.mlir.global internal @splat_float_vector(dense<42.0> : vector<3xf32>) : vector<3xf32> llvm.mlir.global internal @dense_double_vector(dense<[1.0, 2.0, 3.0]> : vector<3xf64>) : vector<3xf64> llvm.mlir.global internal @splat_double_vector(dense<42.0> : vector<3xf64>) : vector<3xf64> llvm.mlir.global internal @dense_i64_vector(dense<[1, 2, 3]> : vector<3xi64>) : vector<3xi64> llvm.mlir.global internal @splat_i64_vector(dense<42> : vector<3xi64>) : vector<3xi64> llvm.mlir.global internal @dense_float_vector_2d(dense<[[1.0, 2.0], [3.0, 4.0]]> : vector<2x2xf32>) : !llvm.array<2 x vector<2xf32>> llvm.mlir.global internal @splat_float_vector_2d(dense<42.0> : vector<2x2xf32>) : !llvm.array<2 x vector<2xf32>> llvm.mlir.global internal @dense_float_vector_3d(dense<[[[1.0, 2.0], [3.0, 4.0]], [[5.0, 6.0], [7.0, 8.0]]]> : vector<2x2x2xf32>) : !llvm.array<2 x !llvm.array<2 x vector<2xf32>>> llvm.mlir.global internal @splat_float_vector_3d(dense<42.0> : vector<2x2x2xf32>) : !llvm.array<2 x !llvm.array<2 x vector<2xf32>>> llvm.mlir.global private @private(42 : i32) : i32 llvm.mlir.global internal @internal(42 : i32) : i32 llvm.mlir.global available_externally @available_externally(42 : i32) : i32 llvm.mlir.global linkonce @linkonce(42 : i32) : i32 llvm.mlir.global weak @weak(42 : i32) : i32 llvm.mlir.global common @common(0 : i32) : i32 llvm.mlir.global appending @appending(dense<[1,2,3]> : tensor<3xi32>) : !llvm.array<3 x i32> llvm.mlir.global extern_weak @extern_weak() : i32 llvm.mlir.global linkonce_odr @linkonce_odr(42 : i32) : i32 llvm.mlir.global weak_odr @weak_odr(42 : i32) : i32 llvm.mlir.global external @external() : i32 llvm.mlir.global external hidden constant @hidden(""string"") llvm.mlir.global external protected constant @protected(42 : i64) : i64 llvm.mlir.global private constant @no_unnamed_addr(42 : i64) : i64 llvm.mlir.global private local_unnamed_addr constant @local_unnamed_addr(42 : i64) : i64 llvm.mlir.global private unnamed_addr constant @unnamed_addr(42 : i64) : i64 llvm.mlir.global @has_dso_local(42 : i64) {dso_local} : i64 llvm.mlir.global thread_local @has_thr_local(42 : i64) : i64 llvm.mlir.global internal constant @sectionvar(""teststring"") {section = "".mysection""}: !llvm.array<10 x i8> llvm.func @malloc(i64) -> !llvm.ptr llvm.func @empty() { llvm.return } llvm.func @global_refs() { %0 = llvm.mlir.addressof @i32_global : !llvm.ptr %1 = llvm.load %0 : !llvm.ptr %2 = llvm.mlir.addressof @string_const : !llvm.ptr> %c0 = llvm.mlir.constant(0 : index) : i64 %3 = llvm.getelementptr %2[%c0, %c0] : (!llvm.ptr>, i64, i64) -> !llvm.ptr %4 = llvm.load %3 : !llvm.ptr llvm.return } llvm.func @body(i64) llvm.func @simple_loop() { llvm.br ^bb1 ^bb1: %0 = llvm.mlir.constant(1 : index) : i64 %1 = llvm.mlir.constant(42 : index) : i64 llvm.br ^bb2(%0 : i64) ^bb2(%2: i64): %3 = llvm.icmp ""slt"" %2, %1 : i64 llvm.cond_br %3, ^bb3, ^bb4 ^bb3: llvm.call @body(%2) : (i64) -> () %4 = llvm.mlir.constant(1 : index) : i64 %5 = llvm.add %2, %4 : i64 llvm.br ^bb2(%5 : i64) ^bb4: llvm.return } llvm.func @simple_caller() { llvm.call @simple_loop() : () -> () llvm.return } llvm.func @ml_caller() { llvm.call @simple_loop() : () -> () llvm.call @more_imperfectly_nested_loops() : () -> () llvm.return } llvm.func @body_args(i64) -> i64 llvm.func @other(i64, i32) -> i32 llvm.func @func_args(%arg0: i32, %arg1: i32) -> i32 { %0 = llvm.mlir.constant(0 : i32) : i32 llvm.br ^bb1 ^bb1: %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(42 : index) : i64 llvm.br ^bb2(%1 : i64) ^bb2(%3: i64): %4 = llvm.icmp ""slt"" %3, %2 : i64 llvm.cond_br %4, ^bb3, ^bb4 ^bb3: %5 = llvm.call @body_args(%3) : (i64) -> i64 %6 = llvm.call @other(%5, %arg0) : (i64, i32) -> i32 %7 = llvm.call @other(%5, %6) : (i64, i32) -> i32 %8 = llvm.call @other(%5, %arg1) : (i64, i32) -> i32 %9 = llvm.mlir.constant(1 : index) : i64 %10 = llvm.add %3, %9 : i64 llvm.br ^bb2(%10 : i64) ^bb4: %11 = llvm.mlir.constant(0 : index) : i64 %12 = llvm.call @other(%11, %0) : (i64, i32) -> i32 llvm.return %12 : i32 } llvm.func @pre(i64) llvm.func @body2(i64, i64) llvm.func @post(i64) llvm.func @imperfectly_nested_loops() { llvm.br ^bb1 ^bb1: %0 = llvm.mlir.constant(0 : index) : i64 %1 = llvm.mlir.constant(42 : index) : i64 llvm.br ^bb2(%0 : i64) ^bb2(%2: i64): %3 = llvm.icmp ""slt"" %2, %1 : i64 llvm.cond_br %3, ^bb3, ^bb8 ^bb3: llvm.call @pre(%2) : (i64) -> () llvm.br ^bb4 ^bb4: %4 = llvm.mlir.constant(7 : index) : i64 %5 = llvm.mlir.constant(56 : index) : i64 llvm.br ^bb5(%4 : i64) ^bb5(%6: i64): %7 = llvm.icmp ""slt"" %6, %5 : i64 llvm.cond_br %7, ^bb6, ^bb7 ^bb6: llvm.call @body2(%2, %6) : (i64, i64) -> () %8 = llvm.mlir.constant(2 : index) : i64 %9 = llvm.add %6, %8 : i64 llvm.br ^bb5(%9 : i64) ^bb7: llvm.call @post(%2) : (i64) -> () %10 = llvm.mlir.constant(1 : index) : i64 %11 = llvm.add %2, %10 : i64 llvm.br ^bb2(%11 : i64) ^bb8: llvm.return } llvm.func @mid(i64) llvm.func @body3(i64, i64) llvm.func @more_imperfectly_nested_loops() { llvm.br ^bb1 ^bb1: %0 = llvm.mlir.constant(0 : index) : i64 %1 = llvm.mlir.constant(42 : index) : i64 llvm.br ^bb2(%0 : i64) ^bb2(%2: i64): %3 = llvm.icmp ""slt"" %2, %1 : i64 llvm.cond_br %3, ^bb3, ^bb12 ^bb3: llvm.call @pre(%2) : (i64) -> () llvm.br ^bb4 ^bb4: %4 = llvm.mlir.constant(7 : index) : i64 %5 = llvm.mlir.constant(56 : index) : i64 llvm.br ^bb5(%4 : i64) ^bb5(%6: i64): %7 = llvm.icmp ""slt"" %6, %5 : i64 llvm.cond_br %7, ^bb6, ^bb7 ^bb6: llvm.call @body2(%2, %6) : (i64, i64) -> () %8 = llvm.mlir.constant(2 : index) : i64 %9 = llvm.add %6, %8 : i64 llvm.br ^bb5(%9 : i64) ^bb7: llvm.call @mid(%2) : (i64) -> () llvm.br ^bb8 ^bb8: %10 = llvm.mlir.constant(18 : index) : i64 %11 = llvm.mlir.constant(37 : index) : i64 llvm.br ^bb9(%10 : i64) ^bb9(%12: i64): %13 = llvm.icmp ""slt"" %12, %11 : i64 llvm.cond_br %13, ^bb10, ^bb11 ^bb10: llvm.call @body3(%2, %12) : (i64, i64) -> () %14 = llvm.mlir.constant(3 : index) : i64 %15 = llvm.add %12, %14 : i64 llvm.br ^bb9(%15 : i64) ^bb11: llvm.call @post(%2) : (i64) -> () %16 = llvm.mlir.constant(1 : index) : i64 %17 = llvm.add %2, %16 : i64 llvm.br ^bb2(%17 : i64) ^bb12: llvm.return } llvm.func internal @func_internal() { llvm.return } llvm.func hidden @hidden_func() { llvm.return } llvm.func protected @protected_func() { llvm.return } llvm.func @dso_local_func() attributes {dso_local} { llvm.return } llvm.func @memref_alloc() { %0 = llvm.mlir.constant(10 : index) : i64 %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mul %0, %1 : i64 %3 = llvm.mlir.undef : !llvm.struct<(ptr)> %4 = llvm.mlir.constant(4 : index) : i64 %5 = llvm.mul %2, %4 : i64 %6 = llvm.call @malloc(%5) : (i64) -> !llvm.ptr %7 = llvm.bitcast %6 : !llvm.ptr to !llvm.ptr %8 = llvm.insertvalue %7, %3[0] : !llvm.struct<(ptr)> llvm.return } llvm.func @get_index() -> i64 llvm.func @store_load_static() { ^bb0: %0 = llvm.mlir.constant(10 : index) : i64 %1 = llvm.mlir.undef : !llvm.struct<(ptr)> %2 = llvm.mlir.constant(4 : index) : i64 %3 = llvm.mul %0, %2 : i64 %4 = llvm.call @malloc(%3) : (i64) -> !llvm.ptr %5 = llvm.bitcast %4 : !llvm.ptr to !llvm.ptr %6 = llvm.insertvalue %5, %1[0] : !llvm.struct<(ptr)> %7 = llvm.mlir.constant(1.000000e+00 : f32) : f32 llvm.br ^bb1 ^bb1: %8 = llvm.mlir.constant(0 : index) : i64 %9 = llvm.mlir.constant(10 : index) : i64 llvm.br ^bb2(%8 : i64) ^bb2(%10: i64): %11 = llvm.icmp ""slt"" %10, %9 : i64 llvm.cond_br %11, ^bb3, ^bb4 ^bb3: %12 = llvm.mlir.constant(10 : index) : i64 %13 = llvm.extractvalue %6[0] : !llvm.struct<(ptr)> %14 = llvm.getelementptr %13[%10] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %7, %14 : !llvm.ptr %15 = llvm.mlir.constant(1 : index) : i64 %16 = llvm.add %10, %15 : i64 llvm.br ^bb2(%16 : i64) ^bb4: llvm.br ^bb5 ^bb5: %17 = llvm.mlir.constant(0 : index) : i64 %18 = llvm.mlir.constant(10 : index) : i64 llvm.br ^bb6(%17 : i64) ^bb6(%19: i64): %20 = llvm.icmp ""slt"" %19, %18 : i64 llvm.cond_br %20, ^bb7, ^bb8 ^bb7: %21 = llvm.mlir.constant(10 : index) : i64 %22 = llvm.extractvalue %6[0] : !llvm.struct<(ptr)> %23 = llvm.getelementptr %22[%19] : (!llvm.ptr, i64) -> !llvm.ptr %24 = llvm.load %23 : !llvm.ptr %25 = llvm.mlir.constant(1 : index) : i64 %26 = llvm.add %19, %25 : i64 llvm.br ^bb6(%26 : i64) ^bb8: llvm.return } llvm.func @store_load_dynamic(%arg0: i64) { %0 = llvm.mlir.undef : !llvm.struct<(ptr, i64)> %1 = llvm.mlir.constant(4 : index) : i64 %2 = llvm.mul %arg0, %1 : i64 %3 = llvm.call @malloc(%2) : (i64) -> !llvm.ptr %4 = llvm.bitcast %3 : !llvm.ptr to !llvm.ptr %5 = llvm.insertvalue %4, %0[0] : !llvm.struct<(ptr, i64)> %6 = llvm.insertvalue %arg0, %5[1] : !llvm.struct<(ptr, i64)> %7 = llvm.mlir.constant(1.000000e+00 : f32) : f32 llvm.br ^bb1 ^bb1: %8 = llvm.mlir.constant(0 : index) : i64 llvm.br ^bb2(%8 : i64) ^bb2(%9: i64): %10 = llvm.icmp ""slt"" %9, %arg0 : i64 llvm.cond_br %10, ^bb3, ^bb4 ^bb3: %11 = llvm.extractvalue %6[1] : !llvm.struct<(ptr, i64)> %12 = llvm.extractvalue %6[0] : !llvm.struct<(ptr, i64)> %13 = llvm.getelementptr %12[%9] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %7, %13 : !llvm.ptr %14 = llvm.mlir.constant(1 : index) : i64 %15 = llvm.add %9, %14 : i64 llvm.br ^bb2(%15 : i64) ^bb4: llvm.br ^bb5 ^bb5: %16 = llvm.mlir.constant(0 : index) : i64 llvm.br ^bb6(%16 : i64) ^bb6(%17: i64): %18 = llvm.icmp ""slt"" %17, %arg0 : i64 llvm.cond_br %18, ^bb7, ^bb8 ^bb7: %19 = llvm.extractvalue %6[1] : !llvm.struct<(ptr, i64)> %20 = llvm.extractvalue %6[0] : !llvm.struct<(ptr, i64)> %21 = llvm.getelementptr %20[%17] : (!llvm.ptr, i64) -> !llvm.ptr %22 = llvm.load %21 : !llvm.ptr %23 = llvm.mlir.constant(1 : index) : i64 %24 = llvm.add %17, %23 : i64 llvm.br ^bb6(%24 : i64) ^bb8: llvm.return } llvm.func @store_load_mixed(%arg0: i64) { %0 = llvm.mlir.constant(10 : index) : i64 %1 = llvm.mlir.constant(2 : index) : i64 %2 = llvm.mlir.constant(4 : index) : i64 %3 = llvm.mul %1, %arg0 : i64 %4 = llvm.mul %3, %2 : i64 %5 = llvm.mul %4, %0 : i64 %6 = llvm.mlir.undef : !llvm.struct<(ptr, i64, i64)> %7 = llvm.mlir.constant(4 : index) : i64 %8 = llvm.mul %5, %7 : i64 %9 = llvm.call @malloc(%8) : (i64) -> !llvm.ptr %10 = llvm.bitcast %9 : !llvm.ptr to !llvm.ptr %11 = llvm.insertvalue %10, %6[0] : !llvm.struct<(ptr, i64, i64)> %12 = llvm.insertvalue %arg0, %11[1] : !llvm.struct<(ptr, i64, i64)> %13 = llvm.insertvalue %0, %12[2] : !llvm.struct<(ptr, i64, i64)> %14 = llvm.mlir.constant(1 : index) : i64 %15 = llvm.mlir.constant(2 : index) : i64 %16 = llvm.call @get_index() : () -> i64 %17 = llvm.call @get_index() : () -> i64 %18 = llvm.mlir.constant(4.200000e+01 : f32) : f32 %19 = llvm.mlir.constant(2 : index) : i64 %20 = llvm.extractvalue %13[1] : !llvm.struct<(ptr, i64, i64)> %21 = llvm.mlir.constant(4 : index) : i64 %22 = llvm.extractvalue %13[2] : !llvm.struct<(ptr, i64, i64)> %23 = llvm.mul %14, %20 : i64 %24 = llvm.add %23, %15 : i64 %25 = llvm.mul %24, %21 : i64 %26 = llvm.add %25, %16 : i64 %27 = llvm.mul %26, %22 : i64 %28 = llvm.add %27, %17 : i64 %29 = llvm.extractvalue %13[0] : !llvm.struct<(ptr, i64, i64)> %30 = llvm.getelementptr %29[%28] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %18, %30 : !llvm.ptr %31 = llvm.mlir.constant(2 : index) : i64 %32 = llvm.extractvalue %13[1] : !llvm.struct<(ptr, i64, i64)> %33 = llvm.mlir.constant(4 : index) : i64 %34 = llvm.extractvalue %13[2] : !llvm.struct<(ptr, i64, i64)> %35 = llvm.mul %17, %32 : i64 %36 = llvm.add %35, %16 : i64 %37 = llvm.mul %36, %33 : i64 %38 = llvm.add %37, %15 : i64 %39 = llvm.mul %38, %34 : i64 %40 = llvm.add %39, %14 : i64 %41 = llvm.extractvalue %13[0] : !llvm.struct<(ptr, i64, i64)> %42 = llvm.getelementptr %41[%40] : (!llvm.ptr, i64) -> !llvm.ptr %43 = llvm.load %42 : !llvm.ptr llvm.return } llvm.func @memref_args_rets(%arg0: !llvm.struct<(ptr)>, %arg1: !llvm.struct<(ptr, i64)>, %arg2: !llvm.struct<(ptr, i64)>) -> !llvm.struct<(ptr, i64)> { %0 = llvm.mlir.constant(7 : index) : i64 %1 = llvm.call @get_index() : () -> i64 %2 = llvm.mlir.constant(4.200000e+01 : f32) : f32 %3 = llvm.mlir.constant(10 : index) : i64 %4 = llvm.extractvalue %arg0[0] : !llvm.struct<(ptr)> %5 = llvm.getelementptr %4[%0] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %5 : !llvm.ptr %6 = llvm.extractvalue %arg1[1] : !llvm.struct<(ptr, i64)> %7 = llvm.extractvalue %arg1[0] : !llvm.struct<(ptr, i64)> %8 = llvm.getelementptr %7[%0] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %8 : !llvm.ptr %9 = llvm.mlir.constant(10 : index) : i64 %10 = llvm.extractvalue %arg2[1] : !llvm.struct<(ptr, i64)> %11 = llvm.mul %0, %10 : i64 %12 = llvm.add %11, %1 : i64 %13 = llvm.extractvalue %arg2[0] : !llvm.struct<(ptr, i64)> %14 = llvm.getelementptr %13[%12] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %14 : !llvm.ptr %15 = llvm.mlir.constant(10 : index) : i64 %16 = llvm.mul %15, %1 : i64 %17 = llvm.mlir.undef : !llvm.struct<(ptr, i64)> %18 = llvm.mlir.constant(4 : index) : i64 %19 = llvm.mul %16, %18 : i64 %20 = llvm.call @malloc(%19) : (i64) -> !llvm.ptr %21 = llvm.bitcast %20 : !llvm.ptr to !llvm.ptr %22 = llvm.insertvalue %21, %17[0] : !llvm.struct<(ptr, i64)> %23 = llvm.insertvalue %1, %22[1] : !llvm.struct<(ptr, i64)> llvm.return %23 : !llvm.struct<(ptr, i64)> } llvm.func @memref_dim(%arg0: !llvm.struct<(ptr, i64, i64)>) -> i64 { %0 = llvm.mlir.constant(42 : index) : i64 %1 = llvm.extractvalue %arg0[1] : !llvm.struct<(ptr, i64, i64)> %2 = llvm.mlir.constant(10 : index) : i64 %3 = llvm.extractvalue %arg0[2] : !llvm.struct<(ptr, i64, i64)> %4 = llvm.add %0, %1 : i64 %5 = llvm.add %2, %3 : i64 %6 = llvm.add %4, %5 : i64 llvm.return %6 : i64 } llvm.func @get_i64() -> i64 llvm.func @get_f32() -> f32 llvm.func @get_memref() -> !llvm.struct<(ptr, i64, i64)> llvm.func @multireturn() -> !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> { %0 = llvm.call @get_i64() : () -> i64 %1 = llvm.call @get_f32() : () -> f32 %2 = llvm.call @get_memref() : () -> !llvm.struct<(ptr, i64, i64)> %3 = llvm.mlir.undef : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %4 = llvm.insertvalue %0, %3[0] : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %5 = llvm.insertvalue %1, %4[1] : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %6 = llvm.insertvalue %2, %5[2] : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> llvm.return %6 : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> } llvm.func @multireturn_caller() { %0 = llvm.call @multireturn() : () -> !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %1 = llvm.extractvalue %0[0] : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %2 = llvm.extractvalue %0[1] : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %3 = llvm.extractvalue %0[2] : !llvm.struct<(i64, f32, struct<(ptr, i64, i64)>)> %4 = llvm.mlir.constant(42) : i64 %5 = llvm.add %1, %4 : i64 %6 = llvm.mlir.constant(4.200000e+01 : f32) : f32 %7 = llvm.fadd %2, %6 : f32 %8 = llvm.mlir.constant(0 : index) : i64 %9 = llvm.mlir.constant(42 : index) : i64 %10 = llvm.extractvalue %3[1] : !llvm.struct<(ptr, i64, i64)> %11 = llvm.mlir.constant(10 : index) : i64 %12 = llvm.extractvalue %3[2] : !llvm.struct<(ptr, i64, i64)> %13 = llvm.mul %8, %10 : i64 %14 = llvm.add %13, %8 : i64 %15 = llvm.mul %14, %11 : i64 %16 = llvm.add %15, %8 : i64 %17 = llvm.mul %16, %12 : i64 %18 = llvm.add %17, %8 : i64 %19 = llvm.extractvalue %3[0] : !llvm.struct<(ptr, i64, i64)> %20 = llvm.getelementptr %19[%18] : (!llvm.ptr, i64) -> !llvm.ptr %21 = llvm.load %20 : !llvm.ptr llvm.return } llvm.func @vector_ops(%arg0: vector<4xf32>, %arg1: vector<4xi1>, %arg2: vector<4xi64>) -> vector<4xf32> { %0 = llvm.mlir.constant(dense<4.200000e+01> : vector<4xf32>) : vector<4xf32> %1 = llvm.fadd %arg0, %0 : vector<4xf32> %2 = llvm.select %arg1, %1, %arg0 : vector<4xi1>, vector<4xf32> %3 = llvm.sdiv %arg2, %arg2 : vector<4xi64> %4 = llvm.udiv %arg2, %arg2 : vector<4xi64> %5 = llvm.srem %arg2, %arg2 : vector<4xi64> %6 = llvm.urem %arg2, %arg2 : vector<4xi64> %7 = llvm.fdiv %arg0, %0 : vector<4xf32> %8 = llvm.frem %arg0, %0 : vector<4xf32> %9 = llvm.and %arg2, %arg2 : vector<4xi64> %10 = llvm.or %arg2, %arg2 : vector<4xi64> %11 = llvm.xor %arg2, %arg2 : vector<4xi64> %12 = llvm.shl %arg2, %arg2 : vector<4xi64> %13 = llvm.lshr %arg2, %arg2 : vector<4xi64> %14 = llvm.ashr %arg2, %arg2 : vector<4xi64> llvm.return %1 : vector<4xf32> } llvm.func @vector_splat_1d() -> vector<4xf32> { %0 = llvm.mlir.constant(dense<0.000000e+00> : vector<4xf32>) : vector<4xf32> llvm.return %0 : vector<4xf32> } llvm.func @vector_splat_1d_scalable() -> vector<[4]xf32> { %0 = llvm.mlir.constant(dense<0.000000e+00> : vector<[4]xf32>) : vector<[4]xf32> llvm.return %0 : vector<[4]xf32> } llvm.func @vector_splat_2d() -> !llvm.array<4 x vector<16 x f32>> { %0 = llvm.mlir.constant(dense<0.000000e+00> : vector<4x16xf32>) : !llvm.array<4 x vector<16 x f32>> llvm.return %0 : !llvm.array<4 x vector<16 x f32>> } llvm.func @vector_splat_3d() -> !llvm.array<4 x array<16 x vector<4 x f32>>> { %0 = llvm.mlir.constant(dense<0.000000e+00> : vector<4x16x4xf32>) : !llvm.array<4 x array<16 x vector<4 x f32>>> llvm.return %0 : !llvm.array<4 x array<16 x vector<4 x f32>>> } llvm.func @vector_splat_nonzero() -> vector<4xf32> { %0 = llvm.mlir.constant(dense<1.000000e+00> : vector<4xf32>) : vector<4xf32> llvm.return %0 : vector<4xf32> } llvm.func @vector_splat_nonzero_scalable() -> vector<[4]xf32> { %0 = llvm.mlir.constant(dense<1.000000e+00> : vector<[4]xf32>) : vector<[4]xf32> llvm.return %0 : vector<[4]xf32> } llvm.func @f8_ptrs(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { llvm.return } llvm.func @ops(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32) -> !llvm.struct<(f32, i32)> { %0 = llvm.fsub %arg0, %arg1 : f32 %1 = llvm.sub %arg2, %arg3 : i32 %2 = llvm.icmp ""slt"" %arg2, %1 : i32 %3 = llvm.select %2, %arg2, %1 : i1, i32 %4 = llvm.sdiv %arg2, %arg3 : i32 %5 = llvm.udiv %arg2, %arg3 : i32 %6 = llvm.srem %arg2, %arg3 : i32 %7 = llvm.urem %arg2, %arg3 : i32 %8 = llvm.mlir.undef : !llvm.struct<(f32, i32)> %9 = llvm.insertvalue %0, %8[0] : !llvm.struct<(f32, i32)> %10 = llvm.insertvalue %3, %9[1] : !llvm.struct<(f32, i32)> %11 = llvm.fdiv %arg0, %arg1 : f32 %12 = llvm.frem %arg0, %arg1 : f32 %13 = llvm.and %arg2, %arg3 : i32 %14 = llvm.or %arg2, %arg3 : i32 %15 = llvm.xor %arg2, %arg3 : i32 %16 = llvm.shl %arg2, %arg3 : i32 %17 = llvm.lshr %arg2, %arg3 : i32 %18 = llvm.ashr %arg2, %arg3 : i32 %19 = llvm.fneg %arg0 : f32 llvm.return %10 : !llvm.struct<(f32, i32)> } llvm.func @gep(%ptr: !llvm.ptr)>>, %idx: i64, %ptr2: !llvm.ptr)>>) { llvm.getelementptr %ptr[%idx, 1, 0] : (!llvm.ptr)>>, i64) -> !llvm.ptr llvm.getelementptr inbounds %ptr2[%idx, 0, %idx] : (!llvm.ptr)>>, i64, i64) -> !llvm.ptr llvm.return } llvm.func @indirect_const_call(%arg0: i64) { %0 = llvm.mlir.addressof @body : !llvm.ptr llvm.call %0(%arg0) : !llvm.ptr, (i64) -> () llvm.return } llvm.func @indirect_call(%arg0: !llvm.ptr<42>, %arg1: f32) -> i32 { %0 = llvm.call %arg0(%arg1) : !llvm.ptr<42>, (f32) -> i32 llvm.return %0 : i32 } llvm.func @cond_br_arguments(%arg0: i1, %arg1: i1) { llvm.cond_br %arg0, ^bb1(%arg0 : i1), ^bb2 ^bb1(%0 : i1): llvm.return ^bb2: llvm.br ^bb1(%arg1 : i1) } llvm.func @llvm_noalias(%arg0: !llvm.ptr {llvm.noalias}) { llvm.return } llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias}) llvm.func @byrefattr(%arg0: !llvm.ptr {llvm.byref = i32}) { llvm.return } llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32}) llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval = i32}) { llvm.return } llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32}) llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret = i32}) { llvm.return } llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32}) llvm.func @nestattr(%arg0: !llvm.ptr {llvm.nest}) { llvm.return } llvm.func @nestattr_decl(!llvm.ptr {llvm.nest}) llvm.func @noundefattr(%arg0: i32 {llvm.noundef}) { llvm.return } llvm.func @noundefattr_decl(i32 {llvm.noundef}) llvm.func @llvm_align(%arg0: !llvm.ptr {llvm.align = 4}) { llvm.return } llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4}) llvm.func @inallocaattr(%arg0: !llvm.ptr {llvm.inalloca = i32}) { llvm.return } llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32}) llvm.func @signextattr(%arg0: i1 {llvm.signext}) { llvm.return } llvm.func @signextattr_decl(i1 {llvm.signext}) llvm.func @zeroextattr(%arg0: i1 {llvm.zeroext}) { llvm.return } llvm.func @zeroextattr_decl(i1 {llvm.zeroext}) llvm.func @alignattr_decl(!llvm.ptr {llvm.align = 64 : i64}) llvm.func @dereferenceableattr_decl(!llvm.ptr {llvm.dereferenceable = 32 : i64}) llvm.func @dereferenceableornullattr_decl(!llvm.ptr {llvm.dereferenceable_or_null = 32 : i64}) llvm.func @inregattr_decl(!llvm.ptr {llvm.inreg}) llvm.func @nocaptureattr_decl(!llvm.ptr {llvm.nocapture}) llvm.func @nofreeattr_decl(!llvm.ptr {llvm.nofree}) llvm.func @nonnullattr_decl(!llvm.ptr {llvm.nonnull}) llvm.func @preallocatedattr_decl(!llvm.ptr {llvm.preallocated = f32}) llvm.func @returnedattr_decl(!llvm.ptr {llvm.returned}) -> !llvm.ptr llvm.func @alignstackattr_decl(!llvm.ptr {llvm.alignstack = 32 : i64}) llvm.func @writeonlyattr_decl(!llvm.ptr {llvm.writeonly}) llvm.func @alignattr_ret_decl() -> (!llvm.ptr {llvm.align = 4}) llvm.func @noaliasattr_ret_decl() -> (!llvm.ptr {llvm.noalias}) llvm.func @noundefattr_ret_decl() -> (!llvm.ptr {llvm.noundef}) llvm.func @signextattr_ret_decl() -> (i1 {llvm.signext}) llvm.func @zeroextattr_ret_decl() -> (i1 {llvm.zeroext}) llvm.func @nonnullattr_ret_decl() -> (!llvm.ptr {llvm.nonnull}) llvm.func @dereferenceableattr_ret_decl() -> (!llvm.ptr {llvm.dereferenceable = 32 : i64}) llvm.func @dereferenceableornullattr_ret_decl() -> (!llvm.ptr {llvm.dereferenceable_or_null = 16 : i64}) llvm.func @inregattr_ret_decl() -> (!llvm.ptr {llvm.inreg}) llvm.func @varargs(...) llvm.func @varargs_call(%arg0 : i32) { llvm.call @varargs(%arg0) : (i32) -> () llvm.return } llvm.func @intpointerconversion(%arg0 : i32) -> i32 { %1 = llvm.inttoptr %arg0 : i32 to !llvm.ptr %2 = llvm.ptrtoint %1 : !llvm.ptr to i32 llvm.return %2 : i32 } llvm.func @fpconversion(%arg0 : i32) -> i32 { %1 = llvm.sitofp %arg0 : i32 to f32 %2 = llvm.fptosi %1 : f32 to i32 %3 = llvm.uitofp %2 : i32 to f32 %4 = llvm.fptoui %3 : f32 to i32 llvm.return %4 : i32 } llvm.func @addrspace(%arg0 : !llvm.ptr) -> !llvm.ptr { %1 = llvm.addrspacecast %arg0 : !llvm.ptr to !llvm.ptr llvm.return %1 : !llvm.ptr } llvm.func @stringconstant() -> !llvm.array<12 x i8> { %1 = llvm.mlir.constant(""Hello world!"") : !llvm.array<12 x i8> llvm.return %1 : !llvm.array<12 x i8> } llvm.func @complexfpconstant() -> !llvm.struct<(f32, f32)> { %1 = llvm.mlir.constant([-1.000000e+00 : f32, 0.000000e+00 : f32]) : !llvm.struct<(f32, f32)> llvm.return %1 : !llvm.struct<(f32, f32)> } llvm.func @complexintconstant() -> !llvm.struct<(i32, i32)> { %1 = llvm.mlir.constant([-1 : i32, 0 : i32]) : !llvm.struct<(i32, i32)> llvm.return %1 : !llvm.struct<(i32, i32)> } llvm.func @complexintconstantsplat() -> !llvm.array<2 x !llvm.struct<(i32, i32)>> { %1 = llvm.mlir.constant(dense<(0, 1)> : tensor>) : !llvm.array<2 x !llvm.struct<(i32, i32)>> llvm.return %1 : !llvm.array<2 x !llvm.struct<(i32, i32)>> } llvm.func @complexintconstantarray() -> !llvm.array<2 x !llvm.array<2 x !llvm.struct<(i32, i32)>>> { %1 = llvm.mlir.constant(dense<[[(0, 1), (2, 3)], [(4, 5), (6, 7)]]> : tensor<2x2xcomplex>) : !llvm.array<2 x!llvm.array<2 x !llvm.struct<(i32, i32)>>> llvm.return %1 : !llvm.array<2 x !llvm.array<2 x !llvm.struct<(i32, i32)>>> } llvm.func @indexconstantsplat() -> vector<3xi32> { %1 = llvm.mlir.constant(dense<42> : vector<3xindex>) : vector<3xi32> llvm.return %1 : vector<3xi32> } llvm.func @indexconstantarray() -> vector<3xi32> { %1 = llvm.mlir.constant(dense<[0, 1, 2]> : vector<3xindex>) : vector<3xi32> llvm.return %1 : vector<3xi32> } llvm.func @noreach() { llvm.unreachable } llvm.func @fcmp(%arg0: f32, %arg1: f32) { %0 = llvm.fcmp ""oeq"" %arg0, %arg1 : f32 %1 = llvm.fcmp ""ogt"" %arg0, %arg1 : f32 %2 = llvm.fcmp ""oge"" %arg0, %arg1 : f32 %3 = llvm.fcmp ""olt"" %arg0, %arg1 : f32 %4 = llvm.fcmp ""ole"" %arg0, %arg1 : f32 %5 = llvm.fcmp ""one"" %arg0, %arg1 : f32 %6 = llvm.fcmp ""ord"" %arg0, %arg1 : f32 %7 = llvm.fcmp ""ueq"" %arg0, %arg1 : f32 %8 = llvm.fcmp ""ugt"" %arg0, %arg1 : f32 %9 = llvm.fcmp ""uge"" %arg0, %arg1 : f32 %10 = llvm.fcmp ""ult"" %arg0, %arg1 : f32 %11 = llvm.fcmp ""ule"" %arg0, %arg1 : f32 %12 = llvm.fcmp ""une"" %arg0, %arg1 : f32 %13 = llvm.fcmp ""uno"" %arg0, %arg1 : f32 llvm.return } llvm.func @vect(%arg0: vector<4xf32>, %arg1: i32, %arg2: f32) { %0 = llvm.extractelement %arg0[%arg1 : i32] : vector<4xf32> %1 = llvm.insertelement %arg2, %arg0[%arg1 : i32] : vector<4xf32> %2 = llvm.shufflevector %arg0, %arg0 [0, 0, 0, 0, 7] : vector<4xf32> llvm.return } llvm.func @vect_i64idx(%arg0: vector<4xf32>, %arg1: i64, %arg2: f32) { %0 = llvm.extractelement %arg0[%arg1 : i64] : vector<4xf32> %1 = llvm.insertelement %arg2, %arg0[%arg1 : i64] : vector<4xf32> llvm.return } llvm.func @scalable_vect(%arg0: vector<[4]xf32>, %arg1: i32, %arg2: f32) { %0 = llvm.extractelement %arg0[%arg1 : i32] : vector<[4]xf32> %1 = llvm.insertelement %arg2, %arg0[%arg1 : i32] : vector<[4]xf32> %2 = llvm.shufflevector %arg0, %arg0 [0, 0, 0, 0] : vector<[4]xf32> llvm.return } llvm.func @scalable_vect_i64idx(%arg0: vector<[4]xf32>, %arg1: i64, %arg2: f32) { %0 = llvm.extractelement %arg0[%arg1 : i64] : vector<[4]xf32> %1 = llvm.insertelement %arg2, %arg0[%arg1 : i64] : vector<[4]xf32> llvm.return } llvm.func @alloca(%size : i64) { llvm.alloca %size x i32 {alignment = 0} : (i64) -> (!llvm.ptr) llvm.alloca %size x i32 {alignment = 8} : (i64) -> (!llvm.ptr) llvm.alloca %size x i32 {alignment = 0} : (i64) -> (!llvm.ptr) llvm.alloca inalloca %size x i32 : (i64) -> !llvm.ptr llvm.return } llvm.func @constants() -> vector<4xf32> { %0 = llvm.mlir.constant(sparse<[0], [4.2e+01]> : vector<4xf32>) : vector<4xf32> llvm.return %0 : vector<4xf32> } llvm.func @fp_casts(%fp1 : f32, %fp2 : f64) -> i16 { %a = llvm.fptrunc %fp2 : f64 to f32 %b = llvm.fpext %fp1 : f32 to f64 %c = llvm.fptosi %b : f64 to i16 llvm.return %c : i16 } llvm.func @integer_extension_and_truncation(%a : i32) { %0 = llvm.sext %a : i32 to i64 %1 = llvm.zext %a : i32 to i64 %2 = llvm.trunc %a : i32 to i16 llvm.return } llvm.func @null() -> !llvm.ptr { %0 = llvm.mlir.null : !llvm.ptr llvm.return %0 : !llvm.ptr } llvm.func @elements_constant_3d_vector() -> !llvm.array<2 x array<2 x vector<2 x i32>>> { %0 = llvm.mlir.constant(dense<[[[1, 2], [3, 4]], [[42, 43], [44, 45]]]> : vector<2x2x2xi32>) : !llvm.array<2 x array<2 x vector<2 x i32>>> llvm.return %0 : !llvm.array<2 x array<2 x vector<2 x i32>>> } llvm.func @elements_constant_3d_array() -> !llvm.array<2 x array<2 x array<2 x i32>>> { %0 = llvm.mlir.constant(dense<[[[1, 2], [3, 4]], [[42, 43], [44, 45]]]> : tensor<2x2x2xi32>) : !llvm.array<2 x array<2 x array<2 x i32>>> llvm.return %0 : !llvm.array<2 x array<2 x array<2 x i32>>> } llvm.func @atomicrmw( %f32_ptr : !llvm.ptr, %f32 : f32, %i32_ptr : !llvm.ptr, %i32 : i32) { %0 = llvm.atomicrmw fadd %f32_ptr, %f32 monotonic : !llvm.ptr, f32 %1 = llvm.atomicrmw fsub %f32_ptr, %f32 monotonic : !llvm.ptr, f32 %2 = llvm.atomicrmw fmax %f32_ptr, %f32 monotonic : !llvm.ptr, f32 %3 = llvm.atomicrmw fmin %f32_ptr, %f32 monotonic : !llvm.ptr, f32 %4 = llvm.atomicrmw xchg %f32_ptr, %f32 monotonic : !llvm.ptr, f32 %5 = llvm.atomicrmw add %i32_ptr, %i32 acquire : !llvm.ptr, i32 %6 = llvm.atomicrmw sub %i32_ptr, %i32 release : !llvm.ptr, i32 %7 = llvm.atomicrmw _and %i32_ptr, %i32 acq_rel : !llvm.ptr, i32 %8 = llvm.atomicrmw nand %i32_ptr, %i32 seq_cst : !llvm.ptr, i32 %9 = llvm.atomicrmw _or %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %10 = llvm.atomicrmw _xor %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %11 = llvm.atomicrmw max %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %12 = llvm.atomicrmw min %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %13 = llvm.atomicrmw umax %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %14 = llvm.atomicrmw umin %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %15 = llvm.atomicrmw uinc_wrap %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %16 = llvm.atomicrmw udec_wrap %i32_ptr, %i32 monotonic : !llvm.ptr, i32 %17 = llvm.atomicrmw volatile udec_wrap %i32_ptr, %i32 syncscope(""singlethread"") monotonic {alignment = 8 : i64} : !llvm.ptr, i32 llvm.return } llvm.func @cmpxchg(%ptr : !llvm.ptr, %cmp : i32, %val: i32) { %0 = llvm.cmpxchg %ptr, %cmp, %val acq_rel monotonic : !llvm.ptr, i32 %1 = llvm.extractvalue %0[0] : !llvm.struct<(i32, i1)> %2 = llvm.extractvalue %0[1] : !llvm.struct<(i32, i1)> %3 = llvm.cmpxchg weak volatile %ptr, %cmp, %val syncscope(""singlethread"") acq_rel monotonic {alignment = 8 : i64} : !llvm.ptr, i32 llvm.return } llvm.mlir.global external constant @_ZTIi() : !llvm.ptr llvm.func @foo(!llvm.ptr) llvm.func @bar(!llvm.ptr) -> !llvm.ptr llvm.func @__gxx_personality_v0(...) -> i32 llvm.func @invokeLandingpad() -> i32 attributes { personality = @__gxx_personality_v0 } { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = llvm.mlir.constant(dense<0> : vector<1xi8>) : !llvm.array<1 x i8> %2 = llvm.mlir.addressof @_ZTIi : !llvm.ptr> %3 = llvm.bitcast %2 : !llvm.ptr> to !llvm.ptr %4 = llvm.mlir.null : !llvm.ptr> %5 = llvm.mlir.constant(1 : i32) : i32 %6 = llvm.alloca %5 x i8 : (i32) -> !llvm.ptr llvm.invoke @foo(%6) to ^bb2 unwind ^bb1 : (!llvm.ptr) -> () ^bb1: %7 = llvm.landingpad (catch %4 : !llvm.ptr>) (catch %3 : !llvm.ptr) (filter %1 : !llvm.array<1 x i8>) : !llvm.struct<(ptr, i32)> llvm.br ^bb3 ^bb2: llvm.return %5 : i32 ^bb3: %8 = llvm.invoke @bar(%6) to ^bb2 unwind ^bb1 : (!llvm.ptr) -> !llvm.ptr }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() -> i8 llvm.func @__gxx_personality_v0(...) -> i32 llvm.func @invoke_result(%arg0 : !llvm.ptr) attributes { personality = @__gxx_personality_v0 } { %0 = llvm.invoke @foo() to ^bb1 unwind ^bb2 : () -> i8 ^bb1: llvm.store %0, %arg0 : !llvm.ptr llvm.return ^bb2: %7 = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() llvm.func @__gxx_personality_v0(...) -> i32 llvm.func @invoke_phis() -> i32 attributes { personality = @__gxx_personality_v0 } { %0 = llvm.mlir.constant(0 : i32) : i32 llvm.invoke @foo() to ^bb1(%0 : i32) unwind ^bb2 : () -> () ^bb1(%1 : i32): llvm.return %1 : i32 ^bb2: %2 = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> %3 = llvm.mlir.constant(1 : i32) : i32 llvm.br ^bb1(%3 : i32) }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @hasGCFunction() attributes { garbageCollector = ""statepoint-example"" } { llvm.return } llvm.func @callFreezeOp(%x : i32) { %0 = llvm.freeze %x : i32 %1 = llvm.mlir.undef : i32 %2 = llvm.freeze %1 : i32 %3 = llvm.mlir.poison : i32 %4 = llvm.freeze %3 : i32 llvm.return } llvm.func @freezeUsed(%x : i32) -> i64 { %frozen = llvm.freeze %x : i32 %ext = llvm.sext %frozen : i32 to i64 llvm.return %ext : i64 } llvm.func @boolConstArg() -> i1 { %0 = llvm.mlir.constant(true) : i1 %1 = llvm.mlir.constant(false) : i1 %2 = llvm.and %0, %1 : i1 llvm.return %2 : i1 } llvm.func @callFenceInst() { llvm.fence syncscope(""agent"") release llvm.fence release llvm.fence syncscope("""") release llvm.return } llvm.func @passthrough() attributes {passthrough = [""noinline"", [""alignstack"", ""4""], ""null_pointer_is_valid"", [""foo"", ""bar""]]} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @functionEntryCount() attributes {function_entry_count = 4242 : i64} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @constant_bf16() -> bf16 { %0 = llvm.mlir.constant(1.000000e+01 : bf16) : bf16 llvm.return %0 : bf16 }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @address_taken() { llvm.return } llvm.mlir.global internal constant @taker_of_address() : !llvm.ptr> { %0 = llvm.mlir.addressof @address_taken : !llvm.ptr> llvm.return %0 : !llvm.ptr> }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.mlir.global linkonce @forward_use_of_address() : !llvm.ptr { %0 = llvm.mlir.addressof @address_declared_after_use : !llvm.ptr llvm.return %0 : !llvm.ptr } llvm.mlir.global linkonce @address_declared_after_use() : f32", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.mlir.global linkonce @take_self_address() : !llvm.struct<(i32, !llvm.ptr)> { %z32 = llvm.mlir.constant(0 : i32) : i32 %0 = llvm.mlir.undef : !llvm.struct<(i32, !llvm.ptr)> %1 = llvm.mlir.addressof @take_self_address : !llvm.ptr)>> %2 = llvm.getelementptr %1[%z32, 0] : (!llvm.ptr)>>, i32) -> !llvm.ptr %3 = llvm.insertvalue %z32, %0[0] : !llvm.struct<(i32, !llvm.ptr)> %4 = llvm.insertvalue %2, %3[1] : !llvm.struct<(i32, !llvm.ptr)> llvm.return %4 : !llvm.struct<(i32, !llvm.ptr)> }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.mlir.global_ctors { ctors = [@foo], priorities = [0 : i32]} llvm.func @foo() { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.mlir.global_dtors { dtors = [@foo], priorities = [0 : i32]} llvm.func @foo() { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @cond_br_weights(%cond : i1, %arg0 : i32, %arg1 : i32) -> i32 { llvm.cond_br %cond weights(dense<[5, 10]> : vector<2xi32>), ^bb1, ^bb2 ^bb1: llvm.return %arg0 : i32 ^bb2: llvm.return %arg1 : i32 }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @fn() llvm.func @call_branch_weights() { llvm.call @fn() {branch_weights = dense<42> : vector<1xi32>} : () -> () llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() llvm.func @__gxx_personality_v0(...) -> i32 llvm.func @invoke_branch_weights() -> i32 attributes {personality = @__gxx_personality_v0} { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.invoke @foo() to ^bb2 unwind ^bb1 {branch_weights = dense<[42, 99]> : vector<2xi32>} : () -> () ^bb1: %1 = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> llvm.br ^bb2 ^bb2: llvm.return %0 : i32 }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @volatile_store_and_load() { %val = llvm.mlir.constant(5 : i32) : i32 %size = llvm.mlir.constant(1 : i64) : i64 %0 = llvm.alloca %size x i32 : (i64) -> (!llvm.ptr) llvm.store volatile %val, %0 : !llvm.ptr %1 = llvm.load volatile %0: !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @nontemporal_store_and_load() { %val = llvm.mlir.constant(5 : i32) : i32 %size = llvm.mlir.constant(1 : i64) : i64 %0 = llvm.alloca %size x i32 : (i64) -> (!llvm.ptr) llvm.store %val, %0 {nontemporal} : !llvm.ptr %1 = llvm.load %0 {nontemporal} : !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @atomic_store_and_load(%ptr : !llvm.ptr) { %1 = llvm.load %ptr atomic acquire {alignment = 4 : i64} : !llvm.ptr -> f32 %2 = llvm.load %ptr atomic syncscope(""singlethread"") acquire {alignment = 4 : i64} : !llvm.ptr -> f32 llvm.store %1, %ptr atomic release {alignment = 4 : i64} : f32, !llvm.ptr llvm.store %2, %ptr atomic syncscope(""singlethread"") release {alignment = 4 : i64} : f32, !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module { llvm.func @module_default_layout() }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {llvm.data_layout = ""E""} { llvm.func @module_big_endian() }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {llvm.target_triple = ""x86_64-pc-windows-msvc""} {}", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {llvm.target_triple = ""aarch64-linux-android""} {}", mlir-translate -mlir-to-llvmir -split-input-file ,1 module attributes {} {}, mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @useInlineAsm(%arg0: i32) { llvm.inline_asm ""foo"", ""r"" %arg0 : (i32) -> () %0 = llvm.inline_asm ""foo"", ""=r,r"" %arg0 : (i32) -> i8 %1 = llvm.inline_asm ""foo"", ""=r,r,r"" %arg0, %arg0 : (i32, i32) -> i8 %2 = llvm.inline_asm has_side_effects ""foo"", ""=r,r,r"" %arg0, %arg0 : (i32, i32) -> i8 %3 = llvm.inline_asm is_align_stack ""foo"", ""=r,r,r"" %arg0, %arg0 : (i32, i32) -> i8 %4 = llvm.inline_asm asm_dialect = ""intel"" ""foo"", ""=r,r,r"" %arg0, %arg0 : (i32, i32) -> i8 %5 = llvm.inline_asm ""foo"", ""=r,=r,r"" %arg0 : (i32) -> !llvm.struct<(i8, i8)> llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @fastmathFlagsFunc(f32) -> f32 llvm.func @fastmathFlags(%arg0: f32, %arg1 : vector<2xf32>) { %0 = llvm.fadd %arg0, %arg0 {fastmathFlags = #llvm.fastmath} : f32 %1 = llvm.fsub %arg0, %arg0 {fastmathFlags = #llvm.fastmath} : f32 %2 = llvm.fmul %arg0, %arg0 {fastmathFlags = #llvm.fastmath} : f32 %3 = llvm.fdiv %arg0, %arg0 {fastmathFlags = #llvm.fastmath} : f32 %4 = llvm.frem %arg0, %arg0 {fastmathFlags = #llvm.fastmath} : f32 %5 = llvm.fcmp ""oeq"" %arg0, %arg0 {fastmathFlags = #llvm.fastmath} : f32 %6 = llvm.fneg %arg0 {fastmathFlags = #llvm.fastmath} : f32 %8 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %9 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %10 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %11 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %12 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %13 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %14 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %15 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %16 = llvm.call @fastmathFlagsFunc(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> (f32) %17 = ""llvm.intr.copysign""(%arg0, %arg0) {fastmathFlags = #llvm.fastmath} : (f32, f32) -> f32 %18 = ""llvm.intr.copysign""(%arg0, %arg0) {fastmathFlags = #llvm.fastmath} : (f32, f32) -> f32 %exp = llvm.mlir.constant(1 : i32) : i32 %19 = ""llvm.intr.powi""(%arg0, %exp) {fastmathFlags = #llvm.fastmath} : (f32, i32) -> f32 %20 = ""llvm.intr.powi""(%arg0, %exp) {fastmathFlags = #llvm.fastmath} : (f32, i32) -> f32 %21 = llvm.intr.vector.reduce.fmax(%arg1) {fastmathFlags = #llvm.fastmath} : (vector<2xf32>) -> f32 %22 = llvm.intr.vector.reduce.fmin(%arg1) {fastmathFlags = #llvm.fastmath} : (vector<2xf32>) -> f32 %23 = llvm.mlir.constant(true) : i1 %24 = llvm.select %23, %arg0, %20 {fastmathFlags = #llvm.fastmath} : i1, f32 llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @switch_args(%arg0: i32) -> i32 { %0 = llvm.mlir.constant(5 : i32) : i32 %1 = llvm.mlir.constant(7 : i32) : i32 %2 = llvm.mlir.constant(11 : i32) : i32 llvm.switch %arg0 : i32, ^bb1 [ -1: ^bb2(%0 : i32), 1: ^bb3(%1, %2 : i32, i32) ] ^bb1: llvm.return %arg0 : i32 ^bb2(%3: i32): llvm.return %1 : i32 ^bb3(%4: i32, %5: i32): llvm.return %4 : i32 } llvm.func @switch_weights(%arg0: i32) -> i32 { %0 = llvm.mlir.constant(19 : i32) : i32 %1 = llvm.mlir.constant(23 : i32) : i32 %2 = llvm.mlir.constant(29 : i32) : i32 llvm.switch %arg0 : i32, ^bb1(%0 : i32) [ 9: ^bb2(%1, %2 : i32, i32), 99: ^bb3 ] {branch_weights = dense<[13, 17, 19]> : vector<3xi32>} ^bb1(%3: i32): llvm.return %3 : i32 ^bb2(%4: i32, %5: i32): llvm.return %5 : i32 ^bb3: llvm.return %arg0 : i32 }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo(%arg0: !llvm.ptr) llvm.func @aliasScope(%arg1 : !llvm.ptr) { %0 = llvm.mlir.constant(0 : i32) : i32 llvm.intr.experimental.noalias.scope.decl @metadata::@scope1 llvm.store %0, %arg1 {alias_scopes = [@metadata::@scope1], noalias_scopes = [@metadata::@scope2, @metadata::@scope3]} : i32, !llvm.ptr %1 = llvm.load %arg1 {alias_scopes = [@metadata::@scope2], noalias_scopes = [@metadata::@scope1, @metadata::@scope3]} : !llvm.ptr -> i32 %2 = llvm.atomicrmw add %arg1, %0 monotonic {alias_scopes = [@metadata::@scope3], noalias_scopes = [@metadata::@scope1, @metadata::@scope2]} : !llvm.ptr, i32 %3 = llvm.cmpxchg %arg1, %1, %2 acq_rel monotonic {alias_scopes = [@metadata::@scope3]} : !llvm.ptr, i32 %4 = llvm.mlir.constant(0 : i1) : i1 %5 = llvm.mlir.constant(42 : i8) : i8 ""llvm.intr.memcpy""(%arg1, %arg1, %0, %4) {alias_scopes = [@metadata::@scope3]} : (!llvm.ptr, !llvm.ptr, i32, i1) -> () ""llvm.intr.memset""(%arg1, %5, %0, %4) {noalias_scopes = [@metadata::@scope3]} : (!llvm.ptr, i8, i32, i1) -> () llvm.call @foo(%arg1) {alias_scopes = [@metadata::@scope3]} : (!llvm.ptr) -> () llvm.call @foo(%arg1) {noalias_scopes = [@metadata::@scope3]} : (!llvm.ptr) -> () llvm.return } llvm.metadata @metadata { llvm.alias_scope_domain @domain {description = ""The domain""} llvm.alias_scope @scope1 {domain = @domain, description = ""The first scope""} llvm.alias_scope @scope2 {domain = @domain} llvm.alias_scope @scope3 {domain = @domain} }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @duplicate_block_in_switch(%cond : i32, %arg1: f32, %arg2: f32) { llvm.switch %cond : i32, ^bb1(%arg1: f32) [ 105: ^bb2, 108: ^bb3(%arg2: f32), 106: ^bb2 ] ^bb1(%arg3: f32): llvm.call @bar(%arg3): (f32) -> () llvm.return ^bb2: llvm.call @baz() : () -> () llvm.return ^bb3(%arg4: f32): llvm.call @qux(%arg4) : (f32) -> () llvm.return } llvm.func @duplicate_block_with_args_in_switch(%cond : i32, %arg1: f32, %arg2: f32) { llvm.switch %cond : i32, ^bb1(%arg1: f32) [ 106: ^bb3(%arg1: f32), 105: ^bb2, 108: ^bb3(%arg2: f32) ] ^bb1(%arg3: f32): llvm.call @bar(%arg3): (f32) -> () llvm.return ^bb2: llvm.call @baz() : () -> () llvm.return ^bb3(%arg4: f32): llvm.call @qux(%arg4) : (f32) -> () llvm.return } llvm.func @bar(f32) llvm.func @baz() llvm.func @qux(f32)", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @vararg_function(%arg0: i32, ...) { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(1 : i32) : i32 %2 = llvm.alloca %1 x !llvm.struct<""struct.va_list"", (ptr)> {alignment = 8 : i64} : (i32) -> !llvm.ptr)>> %3 = llvm.bitcast %2 : !llvm.ptr)>> to !llvm.ptr llvm.intr.vastart %3 : !llvm.ptr %4 = llvm.alloca %0 x !llvm.ptr {alignment = 8 : i64} : (i32) -> !llvm.ptr> %5 = llvm.bitcast %4 : !llvm.ptr> to !llvm.ptr llvm.intr.vacopy %3 to %5 : !llvm.ptr, !llvm.ptr llvm.intr.vaend %5 : !llvm.ptr llvm.intr.vaend %3 : !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 llvm.func @readonly_function(%arg0: !llvm.ptr {llvm.readonly}), mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @arg_mem_none_func() attributes { memory = #llvm.memory_effects}", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @readwrite_func() attributes { memory = #llvm.memory_effects}", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @streaming_func() attributes {arm_streaming} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @locally_streaming_func() attributes {arm_locally_streaming} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @return_void() -> !llvm.void llvm.func @return_half() -> f16 llvm.func @return_bfloat() -> bf16 llvm.func @return_float() -> f32 llvm.func @return_double() -> f64 llvm.func @return_fp128() -> f128 llvm.func @return_x86_fp80() -> f80 llvm.func @return_ppc_fp128() -> !llvm.ppc_fp128 llvm.func @return_x86_mmx() -> !llvm.x86_mmx llvm.func @f_void_i32(i32) -> !llvm.void llvm.func @f_i32_empty() -> i32 llvm.func @f_i32_half_bfloat_float_double(f16, bf16, f32, f64) -> i32 llvm.func @f_i32_i32_i32(i32, i32) -> i32 llvm.func @f_void_variadic(...) llvm.func @f_void_i32_i32_variadic(i32, i32, ...) llvm.func @f_f_i32_i32() -> !llvm.ptr> llvm.func @return_i1() -> i1 llvm.func @return_i8() -> i8 llvm.func @return_i16() -> i16 llvm.func @return_i32() -> i32 llvm.func @return_i64() -> i64 llvm.func @return_i57() -> i57 llvm.func @return_i129() -> i129 llvm.func @return_pi8() -> !llvm.ptr llvm.func @return_pfloat() -> !llvm.ptr llvm.func @return_ppi8() -> !llvm.ptr> llvm.func @return_pppppi8() -> !llvm.ptr>>>> llvm.func @return_pi8_0() -> !llvm.ptr llvm.func @return_pi8_1() -> !llvm.ptr llvm.func @return_pi8_42() -> !llvm.ptr llvm.func @return_ppi8_42_9() -> !llvm.ptr, 9> llvm.func @return_v4_i32() -> vector<4xi32> llvm.func @return_v4_float() -> vector<4xf32> llvm.func @return_vs_4_float() -> vector<[4]xf32> llvm.func @return_vs_4_i32() -> !llvm.vec llvm.func @return_vs_8_half() -> !llvm.vec llvm.func @return_v_4_pi8() -> !llvm.vec<4xptr> llvm.func @return_a10_i32() -> !llvm.array<10 x i32> llvm.func @return_a8_float() -> !llvm.array<8 x f32> llvm.func @return_a10_pi32_4() -> !llvm.array<10 x ptr> llvm.func @return_a10_a4_float() -> !llvm.array<10 x array<4 x f32>> llvm.func @return_struct_empty() -> !llvm.struct<()> llvm.func @return_s_i32() -> !llvm.struct<(i32)> llvm.func @return_s_float_i32() -> !llvm.struct<(f32, i32)> llvm.func @return_s_s_i32() -> !llvm.struct<(struct<(i32)>)> llvm.func @return_s_i32_s_i32_float() -> !llvm.struct<(i32, struct<(i32)>, f32)> llvm.func @return_sp_empty() -> !llvm.struct llvm.func @return_sp_i32() -> !llvm.struct llvm.func @return_sp_float_i32() -> !llvm.struct llvm.func @return_sp_i32_s_i31_1_float() -> !llvm.struct, f32)> llvm.func @return_s_sp_i32() -> !llvm.struct<(struct)> llvm.func @return_sp_s_i32() -> !llvm.struct)> llvm.func @return_target_ext_no_param() -> !llvm.target<""target-no-param""> llvm.func @return_target_ext_type_params() -> !llvm.target<""target-type-param"", i32, f64> llvm.func @return_target_ext_int_params() -> !llvm.target<""target-int-param"", 0, 42> llvm.func @return_target_ext_params() -> !llvm.target<""target-params"", i32, f64, 0, 5>", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @return_s_empty() -> !llvm.struct<""empty"", ()> llvm.func @return_s_opaque() -> !llvm.struct<""opaque"", opaque> llvm.func @return_s_long() -> !llvm.struct<""long"", (i32, struct<(i32, i1)>, f32, ptr>)> llvm.func @return_s_self_recursive() -> !llvm.struct<""self-recursive"", (ptr>)> llvm.func @return_s_unpacked() -> !llvm.struct<""unpacked"", (i32)> llvm.func @return_s_packed() -> !llvm.struct<""packed"", packed (i32)> llvm.func @return_s_symbols() -> !llvm.struct<""name with spaces and !^$@$#"", packed (i32)> llvm.func @return_s_mutually_a() -> !llvm.struct<""mutually-a"", (ptr, 3>)>>)> llvm.func @return_s_mutually_b() -> !llvm.struct<""mutually-b"", (ptr>)>, 3>)> llvm.func @return_s_struct_of_arrays() -> !llvm.struct<""struct-of-arrays"", (array<10 x i32>)> llvm.func @return_s_array_of_structs() -> !llvm.array<10 x struct<""array-of-structs"", (i32)>> llvm.func @return_s_ptr_to_struct() -> !llvm.ptr>", mlir-translate -mlir-to-llvmir -split-input-file ,1 "omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(0.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fadd %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr -> f32 llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } llvm.func @simple_reduction(%lb : i64, %ub : i64, %step : i64) { %c1 = llvm.mlir.constant(1 : i32) : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel { omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr) for (%iv) : i64 = (%lb) to (%ub) step (%step) { %1 = llvm.mlir.constant(2.0 : f32) : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(0.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fadd %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr -> f32 llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } llvm.func @reuse_declaration(%lb : i64, %ub : i64, %step : i64) { %c1 = llvm.mlir.constant(1 : i32) : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr %2 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel { omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr, @add_f32 -> %2 : !llvm.ptr) for (%iv) : i64 = (%lb) to (%ub) step (%step) { %1 = llvm.mlir.constant(2.0 : f32) : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.reduction %1, %2 : f32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(0.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fadd %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr -> f32 llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } llvm.func @missing_omp_reduction(%lb : i64, %ub : i64, %step : i64) { %c1 = llvm.mlir.constant(1 : i32) : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr %2 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel { omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr, @add_f32 -> %2 : !llvm.ptr) for (%iv) : i64 = (%lb) to (%ub) step (%step) { %1 = llvm.mlir.constant(2.0 : f32) : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(0.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fadd %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr -> f32 llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } llvm.func @double_reference(%lb : i64, %ub : i64, %step : i64) { %c1 = llvm.mlir.constant(1 : i32) : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel { omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr) for (%iv) : i64 = (%lb) to (%ub) step (%step) { %1 = llvm.mlir.constant(2.0 : f32) : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(0.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fadd %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr -> f32 llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } omp.reduction.declare @mul_f32 : f32 init { ^bb0(%arg: f32): %0 = llvm.mlir.constant(1.0 : f32) : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = llvm.fmul %arg0, %arg1 : f32 omp.yield (%1 : f32) } llvm.func @no_atomic(%lb : i64, %ub : i64, %step : i64) { %c1 = llvm.mlir.constant(1 : i32) : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr %2 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel { omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr, @mul_f32 -> %2 : !llvm.ptr) for (%iv) : i64 = (%lb) to (%ub) step (%step) { %1 = llvm.mlir.constant(2.0 : f32) : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.reduction %1, %2 : f32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @_QPopenmp_target_data() { %0 = llvm.mlir.constant(1 : i64) : i64 %1 = llvm.alloca %0 x i32 {bindc_name = ""i"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFopenmp_target_dataEi""} : (i64) -> !llvm.ptr omp.target_data map((tofrom -> %1 : !llvm.ptr)) { %2 = llvm.mlir.constant(99 : i32) : i32 llvm.store %2, %1 : !llvm.ptr omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @_QPopenmp_target_data_region(%1 : !llvm.ptr>) { omp.target_data map((from -> %1 : !llvm.ptr>)) { %2 = llvm.mlir.constant(99 : i32) : i32 %3 = llvm.mlir.constant(1 : i64) : i64 %4 = llvm.mlir.constant(1 : i64) : i64 %5 = llvm.mlir.constant(0 : i64) : i64 %6 = llvm.getelementptr %1[0, %5] : (!llvm.ptr>, i64) -> !llvm.ptr llvm.store %2, %6 : !llvm.ptr omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @_QPomp_target_enter_exit(%1 : !llvm.ptr>, %3 : !llvm.ptr>) { %4 = llvm.mlir.constant(1 : i64) : i64 %5 = llvm.alloca %4 x i32 {bindc_name = ""dvc"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_enter_exitEdvc""} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 %7 = llvm.alloca %6 x i32 {bindc_name = ""i"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_enter_exitEi""} : (i64) -> !llvm.ptr %8 = llvm.mlir.constant(5 : i32) : i32 llvm.store %8, %7 : !llvm.ptr %9 = llvm.mlir.constant(2 : i32) : i32 llvm.store %9, %5 : !llvm.ptr %10 = llvm.load %7 : !llvm.ptr %11 = llvm.mlir.constant(10 : i32) : i32 %12 = llvm.icmp ""slt"" %10, %11 : i32 %13 = llvm.load %5 : !llvm.ptr omp.target_enter_data if(%12 : i1) device(%13 : i32) map((to -> %1 : !llvm.ptr>), (alloc -> %3 : !llvm.ptr>)) %14 = llvm.load %7 : !llvm.ptr %15 = llvm.mlir.constant(10 : i32) : i32 %16 = llvm.icmp ""sgt"" %14, %15 : i32 %17 = llvm.load %5 : !llvm.ptr omp.target_exit_data if(%16 : i1) device(%17 : i32) map((from -> %1 : !llvm.ptr>), (release -> %3 : !llvm.ptr>)) llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @arm_neon_smull(%arg0: vector<8xi8>, %arg1: vector<8xi8>) -> !llvm.struct<(vector<8xi16>, vector<4xi32>, vector<2xi64>)> { %0 = arm_neon.intr.smull %arg0, %arg1 : vector<8xi8> to vector<8xi16> %1 = llvm.shufflevector %0, %0 [3, 4, 5, 6] : vector<8xi16> %2 = arm_neon.intr.smull %1, %1 : vector<4xi16> to vector<4xi32> %3 = llvm.shufflevector %2, %2 [1, 2] : vector<4xi32> %4 = arm_neon.intr.smull %3, %3 : vector<2xi32> to vector<2xi64> %5 = llvm.mlir.undef : !llvm.struct<(vector<8xi16>, vector<4xi32>, vector<2xi64>)> %6 = llvm.insertvalue %0, %5[0] : !llvm.struct<(vector<8xi16>, vector<4xi32>, vector<2xi64>)> %7 = llvm.insertvalue %2, %6[1] : !llvm.struct<(vector<8xi16>, vector<4xi32>, vector<2xi64>)> %8 = llvm.insertvalue %4, %7[2] : !llvm.struct<(vector<8xi16>, vector<4xi32>, vector<2xi64>)> llvm.return %8 : !llvm.struct<(vector<8xi16>, vector<4xi32>, vector<2xi64>)> } llvm.func @arm_neon_sdot_8_i8i8(%a: vector<2xi32>, %b: vector<8xi8>, %c: vector<8xi8>) -> vector<2xi32> { %0 = arm_neon.intr.sdot %a, %b, %c : vector<8xi8>, vector<8xi8> to vector<2xi32> llvm.return %0 : vector<2xi32> } llvm.func @arm_neon_sdot_16_i8i8(%a: vector<4xi32>, %b: vector<16xi8>, %c: vector<16xi8>) -> vector<4xi32> { %0 = arm_neon.intr.sdot %a, %b, %c : vector<16xi8>, vector<16xi8> to vector<4xi32> llvm.return %0 : vector<4xi32> }", mlir-translate -mlir-to-llvmir ,1 "llvm.func @LLVM_x86_avx512_mask_ps_512(%a: vector<16 x f32>, %c: i16) -> (vector<16 x f32>) { %b = llvm.mlir.constant(42 : i32) : i32 %0 = ""x86vector.avx512.intr.mask.rndscale.ps.512""(%a, %b, %a, %c, %b) : (vector<16 x f32>, i32, vector<16 x f32>, i16, i32) -> vector<16 x f32> %1 = ""x86vector.avx512.intr.mask.scalef.ps.512""(%a, %a, %a, %c, %b) : (vector<16 x f32>, vector<16 x f32>, vector<16 x f32>, i16, i32) -> vector<16 x f32> llvm.return %1: vector<16 x f32> } llvm.func @LLVM_x86_avx512_mask_pd_512(%a: vector<8xf64>, %c: i8) -> (vector<8xf64>) { %b = llvm.mlir.constant(42 : i32) : i32 %0 = ""x86vector.avx512.intr.mask.rndscale.pd.512""(%a, %b, %a, %c, %b) : (vector<8xf64>, i32, vector<8xf64>, i8, i32) -> vector<8xf64> %1 = ""x86vector.avx512.intr.mask.scalef.pd.512""(%a, %a, %a, %c, %b) : (vector<8xf64>, vector<8xf64>, vector<8xf64>, i8, i32) -> vector<8xf64> llvm.return %1: vector<8xf64> } llvm.func @LLVM_x86_mask_compress(%k: vector<16xi1>, %a: vector<16xf32>) -> vector<16xf32> { %0 = ""x86vector.avx512.intr.mask.compress""(%a, %a, %k) : (vector<16xf32>, vector<16xf32>, vector<16xi1>) -> vector<16xf32> llvm.return %0 : vector<16xf32> } llvm.func @LLVM_x86_vp2intersect_d_512(%a: vector<16xi32>, %b: vector<16xi32>) -> !llvm.struct<(vector<16 x i1>, vector<16 x i1>)> { %0 = ""x86vector.avx512.intr.vp2intersect.d.512""(%a, %b) : (vector<16xi32>, vector<16xi32>) -> !llvm.struct<(vector<16 x i1>, vector<16 x i1>)> llvm.return %0 : !llvm.struct<(vector<16 x i1>, vector<16 x i1>)> } llvm.func @LLVM_x86_vp2intersect_q_512(%a: vector<8xi64>, %b: vector<8xi64>) -> !llvm.struct<(vector<8 x i1>, vector<8 x i1>)> { %0 = ""x86vector.avx512.intr.vp2intersect.q.512""(%a, %b) : (vector<8xi64>, vector<8xi64>) -> !llvm.struct<(vector<8 x i1>, vector<8 x i1>)> llvm.return %0 : !llvm.struct<(vector<8 x i1>, vector<8 x i1>)> } llvm.func @LLVM_x86_avx_rsqrt_ps_256(%a: vector <8xf32>) -> vector<8xf32> { %0 = ""x86vector.avx.intr.rsqrt.ps.256""(%a) : (vector<8xf32>) -> (vector<8xf32>) llvm.return %0 : vector<8xf32> }", mlir-translate --mlir-to-llvmir ,1 "module attributes {omp.is_device = false} { llvm.func @omp_target_region_() { %0 = llvm.mlir.constant(20 : i32) : i32 %1 = llvm.mlir.constant(10 : i32) : i32 %2 = llvm.mlir.constant(1 : i64) : i64 %3 = llvm.alloca %2 x i32 {bindc_name = ""a"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEa""} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(1 : i64) : i64 %5 = llvm.alloca %4 x i32 {bindc_name = ""b"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEb""} : (i64) -> !llvm.ptr %6 = llvm.mlir.constant(1 : i64) : i64 %7 = llvm.alloca %6 x i32 {bindc_name = ""c"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFomp_target_regionEc""} : (i64) -> !llvm.ptr llvm.store %1, %3 : !llvm.ptr llvm.store %0, %5 : !llvm.ptr omp.target { omp.parallel { %8 = llvm.load %3 : !llvm.ptr %9 = llvm.load %5 : !llvm.ptr %10 = llvm.add %8, %9 : i32 llvm.store %10, %7 : !llvm.ptr omp.terminator } omp.terminator } llvm.return } }", mlir-translate -mlir-to-llvmir ,1 "llvm.mlir.global external @global() {addr_space = 0 : i32} : !llvm.target<""spirv.DeviceEvent""> { %0 = llvm.mlir.constant(0 : i64) : !llvm.target<""spirv.DeviceEvent""> llvm.return %0 : !llvm.target<""spirv.DeviceEvent""> } llvm.func @func2() -> !llvm.target<""spirv.Event""> { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.poison : !llvm.target<""spirv.Event""> %2 = llvm.alloca %0 x !llvm.target<""spirv.Event""> {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.load %2 {alignment = 8 : i64} : !llvm.ptr -> !llvm.target<""spirv.Event""> llvm.return %1 : !llvm.target<""spirv.Event""> } llvm.func @func3() { %0 = llvm.mlir.constant(0 : i64) : !llvm.target<""spirv.DeviceEvent""> %1 = llvm.freeze %0 : !llvm.target<""spirv.DeviceEvent""> llvm.return }", mlir-translate -mlir-to-llvmir ,1 "llvm.func @arm_sve_sdot(%arg0: vector<[16]xi8>, %arg1: vector<[16]xi8>, %arg2: vector<[4]xi32>) -> vector<[4]xi32> { %0 = ""arm_sve.intr.sdot""(%arg2, %arg0, %arg1) : (vector<[4]xi32>, vector<[16]xi8>, vector<[16]xi8>) -> vector<[4]xi32> llvm.return %0 : vector<[4]xi32> } llvm.func @arm_sve_smmla(%arg0: vector<[16]xi8>, %arg1: vector<[16]xi8>, %arg2: vector<[4]xi32>) -> vector<[4]xi32> { %0 = ""arm_sve.intr.smmla""(%arg2, %arg0, %arg1) : (vector<[4]xi32>, vector<[16]xi8>, vector<[16]xi8>) -> vector<[4]xi32> llvm.return %0 : vector<[4]xi32> } llvm.func @arm_sve_udot(%arg0: vector<[16]xi8>, %arg1: vector<[16]xi8>, %arg2: vector<[4]xi32>) -> vector<[4]xi32> { %0 = ""arm_sve.intr.udot""(%arg2, %arg0, %arg1) : (vector<[4]xi32>, vector<[16]xi8>, vector<[16]xi8>) -> vector<[4]xi32> llvm.return %0 : vector<[4]xi32> } llvm.func @arm_sve_ummla(%arg0: vector<[16]xi8>, %arg1: vector<[16]xi8>, %arg2: vector<[4]xi32>) -> vector<[4]xi32> { %0 = ""arm_sve.intr.ummla""(%arg2, %arg0, %arg1) : (vector<[4]xi32>, vector<[16]xi8>, vector<[16]xi8>) -> vector<[4]xi32> llvm.return %0 : vector<[4]xi32> } llvm.func @arm_sve_arithi(%arg0: vector<[4]xi32>, %arg1: vector<[4]xi32>, %arg2: vector<[4]xi32>) -> vector<[4]xi32> { %0 = llvm.mul %arg0, %arg1 : vector<[4]xi32> %1 = llvm.add %0, %arg2 : vector<[4]xi32> llvm.return %1 : vector<[4]xi32> } llvm.func @arm_sve_arithf(%arg0: vector<[4]xf32>, %arg1: vector<[4]xf32>, %arg2: vector<[4]xf32>) -> vector<[4]xf32> { %0 = llvm.fmul %arg0, %arg1 : vector<[4]xf32> %1 = llvm.fadd %0, %arg2 : vector<[4]xf32> llvm.return %1 : vector<[4]xf32> } llvm.func @arm_sve_arithi_masked(%arg0: vector<[4]xi32>, %arg1: vector<[4]xi32>, %arg2: vector<[4]xi32>, %arg3: vector<[4]xi32>, %arg4: vector<[4]xi32>, %arg5: vector<[4]xi1>) -> vector<[4]xi32> { %0 = ""arm_sve.intr.add""(%arg5, %arg0, %arg1) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %1 = ""arm_sve.intr.sub""(%arg5, %0, %arg1) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %2 = ""arm_sve.intr.mul""(%arg5, %1, %arg3) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %3 = ""arm_sve.intr.sdiv""(%arg5, %2, %arg4) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %4 = ""arm_sve.intr.udiv""(%arg5, %3, %arg4) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> llvm.return %4 : vector<[4]xi32> } llvm.func @arm_sve_arithf_masked(%arg0: vector<[4]xf32>, %arg1: vector<[4]xf32>, %arg2: vector<[4]xf32>, %arg3: vector<[4]xf32>, %arg4: vector<[4]xf32>, %arg5: vector<[4]xi1>) -> vector<[4]xf32> { %0 = ""arm_sve.intr.fadd""(%arg5, %arg0, %arg1) : (vector<[4]xi1>, vector<[4]xf32>, vector<[4]xf32>) -> vector<[4]xf32> %1 = ""arm_sve.intr.fsub""(%arg5, %0, %arg2) : (vector<[4]xi1>, vector<[4]xf32>, vector<[4]xf32>) -> vector<[4]xf32> %2 = ""arm_sve.intr.fmul""(%arg5, %1, %arg3) : (vector<[4]xi1>, vector<[4]xf32>, vector<[4]xf32>) -> vector<[4]xf32> %3 = ""arm_sve.intr.fdiv""(%arg5, %2, %arg4) : (vector<[4]xi1>, vector<[4]xf32>, vector<[4]xf32>) -> vector<[4]xf32> llvm.return %3 : vector<[4]xf32> } llvm.func @arm_sve_mask_genf(%arg0: vector<[4]xf32>, %arg1: vector<[4]xf32>) -> vector<[4]xi1> { %0 = llvm.fcmp ""oeq"" %arg0, %arg1 : vector<[4]xf32> llvm.return %0 : vector<[4]xi1> } llvm.func @arm_sve_mask_geni(%arg0: vector<[4]xi32>, %arg1: vector<[4]xi32>) -> vector<[4]xi1> { %0 = llvm.icmp ""uge"" %arg0, %arg1 : vector<[4]xi32> llvm.return %0 : vector<[4]xi1> } llvm.func @arm_sve_abs_diff(%arg0: vector<[4]xi32>, %arg1: vector<[4]xi32>) -> vector<[4]xi32> { %0 = llvm.sub %arg0, %arg0 : vector<[4]xi32> %1 = llvm.icmp ""sge"" %arg0, %arg1 : vector<[4]xi32> %2 = llvm.icmp ""slt"" %arg0, %arg1 : vector<[4]xi32> %3 = ""arm_sve.intr.sub""(%1, %arg0, %arg1) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %4 = ""arm_sve.intr.sub""(%2, %arg1, %arg0) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %5 = ""arm_sve.intr.add""(%1, %0, %3) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> %6 = ""arm_sve.intr.add""(%2, %5, %4) : (vector<[4]xi1>, vector<[4]xi32>, vector<[4]xi32>) -> vector<[4]xi32> llvm.return %6 : vector<[4]xi32> } llvm.func @memcopy(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64, %arg4: i64, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: i64, %arg8: i64, %arg9: i64, %arg10: i64) { %0 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %1 = llvm.insertvalue %arg0, %0[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %2 = llvm.insertvalue %arg1, %1[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %3 = llvm.insertvalue %arg2, %2[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %4 = llvm.insertvalue %arg3, %3[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %5 = llvm.insertvalue %arg4, %4[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %6 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %7 = llvm.insertvalue %arg5, %6[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %8 = llvm.insertvalue %arg6, %7[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %9 = llvm.insertvalue %arg7, %8[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %10 = llvm.insertvalue %arg8, %9[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %11 = llvm.insertvalue %arg9, %10[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %12 = llvm.mlir.constant(0 : index) : i64 %13 = llvm.mlir.constant(4 : index) : i64 %14 = ""llvm.intr.vscale""() : () -> i64 %15 = llvm.mul %14, %13 : i64 llvm.br ^bb1(%12 : i64) ^bb1(%16: i64): %17 = llvm.icmp ""slt"" %16, %arg10 : i64 llvm.cond_br %17, ^bb2, ^bb3 ^bb2: %18 = llvm.extractvalue %5[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %19 = llvm.getelementptr %18[%16] : (!llvm.ptr, i64) -> !llvm.ptr %20 = llvm.bitcast %19 : !llvm.ptr to !llvm.ptr> %21 = llvm.load %20 : !llvm.ptr> %22 = llvm.extractvalue %11[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %23 = llvm.getelementptr %22[%16] : (!llvm.ptr, i64) -> !llvm.ptr %24 = llvm.bitcast %23 : !llvm.ptr to !llvm.ptr> llvm.store %21, %24 : !llvm.ptr> %25 = llvm.add %16, %15 : i64 llvm.br ^bb1(%25 : i64) ^bb3: llvm.return } llvm.func @get_vector_scale() -> i64 { %0 = ""llvm.intr.vscale""() : () -> i64 llvm.return %0 : i64 }", mlir-translate --mlir-to-llvmir ,1 "llvm.func @target(%ptr: !llvm.ptr) { %c = llvm.mlir.constant(16 : i16) : i16 %s = llvm.mlir.constant(32 : i64) : i64 %0 = ""amx.tilezero""(%c, %c) : (i16, i16) -> !llvm.array<16 x vector<16xbf16>> ""amx.tilestored64""(%c, %c, %ptr, %s, %0) : (i16, i16, !llvm.ptr, i64, !llvm.array<16 x vector<16xbf16>>) -> () llvm.return }", mlir-translate --mlir-to-llvmir ,1 "llvm.func @disableNonForced() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @mustprogress() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @isvectorized() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "#followup = #llvm.loop_annotation llvm.func @vectorizeOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation >} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @interleaveOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "#followup = #llvm.loop_annotation llvm.func @unrollOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation >} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @unrollOptions2() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "#followup = #llvm.loop_annotation llvm.func @unrollAndJamOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation >} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @licmOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @licmOptions2() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "#followup = #llvm.loop_annotation llvm.func @distributeOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation >} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @pipelineOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @peeledOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @unswitchOptions() { llvm.br ^bb1 {loop_annotation = #llvm.loop_annotation>} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo(%arg0: i32) llvm.func @loopOptions(%arg1 : i32, %arg2 : i32) { %0 = llvm.mlir.constant(0 : i32) : i32 %4 = llvm.alloca %arg1 x i32 : (i32) -> (!llvm.ptr) llvm.br ^bb3(%0 : i32) ^bb3(%1: i32): %2 = llvm.icmp ""slt"" %1, %arg1 : i32 llvm.cond_br %2, ^bb4, ^bb5 {loop_annotation = #llvm.loop_annotation< licm = , interleave = , unroll = , pipeline = , parallelAccesses = @metadata::@group1, @metadata::@group2>} ^bb4: %3 = llvm.add %1, %arg2 : i32 %5 = llvm.load %4 {access_groups = [@metadata::@group1, @metadata::@group2]} : !llvm.ptr -> i32 llvm.store %5, %4 {access_groups = [@metadata::@group1, @metadata::@group2]} : i32, !llvm.ptr %6 = llvm.atomicrmw add %4, %5 monotonic {access_groups = [@metadata::@group1, @metadata::@group2]} : !llvm.ptr, i32 %7 = llvm.cmpxchg %4, %5, %6 acq_rel monotonic {access_groups = [@metadata::@group1, @metadata::@group2]} : !llvm.ptr, i32 %8 = llvm.mlir.constant(0 : i1) : i1 %9 = llvm.mlir.constant(42 : i8) : i8 ""llvm.intr.memcpy""(%4, %4, %0, %8) {access_groups = [@metadata::@group1, @metadata::@group2]} : (!llvm.ptr, !llvm.ptr, i32, i1) -> () ""llvm.intr.memset""(%4, %9, %0, %8) {access_groups = [@metadata::@group1, @metadata::@group2]} : (!llvm.ptr, i8, i32, i1) -> () llvm.call @foo(%arg1) {access_groups = [@metadata::@group1, @metadata::@group2]} : (i32) -> () llvm.br ^bb3(%3 : i32) {loop_annotation = #llvm.loop_annotation< licm = , interleave = , unroll = , pipeline = , parallelAccesses = @metadata::@group1, @metadata::@group2>} ^bb5: llvm.return } llvm.metadata @metadata { llvm.access_group @group1 llvm.access_group @group2 }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "#di_file = #llvm.di_file<""metadata-loop.ll"" in ""/""> #loc1 = loc(""loop-metadata.mlir"":42:4) #loc2 = loc(""loop-metadata.mlir"":52:4) #di_compile_unit = #llvm.di_compile_unit #di_subprogram = #llvm.di_subprogram #start_loc_fused = loc(fused<#di_subprogram>[#loc1]) #end_loc_fused= loc(fused<#di_subprogram>[#loc2]) #loopMD = #llvm.loop_annotation llvm.func @loop_annotation_with_locs() { llvm.br ^bb1 {loop_annotation = #loopMD} ^bb1: llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry<""dlti.endianness"", ""big"">, #dlti.dl_entry<""dlti.alloca_memory_space"", 4 : ui32>, #dlti.dl_entry<""dlti.stack_alignment"", 128 : i32>, #dlti.dl_entry, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<3xi32>>, #dlti.dl_entry, dense<[32,32,32,64]> : vector<4xi32>> >} { llvm.func @foo() { llvm.return } }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry<""dlti.endianness"", ""little"">, #dlti.dl_entry<""dlti.alloca_memory_space"", 0 : ui32>, #dlti.dl_entry<""dlti.stack_alignment"", 0 : i32> >} { llvm.func @bar() { llvm.return } }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<2xi32>>> } {}", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<2xi32>>> } {}", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry<""foo"", dense<[64,128]> : vector<2xi32>>> } {}", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.metadata @__tbaa { llvm.tbaa_root @tbaa_root_0 {id = ""Simple C/C++ TBAA""} llvm.tbaa_type_desc @tbaa_type_desc_1 {id = ""omnipotent char"", members = {<@tbaa_root_0, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_2 {id = ""long long"", members = {<@tbaa_type_desc_1, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_3 {id = ""agg2_t"", members = {<@tbaa_type_desc_2, 0>, <@tbaa_type_desc_2, 8>}} llvm.tbaa_tag @tbaa_tag_4 {access_type = @tbaa_type_desc_2, base_type = @tbaa_type_desc_3, offset = 8 : i64} llvm.tbaa_type_desc @tbaa_type_desc_5 {id = ""int"", members = {<@tbaa_type_desc_1, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_6 {id = ""agg1_t"", members = {<@tbaa_type_desc_5, 0>, <@tbaa_type_desc_5, 4>}} llvm.tbaa_tag @tbaa_tag_7 {access_type = @tbaa_type_desc_5, base_type = @tbaa_type_desc_6, offset = 0 : i64, constant} } llvm.func @tbaa2(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = llvm.mlir.constant(1 : i32) : i32 %2 = llvm.getelementptr inbounds %arg1[%0, 1] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<""struct.agg2_t"", (i64, i64)> %3 = llvm.load %2 {tbaa = [@__tbaa::@tbaa_tag_4]} : !llvm.ptr -> i64 %4 = llvm.trunc %3 : i64 to i32 %5 = llvm.getelementptr inbounds %arg0[%0, 0] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<""struct.agg1_t"", (i32, i32)> llvm.store %4, %5 {tbaa = [@__tbaa::@tbaa_tag_7]} : i32, !llvm.ptr llvm.return } }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module { llvm.metadata @__tbaa { llvm.tbaa_root @tbaa_root_0 {id = ""Simple C/C++ TBAA""} llvm.tbaa_type_desc @tbaa_type_desc_1 {id = ""omnipotent char"", members = {<@tbaa_root_0, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_2 {id = ""float"", members = {<@tbaa_type_desc_1, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_3 {id = ""agg2_t"", members = {<@tbaa_type_desc_2, 0>, <@tbaa_type_desc_2, 4>}} llvm.tbaa_tag @tbaa_tag_4 {access_type = @tbaa_type_desc_2, base_type = @tbaa_type_desc_3, offset = 0 : i64} llvm.tbaa_type_desc @tbaa_type_desc_5 {id = ""int"", members = {<@tbaa_type_desc_1, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_6 {id = ""agg1_t"", members = {<@tbaa_type_desc_5, 0>, <@tbaa_type_desc_5, 4>}} llvm.tbaa_tag @tbaa_tag_7 {access_type = @tbaa_type_desc_5, base_type = @tbaa_type_desc_6, offset = 0 : i64} } llvm.func @foo(%arg0: !llvm.ptr) llvm.func @tbaa2(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = llvm.mlir.constant(1 : i32) : i32 %2 = llvm.getelementptr inbounds %arg1[%0, 0] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<""struct.agg2_t"", (f32, f32)> %3 = llvm.load %2 {tbaa = [@__tbaa::@tbaa_tag_4]} : !llvm.ptr -> f32 %4 = llvm.fptosi %3 : f32 to i32 %5 = llvm.getelementptr inbounds %arg0[%0, 0] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<""struct.agg1_t"", (i32, i32)> llvm.store %4, %5 {tbaa = [@__tbaa::@tbaa_tag_7]} : i32, !llvm.ptr %6 = llvm.atomicrmw add %5, %4 monotonic {tbaa = [@__tbaa::@tbaa_tag_7]} : !llvm.ptr, i32 %7 = llvm.cmpxchg %5, %6, %4 acq_rel monotonic {tbaa = [@__tbaa::@tbaa_tag_7]} : !llvm.ptr, i32 %8 = llvm.mlir.constant(0 : i1) : i1 %9 = llvm.mlir.constant(42 : i8) : i8 ""llvm.intr.memcpy""(%arg1, %arg1, %0, %8) {tbaa = [@__tbaa::@tbaa_tag_7]} : (!llvm.ptr, !llvm.ptr, i32, i1) -> () ""llvm.intr.memset""(%arg1, %9, %0, %8) {tbaa = [@__tbaa::@tbaa_tag_7]} : (!llvm.ptr, i8, i32, i1) -> () llvm.call @foo(%arg1) {tbaa = [@__tbaa::@tbaa_tag_7]} : (!llvm.ptr) -> () llvm.return } }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @test_stand_alone_directives() { omp.barrier omp.taskwait omp.taskyield llvm.return } llvm.func @test_flush_construct(%arg0: !llvm.ptr) { omp.flush omp.flush (%arg0 : !llvm.ptr) omp.flush (%arg0, %arg0 : !llvm.ptr, !llvm.ptr) %0 = llvm.mlir.constant(1 : i64) : i64 %1 = llvm.alloca %0 x i32 {in_type = i32, name = ""a""} : (i64) -> !llvm.ptr omp.flush %2 = llvm.load %1 : !llvm.ptr llvm.return } llvm.func @test_omp_parallel_1() -> () { omp.parallel { omp.barrier omp.terminator } llvm.return } llvm.func @body(i64) llvm.func @test_omp_parallel_2() -> () { omp.parallel { ^bb0: %0 = llvm.mlir.constant(1 : index) : i64 %1 = llvm.mlir.constant(42 : index) : i64 llvm.call @body(%0) : (i64) -> () llvm.call @body(%1) : (i64) -> () llvm.br ^bb1 ^bb1: %2 = llvm.add %0, %1 : i64 llvm.call @body(%2) : (i64) -> () omp.terminator } llvm.return } llvm.func @test_omp_parallel_num_threads_1(%arg0: i32) -> () { omp.parallel num_threads(%arg0: i32) { omp.barrier omp.terminator } llvm.return } llvm.func @test_omp_parallel_num_threads_2() -> () { %0 = llvm.mlir.constant(4 : index) : i32 omp.parallel num_threads(%0: i32) { omp.barrier omp.terminator } llvm.return } llvm.func @test_omp_parallel_num_threads_3() -> () { %0 = llvm.mlir.constant(4 : index) : i32 omp.parallel num_threads(%0: i32) { omp.barrier omp.terminator } %1 = llvm.mlir.constant(8 : index) : i32 omp.parallel num_threads(%1: i32) { omp.barrier omp.terminator } llvm.return } llvm.func @test_omp_parallel_if_1(%arg0: i32) -> () { %0 = llvm.mlir.constant(0 : index) : i32 %1 = llvm.icmp ""slt"" %arg0, %0 : i32 omp.parallel if(%1 : i1) { omp.barrier omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @test_omp_parallel_3() -> () { omp.parallel proc_bind(master) { omp.barrier omp.terminator } omp.parallel proc_bind(close) { omp.barrier omp.terminator } omp.parallel proc_bind(spread) { omp.barrier omp.terminator } llvm.return } llvm.func @test_omp_parallel_4() -> () { omp.parallel { omp.barrier omp.parallel { omp.barrier omp.terminator } omp.barrier omp.terminator } llvm.return } llvm.func @test_omp_parallel_5() -> () { omp.parallel { omp.barrier omp.parallel { omp.parallel { omp.barrier omp.terminator } omp.terminator } omp.barrier omp.terminator } llvm.return } llvm.func @test_omp_master() -> () { omp.parallel { omp.master { omp.terminator } omp.terminator } omp.parallel { omp.parallel { omp.master { omp.terminator } omp.terminator } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @wsloop_simple(%arg0: !llvm.ptr) { %0 = llvm.mlir.constant(42 : index) : i64 %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 omp.parallel { ""omp.wsloop""(%1, %0, %2) ({ ^bb0(%arg1: i64): %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield }) {operand_segment_sizes = array} : (i64, i64, i64) -> () omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @wsloop_inclusive_1(%arg0: !llvm.ptr) { %0 = llvm.mlir.constant(42 : index) : i64 %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 ""omp.wsloop""(%1, %0, %2) ({ ^bb0(%arg1: i64): %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield }) {operand_segment_sizes = array} : (i64, i64, i64) -> () llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @wsloop_inclusive_2(%arg0: !llvm.ptr) { %0 = llvm.mlir.constant(42 : index) : i64 %1 = llvm.mlir.constant(10 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 ""omp.wsloop""(%1, %0, %2) ({ ^bb0(%arg1: i64): %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield }) {inclusive, operand_segment_sizes = array} : (i64, i64, i64) -> () llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_static_defchunk(%lb : i32, %ub : i32, %step : i32) -> () { omp.wsloop schedule(static) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_static_1(%lb : i32, %ub : i32, %step : i32) -> () { %static_chunk_size = llvm.mlir.constant(1 : i32) : i32 omp.wsloop schedule(static = %static_chunk_size : i32) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_static_2(%lb : i32, %ub : i32, %step : i32) -> () { %static_chunk_size = llvm.mlir.constant(2 : i32) : i32 omp.wsloop schedule(static = %static_chunk_size : i32) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(dynamic) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic_chunk_const(%lb : i64, %ub : i64, %step : i64) -> () { %chunk_size_const = llvm.mlir.constant(2 : i16) : i16 omp.wsloop schedule(dynamic = %chunk_size_const : i16) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_dynamic_chunk_var(%lb : i32, %ub : i32, %step : i32) -> () { %1 = llvm.mlir.constant(1 : i64) : i64 %chunk_size_alloca = llvm.alloca %1 x i16 {bindc_name = ""chunk_size"", in_type = i16, uniq_name = ""_QFsub1Echunk_size""} : (i64) -> !llvm.ptr %chunk_size_var = llvm.load %chunk_size_alloca : !llvm.ptr omp.wsloop schedule(dynamic = %chunk_size_var : i16) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_dynamic_chunk_var2(%lb : i32, %ub : i32, %step : i32) -> () { %1 = llvm.mlir.constant(1 : i64) : i64 %chunk_size_alloca = llvm.alloca %1 x i64 {bindc_name = ""chunk_size"", in_type = i64, uniq_name = ""_QFsub1Echunk_size""} : (i64) -> !llvm.ptr %chunk_size_var = llvm.load %chunk_size_alloca : !llvm.ptr omp.wsloop schedule(dynamic = %chunk_size_var : i64) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_dynamic_chunk_var3(%lb : i32, %ub : i32, %step : i32, %chunk_size : i32) -> () { omp.wsloop schedule(dynamic = %chunk_size : i32) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_auto(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(auto) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_runtime(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(runtime) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_guided(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(guided) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic_nonmonotonic(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(dynamic, nonmonotonic) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic_monotonic(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(dynamic, monotonic) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_runtime_simd(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(runtime, simd) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_guided_simd(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(guided, simd) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @simdloop_simple(%lb : i64, %ub : i64, %step : i64, %arg0: !llvm.ptr) { ""omp.simdloop"" (%lb, %ub, %step) ({ ^bb0(%iv: i64): %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%iv] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr omp.yield }) {operand_segment_sizes = array} : (i64, i64, i64) -> () llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @simdloop_simple_multiple(%lb1 : i64, %ub1 : i64, %step1 : i64, %lb2 : i64, %ub2 : i64, %step2 : i64, %arg0: !llvm.ptr, %arg1: !llvm.ptr) { omp.simdloop for (%iv1, %iv2) : i64 = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%iv1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.getelementptr %arg1[%iv2] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr llvm.store %3, %5 : !llvm.ptr omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @simdloop_simple_multiple_simdlen(%lb1 : i64, %ub1 : i64, %step1 : i64, %lb2 : i64, %ub2 : i64, %step2 : i64, %arg0: !llvm.ptr, %arg1: !llvm.ptr) { omp.simdloop simdlen(2) for (%iv1, %iv2) : i64 = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%iv1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.getelementptr %arg1[%iv2] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr llvm.store %3, %5 : !llvm.ptr omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @simdloop_simple_multiple_safelen(%lb1 : i64, %ub1 : i64, %step1 : i64, %lb2 : i64, %ub2 : i64, %step2 : i64, %arg0: !llvm.ptr, %arg1: !llvm.ptr) { omp.simdloop safelen(2) for (%iv1, %iv2) : i64 = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%iv1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.getelementptr %arg1[%iv2] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr llvm.store %3, %5 : !llvm.ptr omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @simdloop_simple_multiple_simdlen_safelen(%lb1 : i64, %ub1 : i64, %step1 : i64, %lb2 : i64, %ub2 : i64, %step2 : i64, %arg0: !llvm.ptr, %arg1: !llvm.ptr) { omp.simdloop simdlen(1) safelen(2) for (%iv1, %iv2) : i64 = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { %3 = llvm.mlir.constant(2.000000e+00 : f32) : f32 %4 = llvm.getelementptr %arg0[%iv1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.getelementptr %arg1[%iv2] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %3, %4 : !llvm.ptr llvm.store %3, %5 : !llvm.ptr omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @simdloop_if(%arg0: !llvm.ptr {fir.bindc_name = ""n""}, %arg1: !llvm.ptr {fir.bindc_name = ""threshold""}) { %0 = llvm.mlir.constant(1 : i64) : i64 %1 = llvm.alloca %0 x i32 {adapt.valuebyref, in_type = i32, operand_segment_sizes = array} : (i64) -> !llvm.ptr %2 = llvm.mlir.constant(1 : i64) : i64 %3 = llvm.alloca %2 x i32 {bindc_name = ""i"", in_type = i32, operand_segment_sizes = array, uniq_name = ""_QFtest_simdEi""} : (i64) -> !llvm.ptr %4 = llvm.mlir.constant(0 : i32) : i32 %5 = llvm.load %arg0 : !llvm.ptr %6 = llvm.mlir.constant(1 : i32) : i32 %7 = llvm.load %arg0 : !llvm.ptr %8 = llvm.load %arg1 : !llvm.ptr %9 = llvm.icmp ""sge"" %7, %8 : i32 omp.simdloop if(%9) for (%arg2) : i32 = (%4) to (%5) inclusive step (%6) { llvm.store %arg2, %1 : !llvm.ptr omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_static_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(static) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i32) llvm.func @test_omp_wsloop_static_chunk_ordered(%lb : i32, %ub : i32, %step : i32) -> () { %static_chunk_size = llvm.mlir.constant(1 : i32) : i32 omp.wsloop schedule(static = %static_chunk_size : i32) ordered(0) for (%iv) : i32 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i32) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(dynamic) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_auto_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(auto) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_runtime_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(runtime) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_guided_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(guided) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic_nonmonotonic_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(dynamic, nonmonotonic) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @body(i64) llvm.func @test_omp_wsloop_dynamic_monotonic_ordered(%lb : i64, %ub : i64, %step : i64) -> () { omp.wsloop schedule(dynamic, monotonic) ordered(0) for (%iv) : i64 = (%lb) to (%ub) step (%step) { llvm.call @body(%iv) : (i64) -> () omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "omp.critical.declare @mutex_none hint(none) omp.critical.declare @mutex_uncontended hint(uncontended) omp.critical.declare @mutex_contended hint(contended) omp.critical.declare @mutex_nonspeculative hint(nonspeculative) omp.critical.declare @mutex_nonspeculative_uncontended hint(nonspeculative, uncontended) omp.critical.declare @mutex_nonspeculative_contended hint(nonspeculative, contended) omp.critical.declare @mutex_speculative hint(speculative) omp.critical.declare @mutex_speculative_uncontended hint(speculative, uncontended) omp.critical.declare @mutex_speculative_contended hint(speculative, contended) llvm.func @omp_critical(%x : !llvm.ptr, %xval : i32) -> () { omp.critical { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_none) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_uncontended) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_contended) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_nonspeculative) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_nonspeculative_uncontended) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_nonspeculative_contended) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_speculative) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_speculative_uncontended) { llvm.store %xval, %x : !llvm.ptr omp.terminator } omp.critical(@mutex_speculative_contended) { llvm.store %xval, %x : !llvm.ptr omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @collapse_wsloop( %0: i32, %1: i32, %2: i32, %3: i32, %4: i32, %5: i32, %6: i32, %7: i32, %8: i32, %20: !llvm.ptr) { omp.parallel { omp.wsloop for (%arg0, %arg1, %arg2) : i32 = (%0, %1, %2) to (%3, %4, %5) step (%6, %7, %8) { %31 = llvm.load %20 : !llvm.ptr %32 = llvm.add %31, %arg0 : i32 %33 = llvm.add %32, %arg1 : i32 %34 = llvm.add %33, %arg2 : i32 llvm.store %34, %20 : !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @collapse_wsloop_dynamic( %0: i32, %1: i32, %2: i32, %3: i32, %4: i32, %5: i32, %6: i32, %7: i32, %8: i32, %20: !llvm.ptr) { omp.parallel { omp.wsloop schedule(dynamic) for (%arg0, %arg1, %arg2) : i32 = (%0, %1, %2) to (%3, %4, %5) step (%6, %7, %8) { %31 = llvm.load %20 : !llvm.ptr %32 = llvm.add %31, %arg0 : i32 %33 = llvm.add %32, %arg1 : i32 %34 = llvm.add %33, %arg2 : i32 llvm.store %34, %20 : !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_ordered(%arg0 : i32, %arg1 : i32, %arg2 : i32, %arg3 : i64, %arg4: i64, %arg5: i64, %arg6: i64) -> () { omp.ordered_region { omp.terminator } omp.wsloop ordered(0) for (%arg7) : i32 = (%arg0) to (%arg1) step (%arg2) { omp.ordered_region { omp.terminator } omp.yield } omp.wsloop ordered(1) for (%arg7) : i32 = (%arg0) to (%arg1) step (%arg2) { omp.ordered depend_type(dependsink) depend_vec(%arg3 : i64) {num_loops_val = 1 : i64} omp.ordered depend_type(dependsource) depend_vec(%arg3 : i64) {num_loops_val = 1 : i64} omp.yield } omp.wsloop ordered(2) for (%arg7) : i32 = (%arg0) to (%arg1) step (%arg2) { omp.ordered depend_type(dependsink) depend_vec(%arg3, %arg4, %arg5, %arg6 : i64, i64, i64, i64) {num_loops_val = 2 : i64} omp.ordered depend_type(dependsource) depend_vec(%arg3, %arg4 : i64, i64) {num_loops_val = 2 : i64} omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_read(%arg0 : !llvm.ptr, %arg1 : !llvm.ptr) -> () { omp.atomic.read %arg1 = %arg0 : !llvm.ptr, i32 omp.atomic.read %arg1 = %arg0 memory_order(seq_cst) : !llvm.ptr, i32 omp.atomic.read %arg1 = %arg0 memory_order(acquire) : !llvm.ptr, i32 omp.atomic.read %arg1 = %arg0 memory_order(relaxed) : !llvm.ptr, i32 llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_write(%x: !llvm.ptr, %expr: i32) -> () { omp.atomic.write %x = %expr : !llvm.ptr, i32 omp.atomic.write %x = %expr memory_order(seq_cst) : !llvm.ptr, i32 omp.atomic.write %x = %expr memory_order(release) : !llvm.ptr, i32 omp.atomic.write %x = %expr memory_order(relaxed) : !llvm.ptr, i32 llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_update(%x:!llvm.ptr, %expr: i32, %xbool: !llvm.ptr, %exprbool: i1) { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.mul %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_update_ordering(%x:!llvm.ptr, %expr: i32) { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.shl %expr, %xval : i32 omp.yield(%newval : i32) } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_update_ordering(%x:!llvm.ptr, %expr: i32) { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.shl %xval, %expr : i32 omp.yield(%newval : i32) } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_update_intrinsic(%x:!llvm.ptr, %expr: i32) { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.smax""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.umax""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_capture_prefix_update( %x: !llvm.ptr, %v: !llvm.ptr, %expr: i32, %xf: !llvm.ptr, %vf: !llvm.ptr, %exprf: f32) -> () { omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.sub %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.and %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.or %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.xor %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.mul %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.sdiv %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.udiv %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.shl %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.lshr %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.ashr %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.smax""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.smin""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.umax""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.umin""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : !llvm.ptr, i32 } omp.atomic.capture { omp.atomic.update %xf : !llvm.ptr { ^bb0(%xval: f32): %newval = llvm.fadd %xval, %exprf : f32 omp.yield(%newval : f32) } omp.atomic.read %vf = %xf : !llvm.ptr, f32 } omp.atomic.capture { omp.atomic.update %xf : !llvm.ptr { ^bb0(%xval: f32): %newval = llvm.fsub %xval, %exprf : f32 omp.yield(%newval : f32) } omp.atomic.read %vf = %xf : !llvm.ptr, f32 } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_capture_postfix_update( %x: !llvm.ptr, %v: !llvm.ptr, %expr: i32, %xf: !llvm.ptr, %vf: !llvm.ptr, %exprf: f32) -> () { omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.sub %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.and %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.or %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.xor %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.mul %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.sdiv %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.udiv %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.shl %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.lshr %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.ashr %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.smax""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.smin""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.umax""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = ""llvm.intr.umin""(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } } omp.atomic.capture { omp.atomic.read %vf = %xf : !llvm.ptr, f32 omp.atomic.update %xf : !llvm.ptr { ^bb0(%xval: f32): %newval = llvm.fadd %xval, %exprf : f32 omp.yield(%newval : f32) } } omp.atomic.capture { omp.atomic.read %vf = %xf : !llvm.ptr, f32 omp.atomic.update %xf : !llvm.ptr { ^bb0(%xval: f32): %newval = llvm.fsub %xval, %exprf : f32 omp.yield(%newval : f32) } } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_atomic_capture_misc( %x: !llvm.ptr, %v: !llvm.ptr, %expr: i32, %xf: !llvm.ptr, %vf: !llvm.ptr, %exprf: f32) -> () { omp.atomic.capture{ omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.write %x = %expr : !llvm.ptr, i32 } omp.atomic.capture{ omp.atomic.read %vf = %xf : !llvm.ptr, f32 omp.atomic.write %xf = %exprf : !llvm.ptr, f32 } omp.atomic.capture memory_order(seq_cst) { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture memory_order(acquire) { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture memory_order(release) { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture memory_order(relaxed) { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture memory_order(acq_rel) { omp.atomic.read %v = %x : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_sections_empty() -> () { omp.sections { omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_sections_trivial() -> () { omp.sections { omp.section { omp.terminator } omp.section { omp.terminator } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() llvm.func @bar(%arg0 : i32) llvm.func @omp_sections(%arg0 : i32, %arg1 : i32, %arg2 : !llvm.ptr) -> () { omp.sections { omp.section { llvm.call @foo() : () -> () omp.terminator } omp.section { llvm.call @bar(%arg0) : (i32) -> () omp.terminator } omp.section { %add = llvm.add %arg0, %arg1 : i32 llvm.store %add, %arg2 : !llvm.ptr omp.terminator } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() llvm.func @omp_sections_with_clauses() -> () { omp.sections nowait { omp.section { llvm.call @foo() : () -> () omp.terminator } omp.section { llvm.call @foo() : () -> () omp.terminator } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @repeated_successor(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i1) { omp.wsloop for (%arg4) : i64 = (%arg0) to (%arg1) step (%arg2) { llvm.cond_br %arg3, ^bb1(%arg0 : i64), ^bb1(%arg1 : i64) ^bb1(%0: i64): omp.yield } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @single(%x: i32, %y: i32, %zaddr: !llvm.ptr) { %a = llvm.sub %x, %y : i32 llvm.store %a, %zaddr : !llvm.ptr omp.single { %z = llvm.add %x, %y : i32 llvm.store %z, %zaddr : !llvm.ptr omp.terminator } %b = llvm.mul %x, %y : i32 llvm.store %b, %zaddr : !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @single_nowait(%x: i32, %y: i32, %zaddr: !llvm.ptr) { %a = llvm.sub %x, %y : i32 llvm.store %a, %zaddr : !llvm.ptr omp.single nowait { %z = llvm.add %x, %y : i32 llvm.store %z, %zaddr : !llvm.ptr omp.terminator } %t = llvm.mul %x, %y : i32 llvm.store %t, %zaddr : !llvm.ptr llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_threadprivate() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i32) : i32 %2 = llvm.mlir.constant(3 : i32) : i32 %3 = llvm.mlir.addressof @_QFsubEx : !llvm.ptr %4 = omp.threadprivate %3 : !llvm.ptr -> !llvm.ptr llvm.store %0, %4 : !llvm.ptr omp.parallel { %5 = omp.threadprivate %3 : !llvm.ptr -> !llvm.ptr llvm.store %1, %5 : !llvm.ptr omp.terminator } llvm.store %2, %4 : !llvm.ptr llvm.return } llvm.mlir.global internal @_QFsubEx() : i32", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_task(%x: i32, %y: i32, %zaddr: !llvm.ptr) { omp.task { %n = llvm.mlir.constant(1 : i64) : i64 %valaddr = llvm.alloca %n x i32 : (i64) -> !llvm.ptr %val = llvm.load %valaddr : !llvm.ptr %double = llvm.add %val, %val : i32 llvm.store %double, %valaddr : !llvm.ptr omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_task_with_deps(%zaddr: !llvm.ptr) { omp.task depend(taskdependin -> %zaddr : !llvm.ptr) { %n = llvm.mlir.constant(1 : i64) : i64 %valaddr = llvm.alloca %n x i32 : (i64) -> !llvm.ptr %val = llvm.load %valaddr : !llvm.ptr %double = llvm.add %val, %val : i32 llvm.store %double, %valaddr : !llvm.ptr omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {llvm.target_triple = ""x86_64-unknown-linux-gnu""} { llvm.func @omp_task(%x: i32, %y: i32, %zaddr: !llvm.ptr) { %diff = llvm.sub %x, %y : i32 llvm.store %diff, %zaddr : !llvm.ptr omp.task { %z = llvm.add %x, %y : i32 llvm.store %z, %zaddr : !llvm.ptr omp.terminator } %b = llvm.mul %x, %y : i32 llvm.store %b, %zaddr : !llvm.ptr llvm.return } }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @par_task_(%arg0: !llvm.ptr {fir.bindc_name = ""a""}) { %0 = llvm.mlir.constant(1 : i32) : i32 omp.task { omp.parallel { llvm.store %0, %arg0 : !llvm.ptr omp.terminator } omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() -> () llvm.func @omp_taskgroup(%x: i32, %y: i32, %zaddr: !llvm.ptr) { omp.taskgroup { llvm.call @foo() : () -> () omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @foo() -> () llvm.func @bar(i32, i32, !llvm.ptr) -> () llvm.func @omp_taskgroup_task(%x: i32, %y: i32, %zaddr: !llvm.ptr) { omp.taskgroup { %c1 = llvm.mlir.constant(1) : i32 %ptr1 = llvm.alloca %c1 x i8 : (i32) -> !llvm.ptr omp.task { llvm.call @foo() : () -> () omp.terminator } omp.task { llvm.call @bar(%x, %y, %zaddr) : (i32, i32, !llvm.ptr) -> () omp.terminator } llvm.br ^bb1 ^bb1: llvm.call @foo() : () -> () omp.terminator } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @omp_opaque_pointers(%arg0 : !llvm.ptr, %arg1: !llvm.ptr, %expr: i32) -> () { omp.atomic.read %arg1 = %arg0 : !llvm.ptr, i32 omp.atomic.capture memory_order(acq_rel) { omp.atomic.read %arg0 = %arg1 : !llvm.ptr, i32 omp.atomic.update %arg1 : !llvm.ptr { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {omp.flags = #omp.flags} {}", mlir-translate -mlir-to-llvmir -split-input-file ,1 module attributes {omp.flags = #omp.flags<>} {}, mlir-translate -mlir-to-llvmir -split-input-file ,1 module attributes {omp.flags = #omp.flags} {}, mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {omp.version = #omp.version, omp.flags = #omp.flags<>} {}", mlir-translate -mlir-to-llvmir -split-input-file ,1 module attributes {omp.version = #omp.version} {}, mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {omp.flags = #omp.flags} {}", mlir-translate -mlir-to-llvmir -split-input-file ,1 "module attributes {omp.flags = #omp.flags} {}", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @testenterdataop(%arg0: !llvm.ptr, %arg1 : !llvm.ptr) { %0 = acc.create varPtr(%arg0 : !llvm.ptr) -> !llvm.ptr %1 = acc.copyin varPtr(%arg1 : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%0, %1 : !llvm.ptr, !llvm.ptr) llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @testexitdataop(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { %arg0_devptr = acc.getdeviceptr varPtr(%arg0 : !llvm.ptr) -> !llvm.ptr %1 = acc.getdeviceptr varPtr(%arg1 : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%arg0_devptr, %1 : !llvm.ptr, !llvm.ptr) acc.delete accPtr(%arg0_devptr : !llvm.ptr) acc.copyout accPtr(%1 : !llvm.ptr) to varPtr(%arg1 : !llvm.ptr) llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @testupdateop(%arg1: !llvm.ptr) { %0 = acc.update_device varPtr(%arg1 : !llvm.ptr) -> !llvm.ptr acc.update dataOperands(%0 : !llvm.ptr) llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "llvm.func @testdataop(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr) { %0 = acc.copyin varPtr(%arg0 : !llvm.ptr) -> !llvm.ptr %1 = acc.create varPtr(%arg1 : !llvm.ptr) -> !llvm.ptr acc.data dataOperands(%0, %1 : !llvm.ptr, !llvm.ptr) { %9 = llvm.mlir.constant(2 : i32) : i32 llvm.store %9, %arg2 : !llvm.ptr acc.terminator } acc.copyout accPtr(%0 : !llvm.ptr) to varPtr(%arg0 : !llvm.ptr) acc.copyout accPtr(%1 : !llvm.ptr) to varPtr(%arg1 : !llvm.ptr) llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file ,1 "func.func @genbool_1d() -> vector<8xi1> { %0 = vector.constant_mask [4] : vector<8xi1> return %0 : vector<8xi1> } func.func @genbool_2d() -> vector<4x4xi1> { %v = vector.constant_mask [2, 2] : vector<4x4xi1> return %v: vector<4x4xi1> } func.func @genbool_3d() -> vector<2x3x4xi1> { %v = vector.constant_mask [1, 1, 3] : vector<2x3x4xi1> return %v: vector<2x3x4xi1> } func.func @genbool_1d_var_but_constant() -> vector<8xi1> { %i = arith.constant 0 : index %v = vector.create_mask %i : vector<8xi1> return %v : vector<8xi1> }"," mlir-opt -pass-pipeline=""builtin.module(convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-translate -mlir-to-llvmir ",1 "llvm.func @nvvm_special_regs() -> i32 { %1 = nvvm.read.ptx.sreg.tid.x : i32 %2 = nvvm.read.ptx.sreg.tid.y : i32 %3 = nvvm.read.ptx.sreg.tid.z : i32 %4 = nvvm.read.ptx.sreg.ntid.x : i32 %5 = nvvm.read.ptx.sreg.ntid.y : i32 %6 = nvvm.read.ptx.sreg.ntid.z : i32 %7 = nvvm.read.ptx.sreg.ctaid.x : i32 %8 = nvvm.read.ptx.sreg.ctaid.y : i32 %9 = nvvm.read.ptx.sreg.ctaid.z : i32 %10 = nvvm.read.ptx.sreg.nctaid.x : i32 %11 = nvvm.read.ptx.sreg.nctaid.y : i32 %12 = nvvm.read.ptx.sreg.nctaid.z : i32 %13 = nvvm.read.ptx.sreg.warpsize : i32 %14 = nvvm.read.ptx.sreg.laneid : i32 llvm.return %1 : i32 } llvm.func @nvvm_rcp(%0: f32) -> f32 { %1 = nvvm.rcp.approx.ftz.f %0 : f32 llvm.return %1 : f32 } llvm.func @llvm_nvvm_barrier0() { nvvm.barrier0 llvm.return } llvm.func @nvvm_shfl( %0 : i32, %1 : i32, %2 : i32, %3 : i32, %4 : f32) -> i32 { %6 = nvvm.shfl.sync bfly %0, %3, %1, %2 : i32 -> i32 %7 = nvvm.shfl.sync bfly %0, %4, %1, %2 : f32 -> f32 %8 = nvvm.shfl.sync up %0, %3, %1, %2 : i32 -> i32 %9 = nvvm.shfl.sync up %0, %4, %1, %2 : f32 -> f32 %10 = nvvm.shfl.sync down %0, %3, %1, %2 : i32 -> i32 %11 = nvvm.shfl.sync down %0, %4, %1, %2 : f32 -> f32 %12 = nvvm.shfl.sync idx %0, %3, %1, %2 : i32 -> i32 %13 = nvvm.shfl.sync idx %0, %4, %1, %2 : f32 -> f32 llvm.return %6 : i32 } llvm.func @nvvm_shfl_pred( %0 : i32, %1 : i32, %2 : i32, %3 : i32, %4 : f32) -> !llvm.struct<(i32, i1)> { %6 = nvvm.shfl.sync bfly %0, %3, %1, %2 {return_value_and_is_valid} : i32 -> !llvm.struct<(i32, i1)> %7 = nvvm.shfl.sync bfly %0, %4, %1, %2 {return_value_and_is_valid} : f32 -> !llvm.struct<(f32, i1)> %8 = nvvm.shfl.sync up %0, %3, %1, %2 {return_value_and_is_valid} : i32 -> !llvm.struct<(i32, i1)> %9 = nvvm.shfl.sync up %0, %4, %1, %2 {return_value_and_is_valid} : f32 -> !llvm.struct<(f32, i1)> %10 = nvvm.shfl.sync down %0, %3, %1, %2 {return_value_and_is_valid} : i32 -> !llvm.struct<(i32, i1)> %11 = nvvm.shfl.sync down %0, %4, %1, %2 {return_value_and_is_valid} : f32 -> !llvm.struct<(f32, i1)> %12 = nvvm.shfl.sync idx %0, %3, %1, %2 {return_value_and_is_valid} : i32 -> !llvm.struct<(i32, i1)> %13 = nvvm.shfl.sync idx %0, %4, %1, %2 {return_value_and_is_valid} : f32 -> !llvm.struct<(f32, i1)> llvm.return %6 : !llvm.struct<(i32, i1)> } llvm.func @nvvm_vote(%0 : i32, %1 : i1) -> i32 { %3 = nvvm.vote.ballot.sync %0, %1 : i32 llvm.return %3 : i32 } llvm.func @nvvm_mma_mn8n8k4_row_col_f32_f32(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32, %c4 : f32, %c5 : f32, %c6 : f32, %c7 : f32) -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0, %b1] C[%c0, %c1, %c2, %c3, %c4, %c5, %c6, %c7] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, f32) -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> } llvm.func @nvvm_mma_m16n8k16_f16_f16(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : vector<2xf16>, %c1 : vector<2xf16>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> { %0 = nvvm.mma.sync A[ %a0, %a1, %a2, %a3 ] B[ %b0, %b1 ] C[ %c0, %c1 ] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, vector<2xf16>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> llvm.return %0 : !llvm.struct<(vector<2xf16>, vector<2xf16>)> } llvm.func @nvvm_mma_m16n8k16_f32_f16(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : vector<2xf16>, %c1 : vector<2xf16>) -> !llvm.struct<(f32, f32, f32, f32)> { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, vector<2xf16>) -> !llvm.struct<(f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32)> } llvm.func @nvvm_mma_m16n8k16_f16_f32(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, f32) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> llvm.return %0 : !llvm.struct<(vector<2xf16>, vector<2xf16>)> } llvm.func @nvvm_mma_m16n8k16_f32_f32(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32) -> !llvm.struct<(f32, f32, f32, f32)> { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, f32) -> !llvm.struct<(f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32)> } llvm.func @nvvm_mma_m16n8k16_s8_s8(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) -> !llvm.struct<(i32, i32, i32, i32)> { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } llvm.func @nvvm_mma_m16n8k16_s8_u8(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) -> !llvm.struct<(i32, i32, i32, i32)> { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } llvm.func @nvvm_mma_m16n8k128_b1_b1(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) -> !llvm.struct<(i32,i32,i32,i32)> { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, b1Op = #nvvm.mma_b1op, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } llvm.func @nvvm_mma_m16n8k32_s4_s4(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) -> !llvm.struct<(i32,i32,i32,i32)> { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } llvm.func @nvvm_mma_m8n8k4_f64_f64(%a0 : f64, %b0 : f64, %c0 : f64, %c1 : f64) -> !llvm.struct<(f64, f64)> { %0 = nvvm.mma.sync A[%a0] B[%b0] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (f64, f64, f64) -> !llvm.struct<(f64, f64)> llvm.return %0 : !llvm.struct<(f64, f64)> } llvm.func @nvvm_mma_m16n8k4_tf32_f32(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32) -> !llvm.struct<(f32, f32, f32, f32)> { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, shape = #nvvm.shape} : (i32, i32, f32) -> !llvm.struct<(f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32)> } llvm.func @gpu_wmma_load_op(%arg0: !llvm.ptr, %arg1: i32) { %0 = nvvm.wmma.load %arg0, %arg1 {eltype = #nvvm.mma_type, frag = #nvvm.mma_frag, k = 16 : i32, layout = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (!llvm.ptr) -> !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)> llvm.return } llvm.func @gpu_wmma_store_op(%arg0: !llvm.ptr, %arg1: i32, %arg2: vector<2 x f16>, %arg3: vector<2 x f16>, %arg4: vector<2 xf16>, %arg5: vector<2 x f16>) { nvvm.wmma.store %arg0, %arg1, %arg2, %arg3, %arg4, %arg5 {eltype = #nvvm.mma_type, k = 16 : i32, layout = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : !llvm.ptr, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16> llvm.return } llvm.func @gpu_wmma_mma_op(%arg0: vector<2 x f16>, %arg1: vector<2 x f16>, %arg2: vector<2 x f16>, %arg3: vector<2 x f16>, %arg4: vector<2 x f16>, %arg5: vector<2 x f16>, %arg6: vector<2 x f16>, %arg7: vector<2 x f16>, %arg8: vector<2 x f16>, %arg9: vector<2 x f16>, %arg10: vector<2 x f16>, %arg11: vector<2 x f16>, %arg12: vector<2 x f16>, %arg13: vector<2 x f16>, %arg14: vector<2 x f16>, %arg15: vector<2 x f16>, %arg16: vector<2 x f16>, %arg17: vector<2 x f16>, %arg18: vector<2 x f16>, %arg19: vector<2 x f16>) { %0 = nvvm.wmma.mma %arg0, %arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10, %arg11, %arg12, %arg13, %arg14, %arg15, %arg16, %arg17, %arg18, %arg19 {eltypeA = #nvvm.mma_type, eltypeB = #nvvm.mma_type, k = 16 : i32, layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>) -> !llvm.struct<(vector<2 x f16>, vector<2 x f16>, vector<2 x f16>, vector<2 x f16>)> llvm.return } llvm.func @nvvm_wmma_load_tf32(%arg0: !llvm.ptr, %arg1 : i32) { %0 = nvvm.wmma.load %arg0, %arg1 {eltype = #nvvm.mma_type, frag = #nvvm.mma_frag, k = 8 : i32, layout = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (!llvm.ptr) -> !llvm.struct<(i32, i32, i32, i32)> llvm.return } llvm.func @nvvm_wmma_mma(%0 : i32, %1 : i32, %2 : i32, %3 : i32, %4 : i32, %5 : i32, %6 : i32, %7 : i32, %8 : f32, %9 : f32, %10 : f32, %11 : f32, %12 : f32, %13 : f32, %14 : f32, %15 : f32) { %r = nvvm.wmma.mma %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15 {eltypeA = #nvvm.mma_type, eltypeB = #nvvm.mma_type, k = 8 : i32, layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (i32, i32, i32, i32, i32, i32, i32, i32, f32, f32, f32, f32, f32, f32, f32, f32) -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> llvm.return } llvm.func @cp_async(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { nvvm.cp.async.shared.global %arg0, %arg1, 4 : !llvm.ptr, !llvm.ptr nvvm.cp.async.shared.global %arg0, %arg1, 8 : !llvm.ptr, !llvm.ptr nvvm.cp.async.shared.global %arg0, %arg1, 16 : !llvm.ptr, !llvm.ptr nvvm.cp.async.shared.global %arg0, %arg1, 16 {bypass_l1} : !llvm.ptr, !llvm.ptr nvvm.cp.async.commit.group nvvm.cp.async.wait.group 0 llvm.return } llvm.func @ld_matrix(%arg0: !llvm.ptr) { %l1 = nvvm.ldmatrix %arg0 {num = 1 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> i32 %l2 = nvvm.ldmatrix %arg0 {num = 2 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> !llvm.struct<(i32, i32)> %l4 = nvvm.ldmatrix %arg0 {num = 4 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> !llvm.struct<(i32, i32, i32, i32)> %l1t = nvvm.ldmatrix %arg0 {num = 1 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> i32 %l2t = nvvm.ldmatrix %arg0 {num = 2 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> !llvm.struct<(i32, i32)> %l4t = nvvm.ldmatrix %arg0 {num = 4 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> !llvm.struct<(i32, i32, i32, i32)> llvm.return } llvm.func @kernel_func() attributes {nvvm.kernel} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.maxntid = [1,23,32]} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.reqntid = [1,23,32]} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.minctasm = 16} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.maxnreg = 16} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.maxntid = [1,23,32], nvvm.minctasm = 16, nvvm.maxnreg = 32} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.minctasm = ""foo""} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.maxnreg = ""boo""} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.reqntid = [3,4,5,6]} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "llvm.func @kernel_func() attributes {nvvm.kernel, nvvm.maxntid = [3,4,5,6]} { llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file --verify-diagnostics ,1 "func.func @matmul_tensors( %arg0: tensor<2x4xf32>, %arg1: tensor<4x6xf32>, %arg2: tensor<2x6xf32>) -> tensor<2x6xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<2x4xf32>, tensor<4x6xf32>) outs(%arg2: tensor<2x6xf32>) -> tensor<2x6xf32> return %0 : tensor<2x6xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %module_op : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2, 2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2 = get_closest_isolated_parent %1 : (!transform.any_op) -> !transform.any_op transform.structured.vectorize %2 : (!transform.any_op) -> !transform.any_op %b = transform.bufferization.one_shot_bufferize layout{IdentityLayoutMap} %module_op {bufferize_function_boundaries = true} : (!transform.any_op) -> !transform.any_op %f = transform.structured.match ops{[""func.func""]} in %b : (!transform.any_op) -> !transform.any_op %func = transform.vector.lower_contraction %f lowering_strategy = ""outerproduct"" : (!transform.any_op) -> !transform.any_op %func_2 = transform.vector.apply_transfer_permutation_patterns %func : (!transform.any_op) -> !transform.any_op %func_3 = transform.vector.lower_multi_reduction %func_2 lowering_strategy = ""innerparallel"" : (!transform.any_op) -> !transform.any_op %func_4 = transform.vector.split_transfer_full_partial %func_3 split_transfer_strategy = ""linalg-copy"" : (!transform.any_op) -> !transform.any_op %func_5 = transform.vector.transfer_to_scf %func_4 max_transfer_rank = 1 full_unroll = true : (!transform.any_op) -> !transform.any_op %func_6 = transform.vector.lower_transfer %func_5 max_transfer_rank = 1 : (!transform.any_op) -> !transform.any_op %func_7 = transform.vector.lower_shape_cast %func_6 : (!transform.any_op) -> !transform.any_op %func_8 = transform.vector.lower_transpose %func_7 lowering_strategy = ""shuffle_1d"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -test-transform-dialect-erase-schedule --test-lower-to-llvm --split-input-file ,1 "func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) -> memref> { %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref> return %1 : memref> }", mlir-opt -o - -test-lower-to-llvm -cse -split-input-file ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @linkage_attr_test_kernel() ""DontInline"" attributes {} { %uchar_0 = spirv.Constant 0 : i8 %ushort_1 = spirv.Constant 1 : i16 %uint_0 = spirv.Constant 0 : i32 spirv.FunctionCall @outside.func.with.linkage(%uchar_0):(i8) -> () spirv.Return } spirv.func @outside.func.with.linkage(%arg0 : i8) -> () ""Pure"" attributes { linkage_attributes=#spirv.linkage_attributes< linkage_name=""outside.func"", linkage_type= > } spirv.func @inside.func() -> () ""Pure"" attributes {} {spirv.Return} }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_load(%ptr : !spirv.ptr, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride : (!spirv.ptr, i32) -> !spirv.jointmatrix<16x8xi32, RowMajor, Workgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_load_memaccess(%ptr : !spirv.ptr, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride {memory_access = #spirv.memory_access} : (!spirv.ptr, i32) -> !spirv.jointmatrix<8x16xi32, ColumnMajor, Subgroup> spirv.Return } spirv.func @joint_matrix_load_diff_ptr_type(%ptr : !spirv.ptr, Workgroup>, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride {memory_access = #spirv.memory_access} : (!spirv.ptr, Workgroup>, i32) -> !spirv.jointmatrix<8x16xi32, RowMajor, Workgroup> spirv.Return } spirv.func @joint_matrix_store(%ptr : !spirv.ptr, %stride : i32, %m : !spirv.jointmatrix<8x16xi32, RowMajor, Workgroup>) ""None"" { spirv.INTEL.JointMatrixStore %ptr, %m, %stride : (!spirv.ptr, !spirv.jointmatrix<8x16xi32, RowMajor, Workgroup>, i32) spirv.Return } spirv.func @joint_matrix_store_memaccess(%ptr : !spirv.ptr, %m : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, %stride : i32) ""None"" { spirv.INTEL.JointMatrixStore %ptr, %m, %stride {Volatile} : (!spirv.ptr, !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, i32) spirv.Return } spirv.func @joint_matrix_length() -> i32 ""None"" { %0 = spirv.INTEL.JointMatrixWorkItemLength : !spirv.jointmatrix<8x16xi32, PackedB, Subgroup> spirv.ReturnValue %0 : i32 } spirv.func @joint_matrix_muladd(%a : !spirv.jointmatrix<8x32xi8, RowMajor, Subgroup>, %b : !spirv.jointmatrix<32x8xi8, ColumnMajor, Subgroup>, %c : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>) ""None"" { %r = spirv.INTEL.JointMatrixMad %a, %b, %c : !spirv.jointmatrix<8x32xi8, RowMajor, Subgroup>, !spirv.jointmatrix<32x8xi8, ColumnMajor, Subgroup> -> !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_muladd(%a : !spirv.jointmatrix<16x16xi32, RowMajor, Subgroup>, %b : !spirv.jointmatrix<16x8xi32, RowMajor, Subgroup>, %c : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>) ""None"" { %r = spirv.INTEL.JointMatrixMad %a, %b, %c : !spirv.jointmatrix<16x16xi32, RowMajor, Subgroup>, !spirv.jointmatrix<16x8xi32, RowMajor, Subgroup> -> !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_muladd(%a : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, %b : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>, %c : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>) ""None"" { %r = spirv.INTEL.JointMatrixMad %a, %b, %c : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> -> !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_muladd(%a : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, %b : !spirv.jointmatrix<16x8xi32, RowMajor, Workgroup>, %c : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>) ""None"" { %r = spirv.INTEL.JointMatrixMad %a, %b, %c : !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup>, !spirv.jointmatrix<16x8xi32, RowMajor, Workgroup> -> !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_muladd(%a : !spirv.jointmatrix<8x16xf32, RowMajor, Subgroup>, %b : !spirv.jointmatrix<16x8xi32, RowMajor, Subgroup>, %c : !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup>) ""None"" { %r = spirv.INTEL.JointMatrixMad %a, %b, %c : !spirv.jointmatrix<8x16xf32, RowMajor, Subgroup>, !spirv.jointmatrix<16x8xi32, RowMajor, Subgroup> -> !spirv.jointmatrix<8x8xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_load_memaccess(%ptr : !spirv.ptr, Workgroup>, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride : (!spirv.ptr, Workgroup>, i32)-> !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @joint_matrix_load_memaccess(%ptr : !spirv.ptr, %stride : i32) ""None"" { %0 = spirv.INTEL.JointMatrixLoad %ptr, %stride : (!spirv.ptr, i32) -> !spirv.jointmatrix<8x16xi32, RowMajor, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @iadd(%arg: i32) -> i32 { %0 = spirv.IAdd %arg, %arg: i32 return %0: i32 } func.func @atomic_compare_exchange_weak(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 { %0 = spirv.AtomicCompareExchangeWeak ""Workgroup"" ""Release"" ""Acquire"" %ptr, %value, %comparator: !spirv.ptr return %0: i32 } func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> { %0 = spirv.GroupNonUniformBallot %predicate : vector<4xi32> return %0: vector<4xi32> } func.func @module_logical_glsl450() { spirv.module Logical GLSL450 { } return } func.func @module_physical_storage_buffer64_vulkan() { spirv.module PhysicalStorageBuffer64 Vulkan { } return } func.func @sdot_scalar_i32_i32(%a: i32) -> i32 { %r = spirv.SDot %a, %a {format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r: i32 } func.func @sdot_vector_4xi8_i64(%a: vector<4xi8>) -> i64 { %r = spirv.SDot %a, %a: (vector<4xi8>, vector<4xi8>) -> i64 return %r: i64 } func.func @sdot_vector_4xi16_i64(%a: vector<4xi16>) -> i64 { %r = spirv.SDot %a, %a: (vector<4xi16>, vector<4xi16>) -> i64 return %r: i64 } func.func @sudot_scalar_i32_i32(%a: i32) -> i32 { %r = spirv.SUDot %a, %a {format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r: i32 } func.func @sudot_vector_4xi8_i64(%a: vector<4xi8>) -> i64 { %r = spirv.SUDot %a, %a: (vector<4xi8>, vector<4xi8>) -> i64 return %r: i64 } func.func @sudot_vector_4xi16_i64(%a: vector<4xi16>) -> i64 { %r = spirv.SUDot %a, %a: (vector<4xi16>, vector<4xi16>) -> i64 return %r: i64 } func.func @udot_scalar_i32_i32(%a: i32) -> i32 { %r = spirv.UDot %a, %a {format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r: i32 } func.func @udot_vector_4xi8_i64(%a: vector<4xi8>) -> i64 { %r = spirv.UDot %a, %a: (vector<4xi8>, vector<4xi8>) -> i64 return %r: i64 } func.func @udot_vector_4xi16_i64(%a: vector<4xi16>) -> i64 { %r = spirv.UDot %a, %a: (vector<4xi16>, vector<4xi16>) -> i64 return %r: i64 } func.func @sdot_acc_sat_scalar_i32_i32(%a: i32) -> i32 { %r = spirv.SDotAccSat %a, %a, %a {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i32 return %r: i32 } func.func @sdot_acc_sat_vector_4xi8_i64(%a: vector<4xi8>, %acc: i64) -> i64 { %r = spirv.SDotAccSat %a, %a, %acc: (vector<4xi8>, vector<4xi8>, i64) -> i64 return %r: i64 } func.func @sdot_acc_sat_vector_4xi16_i64(%a: vector<4xi16>, %acc: i64) -> i64 { %r = spirv.SDotAccSat %a, %a, %acc: (vector<4xi16>, vector<4xi16>, i64) -> i64 return %r: i64 } func.func @sudot_acc_sat_scalar_i32_i32(%a: i32) -> i32 { %r = spirv.SUDotAccSat %a, %a, %a {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i32 return %r: i32 } func.func @sudot_acc_sat_vector_4xi8_i64(%a: vector<4xi8>, %acc: i64) -> i64 { %r = spirv.SUDotAccSat %a, %a, %acc: (vector<4xi8>, vector<4xi8>, i64) -> i64 return %r: i64 } func.func @sudot_acc_sat_vector_4xi16_i64(%a: vector<4xi16>, %acc: i64) -> i64 { %r = spirv.SUDotAccSat %a, %a, %acc: (vector<4xi16>, vector<4xi16>, i64) -> i64 return %r: i64 } func.func @udot_acc_sat_scalar_i32_i32(%a: i32) -> i32 { %r = spirv.UDotAccSat %a, %a, %a {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i32 return %r: i32 } func.func @udot_acc_sat_vector_4xi8_i64(%a: vector<4xi8>, %acc: i64) -> i64 { %r = spirv.UDotAccSat %a, %a, %acc: (vector<4xi8>, vector<4xi8>, i64) -> i64 return %r: i64 } func.func @udot_acc_sat_vector_4xi16_i64(%a: vector<4xi16>, %acc: i64) -> i64 { %r = spirv.UDotAccSat %a, %a, %acc: (vector<4xi16>, vector<4xi16>, i64) -> i64 return %r: i64 }", mlir-opt -mlir-disable-threading -test-spirv-op-availability ,1 "func.func @undef() -> () { %0 = spirv.Undef : f32 %1 = spirv.Undef : vector<4xf32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @undef() -> () { %0 = spirv.Undef : spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @undef() -> () { %0 = spirv.Undef spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @assume_true(%arg : i1) -> () { spirv.KHR.AssumeTrue %arg spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @assume_true(%arg : f32) -> () { spirv.KHR.AssumeTrue %arg spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @main() { return }", mlir-opt --split-input-file --verify-diagnostics --mlir-disable-threading --test-spirv-target-env ,1 "func.func @cmp_exchange_weak_suitable_version_capabilities(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_atomic_compare_exchange_weak_op""(%ptr, %value, %comparator): (!spirv.ptr, i32, i32) -> (i32) return %0: i32 } func.func @cmp_exchange_weak_unsupported_version(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_atomic_compare_exchange_weak_op""(%ptr, %value, %comparator): (!spirv.ptr, i32, i32) -> (i32) return %0: i32 } func.func @group_non_uniform_ballot_suitable_version(%predicate: i1) -> vector<4xi32> attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_group_non_uniform_ballot_op""(%predicate): (i1) -> (vector<4xi32>) return %0: vector<4xi32> } func.func @group_non_uniform_ballot_unsupported_version(%predicate: i1) -> vector<4xi32> attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_group_non_uniform_ballot_op""(%predicate): (i1) -> (vector<4xi32>) return %0: vector<4xi32> } func.func @cmp_exchange_weak_missing_capability_kernel(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_atomic_compare_exchange_weak_op""(%ptr, %value, %comparator): (!spirv.ptr, i32, i32) -> (i32) return %0: i32 } func.func @cmp_exchange_weak_missing_capability_atomic_storage(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_atomic_compare_exchange_weak_op""(%ptr, %value, %comparator): (!spirv.ptr, i32, i32) -> (i32) return %0: i32 } func.func @subgroup_ballot_missing_capability(%predicate: i1) -> vector<4xi32> attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_subgroup_ballot_op""(%predicate): (i1) -> (vector<4xi32>) return %0: vector<4xi32> } func.func @bit_reverse_directly_implied_capability(%operand: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_bit_reverse_op""(%operand): (i32) -> (i32) return %0: i32 } func.func @bit_reverse_recursively_implied_capability(%operand: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_bit_reverse_op""(%operand): (i32) -> (i32) return %0: i32 } func.func @sdot_scalar_i32_i32_capabilities(%operand: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sdot_op""(%operand, %operand) {format = #spirv.packed_vector_format}: (i32, i32) -> (i32) return %0: i32 } func.func @sdot_scalar_i32_i32_missing_capability1(%operand: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sdot_op""(%operand, %operand) {format = #spirv.packed_vector_format}: (i32, i32) -> (i32) return %0: i32 } func.func @sdot_scalar_i32_i32_missing_capability2(%operand: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sdot_op""(%operand, %operand) {format = #spirv.packed_vector_format}: (i32, i32) -> (i32) return %0: i32 } func.func @sudot_vector_4xi8_i32_capabilities(%operand: vector<4xi8>) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sudot_op""(%operand, %operand): (vector<4xi8>, vector<4xi8>) -> (i32) return %0: i32 } func.func @sudot_vector_4xi8_i32_missing_capability1(%operand: vector<4xi8>) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sudot_op""(%operand, %operand): (vector<4xi8>, vector<4xi8>) -> (i32) return %0: i32 } func.func @sudot_vector_4xi8_i32_missing_capability2(%operand: vector<4xi8>) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sudot_op""(%operand, %operand): (vector<4xi8>, vector<4xi8>) -> (i32) return %0: i32 } func.func @udot_vector_4xi16_i64_capabilities(%operand: vector<4xi16>) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_op""(%operand, %operand): (vector<4xi16>, vector<4xi16>) -> (i64) return %0: i64 } func.func @udot_vector_4xi16_i64_missing_capability1(%operand: vector<4xi16>) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_op""(%operand, %operand): (vector<4xi16>, vector<4xi16>) -> (i64) return %0: i64 } func.func @udot_vector_4xi16_i64_missing_capability2(%operand: vector<4xi16>) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_op""(%operand, %operand): (vector<4xi16>, vector<4xi16>) -> (i64) return %0 : i64 } func.func @sdot_acc_sat_scalar_i32_i32_capabilities(%operand: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sdot_acc_sat_op""(%operand, %operand, %operand) {format = #spirv.packed_vector_format}: (i32, i32, i32) -> (i32) return %0: i32 } func.func @sudot_acc_sat_vector_4xi8_i32_capabilities(%operand: vector<4xi8>, %acc: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sudot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi8>, vector<4xi8>, i32) -> (i32) return %0: i32 } func.func @udot_acc_sat_vector_4xi8_i32_missing_capability1(%operand: vector<4xi8>, %acc: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi8>, vector<4xi8>, i32) -> (i32) return %0: i32 } func.func @udot_acc_sat_vector_4xi8_i32_missing_capability2(%operand: vector<4xi8>, %acc: i32) -> i32 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi8>, vector<4xi8>, i32) -> (i32) return %0: i32 } func.func @udot_acc_sat_vector_4xi16_i64_capabilities(%operand: vector<4xi16>, %acc: i64) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi16>, vector<4xi16>, i64) -> (i64) return %0: i64 } func.func @udot_acc_sat_vector_4xi16_i64_missing_capability1(%operand: vector<4xi16>, %acc: i64) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi16>, vector<4xi16>, i64) -> (i64) return %0: i64 } func.func @udot_acc_sat_vector_4xi16_i64_missing_capability2(%operand: vector<4xi16>, %acc: i64) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi16>, vector<4xi16>, i64) -> (i64) return %0: i64 } func.func @subgroup_ballot_suitable_extension(%predicate: i1) -> vector<4xi32> attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_subgroup_ballot_op""(%predicate): (i1) -> (vector<4xi32>) return %0: vector<4xi32> } func.func @subgroup_ballot_missing_extension(%predicate: i1) -> vector<4xi32> attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_subgroup_ballot_op""(%predicate): (i1) -> (vector<4xi32>) return %0: vector<4xi32> } func.func @module_suitable_extension1() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { ""test.convert_to_module_op""() : () ->() return } func.func @module_suitable_extension2() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { ""test.convert_to_module_op""() : () -> () return } func.func @module_missing_extension_mm() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { ""test.convert_to_module_op""() : () -> () return } func.func @module_missing_extension_am() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { ""test.convert_to_module_op""() : () -> () return } func.func @module_implied_extension() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { ""test.convert_to_module_op""() : () -> () return } func.func @udot_vector_4xi16_i64_implied_extension(%operand: vector<4xi16>) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_op""(%operand, %operand): (vector<4xi16>, vector<4xi16>) -> (i64) return %0: i64 } func.func @udot_vector_4xi16_i64_missing_extension(%operand: vector<4xi16>) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_udot_op""(%operand, %operand): (vector<4xi16>, vector<4xi16>) -> (i64) return %0: i64 } func.func @sdot_acc_sat_vector_4xi16_i64_implied_extension(%operand: vector<4xi16>, %acc: i64) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sdot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi16>, vector<4xi16>, i64) -> (i64) return %0: i64 } func.func @sdot_acc_sat_vector_4xi16_i64_missing_extension(%operand: vector<4xi16>, %acc: i64) -> i64 attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { %0 = ""test.convert_to_sdot_acc_sat_op""(%operand, %operand, %acc): (vector<4xi16>, vector<4xi16>, i64) -> (i64) return %0: i64 }", mlir-opt --split-input-file --verify-diagnostics --mlir-disable-threading --test-spirv-target-env ,1 "func.func @branch() -> () { spirv.Branch ^next ^next: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @branch_argument() -> () { %zero = spirv.Constant 0 : i32 spirv.Branch ^next(%zero, %zero: i32, i32) ^next(%arg0: i32, %arg1: i32): spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_accessor() -> () { spirv.Branch }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @wrong_accessor_count() -> () { %true = spirv.Constant true ""spirv.Branch""()[^one, ^two] : () -> () ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @cond_branch() -> () { %true = spirv.Constant true spirv.BranchConditional %true, ^one, ^two ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @cond_branch_argument() -> () { %true = spirv.Constant true %zero = spirv.Constant 0 : i32 spirv.BranchConditional %true, ^true1(%zero, %zero: i32, i32), ^false1 ^true1(%arg0: i32, %arg1: i32): spirv.BranchConditional %true, ^true2, ^false2(%zero, %zero: i32, i32) ^false1: spirv.Return ^true2: spirv.Return ^false2(%arg3: i32, %arg4: i32): spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @cond_branch_with_weights() -> () { %true = spirv.Constant true spirv.BranchConditional %true [5, 10], ^one, ^two ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_condition() -> () { spirv.BranchConditional ^one, ^two ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @wrong_condition_type() -> () { %zero = spirv.Constant 0 : i32 spirv.BranchConditional %zero, ^one, ^two ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @wrong_accessor_count() -> () { %true = spirv.Constant true ""spirv.BranchConditional""(%true)[^one] {operand_segment_sizes = array} : (i1) -> () ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @wrong_number_of_weights() -> () { %true = spirv.Constant true ""spirv.BranchConditional""(%true)[^one, ^two] {branch_weights = [1 : i32, 2 : i32, 3 : i32], operand_segment_sizes = array} : (i1) -> () ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @weights_cannot_both_be_zero() -> () { %true = spirv.Constant true spirv.BranchConditional %true [0, 0], ^one, ^two ^one: spirv.Return ^two: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @fmain(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>, %arg2 : i32) -> i32 ""None"" { %0 = spirv.FunctionCall @f_0(%arg0, %arg1) : (vector<4xf32>, vector<4xf32>) -> vector<4xf32> spirv.FunctionCall @f_1(%0, %arg1) : (vector<4xf32>, vector<4xf32>) -> () spirv.FunctionCall @f_2() : () -> () %1 = spirv.FunctionCall @f_3(%arg2) : (i32) -> i32 spirv.ReturnValue %1 : i32 } spirv.func @f_0(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) -> (vector<4xf32>) ""None"" { spirv.ReturnValue %arg0 : vector<4xf32> } spirv.func @f_1(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) -> () ""None"" { spirv.Return } spirv.func @f_2() -> () ""None"" { spirv.Return } spirv.func @f_3(%arg0 : i32) -> (i32) ""None"" { spirv.ReturnValue %arg0 : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @callee() ""None"" { spirv.Return } func.func @caller() { spirv.FunctionCall @callee() : () -> () spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @f_invalid_result_type(%arg0 : i32, %arg1 : i32) -> () ""None"" { %0:2 = spirv.FunctionCall @f_invalid_result_type(%arg0, %arg1) : (i32, i32) -> (i32, i32) spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @f_result_type_mismatch(%arg0 : i32, %arg1 : i32) -> () ""None"" { %1 = spirv.FunctionCall @f_result_type_mismatch(%arg0, %arg0) : (i32, i32) -> (i32) spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @f_type_mismatch(%arg0 : i32, %arg1 : i32) -> () ""None"" { spirv.FunctionCall @f_type_mismatch(%arg0) : (i32) -> () spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @f_type_mismatch(%arg0 : i32, %arg1 : i32) -> () ""None"" { %0 = spirv.Constant 2.0 : f32 spirv.FunctionCall @f_type_mismatch(%arg0, %0) : (i32, f32) -> () spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @f_type_mismatch(%arg0 : i32, %arg1 : i32) -> i32 ""None"" { %cst = spirv.Constant 0: i32 %0 = spirv.FunctionCall @f_type_mismatch(%arg0, %arg0) : (i32, i32) -> f32 spirv.ReturnValue %cst: i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @f_foo(%arg0 : i32, %arg1 : i32) -> i32 ""None"" { %0 = spirv.FunctionCall @f_undefined(%arg0, %arg0) : (i32, i32) -> i32 spirv.ReturnValue %0: i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @loop(%count : i32) -> () { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.loop { spirv.Branch ^header ^header: %val0 = spirv.Load ""Function"" %var : i32 %cmp = spirv.SLessThan %val0, %count : i32 spirv.BranchConditional %cmp, ^body, ^merge ^body: spirv.Branch ^continue ^continue: %val1 = spirv.Load ""Function"" %var : i32 %add = spirv.IAdd %val1, %one : i32 spirv.Store ""Function"" %var, %add : i32 spirv.Branch ^header ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @empty_region() -> () { spirv.mlir.loop { } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @loop_with_control() -> () { spirv.mlir.loop control(Unroll) { } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @wrong_merge_block() -> () { spirv.mlir.loop { spirv.Return } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_entry_block() -> () { spirv.mlir.loop { spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_header_block() -> () { spirv.mlir.loop { ^entry: spirv.Branch ^merge ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @entry_should_branch_to_header() -> () { spirv.mlir.loop { ^entry: spirv.Branch ^merge ^header: spirv.Branch ^merge ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_continue_block() -> () { spirv.mlir.loop { ^entry: spirv.Branch ^header ^header: spirv.Branch ^merge ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @continue_should_branch_to_header() -> () { spirv.mlir.loop { ^entry: spirv.Branch ^header ^header: spirv.Branch ^continue ^continue: spirv.Branch ^merge ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @only_entry_and_continue_branch_to_header() -> () { spirv.mlir.loop { ^entry: spirv.Branch ^header ^header: spirv.Branch ^cont1 ^cont1: spirv.Branch ^header ^cont2: spirv.Branch ^header ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @merge() -> () { spirv.mlir.merge }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @only_allowed_in_last_block(%cond : i1) -> () { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: spirv.Store ""Function"" %var, %one : i32 spirv.mlir.merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @only_allowed_in_last_block() -> () { %true = spirv.Constant true spirv.mlir.loop { spirv.Branch ^header ^header: spirv.BranchConditional %true, ^body, ^merge ^body: spirv.mlir.merge ^continue: spirv.Branch ^header ^merge: spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @in_selection(%cond : i1) -> () { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: spirv.Return ^merge: spirv.mlir.merge } spirv.Return } func.func @in_loop(%cond : i1) -> () { spirv.mlir.loop { spirv.Branch ^header ^header: spirv.BranchConditional %cond, ^body, ^merge ^body: spirv.Return ^continue: spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } func.func @in_other_func_like_op() { spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """foo.function""() ({ spirv.Return }) : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @work() -> (i32) ""None"" { spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @in_nested_region(%cond: i1) -> (i32) ""None"" { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: spirv.Return ^merge: spirv.mlir.merge } %zero = spirv.Constant 0: i32 spirv.ReturnValue %zero: i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @ret_val() -> (i32) { %0 = spirv.Constant 42 : i32 spirv.ReturnValue %0 : i32 } func.func @in_selection(%cond : i1) -> (i32) { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: %zero = spirv.Constant 0 : i32 spirv.ReturnValue %zero : i32 ^merge: spirv.mlir.merge } %one = spirv.Constant 1 : i32 spirv.ReturnValue %one : i32 } func.func @in_loop(%cond : i1) -> (i32) { spirv.mlir.loop { spirv.Branch ^header ^header: spirv.BranchConditional %cond, ^body, ^merge ^body: %zero = spirv.Constant 0 : i32 spirv.ReturnValue %zero : i32 ^continue: spirv.Branch ^header ^merge: spirv.mlir.merge } %one = spirv.Constant 1 : i32 spirv.ReturnValue %one : i32 } func.func @in_other_func_like_op(%arg: i32) -> i32 { spirv.ReturnValue %arg: i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """foo.function""() ({ %0 = spirv.Constant true spirv.ReturnValue %0 : i1 }) : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @value_count_mismatch() -> () ""None"" { %0 = spirv.Constant 42 : i32 spirv.ReturnValue %0 : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @value_type_mismatch() -> (f32) ""None"" { %0 = spirv.Constant 42 : i32 spirv.ReturnValue %0 : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @in_nested_region(%cond: i1) -> () ""None"" { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: %cst = spirv.Constant 0: i32 spirv.ReturnValue %cst: i32 ^merge: spirv.mlir.merge } spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @selection(%cond: i1) -> () { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: spirv.Store ""Function"" %var, %one : i32 spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @selection(%cond: i1) -> () { %zero = spirv.Constant 0: i32 %one = spirv.Constant 1: i32 %two = spirv.Constant 2: i32 %var = spirv.Variable init(%zero) : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %var, %one : i32 spirv.Branch ^merge ^else: spirv.Store ""Function"" %var, %two : i32 spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @empty_region() -> () { spirv.mlir.selection { } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @selection_with_control() -> () { spirv.mlir.selection control(Flatten) { } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @wrong_merge_block() -> () { spirv.mlir.selection { spirv.Return } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_entry_block() -> () { spirv.mlir.selection { spirv.mlir.merge } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @unreachable_no_pred() { spirv.Return ^next: spirv.Unreachable } func.func @unreachable_with_pred() { spirv.Return ^parent: spirv.Branch ^unreachable ^unreachable: spirv.Unreachable }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @unreachable() { spirv.Unreachable }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @matrix_times_scalar_1(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> !spirv.matrix<3 x vector<3xf32>> ""None"" { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f32 spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>> } spirv.func @matrix_times_scalar_2(%arg0 : !spirv.coopmatrix<16x16xf16, Subgroup>, %arg1 : f16) -> !spirv.coopmatrix<16x16xf16, Subgroup> ""None"" { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.coopmatrix<16x16xf16, Subgroup>, f16 spirv.ReturnValue %result : !spirv.coopmatrix<16x16xf16, Subgroup> } spirv.func @matrix_transpose_1(%arg0 : !spirv.matrix<3 x vector<2xf32>>) -> !spirv.matrix<2 x vector<3xf32>> ""None"" { %result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<2xf32>> -> !spirv.matrix<2 x vector<3xf32>> spirv.ReturnValue %result : !spirv.matrix<2 x vector<3xf32>> } spirv.func @matrix_transpose_2(%arg0 : !spirv.matrix<3 x vector<3xf32>>) -> !spirv.matrix<3 x vector<3xf32>> ""None"" { %result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>> spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>> } spirv.func @matrix_times_matrix_1(%arg0: !spirv.matrix<3 x vector<3xf32>>, %arg1: !spirv.matrix<3 x vector<3xf32>>) -> !spirv.matrix<3 x vector<3xf32>> ""None""{ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>> spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>> } spirv.func @matrix_times_matrix_2(%arg0: !spirv.matrix<3 x vector<2xf32>>, %arg1: !spirv.matrix<2 x vector<3xf32>>) -> !spirv.matrix<2 x vector<2xf32>> ""None""{ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<2 x vector<2xf32>> spirv.ReturnValue %result : !spirv.matrix<2 x vector<2xf32>> } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @input_type_mismatch(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f16) { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f16 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @input_type_mismatch(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f64) { %result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f64 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @transpose_op_shape_mismatch_1(%arg0 : !spirv.matrix<3 x vector<4xf32>>) { %result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<4xf32>> -> !spirv.matrix<3 x vector<3xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @transpose_op_shape_mismatch_2(%arg0 : !spirv.matrix<3 x vector<4xf32>>) { %result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<4xf32>> -> !spirv.matrix<2 x vector<4xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @transpose_op_type_mismatch(%arg0 : !spirv.matrix<3 x vector<4xf32>>) { %result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<4xf32>> -> !spirv.matrix<4 x vector<3xf16>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @matrix_times_matrix_invalid_input_shape_1(%arg0 : !spirv.matrix<3 x vector<2xf32>>, %arg1 : !spirv.matrix<2 x vector<3xf32>>){ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<3 x vector<2xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @matrix_times_matrix_invalid_input_shape_2(%arg0 : !spirv.matrix<3 x vector<2xf32>>, %arg1 : !spirv.matrix<2 x vector<3xf32>>){ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<2 x vector<3xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @matrix_times_matrix_inputs_shape_mismatch(%arg0 : !spirv.matrix<3 x vector<2xf32>>, %arg1 : !spirv.matrix<2 x vector<2xf32>>){ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<2xf32>> -> !spirv.matrix<2 x vector<2xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @matrix_times_matrix_component_type_mismatch_1(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : !spirv.matrix<3x vector<3xf32>>){ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf64>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @matrix_times_matrix_component_type_mismatch_2(%arg0 : !spirv.matrix<3 x vector<3xf64>>, %arg1 : !spirv.matrix<3x vector<3xf32>>){ %result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf64>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_load(%ptr : !spirv.ptr, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b : !spirv.ptr as !spirv.coopmatrix<16x8xi32, Workgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_load_memaccess(%ptr : !spirv.ptr, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b [""Volatile""] : !spirv.ptr as !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_load_diff_ptr_type(%ptr : !spirv.ptr, StorageBuffer>, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b [""Volatile""] : !spirv.ptr, StorageBuffer> as !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_store(%ptr : !spirv.ptr, %stride : i32, %m : !spirv.coopmatrix<8x16xi32, Workgroup>, %b : i1) ""None"" { spirv.NV.CooperativeMatrixStore %ptr, %m, %stride, %b : !spirv.ptr, !spirv.coopmatrix<8x16xi32, Workgroup> spirv.Return } spirv.func @cooperative_matrix_store_memaccess(%ptr : !spirv.ptr, %m : !spirv.coopmatrix<8x16xi32, Subgroup>, %stride : i32, %b : i1) ""None"" { spirv.NV.CooperativeMatrixStore %ptr, %m, %stride, %b [""Volatile""] : !spirv.ptr, !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_length() -> i32 ""None"" { %0 = spirv.NV.CooperativeMatrixLength : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.ReturnValue %0 : i32 } spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<8x32xi8, Subgroup>, %b : !spirv.coopmatrix<32x8xi8, Subgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<8x32xi8, Subgroup>, !spirv.coopmatrix<32x8xi8, Subgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_add(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.IAdd %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_sub(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.ISub %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_sdiv(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.SDiv %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_udiv(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x16xi32, Subgroup>) ""None"" { %r = spirv.UDiv %a, %b : !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_fadd(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<8x16xf32, Subgroup>) ""None"" { %r = spirv.FAdd %a, %b : !spirv.coopmatrix<8x16xf32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_fsub(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<8x16xf32, Subgroup>) ""None"" { %r = spirv.FSub %a, %b : !spirv.coopmatrix<8x16xf32, Subgroup> spirv.Return } spirv.func @cooperative_matrix_fdiv(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<8x16xf32, Subgroup>) ""None"" { %r = spirv.FDiv %a, %b : !spirv.coopmatrix<8x16xf32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_access_chain(%a : !spirv.ptr, Function>) -> !spirv.ptr ""None"" { %0 = spirv.Constant 0: i32 %1 = spirv.AccessChain %a[%0] : !spirv.ptr, Function>, i32 spirv.ReturnValue %1 : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<16x16xi32, Subgroup>, %b : !spirv.coopmatrix<16x8xi32, Subgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<16x16xi32, Subgroup>, !spirv.coopmatrix<16x8xi32, Subgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<8x8xi32, Subgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<8x16xi32, Subgroup>, !spirv.coopmatrix<8x8xi32, Subgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<8x16xi32, Subgroup>, %b : !spirv.coopmatrix<16x8xi32, Workgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<8x16xi32, Subgroup>, !spirv.coopmatrix<16x8xi32, Workgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<8x16xf32, Subgroup>, %b : !spirv.coopmatrix<16x8xi32, Subgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<8x16xf32, Subgroup>, !spirv.coopmatrix<16x8xi32, Subgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_muladd(%a : !spirv.coopmatrix<8x16xui8, Subgroup>, %b : !spirv.coopmatrix<16x8xsi32, Subgroup>, %c : !spirv.coopmatrix<8x8xi32, Subgroup>) ""None"" { %r = spirv.NV.CooperativeMatrixMulAdd %a, %b, %c : !spirv.coopmatrix<8x16xui8, Subgroup>, !spirv.coopmatrix<16x8xsi32, Subgroup> -> !spirv.coopmatrix<8x8xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_load_memaccess(%ptr : !spirv.ptr, StorageBuffer>, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b : !spirv.ptr, StorageBuffer> as !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cooperative_matrix_load_memaccess(%ptr : !spirv.ptr, %stride : i32, %b : i1) ""None"" { %0 = spirv.NV.CooperativeMatrixLoad %ptr, %stride, %b : !spirv.ptr as !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @unknown_attr_on_op() attributes { spirv.something = 64 } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @unknown_attr_on_region(%arg: i32 {spirv.something}) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @unknown_attr_on_region() -> (i32 {spirv.something}) { %0 = arith.constant 10.0 : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @spv_entry_point() attributes { spirv.entry_point_abi = 64 } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @spv_entry_point() attributes { spirv.entry_point_abi = #spirv.entry_point_abi } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @spv_entry_point() attributes { spirv.entry_point_abi = #spirv.entry_point_abi } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : f32 {spirv.interface_var_abi = 64} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<()>} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(1,)>} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(1,2), Foo>} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1), Uniform>} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @interface_var( %arg0 : memref<4xf32> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1), Uniform>} ) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @resource_limits_all_default() attributes { limits = #spirv.resource_limits<> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @resource_limits_min_max_subgroup_size() attributes { limits = #spirv.resource_limits } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env() attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits< max_compute_workgroup_size = [128, 64, 64] >> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_client_api() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, api=Metal, #spirv.resource_limits<>> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_client_api() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, api=Unknown, #spirv.resource_limits<>> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_vendor_id() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, NVIDIA, #spirv.resource_limits<>> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_vendor_id_device_type() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, AMD:DiscreteGPU, #spirv.resource_limits<>> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_vendor_id_device_type_device_id() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, Qualcomm:IntegratedGPU:0x6040001, #spirv.resource_limits<>> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_client_api_vendor_id_device_type_device_id() attributes { spirv.target_env = #spirv.target_env<#spirv.vce, api=Vulkan, Qualcomm:IntegratedGPU:0x6040001, #spirv.resource_limits<>> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_extra_fields() attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>, more_stuff > } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @target_env_cooperative_matrix() attributes{ spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits< cooperative_matrix_properties_nv = [#spirv.coop_matrix_props< m_size = 8, n_size = 8, k_size = 32, a_type = i8, b_type = i8, c_type = i32, result_type = i32, scope = #spirv.scope >, #spirv.coop_matrix_props< m_size = 8, n_size = 8, k_size = 16, a_type = f16, b_type = f16, c_type = f16, result_type = f16, scope = #spirv.scope >] >> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce_wrong_type() attributes { vce = #spirv.vce<64> } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce_missing_fields() attributes { vce = #spirv.vce } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce_wrong_version() attributes { vce = #spirv.vce } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce_wrong_extension_type() attributes { vce = #spirv.vce } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce_wrong_extension() attributes { vce = #spirv.vce } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce_wrong_capability() attributes { vce = #spirv.vce } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vce() attributes { vce = #spirv.vce } { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_struct() -> () { %0 = spirv.Constant 1: i32 %1 = spirv.Variable : !spirv.ptr)>, Function> %2 = spirv.AccessChain %1[%0, %0] : !spirv.ptr)>, Function>, i32, i32 return } func.func @access_chain_1D_array(%arg0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr, Function> %1 = spirv.AccessChain %0[%arg0] : !spirv.ptr, Function>, i32 return } func.func @access_chain_2D_array_1(%arg0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%arg0, %arg0] : !spirv.ptr>, Function>, i32, i32 %2 = spirv.Load ""Function"" %1 [""Volatile""] : f32 return } func.func @access_chain_2D_array_2(%arg0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%arg0] : !spirv.ptr>, Function>, i32 %2 = spirv.Load ""Function"" %1 [""Volatile""] : !spirv.array<4xf32> return } func.func @access_chain_rtarray(%arg0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr, Function> %1 = spirv.AccessChain %0[%arg0] : !spirv.ptr, Function>, i32 %2 = spirv.Load ""Function"" %1 [""Volatile""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_non_composite() -> () { %0 = spirv.Constant 1: i32 %1 = spirv.Variable : !spirv.ptr %2 = spirv.AccessChain %1[%0] : !spirv.ptr, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_no_indices(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[] : !spirv.ptr>, Function>, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_missing_comma(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%index0] : !spirv.ptr>, Function> i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_invalid_indices_types_count(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%index0] : !spirv.ptr>, Function>, i32, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_missing_indices_type(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%index0, %index0] : !spirv.ptr>, Function>, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_invalid_type(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.Load ""Function"" %0 [""Volatile""] : !spirv.array<4x!spirv.array<4xf32>> %2 = spirv.AccessChain %1[%index0] : !spirv.array<4x!spirv.array<4xf32>>, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_invalid_index_1(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%index, 4] : !spirv.ptr>, Function>, i32, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_invalid_index_2(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr)>, Function> %1 = spirv.AccessChain %0[%index0, %index0] : !spirv.ptr)>, Function>, i32, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_invalid_constant_type_1() -> () { %0 = arith.constant 1: i32 %1 = spirv.Variable : !spirv.ptr)>, Function> %2 = spirv.AccessChain %1[%0, %0] : !spirv.ptr)>, Function>, i32, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_out_of_bounds() -> () { %index0 = ""spirv.Constant""() { value = 12: i32} : () -> i32 %0 = spirv.Variable : !spirv.ptr)>, Function> %1 = spirv.AccessChain %0[%index0, %index0] : !spirv.ptr)>, Function>, i32, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @access_chain_invalid_accessing_type(%index0 : i32) -> () { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%index, %index0, %index0] : !spirv.ptr>, Function>, i32, i32, i32 return", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 : f32 return } func.func @load_none_access() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""None""] : f32 return } func.func @volatile_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Volatile""] : f32 return } func.func @aligned_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Aligned"", 4] : f32 return } func.func @volatile_aligned_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Volatile|Aligned"", 4] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @load_none_access() -> () { %0 = spirv.Variable : !spirv.ptr %1 = ""spirv.Load""(%0) {memory_access = #spirv.memory_access} : (!spirv.ptr) -> (f32) return } func.func @volatile_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = ""spirv.Load""(%0) {memory_access = #spirv.memory_access} : (!spirv.ptr) -> (f32) return } func.func @aligned_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = ""spirv.Load""(%0) {memory_access = #spirv.memory_access, alignment = 4 : i32} : (!spirv.ptr) -> (f32) return } func.func @volatile_aligned_load() -> () { %0 = spirv.Variable : !spirv.ptr %1 = ""spirv.Load""(%0) {memory_access = #spirv.memory_access, alignment = 4 : i32} : (!spirv.ptr) -> (f32) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_load_missing_storageclass() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load %0 : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_load_missing_operand() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_load_missing_rettype() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @volatile_load_missing_lbrace() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 ""Volatile""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @volatile_load_missing_rbrace() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Volatile""} : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @aligned_load_missing_alignment() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Aligned""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @aligned_load_missing_comma() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Aligned"" 4] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @load_incorrect_attributes() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Volatile"", 4] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @load_unknown_memory_access() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Something""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @load_unknown_memory_access() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Volatile|Something""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @load_unknown_memory_access() -> () { %0 = spirv.Variable : !spirv.ptr %1 = ""spirv.Load""(%0) {memory_access = 0x80000000 : i32} : (!spirv.ptr) -> (f32) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @aligned_load_incorrect_attributes() -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Aligned"", 4, 23] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr spirv.GlobalVariable @var1 : !spirv.ptr>, UniformConstant> spirv.func @simple_load() -> () ""None"" { %0 = spirv.mlir.addressof @var0 : !spirv.ptr %1 = spirv.Load ""Input"" %0 : f32 %2 = spirv.mlir.addressof @var1 : !spirv.ptr>, UniformConstant> %3 = spirv.Load ""UniformConstant"" %2 : !spirv.sampled_image> spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_store(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 : f32 return } func.func @volatile_store(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Volatile""] : f32 return } func.func @aligned_store(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Aligned"", 4] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_store_missing_ptr_type(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store %0, %arg0 : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_store_missing_operand(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" , %arg0 : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @simple_store_missing_operand(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0 : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @volatile_store_missing_lbrace(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 ""Volatile""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @volatile_store_missing_rbrace(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Volatile""} : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @aligned_store_missing_alignment(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Aligned""] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @aligned_store_missing_comma(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Aligned"" 4] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @load_incorrect_attributes(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Volatile"", 4] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @aligned_store_incorrect_attributes(%arg0 : f32) -> () { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Aligned"", 4, 23] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr spirv.func @simple_store(%arg0 : f32) -> () ""None"" { %0 = spirv.mlir.addressof @var0 : !spirv.ptr spirv.Store ""Input"" %0, %arg0 : f32 spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @variable(%arg0: f32) -> () { %0 = spirv.Variable : !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @variable_init_normal_constant() -> () { %0 = spirv.Constant 4.0 : f32 %1 = spirv.Variable init(%0) : !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @global : !spirv.ptr spirv.func @variable_init_global_variable() -> () ""None"" { %0 = spirv.mlir.addressof @global : !spirv.ptr %1 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = 42 : i32 spirv.func @variable_init_spec_constant() -> () ""None"" { %0 = spirv.mlir.referenceof @sc : i32 %1 = spirv.Variable init(%0) : !spirv.ptr spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @variable_bind() -> () { %0 = spirv.Variable bind(1, 2) : !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @variable_init_bind() -> () { %0 = spirv.Constant 4.0 : f32 %1 = spirv.Variable init(%0) {binding = 5 : i32} : !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @variable_builtin() -> () { %1 = spirv.Variable built_in(""GlobalInvocationID"") : !spirv.ptr, Function> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @expect_ptr_result_type(%arg0: f32) -> () { %0 = spirv.Variable : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @variable_init(%arg0: f32) -> () { %0 = spirv.Variable init(%arg0) : !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cannot_be_generic_storage_class(%arg0: f32) -> () { %0 = spirv.Variable : !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @copy_memory_incompatible_ptrs() { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr ""spirv.CopyMemory""(%0, %1) {} : (!spirv.ptr, !spirv.ptr) -> () spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @copy_memory_invalid_maa() { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr ""spirv.CopyMemory""(%0, %1) {memory_access=#spirv.memory_access} : (!spirv.ptr, !spirv.ptr) -> () spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @copy_memory_invalid_source_maa() { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr ""spirv.CopyMemory""(%0, %1) {source_memory_access=#spirv.memory_access, memory_access=#spirv.memory_access, source_alignment=8 : i32, alignment=4 : i32} : (!spirv.ptr, !spirv.ptr) -> () spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @copy_memory_invalid_source_maa2() { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr ""spirv.CopyMemory""(%0, %1) {source_memory_access=#spirv.memory_access, memory_access=#spirv.memory_access, alignment=4 : i32} : (!spirv.ptr, !spirv.ptr) -> () spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @copy_memory_print_maa() { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr ""spirv.CopyMemory""(%0, %1) {memory_access=#spirv.memory_access} : (!spirv.ptr, !spirv.ptr) -> () ""spirv.CopyMemory""(%0, %1) {memory_access=#spirv.memory_access, alignment=4 : i32} : (!spirv.ptr, !spirv.ptr) -> () ""spirv.CopyMemory""(%0, %1) {source_memory_access=#spirv.memory_access, memory_access=#spirv.memory_access, alignment=4 : i32} : (!spirv.ptr, !spirv.ptr) -> () ""spirv.CopyMemory""(%0, %1) {source_memory_access=#spirv.memory_access, memory_access=#spirv.memory_access, source_alignment=8 : i32, alignment=4 : i32} : (!spirv.ptr, !spirv.ptr) -> () spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ptr_access_chain1(%arg0: !spirv.ptr, %arg1 : i64) -> () { %0 = spirv.PtrAccessChain %arg0[%arg1] : !spirv.ptr, i64 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @inbounds_ptr_access_chain1(%arg0: !spirv.ptr, %arg1 : i64) -> () { %0 = spirv.InBoundsPtrAccessChain %arg0[%arg1] : !spirv.ptr, i64 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @scalar_array_type(!spirv.array<16xf32>, !spirv.array<8 x i32>) -> () func.func private @vector_array_type(!spirv.array< 32 x vector<4xf32> >) -> () func.func private @array_type_stride(!spirv.array< 4 x !spirv.array<4 x f32, stride=4>, stride = 128>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_left_angle_bracket(!spirv.array 4xf32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_count(!spirv.array) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_x(!spirv.array<4 f32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_element_type(!spirv.array<4x>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @cannot_parse_type(!spirv.array<4xblabla>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @more_than_one_dim(!spirv.array<4x3xf32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @non_1D_vector(!spirv.array<4xvector<4x3xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @tensor_type(!spirv.array<4xtensor<4xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @bf16_type(!spirv.array<4xbf16>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @i256_type(!spirv.array<4xi256>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @index_type(!spirv.array<4xindex>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @llvm_type(!spirv.array<4x!llvm.struct<()>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @array_type_zero_stride(!spirv.array<4xi32, stride=0>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @array_type_zero_length(!spirv.array<0xf32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @bool_ptr_type(!spirv.ptr) -> () func.func private @scalar_ptr_type(!spirv.ptr) -> () func.func private @vector_ptr_type(!spirv.ptr,PushConstant>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @missing_left_angle_bracket(!spirv.ptr f32, Uniform>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_comma(!spirv.ptr) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @missing_pointee_type(!spirv.ptr<, Uniform>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @unknown_storage_class(!spirv.ptr) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @scalar_runtime_array_type(!spirv.rtarray, !spirv.rtarray) -> () func.func private @vector_runtime_array_type(!spirv.rtarray< vector<4xf32> >) -> () func.func private @runtime_array_type_stride(!spirv.rtarray) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_left_angle_bracket(!spirv.rtarray f32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_element_type(!spirv.rtarray<>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @redundant_count(!spirv.rtarray<4xf32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @runtime_array_type_zero_stride(!spirv.rtarray) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_1D(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @image_parameters_one_element(!spirv.image) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_two_elements(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_three_elements(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_four_elements(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_five_elements(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_six_elements(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_delimiter(!spirv.image f32, Dim1D, NoDepth, NonArrayed, SingleSampled, SamplerUnknown, Unknown>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_nocomma_1(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_nocomma_2(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_nocomma_3(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_nocomma_4(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @image_parameters_nocomma_5(!spirv.image) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @sampled_image_type(!spirv.sampled_image>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @samped_image_type_invaid_type(!spirv.sampled_image) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type(!spirv.struct<(f32)>) -> () func.func private @struct_type2(!spirv.struct<(f32 [0])>) -> () func.func private @struct_type_simple(!spirv.struct<(f32, !spirv.image)>) -> () func.func private @struct_type_with_offset(!spirv.struct<(f32 [0], i32 [4])>) -> () func.func private @nested_struct(!spirv.struct<(f32, !spirv.struct<(f32, i32)>)>) func.func private @nested_struct_with_offset(!spirv.struct<(f32 [0], !spirv.struct<(f32 [0], i32 [4])> [4])>) func.func private @struct_type_with_decoration(!spirv.struct<(f32 [NonWritable])>) func.func private @struct_type_with_decoration_and_offset(!spirv.struct<(f32 [0, NonWritable])>) func.func private @struct_type_with_decoration2(!spirv.struct<(f32 [NonWritable], i32 [NonReadable])>) func.func private @struct_type_with_decoration3(!spirv.struct<(f32, i32 [NonReadable])>) func.func private @struct_type_with_decoration4(!spirv.struct<(f32 [0], i32 [4, NonReadable])>) func.func private @struct_type_with_decoration5(!spirv.struct<(f32 [NonWritable, NonReadable])>) func.func private @struct_type_with_decoration6(!spirv.struct<(f32, !spirv.struct<(i32 [NonWritable, NonReadable])>)>) func.func private @struct_type_with_decoration7(!spirv.struct<(f32 [0], !spirv.struct<(i32, f32 [NonReadable])> [4])>) func.func private @struct_type_with_decoration8(!spirv.struct<(f32, !spirv.struct<(i32 [0], f32 [4, NonReadable])>)>) func.func private @struct_type_with_matrix_1(!spirv.struct<(!spirv.matrix<3 x vector<3xf32>> [0, ColMajor, MatrixStride=16])>) func.func private @struct_type_with_matrix_2(!spirv.struct<(!spirv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=16])>) func.func private @struct_empty(!spirv.struct<()>)", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type_missing_offset1((!spirv.struct<(f32, i32 [4])>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type_missing_offset2(!spirv.struct<(f32 [3], i32)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @struct_type_missing_comma1(!spirv.struct<(f32 i32)>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @struct_type_missing_comma2(!spirv.struct<(f32 [0] i32)>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @struct_type_neg_offset(!spirv.struct<(f32 [0)>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @struct_type_neg_offset(!spirv.struct<(f32 0])>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @struct_type_neg_offset(!spirv.struct<(f32 [NonWritable 0])>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type_neg_offset(!spirv.struct<(f32 [NonWritable, 0])>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type_missing_comma(!spirv.struct<(f32 [0 NonWritable], i32 [4])>)", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type_missing_comma(!spirv.struct<(f32 [0, NonWritable NonReadable], i32 [4])>)", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_type_missing_comma(!spirv.struct<(!spirv.matrix<3 x vector<3xf32>> [0, RowMajor MatrixStride=16])>)", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @struct_missing_member_decorator_value(!spirv.struct<(!spirv.matrix<3 x vector<3xf32>> [0, RowMajor, MatrixStride=])>)", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_empty(!spirv.struct) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_simple(!spirv.struct) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_multiple_elements(!spirv.struct) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_nested_literal(!spirv.struct)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_nested_id(!spirv.struct)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @literal_struct_nested_id(!spirv.struct<(!spirv.struct)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_self_recursive(!spirv.struct, Uniform>)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_self_recursive2(!spirv.struct, Uniform>)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @id_wrong_recursive_reference(!spirv.struct) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_recursive_invalid(!spirv.struct, Uniform>)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_redefinition(!spirv.struct, Uniform>)>, Uniform>)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_recursive(!spirv.struct, Uniform>)>, Uniform>)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @id_struct_recursive(!spirv.struct, Uniform>, !spirv.ptr, Uniform>)>, Uniform>)>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @coop_matrix_type(!spirv.coopmatrix<8x16xi32, Subgroup>, !spirv.coopmatrix<8x8xf32, Workgroup>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @missing_scope(!spirv.coopmatrix<8x16xi32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func private @missing_count(!spirv.coopmatrix<8xi32, Subgroup>) -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_type(!spirv.matrix<2 x vector<2xf16>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_type(!spirv.matrix<3 x vector<3xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_type(!spirv.matrix<4 x vector<4xf16>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_size(!spirv.matrix<5 x vector<3xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_size(!spirv.matrix<1 x vector<3xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_columns_size(!spirv.matrix<3 x vector<5xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_columns_size(!spirv.matrix<3 x vector<1xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_format(!spirv.matrix 3 x vector<3xf32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_format(!spirv.matrix< 3 x vector<3xf32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_format(!spirv.matrix<2 vector<3xi32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_type(!spirv.matrix< 3 x i32>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_type(!spirv.matrix< 3 x !spirv.array<16 x f32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_type(!spirv.matrix< 3 x !spirv.rtarray>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_invalid_type(!spirv.matrix<2 x vector<3xi32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_size_type(!spirv.matrix< x vector<3xi32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @matrix_size_type(!spirv.matrix<2.0 x vector<3xi32>>) -> (), mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_scalar_i32(%a: i32, %b: i32) -> i32 { %r = spirv.SDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r : i32 } func.func @sdot_scalar_i64(%a: i32, %b: i32) -> i64 { %r = spirv.SDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i64 return %r : i64 } func.func @sdot_vector_4xi8(%a: vector<4xi8>, %b: vector<4xi8>) -> i32 { %r = spirv.SDot %a, %b : (vector<4xi8>, vector<4xi8>) -> i32 return %r : i32 } func.func @sdot_vector_4xi16(%a: vector<4xi16>, %b: vector<4xi16>) -> i64 { %r = spirv.SDot %a, %b : (vector<4xi16>, vector<4xi16>) -> i64 return %r : i64 } func.func @sdot_vector_8xi8(%a: vector<8xi8>, %b: vector<8xi8>) -> i64 { %r = spirv.SDot %a, %b : (vector<8xi8>, vector<8xi8>) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_scalar_bad_types(%a: i32, %b: i64) -> i32 { %r = spirv.SDot %a, %b : (i32, i64) -> i32 return %r : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_vector_4xi8_bad_attr(%a: vector<4xi8>, %b: vector<4xi8>) -> i32 { %r = spirv.SDot %a, %b {format = #spirv.packed_vector_format}: (vector<4xi8>, vector<4xi8>) -> i32 return %r : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_scalar_i32_bad_attr(%a: i32, %b: i32) -> i32 { %r = spirv.SDot %a, %b {volatile = #spirv.decoration, format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @udot_vector_4xi8_bad_attr(%a: vector<4xi8>, %b: vector<4xi8>) -> i32 { %r = spirv.UDot %a, %b {volatile = #spirv.decoration}: (vector<4xi8>, vector<4xi8>) -> i32 return %r : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_scalar_bad_types(%a: i32, %b: i32) -> i16 { %r = spirv.SDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i16 return %r : i16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_scalar_bad_types(%a: i64, %b: i64) -> i64 { %r = spirv.SDot %a, %b {format = #spirv.packed_vector_format}: (i64, i64) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sudot_scalar_i32(%a: i32, %b: i32) -> i32 { %r = spirv.SUDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r : i32 } func.func @sudot_scalar_i64(%a: i32, %b: i32) -> i64 { %r = spirv.SUDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i64 return %r : i64 } func.func @sudot_vector_4xi8(%a: vector<4xi8>, %b: vector<4xi8>) -> i32 { %r = spirv.SUDot %a, %b : (vector<4xi8>, vector<4xi8>) -> i32 return %r : i32 } func.func @sudot_vector_4xi16(%a: vector<4xi16>, %b: vector<4xi16>) -> i64 { %r = spirv.SUDot %a, %b : (vector<4xi16>, vector<4xi16>) -> i64 return %r : i64 } func.func @sudot_vector_8xi8(%a: vector<8xi8>, %b: vector<8xi8>) -> i64 { %r = spirv.SUDot %a, %b : (vector<8xi8>, vector<8xi8>) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @udot_scalar_i32(%a: i32, %b: i32) -> i32 { %r = spirv.UDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i32 return %r : i32 } func.func @udot_scalar_i64(%a: i32, %b: i32) -> i64 { %r = spirv.UDot %a, %b {format = #spirv.packed_vector_format}: (i32, i32) -> i64 return %r : i64 } func.func @udot_vector_4xi8(%a: vector<4xi8>, %b: vector<4xi8>) -> i32 { %r = spirv.UDot %a, %b : (vector<4xi8>, vector<4xi8>) -> i32 return %r : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_acc_sat_scalar_i32(%a: i32, %b: i32, %acc: i32) -> i32 { %r = spirv.SDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i32 return %r : i32 } func.func @sdot_acc_sat_scalar_i64(%a: i32, %b: i32, %acc: i64) -> i64 { %r = spirv.SDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i64) -> i64 return %r : i64 } func.func @sdot_acc_sat_vector_4xi8(%a: vector<4xi8>, %b: vector<4xi8>, %acc: i32) -> i32 { %r = spirv.SDotAccSat %a, %b, %acc : (vector<4xi8>, vector<4xi8>, i32) -> i32 return %r : i32 } func.func @sdot_acc_sat_vector_4xi16(%a: vector<4xi16>, %b: vector<4xi16>, %acc: i64) -> i64 { %r = spirv.SDotAccSat %a, %b, %acc : (vector<4xi16>, vector<4xi16>, i64) -> i64 return %r : i64 } func.func @sdot_acc_sat_vector_8xi8(%a: vector<8xi8>, %b: vector<8xi8>, %acc: i64) -> i64 { %r = spirv.SDotAccSat %a, %b, %acc : (vector<8xi8>, vector<8xi8>, i64) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_acc_sat_scalar_bad_types(%a: i32, %b: i64, %acc: i32) -> i32 { %r = spirv.SDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i64, i32) -> i32 return %r : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_acc_sat_scalar_bad_types(%a: i32, %b: i32, %acc: i16) -> i16 { %r = spirv.SDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i16) -> i16 return %r : i16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_acc_sat_scalar_bad_types(%a: i64, %b: i64, %acc: i64) -> i64 { %r = spirv.SDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i64, i64, i64) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdot_acc_sat_scalar_bad_accumulator(%a: i32, %b: i32, %acc: i32) -> i64 { %r = spirv.SDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sudot_acc_sat_scalar_i32(%a: i32, %b: i32, %acc: i32) -> i32 { %r = spirv.SUDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i32 return %r : i32 } func.func @sudot_acc_sat_scalar_i64(%a: i32, %b: i32, %acc: i64) -> i64 { %r = spirv.SUDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i64) -> i64 return %r : i64 } func.func @sudot_acc_sat_vector_4xi8(%a: vector<4xi8>, %b: vector<4xi8>, %acc: i32) -> i32 { %r = spirv.SUDotAccSat %a, %b, %acc : (vector<4xi8>, vector<4xi8>, i32) -> i32 return %r : i32 } func.func @sudot_acc_sat_vector_4xi16(%a: vector<4xi16>, %b: vector<4xi16>, %acc: i64) -> i64 { %r = spirv.SUDotAccSat %a, %b, %acc : (vector<4xi16>, vector<4xi16>, i64) -> i64 return %r : i64 } func.func @sudot_acc_sat_vector_8xi8(%a: vector<8xi8>, %b: vector<8xi8>, %acc: i64) -> i64 { %r = spirv.SUDotAccSat %a, %b, %acc : (vector<8xi8>, vector<8xi8>, i64) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @udot_acc_sat_scalar_i32(%a: i32, %b: i32, %acc: i32) -> i32 { %r = spirv.UDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i32) -> i32 return %r : i32 } func.func @udot_acc_sat_scalar_i64(%a: i32, %b: i32, %acc: i64) -> i64 { %r = spirv.UDotAccSat %a, %b, %acc {format = #spirv.packed_vector_format}: (i32, i32, i64) -> i64 return %r : i64 } func.func @udot_acc_sat_vector_4xi8(%a: vector<4xi8>, %b: vector<4xi8>, %acc: i32) -> i32 { %r = spirv.UDotAccSat %a, %b, %acc : (vector<4xi8>, vector<4xi8>, i32) -> i32 return %r : i32 } func.func @udot_acc_sat_vector_4xi16(%a: vector<4xi16>, %b: vector<4xi16>, %acc: i64) -> i64 { %r = spirv.UDotAccSat %a, %b, %acc : (vector<4xi16>, vector<4xi16>, i64) -> i64 return %r : i64 } func.func @udot_acc_sat_vector_8xi8(%a: vector<8xi8>, %b: vector<8xi8>, %acc: i64) -> i64 { %r = spirv.UDotAccSat %a, %b, %acc : (vector<8xi8>, vector<8xi8>, i64) -> i64 return %r : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cast1(%arg0 : f32) { %0 = spirv.Bitcast %arg0 : f32 to i32 return } func.func @cast2(%arg0 : vector<2xf32>) { %0 = spirv.Bitcast %arg0 : vector<2xf32> to vector<2xi32> return } func.func @cast3(%arg0 : vector<2xf32>) { %0 = spirv.Bitcast %arg0 : vector<2xf32> to i64 return } func.func @cast4(%arg0 : !spirv.ptr) { %0 = spirv.Bitcast %arg0 : !spirv.ptr to !spirv.ptr return } func.func @cast5(%arg0 : !spirv.ptr) { %0 = spirv.Bitcast %arg0 : !spirv.ptr to !spirv.ptr, Function> return } func.func @cast6(%arg0 : vector<4xf32>) { %0 = spirv.Bitcast %arg0 : vector<4xf32> to vector<2xi64> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cast1(%arg0 : f32) { %0 = spirv.Bitcast %arg0 : f32 to f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cast1(%arg0 : f32) { %0 = spirv.Bitcast %arg0 : f32 to i64 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cast1(%arg0 : vector<2xf32>) { %0 = spirv.Bitcast %arg0 : vector<2xf32> to vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cast3(%arg0 : !spirv.ptr) { %0 = spirv.Bitcast %arg0 : !spirv.ptr to i64 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @cast3(%arg0 : i64) { %0 = spirv.Bitcast %arg0 : i64 to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f_to_s_scalar(%arg0 : f32) -> i32 { %0 = spirv.ConvertFToS %arg0 : f32 to i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f64_to_s32_scalar(%arg0 : f64) -> i32 { %0 = spirv.ConvertFToS %arg0 : f64 to i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f_to_s_vector(%arg0 : vector<3xf32>) -> vector<3xi32> { %0 = spirv.ConvertFToS %arg0 : vector<3xf32> to vector<3xi32> spirv.ReturnValue %0 : vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f_to_u_scalar(%arg0 : f32) -> i32 { %0 = spirv.ConvertFToU %arg0 : f32 to i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f64_to_u32_scalar(%arg0 : f64) -> i32 { %0 = spirv.ConvertFToU %arg0 : f64 to i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f_to_u_vector(%arg0 : vector<3xf32>) -> vector<3xi32> { %0 = spirv.ConvertFToU %arg0 : vector<3xf32> to vector<3xi32> spirv.ReturnValue %0 : vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_f_to_u_coopmatrix(%arg0 : !spirv.coopmatrix<8x16xf32, Subgroup>) { %0 = spirv.ConvertFToU %arg0 : !spirv.coopmatrix<8x16xf32, Subgroup> to !spirv.coopmatrix<8x16xi32, Subgroup> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_s_to_f_scalar(%arg0 : i32) -> f32 { %0 = spirv.ConvertSToF %arg0 : i32 to f32 spirv.ReturnValue %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_s64_to_f32_scalar(%arg0 : i64) -> f32 { %0 = spirv.ConvertSToF %arg0 : i64 to f32 spirv.ReturnValue %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_s_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> { %0 = spirv.ConvertSToF %arg0 : vector<3xi32> to vector<3xf32> spirv.ReturnValue %0 : vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_u_to_f_scalar(%arg0 : i32) -> f32 { %0 = spirv.ConvertUToF %arg0 : i32 to f32 spirv.ReturnValue %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_u64_to_f32_scalar(%arg0 : i64) -> f32 { %0 = spirv.ConvertUToF %arg0 : i64 to f32 spirv.ReturnValue %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @convert_u_to_f_vector(%arg0 : vector<3xi32>) -> vector<3xf32> { %0 = spirv.ConvertUToF %arg0 : vector<3xi32> to vector<3xf32> spirv.ReturnValue %0 : vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @f_convert_scalar(%arg0 : f32) -> f64 { %0 = spirv.FConvert %arg0 : f32 to f64 spirv.ReturnValue %0 : f64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @f_convert_vector(%arg0 : vector<3xf32>) -> vector<3xf64> { %0 = spirv.FConvert %arg0 : vector<3xf32> to vector<3xf64> spirv.ReturnValue %0 : vector<3xf64> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @f_convert_coop_matrix(%arg0 : !spirv.coopmatrix<8x16xf32, Subgroup>) { %0 = spirv.FConvert %arg0 : !spirv.coopmatrix<8x16xf32, Subgroup> to !spirv.coopmatrix<8x16xf64, Subgroup> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @f_convert_vector(%arg0 : f32) -> f32 { %0 = spirv.FConvert %arg0 : f32 to f32 spirv.ReturnValue %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @s_convert_scalar(%arg0 : i32) -> i64 { %0 = spirv.SConvert %arg0 : i32 to i64 spirv.ReturnValue %0 : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @u_convert_scalar(%arg0 : i32) -> i64 { %0 = spirv.UConvert %arg0 : i32 to i64 spirv.ReturnValue %0 : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ptrcasttogeneric1(%arg0 : !spirv.ptr) { %0 = spirv.PtrCastToGeneric %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ptrcasttogeneric2(%arg0 : !spirv.ptr) { %0 = spirv.PtrCastToGeneric %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ptrcasttogeneric3(%arg0 : !spirv.ptr) { %0 = spirv.PtrCastToGeneric %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ptrcasttogeneric4(%arg0 : !spirv.ptr) { %0 = spirv.PtrCastToGeneric %arg0 : !spirv.ptr to !spirv.ptr, Generic> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptr1(%arg0 : !spirv.ptr, Generic>) { %0 = spirv.GenericCastToPtr %arg0 : !spirv.ptr, Generic> to !spirv.ptr, CrossWorkgroup> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptr2(%arg0 : !spirv.ptr) { %0 = spirv.GenericCastToPtr %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptr3(%arg0 : !spirv.ptr) { %0 = spirv.GenericCastToPtr %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptr4(%arg0 : !spirv.ptr) { %0 = spirv.GenericCastToPtr %arg0 : !spirv.ptr to !spirv.ptr, Workgroup> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptrexplicit1(%arg0 : !spirv.ptr, Generic>) { %0 = spirv.GenericCastToPtrExplicit %arg0 : !spirv.ptr, Generic> to !spirv.ptr, CrossWorkgroup> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptrexplicit2(%arg0 : !spirv.ptr) { %0 = spirv.GenericCastToPtrExplicit %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptrexplicit3(%arg0 : !spirv.ptr) { %0 = spirv.GenericCastToPtrExplicit %arg0 : !spirv.ptr to !spirv.ptr return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @genericcasttoptrexplicit4(%arg0 : !spirv.ptr) { %0 = spirv.GenericCastToPtrExplicit %arg0 : !spirv.ptr to !spirv.ptr, Workgroup> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Physical64 OpenCL requires #spirv.vce { spirv.func @covert_ptr_to_u(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } spirv.func @covert_ptr_to_u_truncate(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } spirv.func @covert_ptr_to_u_extend(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i64 spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce { spirv.func @covert_ptr_to_u_PhysicalStorageBuffer(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce { spirv.func @covert_ptr_to_u_fail(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @covert_ptr_to_u_fail_2(%arg0 : !spirv.ptr) ""None"" { %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr to i32 spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Physical64 OpenCL requires #spirv.vce { spirv.func @covert_u_to_ptr(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } spirv.func @covert_u_to_ptr_truncate(%arg0 : i64) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i64 to !spirv.ptr spirv.Return } spirv.func @covert_u_to_ptr_extend(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce { spirv.func @covert_u_to_ptr_PhysicalStorageBuffer(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce { spirv.func @covert_u_to_ptr_fail(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @covert_u_to_ptr_fail_2(%arg0 : i32) ""None"" { %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr spirv.Return } }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var1 : !spirv.ptr)>, Input> spirv.func @access_chain() -> () ""None"" { %0 = spirv.Constant 1: i32 %1 = spirv.mlir.addressof @var1 : !spirv.ptr)>, Input> %2 = spirv.AccessChain %1[%0, %0] : !spirv.ptr)>, Input>, i32, i32 spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.GlobalVariable @var : !spirv.ptr)>, Input> func.func @addressof() -> () { %1 = spirv.mlir.addressof @var : !spirv.ptr)>, Input> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var1 : !spirv.ptr)>, Input> spirv.func @foo() -> () ""None"" { %0 = spirv.mlir.addressof @var2 : !spirv.ptr)>, Input> } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var1 : !spirv.ptr)>, Input> spirv.func @foo() -> () ""None"" { %0 = spirv.mlir.addressof @var1 : !spirv.ptr } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @const() -> () { %0 = spirv.Constant true %1 = spirv.Constant 42 : i32 %2 = spirv.Constant 0.5 : f32 %3 = spirv.Constant dense<[2, 3]> : vector<2xi32> %4 = spirv.Constant [dense<3.0> : vector<2xf32>] : !spirv.array<1xvector<2xf32>> %5 = spirv.Constant dense<1> : tensor<2x3xi32> : !spirv.array<2 x !spirv.array<3 x i32>> %6 = spirv.Constant dense<1.0> : tensor<2x3xf32> : !spirv.array<2 x !spirv.array<3 x f32>> %7 = spirv.Constant dense<[[1, 2, 3], [4, 5, 6]]> : tensor<2x3xi32> : !spirv.array<2 x !spirv.array<3 x i32>> %8 = spirv.Constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> : tensor<2x3xf32> : !spirv.array<2 x !spirv.array<3 x f32>> %9 = spirv.Constant [[dense<3.0> : vector<2xf32>]] : !spirv.array<1 x !spirv.array<1xvector<2xf32>>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @unaccepted_std_attr() -> () { %0 = spirv.Constant unit : none return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @array_constant() -> () { %0 = spirv.Constant [dense<3.0> : vector<2xf32>, dense<4> : vector<2xi32>] : !spirv.array<2xvector<2xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @array_constant() -> () { %0 = spirv.Constant [dense<3.0> : vector<2xf32>] : !spirv.rtarray> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @non_nested_array_constant() -> () { %0 = spirv.Constant dense<3.0> : tensor<2x2xf32> : !spirv.array<2xvector<2xf32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @value_result_type_mismatch() -> () { %0 = ""spirv.Constant""() {value = dense<0> : tensor<4xi32>} : () -> (vector<4xi32>) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @value_result_type_mismatch() -> () { %0 = spirv.Constant dense<1.0> : tensor<2x3xf32> : !spirv.array<2 x !spirv.array<3 x i32>> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @value_result_num_elements_mismatch() -> () { %0 = spirv.Constant dense<1.0> : tensor<2x2xf32> : !spirv.array<2 x !spirv.array<3 x f32>> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_nothing } spirv.module Logical GLSL450 { spirv.GlobalVariable @var2 : !spirv.ptr spirv.GlobalVariable @var3 : !spirv.ptr spirv.func @do_something(%arg0 : !spirv.ptr, %arg1 : !spirv.ptr) -> () ""None"" { %1 = spirv.Load ""Input"" %arg0 : f32 spirv.Store ""Output"" %arg1, %1 : f32 spirv.Return } spirv.EntryPoint ""GLCompute"" @do_something, @var2, @var3 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" ""do_nothing"" }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_something }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.EntryPoint ""GLCompute"" @do_something } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_nothing spirv.EntryPoint ""GLCompute"" @do_nothing }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_nothing spirv.EntryPoint ""ContractionOff"" @do_nothing }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_nothing spirv.ExecutionMode @do_nothing ""ContractionOff"" } spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_nothing spirv.ExecutionMode @do_nothing ""LocalSizeHint"", 3, 4, 5 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @do_nothing spirv.ExecutionMode @do_nothing ""GLCompute"", 3, 4, 5 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @foo() ""None"" spirv.func @bar(%arg: i32) -> (i32) ""Inline|Pure"" { spirv.ReturnValue %arg: i32 } spirv.func @baz(%arg: i32) ""DontInline"" attributes { additional_stuff = 64 } { spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @outside.func.with.linkage(%arg0 : i8) -> () ""Pure"" attributes { linkage_attributes=#spirv.linkage_attributes< linkage_name=""outside.func"", linkage_type= > } spirv.func @inside.func() -> () ""Pure"" attributes {} {spirv.Return} }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.func @outside.func.without.linkage(%arg0 : i8) -> () ""Pure"" spirv.func @inside.func() -> () ""Pure"" attributes {} {spirv.Return} }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 spirv.func @missing_function_control() { spirv.Return }, mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cannot_have_more_than_one_result(%arg: i32) -> (i32, i32) ""None""", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.func @cannot_have_variadic_arguments(%arg: i32, ...) ""None""", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @outer_func() -> () ""None"" { spirv.func @inner_func() -> () ""None"" { spirv.Return } spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = 4.0 : f32 spirv.GlobalVariable @var initializer(@sc) : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.SpecConstant @sc = 4.0 : f32 spirv.GlobalVariable @var initializer(@sc) : !spirv.ptr", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 bind(1, 2) : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var1 built_in(""GlobalInvocationID"") : !spirv.ptr, Input> spirv.GlobalVariable @var2 {built_in = ""GlobalInvocationID""} : !spirv.ptr, Input> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "module { spirv.GlobalVariable @var0 : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @var1 { linkage_attributes=#spirv.linkage_attributes< linkage_name=""outSideGlobalVar1"", linkage_type= > } : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { ""spirv.GlobalVariable""() {sym_name = ""var0"", type = none} : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 initializer(@var1) : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo() ""None"" { spirv.GlobalVariable @var0 : !spirv.ptr spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { } spirv.module @name Logical GLSL450 { } spirv.module Logical GLSL450 requires #spirv.vce { } spirv.module Logical GLSL450 attributes {foo = ""bar""} { } spirv.module Logical GLSL450 requires #spirv.vce attributes {foo = ""bar""} { } spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 spirv.module { }, mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 spirv.module Physical { }, mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 spirv.module Logical { }, mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 spirv.module Logical Bla { }, mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { ^first: spirv.Return ^second: spirv.Return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { ""dialect.op""() : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @do_nothing() -> () ""None"" { ""dialect.op""() : () -> () } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @extern() -> () ""None"" }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = false spirv.SpecConstant @sc2 = 42 : i64 spirv.SpecConstant @sc3 = 1.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.struct<(i1, i64, f32)> spirv.func @reference() -> i1 ""None"" { %0 = spirv.mlir.referenceof @sc1 : i1 spirv.ReturnValue %0 : i1 } spirv.func @reference_composite() -> i1 ""None"" { %0 = spirv.mlir.referenceof @scc : !spirv.struct<(i1, i64, f32)> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.struct<(i1, i64, f32)> spirv.ReturnValue %1 : i1 } spirv.func @initialize() -> i64 ""None"" { %0 = spirv.mlir.referenceof @sc2 : i64 %1 = spirv.Variable init(%0) : !spirv.ptr %2 = spirv.Load ""Function"" %1 : i64 spirv.ReturnValue %2 : i64 } spirv.func @compute() -> f32 ""None"" { %0 = spirv.mlir.referenceof @sc3 : f32 %1 = spirv.Constant 6.0 : f32 %2 = spirv.FAdd %0, %1 : f32 spirv.ReturnValue %2 : f32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.SpecConstant @sc = 5 : i32 func.func @reference_of() { %0 = spirv.mlir.referenceof @sc : i32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.SpecConstant @sc = 5 : i32 spirv.SpecConstantComposite @scc (@sc) : !spirv.array<1 x i32> func.func @reference_of_composite() { %0 = spirv.mlir.referenceof @scc : !spirv.array<1 x i32> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.array<1 x i32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo() -> () ""None"" { %0 = spirv.mlir.referenceof @sc : i32 spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = 42 : i32 spirv.func @foo() -> () ""None"" { %0 = spirv.mlir.referenceof @sc : f32 spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = 42 : i32 spirv.SpecConstantComposite @scc (@sc) : !spirv.array<1 x i32> spirv.func @foo() -> () ""None"" { %0 = spirv.mlir.referenceof @scc : f32 spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = false spirv.SpecConstant @sc2 spec_id(5) = 42 : i64 spirv.SpecConstant @sc3 = 1.5 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc2 spec_id(-5) = 42 : i64 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = 15 : i4 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = dense<[2, 3]> : vector<2xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @use_in_function() -> () { spirv.SpecConstant @sc = false return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstantComposite @scc2 (@sc1, @sc2, @sc3) : i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1.5 : f32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.array<3 x f32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = false spirv.SpecConstant @sc2 spec_id(5) = 42 : i64 spirv.SpecConstant @sc3 = 1.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.array<4 x f32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1 : i32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.array<3 x f32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1 : i32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.struct<(i32, f32, f32)> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1 : i32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.struct<(i32, f32)> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1.5 : f32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : !spirv.struct<(i32, f32, f32)> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1.5 : f32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3 x f32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = false spirv.SpecConstant @sc2 spec_id(5) = 42 : i64 spirv.SpecConstant @sc3 = 1.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1 : i32 spirv.SpecConstant @sc2 = 2.5 : f32 spirv.SpecConstant @sc3 = 3.5 : f32 spirv.SpecConstantComposite @scc (@sc1, @sc2, @sc3) : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc1 = 1.5 : f32 spirv.SpecConstantComposite @scc (@sc1) : !spirv.coopmatrix<8x16xf32, Device> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo() -> i32 ""None"" { %0 = spirv.Constant 1: i32 %1 = spirv.Constant 1: i32 %2 = spirv.SpecConstantOperation wraps ""spirv.IAdd""(%0, %1) : (i32, i32) -> i32 spirv.ReturnValue %2 : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @sc = 42 : i32 spirv.func @foo() -> i32 ""None"" { %0 = spirv.mlir.referenceof @sc : i32 %1 = spirv.SpecConstantOperation wraps ""spirv.ISub""(%0, %0) : (i32, i32) -> i32 spirv.ReturnValue %1 : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo() -> i32 ""None"" { %0 = spirv.Constant 1: i32 spirv.mlir.yield %0 : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo() -> () ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.SpecConstantOperation wraps ""spirv.Load""(%0) {memory_access = #spirv.memory_access} : (!spirv.ptr) -> i32 spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo() -> () ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 : i32 %2 = spirv.SpecConstantOperation wraps ""spirv.IAdd""(%1, %1) : (i32, i32) -> i32 spirv.Return } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @fadd_scalar(%arg: f32) -> f32 { %0 = spirv.FAdd %arg, %arg : f32 return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fdiv_scalar(%arg: f32) -> f32 { %0 = spirv.FDiv %arg, %arg : f32 return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmod_scalar(%arg: f32) -> f32 { %0 = spirv.FMod %arg, %arg : f32 return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmul_scalar(%arg: f32) -> f32 { %0 = spirv.FMul %arg, %arg : f32 return %0 : f32 } func.func @fmul_vector(%arg: vector<4xf32>) -> vector<4xf32> { %0 = spirv.FMul %arg, %arg : vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmul_i32(%arg: i32) -> i32 { %0 = spirv.FMul %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmul_bf16(%arg: bf16) -> bf16 { %0 = spirv.FMul %arg, %arg : bf16 return %0 : bf16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmul_tensor(%arg: tensor<4xf32>) -> tensor<4xf32> { %0 = spirv.FMul %arg, %arg : tensor<4xf32> return %0 : tensor<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fnegate_scalar(%arg: f32) -> f32 { %0 = spirv.FNegate %arg : f32 return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @frem_scalar(%arg: f32) -> f32 { %0 = spirv.FRem %arg, %arg : f32 return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fsub_scalar(%arg: f32) -> f32 { %0 = spirv.FSub %arg, %arg : f32 return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iadd_scalar(%arg: i32) -> i32 { %0 = spirv.IAdd %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @imul_scalar(%arg: i32) -> i32 { %0 = spirv.IMul %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isub_scalar(%arg: i32) -> i32 { %0 = spirv.ISub %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iadd_carry_scalar(%arg: i32) -> !spirv.struct<(i32, i32)> { %0 = spirv.IAddCarry %arg, %arg : !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> } func.func @iadd_carry_vector(%arg: vector<3xi32>) -> !spirv.struct<(vector<3xi32>, vector<3xi32>)> { %0 = spirv.IAddCarry %arg, %arg : !spirv.struct<(vector<3xi32>, vector<3xi32>)> return %0 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iadd_carry(%arg: i32) -> !spirv.struct<(i32, i32, i32)> { %0 = spirv.IAddCarry %arg, %arg : !spirv.struct<(i32, i32, i32)> return %0 : !spirv.struct<(i32, i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iadd_carry(%arg: i32) -> !spirv.struct<(i32)> { %0 = ""spirv.IAddCarry""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32)> return %0 : !spirv.struct<(i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iadd_carry(%arg: i32) -> !spirv.struct<(i32, i64)> { %0 = ""spirv.IAddCarry""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32, i64)> return %0 : !spirv.struct<(i32, i64)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iadd_carry(%arg: i64) -> !spirv.struct<(i32, i32)> { %0 = ""spirv.IAddCarry""(%arg, %arg): (i64, i64) -> !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isub_borrow_scalar(%arg: i32) -> !spirv.struct<(i32, i32)> { %0 = spirv.ISubBorrow %arg, %arg : !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> } func.func @isub_borrow_vector(%arg: vector<3xi32>) -> !spirv.struct<(vector<3xi32>, vector<3xi32>)> { %0 = spirv.ISubBorrow %arg, %arg : !spirv.struct<(vector<3xi32>, vector<3xi32>)> return %0 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isub_borrow(%arg: i32) -> !spirv.struct<(i32, i32, i32)> { %0 = spirv.ISubBorrow %arg, %arg : !spirv.struct<(i32, i32, i32)> return %0 : !spirv.struct<(i32, i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isub_borrow(%arg: i32) -> !spirv.struct<(i32)> { %0 = ""spirv.ISubBorrow""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32)> return %0 : !spirv.struct<(i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isub_borrow(%arg: i32) -> !spirv.struct<(i32, i64)> { %0 = ""spirv.ISubBorrow""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32, i64)> return %0 : !spirv.struct<(i32, i64)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isub_borrow(%arg: i64) -> !spirv.struct<(i32, i32)> { %0 = ""spirv.ISubBorrow""(%arg, %arg): (i64, i64) -> !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @smul_extended_scalar(%arg: i32) -> !spirv.struct<(i32, i32)> { %0 = spirv.SMulExtended %arg, %arg : !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> } func.func @smul_extended_vector(%arg: vector<3xi32>) -> !spirv.struct<(vector<3xi32>, vector<3xi32>)> { %0 = spirv.SMulExtended %arg, %arg : !spirv.struct<(vector<3xi32>, vector<3xi32>)> return %0 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @smul_extended(%arg: i32) -> !spirv.struct<(i32, i32, i32)> { %0 = spirv.SMulExtended %arg, %arg : !spirv.struct<(i32, i32, i32)> return %0 : !spirv.struct<(i32, i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @smul_extended(%arg: i32) -> !spirv.struct<(i32)> { %0 = ""spirv.SMulExtended""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32)> return %0 : !spirv.struct<(i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @smul_extended(%arg: i32) -> !spirv.struct<(i32, i64)> { %0 = ""spirv.SMulExtended""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32, i64)> return %0 : !spirv.struct<(i32, i64)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @smul_extended(%arg: i64) -> !spirv.struct<(i32, i32)> { %0 = ""spirv.SMulExtended""(%arg, %arg): (i64, i64) -> !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @umul_extended_scalar(%arg: i32) -> !spirv.struct<(i32, i32)> { %0 = spirv.UMulExtended %arg, %arg : !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> } func.func @umul_extended_vector(%arg: vector<3xi32>) -> !spirv.struct<(vector<3xi32>, vector<3xi32>)> { %0 = spirv.UMulExtended %arg, %arg : !spirv.struct<(vector<3xi32>, vector<3xi32>)> return %0 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @umul_extended(%arg: i32) -> !spirv.struct<(i32, i32, i32)> { %0 = spirv.UMulExtended %arg, %arg : !spirv.struct<(i32, i32, i32)> return %0 : !spirv.struct<(i32, i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @umul_extended(%arg: i32) -> !spirv.struct<(i32)> { %0 = ""spirv.UMulExtended""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32)> return %0 : !spirv.struct<(i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @umul_extended(%arg: i32) -> !spirv.struct<(i32, i64)> { %0 = ""spirv.UMulExtended""(%arg, %arg): (i32, i32) -> !spirv.struct<(i32, i64)> return %0 : !spirv.struct<(i32, i64)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @umul_extended(%arg: i64) -> !spirv.struct<(i32, i32)> { %0 = ""spirv.UMulExtended""(%arg, %arg): (i64, i64) -> !spirv.struct<(i32, i32)> return %0 : !spirv.struct<(i32, i32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sdiv_scalar(%arg: i32) -> i32 { %0 = spirv.SDiv %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @smod_scalar(%arg: i32) -> i32 { %0 = spirv.SMod %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @snegate_scalar(%arg: i32) -> i32 { %0 = spirv.SNegate %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @srem_scalar(%arg: i32) -> i32 { %0 = spirv.SRem %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @udiv_scalar(%arg: i32) -> i32 { %0 = spirv.UDiv %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @umod_scalar(%arg: i32) -> i32 { %0 = spirv.UMod %arg, %arg : i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<4xf32> { %0 = spirv.VectorTimesScalar %vector, %scalar : (vector<4xf32>, f32) -> vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f16) -> vector<4xf32> { %0 = spirv.VectorTimesScalar %vector, %scalar : (vector<4xf32>, f16) -> vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_times_scalar(%vector: vector<4xf32>, %scalar: f32) -> vector<3xf32> { %0 = spirv.VectorTimesScalar %vector, %scalar : (vector<4xf32>, f32) -> vector<3xf32> return %0 : vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_vector(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> { %0 = spirv.CompositeConstruct %arg0, %arg1, %arg2 : (f32, f32, f32) -> vector<3xf32> return %0: vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_struct(%arg0: vector<3xf32>, %arg1: !spirv.array<4xf32>, %arg2 : !spirv.struct<(f32)>) -> !spirv.struct<(vector<3xf32>, !spirv.array<4xf32>, !spirv.struct<(f32)>)> { %0 = spirv.CompositeConstruct %arg0, %arg1, %arg2 : (vector<3xf32>, !spirv.array<4xf32>, !spirv.struct<(f32)>) -> !spirv.struct<(vector<3xf32>, !spirv.array<4xf32>, !spirv.struct<(f32)>)> return %0: !spirv.struct<(vector<3xf32>, !spirv.array<4xf32>, !spirv.struct<(f32)>)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_mixed_scalar_vector(%arg0: f32, %arg1: f32, %arg2 : vector<2xf32>) -> vector<4xf32> { %0 = spirv.CompositeConstruct %arg0, %arg2, %arg1 : (f32, vector<2xf32>, f32) -> vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_coopmatrix(%arg0 : f32) -> !spirv.coopmatrix<8x16xf32, Subgroup> { %0 = spirv.CompositeConstruct %arg0 : (f32) -> !spirv.coopmatrix<8x16xf32, Subgroup> return %0: !spirv.coopmatrix<8x16xf32, Subgroup> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_invalid_result_type(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xf32> { %0 = spirv.CompositeConstruct %arg0, %arg2 : (f32, f32) -> vector<3xf32> return %0: vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_invalid_operand_type(%arg0: f32, %arg1: f32, %arg2 : f32) -> vector<3xi32> { %0 = spirv.CompositeConstruct %arg0, %arg1, %arg2 : (f32, f32, f32) -> vector<3xi32> return %0: vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_coopmatrix_incorrect_operand_count(%arg0 : f32, %arg1 : f32) -> !spirv.coopmatrix<8x16xf32, Subgroup> { %0 = spirv.CompositeConstruct %arg0, %arg1 : (f32, f32) -> !spirv.coopmatrix<8x16xf32, Subgroup> return %0: !spirv.coopmatrix<8x16xf32, Subgroup> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_coopmatrix_incorrect_element_type(%arg0 : i32) -> !spirv.coopmatrix<8x16xf32, Subgroup> { %0 = spirv.CompositeConstruct %arg0 : (i32) -> !spirv.coopmatrix<8x16xf32, Subgroup> return %0: !spirv.coopmatrix<8x16xf32, Subgroup> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_array(%arg0: f32) -> !spirv.array<4xf32> { %0 = spirv.CompositeConstruct %arg0 : (f32) -> !spirv.array<4xf32> return %0: !spirv.array<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_vector_wrong_element_type(%arg0: f32, %arg1: f32, %arg2 : vector<2xi32>) -> vector<4xf32> { %0 = spirv.CompositeConstruct %arg0, %arg2, %arg1 : (f32, vector<2xi32>, f32) -> vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_construct_vector_wrong_count(%arg0: f32, %arg1: f32, %arg2 : vector<2xf32>) -> vector<4xf32> { %0 = spirv.CompositeConstruct %arg0, %arg2 : (f32, vector<2xf32>) -> vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_array(%arg0: !spirv.array<4xf32>) -> f32 { %0 = spirv.CompositeExtract %arg0[1 : i32] : !spirv.array<4xf32> return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_struct(%arg0 : !spirv.struct<(f32, !spirv.array<4xf32>)>) -> f32 { %0 = spirv.CompositeExtract %arg0[1 : i32, 2 : i32] : !spirv.struct<(f32, !spirv.array<4xf32>)> return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_vector(%arg0 : vector<4xf32>) -> f32 { %0 = spirv.CompositeExtract %arg0[1 : i32] : vector<4xf32> return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_coopmatrix(%arg0 : !spirv.coopmatrix<8x16xf32, Subgroup>) -> f32 { %0 = spirv.CompositeExtract %arg0[2 : i32] : !spirv.coopmatrix<8x16xf32, Subgroup> return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_no_ssa_operand() -> () { %0 = spirv.CompositeExtract [4 : i32, 1 : i32] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_invalid_index_type_1() -> () { %0 = spirv.Constant 10 : i32 %1 = spirv.Variable : !spirv.ptr>, Function> %2 = spirv.Load ""Function"" %1 [""Volatile""] : !spirv.array<4x!spirv.array<4xf32>> %3 = spirv.CompositeExtract %2[%0] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_invalid_index_type_2(%arg0 : !spirv.array<4x!spirv.array<4xf32>>) -> () { %0 = spirv.CompositeExtract %arg0[1] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_invalid_index_identifier(%arg0 : !spirv.array<4x!spirv.array<4xf32>>) -> () { %0 = spirv.CompositeExtract %arg0 ]1 : i32) : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_2D_array_out_of_bounds_access_1(%arg0: !spirv.array<4x!spirv.array<4xf32>>) -> () { %0 = spirv.CompositeExtract %arg0[4 : i32, 1 : i32] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_2D_array_out_of_bounds_access_2(%arg0: !spirv.array<4x!spirv.array<4xf32>> ) -> () { %0 = spirv.CompositeExtract %arg0[1 : i32, 4 : i32] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_struct_element_out_of_bounds_access(%arg0 : !spirv.struct<(f32, !spirv.array<4xf32>)>) -> () { %0 = spirv.CompositeExtract %arg0[2 : i32, 0 : i32] : !spirv.struct<(f32, !spirv.array<4xf32>)> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_vector_out_of_bounds_access(%arg0: vector<4xf32>) -> () { %0 = spirv.CompositeExtract %arg0[4 : i32] : vector<4xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_invalid_types_1(%arg0: !spirv.array<4x!spirv.array<4xf32>>) -> () { %0 = spirv.CompositeExtract %arg0[1 : i32, 2 : i32, 3 : i32] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_invalid_types_2(%arg0: f32) -> () { %0 = spirv.CompositeExtract %arg0[1 : i32] : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_invalid_extracted_type(%arg0: !spirv.array<4x!spirv.array<4xf32>>) -> () { %0 = spirv.CompositeExtract %arg0[] : !spirv.array<4x!spirv.array<4xf32>> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_extract_result_type_mismatch(%arg0: !spirv.array<4xf32>) -> i32 { %0 = ""spirv.CompositeExtract""(%arg0) {indices = [2: i32]} : (!spirv.array<4xf32>) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_array(%arg0: !spirv.array<4xf32>, %arg1: f32) -> !spirv.array<4xf32> { %0 = spirv.CompositeInsert %arg1, %arg0[1 : i32] : f32 into !spirv.array<4xf32> return %0: !spirv.array<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_struct(%arg0: !spirv.struct<(!spirv.array<4xf32>, f32)>, %arg1: !spirv.array<4xf32>) -> !spirv.struct<(!spirv.array<4xf32>, f32)> { %0 = spirv.CompositeInsert %arg1, %arg0[0 : i32] : !spirv.array<4xf32> into !spirv.struct<(!spirv.array<4xf32>, f32)> return %0: !spirv.struct<(!spirv.array<4xf32>, f32)> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_coopmatrix(%arg0: !spirv.coopmatrix<8x16xi32, Subgroup>, %arg1: i32) -> !spirv.coopmatrix<8x16xi32, Subgroup> { %0 = spirv.CompositeInsert %arg1, %arg0[5 : i32] : i32 into !spirv.coopmatrix<8x16xi32, Subgroup> return %0: !spirv.coopmatrix<8x16xi32, Subgroup> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_no_indices(%arg0: !spirv.array<4xf32>, %arg1: f32) -> !spirv.array<4xf32> { %0 = spirv.CompositeInsert %arg1, %arg0[] : f32 into !spirv.array<4xf32> return %0: !spirv.array<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_out_of_bounds(%arg0: !spirv.array<4xf32>, %arg1: f32) -> !spirv.array<4xf32> { %0 = spirv.CompositeInsert %arg1, %arg0[4 : i32] : f32 into !spirv.array<4xf32> return %0: !spirv.array<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_invalid_object_type(%arg0: !spirv.array<4xf32>, %arg1: f64) -> !spirv.array<4xf32> { %0 = spirv.CompositeInsert %arg1, %arg0[3 : i32] : f64 into !spirv.array<4xf32> return %0: !spirv.array<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @composite_insert_invalid_result_type(%arg0: !spirv.array<4xf32>, %arg1 : f32) -> !spirv.array<4xf64> { %0 = ""spirv.CompositeInsert""(%arg1, %arg0) {indices = [0: i32]} : (f32, !spirv.array<4xf32>) -> !spirv.array<4xf64> return %0: !spirv.array<4xf64> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_dynamic_extract(%vec: vector<4xf32>, %id : i32) -> f32 { %0 = spirv.VectorExtractDynamic %vec[%id] : vector<4xf32>, i32 return %0 : f32 } func.func @vector_dynamic_insert(%val: f32, %vec: vector<4xf32>, %id : i32) -> vector<4xf32> { %0 = spirv.VectorInsertDynamic %val, %vec[%id] : vector<4xf32>, i32 return %0 : vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_shuffle(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> { %0 = spirv.VectorShuffle [1: i32, 3: i32, 0xffffffff: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32> return %0: vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> { %0 = spirv.VectorShuffle [1: i32, 3: i32, 5: i32, 2: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32> return %0: vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @vector_shuffle_extra_selector(%vector1: vector<4xf32>, %vector2: vector<2xf32>) -> vector<3xf32> { %0 = spirv.VectorShuffle [1: i32, 7: i32, 5: i32] %vector1: vector<4xf32>, %vector2: vector<2xf32> -> vector<3xf32> return %0: vector<3xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : f32) -> () { %2 = spirv.GL.Exp %arg0 : f32 return } func.func @expvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Exp %arg0 : vector<3xf16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : i32) -> () { %2 = spirv.GL.Exp %arg0 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : vector<5xf32>) -> () { %2 = spirv.GL.Exp %arg0 : vector<5xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : f32, %arg1 : f32) -> () { %2 = spirv.GL.Exp %arg0, %arg1 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : i32) -> () { %2 = spirv.GL.Exp %arg0 : return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmaxmin(%arg0 : f32, %arg1 : f32) { %1 = spirv.GL.FMax %arg0, %arg1 : f32 %2 = spirv.GL.FMin %arg0, %arg1 : f32 return } func.func @fmaxminvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) { %1 = spirv.GL.FMax %arg0, %arg1 : vector<3xf16> %2 = spirv.GL.FMin %arg0, %arg1 : vector<3xf16> return } func.func @fmaxminf64(%arg0 : f64, %arg1 : f64) { %1 = spirv.GL.FMax %arg0, %arg1 : f64 %2 = spirv.GL.FMin %arg0, %arg1 : f64 return } func.func @iminmax(%arg0: i32, %arg1: i32) { %1 = spirv.GL.SMax %arg0, %arg1 : i32 %2 = spirv.GL.UMax %arg0, %arg1 : i32 %3 = spirv.GL.SMin %arg0, %arg1 : i32 %4 = spirv.GL.UMin %arg0, %arg1 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @inversesqrt(%arg0 : f32) -> () { %2 = spirv.GL.InverseSqrt %arg0 : f32 return } func.func @inversesqrtvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.InverseSqrt %arg0 : vector<3xf16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sqrt(%arg0 : f32) -> () { %2 = spirv.GL.Sqrt %arg0 : f32 return } func.func @sqrtvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Sqrt %arg0 : vector<3xf16> return } func.func @cos(%arg0 : f32) -> () { %2 = spirv.GL.Cos %arg0 : f32 return } func.func @cosvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Cos %arg0 : vector<3xf16> return } func.func @sin(%arg0 : f32) -> () { %2 = spirv.GL.Sin %arg0 : f32 return } func.func @sinvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Sin %arg0 : vector<3xf16> return } func.func @tan(%arg0 : f32) -> () { %2 = spirv.GL.Tan %arg0 : f32 return } func.func @tanvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Tan %arg0 : vector<3xf16> return } func.func @acos(%arg0 : f32) -> () { %2 = spirv.GL.Acos %arg0 : f32 return } func.func @acosvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Acos %arg0 : vector<3xf16> return } func.func @asin(%arg0 : f32) -> () { %2 = spirv.GL.Asin %arg0 : f32 return } func.func @asinvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Asin %arg0 : vector<3xf16> return } func.func @atan(%arg0 : f32) -> () { %2 = spirv.GL.Atan %arg0 : f32 return } func.func @atanvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Atan %arg0 : vector<3xf16> return } func.func @sinh(%arg0 : f32) -> () { %2 = spirv.GL.Sinh %arg0 : f32 return } func.func @sinhvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Sinh %arg0 : vector<3xf16> return } func.func @cosh(%arg0 : f32) -> () { %2 = spirv.GL.Cosh %arg0 : f32 return } func.func @coshvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Cosh %arg0 : vector<3xf16> return } func.func @pow(%arg0 : f32, %arg1 : f32) -> () { %2 = spirv.GL.Pow %arg0, %arg1 : f32 return } func.func @powvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) -> () { %2 = spirv.GL.Pow %arg0, %arg1 : vector<3xf16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @round(%arg0 : f32) -> () { %2 = spirv.GL.Round %arg0 : f32 return } func.func @roundvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.Round %arg0 : vector<3xf16> return } func.func @round_even(%arg0 : f32) -> () { %2 = spirv.GL.RoundEven %arg0 : f32 return } func.func @round_even_vec(%arg0 : vector<3xf16>) -> () { %2 = spirv.GL.RoundEven %arg0 : vector<3xf16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fclamp(%arg0 : f32, %min : f32, %max : f32) -> () { %2 = spirv.GL.FClamp %arg0, %min, %max : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fclamp(%arg0 : vector<3xf32>, %min : vector<3xf32>, %max : vector<3xf32>) -> () { %2 = spirv.GL.FClamp %arg0, %min, %max : vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @uclamp(%arg0 : ui32, %min : ui32, %max : ui32) -> () { %2 = spirv.GL.UClamp %arg0, %min, %max : ui32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @uclamp(%arg0 : vector<4xi32>, %min : vector<4xi32>, %max : vector<4xi32>) -> () { %2 = spirv.GL.UClamp %arg0, %min, %max : vector<4xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @uclamp(%arg0 : si32, %min : si32, %max : si32) -> () { %2 = spirv.GL.UClamp %arg0, %min, %max : si32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sclamp(%arg0 : si32, %min : si32, %max : si32) -> () { %2 = spirv.GL.SClamp %arg0, %min, %max : si32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sclamp(%arg0 : vector<4xsi32>, %min : vector<4xsi32>, %max : vector<4xsi32>) -> () { %2 = spirv.GL.SClamp %arg0, %min, %max : vector<4xsi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sclamp(%arg0 : i32, %min : i32, %max : i32) -> () { %2 = spirv.GL.SClamp %arg0, %min, %max : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fma(%a : f32, %b : f32, %c : f32) -> () { %2 = spirv.GL.Fma %a, %b, %c : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () { %2 = spirv.GL.Fma %a, %b, %c : vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @frexp_struct(%arg0 : f32) -> () { %2 = spirv.GL.FrexpStruct %arg0 : f32 -> !spirv.struct<(f32, i32)> return } func.func @frexp_struct_64(%arg0 : f64) -> () { %2 = spirv.GL.FrexpStruct %arg0 : f64 -> !spirv.struct<(f64, i32)> return } func.func @frexp_struct_vec(%arg0 : vector<3xf32>) -> () { %2 = spirv.GL.FrexpStruct %arg0 : vector<3xf32> -> !spirv.struct<(vector<3xf32>, vector<3xi32>)> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @frexp_struct_mismatch_type(%arg0 : f32) -> () { %2 = spirv.GL.FrexpStruct %arg0 : f32 -> !spirv.struct<(vector<3xf32>, i32)> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @frexp_struct_wrong_type(%arg0 : i32) -> () { %2 = spirv.GL.FrexpStruct %arg0 : i32 -> !spirv.struct<(i32, i32)> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @frexp_struct_mismatch_num_components(%arg0 : vector<3xf32>) -> () { %2 = spirv.GL.FrexpStruct %arg0 : vector<3xf32> -> !spirv.struct<(vector<3xf32>, vector<2xi32>)> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @frexp_struct_not_i32(%arg0 : f32) -> () { %2 = spirv.GL.FrexpStruct %arg0 : f32 -> !spirv.struct<(f32, i64)> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ldexp(%arg0 : f32, %arg1 : i32) -> () { %0 = spirv.GL.Ldexp %arg0 : f32, %arg1 : i32 -> f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ldexp_vec(%arg0 : vector<3xf32>, %arg1 : vector<3xi32>) -> () { %0 = spirv.GL.Ldexp %arg0 : vector<3xf32>, %arg1 : vector<3xi32> -> vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ldexp_wrong_type_scalar(%arg0 : f32, %arg1 : vector<2xi32>) -> () { %0 = spirv.GL.Ldexp %arg0 : f32, %arg1 : vector<2xi32> -> f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ldexp_wrong_type_vec_1(%arg0 : vector<3xf32>, %arg1 : i32) -> () { %0 = spirv.GL.Ldexp %arg0 : vector<3xf32>, %arg1 : i32 -> vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ldexp_wrong_type_vec_2(%arg0 : vector<3xf32>, %arg1 : vector<2xi32>) -> () { %0 = spirv.GL.Ldexp %arg0 : vector<3xf32>, %arg1 : vector<2xi32> -> vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmix(%arg0 : f32, %arg1 : f32, %arg2 : f32) -> () { %0 = spirv.GL.FMix %arg0 : f32, %arg1 : f32, %arg2 : f32 -> f32 return } func.func @fmix_vector(%arg0 : vector<3xf32>, %arg1 : vector<3xf32>, %arg2 : vector<3xf32>) -> () { %0 = spirv.GL.FMix %arg0 : vector<3xf32>, %arg1 : vector<3xf32>, %arg2 : vector<3xf32> -> vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @findumsb(%arg0 : i32) -> () { %2 = spirv.GL.FindUMsb %arg0 : i32 return } func.func @findumsb_vector(%arg0 : vector<3xi32>) -> () { %2 = spirv.GL.FindUMsb %arg0 : vector<3xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @findumsb(%arg0 : i64) -> () { %2 = spirv.GL.FindUMsb %arg0 : i64 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @control_barrier_0() -> () { spirv.ControlBarrier , , return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @control_barrier_1() -> () { spirv.ControlBarrier , , return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @memory_barrier_0() -> () { spirv.MemoryBarrier , return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @memory_barrier_1() -> () { spirv.MemoryBarrier , return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @memory_barrier_2() -> () { spirv.MemoryBarrier , return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> { %0 = spirv.GroupNonUniformBallot %predicate : vector<4xi32> return %0: vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xi32> { %0 = spirv.GroupNonUniformBallot %predicate : vector<4xi32> return %0: vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_ballot(%predicate: i1) -> vector<4xsi32> { %0 = spirv.GroupNonUniformBallot %predicate : vector<4xsi32> return %0: vector<4xsi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_broadcast_scalar(%value: f32) -> f32 { %one = spirv.Constant 1 : i32 %0 = spirv.GroupNonUniformBroadcast %value, %one : f32, i32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_broadcast_vector(%value: vector<4xf32>) -> vector<4xf32> { %one = spirv.Constant 1 : i32 %0 = spirv.GroupNonUniformBroadcast %value, %one : vector<4xf32>, i32 return %0: vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_broadcast_negative_scope(%value: f32, %localid: i32 ) -> f32 { %one = spirv.Constant 1 : i32 %0 = spirv.GroupNonUniformBroadcast %value, %one : f32, i32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_broadcast_negative_non_const(%value: f32, %localid: i32) -> f32 { %0 = spirv.GroupNonUniformBroadcast %value, %localid : f32, i32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_elect() -> i1 { %0 = spirv.GroupNonUniformElect : i1 return %0: i1 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_elect() -> i1 { %0 = spirv.GroupNonUniformElect : i1 return %0: i1 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_fadd_reduce(%val: f32) -> f32 { %0 = spirv.GroupNonUniformFAdd ""Workgroup"" ""Reduce"" %val : f32 return %0: f32 } func.func @group_non_uniform_fadd_clustered_reduce(%val: vector<2xf32>) -> vector<2xf32> { %four = spirv.Constant 4 : i32 %0 = spirv.GroupNonUniformFAdd ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%four) : vector<2xf32> return %0: vector<2xf32> } func.func @group_non_uniform_fmul_reduce(%val: f32) -> f32 { %0 = spirv.GroupNonUniformFMul ""Workgroup"" ""Reduce"" %val : f32 return %0: f32 } func.func @group_non_uniform_fmul_clustered_reduce(%val: vector<2xf32>) -> vector<2xf32> { %four = spirv.Constant 4 : i32 %0 = spirv.GroupNonUniformFMul ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%four) : vector<2xf32> return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_fmax_reduce(%val: f32) -> f32 { %0 = spirv.GroupNonUniformFMax ""Workgroup"" ""Reduce"" %val : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_fmin_reduce(%val: f32) -> f32 { %0 = spirv.GroupNonUniformFMin ""Workgroup"" ""Reduce"" %val : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_iadd_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""Reduce"" %val : i32 return %0: i32 } func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> { %four = spirv.Constant 4 : i32 %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%four) : vector<2xi32> return %0: vector<2xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_iadd_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformIAdd ""Device"" ""Reduce"" %val : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> { %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""ClusteredReduce"" %val : vector<2xi32> return %0: vector<2xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>, %size: i32) -> vector<2xi32> { %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%size) : vector<2xi32> return %0: vector<2xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_iadd_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> { %five = spirv.Constant 5 : i32 %0 = spirv.GroupNonUniformIAdd ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%five) : vector<2xi32> return %0: vector<2xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_imul_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformIMul ""Workgroup"" ""Reduce"" %val : i32 return %0: i32 } func.func @group_non_uniform_imul_clustered_reduce(%val: vector<2xi32>) -> vector<2xi32> { %four = spirv.Constant 4 : i32 %0 = spirv.GroupNonUniformIMul ""Workgroup"" ""ClusteredReduce"" %val cluster_size(%four) : vector<2xi32> return %0: vector<2xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_smax_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformSMax ""Workgroup"" ""Reduce"" %val : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_smin_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformSMin ""Workgroup"" ""Reduce"" %val : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle1(%val: f32, %id: i32) -> f32 { %0 = spirv.GroupNonUniformShuffle %val, %id : f32, i32 return %0: f32 } func.func @group_non_uniform_shuffle2(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffle %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffle %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: si32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffle %val, %id : vector<2xf32>, si32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle1(%val: f32, %id: i32) -> f32 { %0 = spirv.GroupNonUniformShuffleXor %val, %id : f32, i32 return %0: f32 } func.func @group_non_uniform_shuffle2(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleXor %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleXor %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: si32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleXor %val, %id : vector<2xf32>, si32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle1(%val: f32, %id: i32) -> f32 { %0 = spirv.GroupNonUniformShuffleUp %val, %id : f32, i32 return %0: f32 } func.func @group_non_uniform_shuffle2(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleUp %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleUp %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: si32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleUp %val, %id : vector<2xf32>, si32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle1(%val: f32, %id: i32) -> f32 { %0 = spirv.GroupNonUniformShuffleDown %val, %id : f32, i32 return %0: f32 } func.func @group_non_uniform_shuffle2(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleDown %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: i32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleDown %val, %id : vector<2xf32>, i32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_shuffle(%val: vector<2xf32>, %id: si32) -> vector<2xf32> { %0 = spirv.GroupNonUniformShuffleDown %val, %id : vector<2xf32>, si32 return %0: vector<2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_umax_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformUMax ""Workgroup"" ""Reduce"" %val : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_non_uniform_umin_reduce(%val: i32) -> i32 { %0 = spirv.GroupNonUniformUMin ""Workgroup"" ""Reduce"" %val : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather_with_single_imageoperands(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 [""NonPrivateTexel""] -> vector<4xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather_with_mismatch_imageoperands(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 (%arg2, %arg2 : f32, f32) -> vector<4xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather_error_result_type(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<3xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather_error_same_type(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xf32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather_error_dim(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_dref_gather_error_ms(%arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32) -> () { %0 = spirv.ImageDrefGather %arg0 : !spirv.sampled_image>, %arg1 : vector<4xf32>, %arg2 : f32 -> vector<4xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image(%arg0 : !spirv.sampled_image>) -> () { %0 = spirv.Image %arg0 : !spirv.sampled_image> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_query_size(%arg0 : !spirv.image) -> () { %0 = spirv.ImageQuerySize %arg0 : !spirv.image -> i32 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_query_size_error_dim(%arg0 : !spirv.image) -> () { %0 = spirv.ImageQuerySize %arg0 : !spirv.image -> i32 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_query_size_error_dim_sample(%arg0 : !spirv.image) -> () { %0 = spirv.ImageQuerySize %arg0 : !spirv.image -> i32 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_query_size_error_result1(%arg0 : !spirv.image) -> () { %0 = spirv.ImageQuerySize %arg0 : !spirv.image -> vector<3xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @image_query_size_error_result2(%arg0 : !spirv.image) -> () { %0 = spirv.ImageQuerySize %arg0 : !spirv.image -> vector<2xi32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @f32_to_bf16(%arg0 : f32) ""None"" { %0 = spirv.INTEL.ConvertFToBF16 %arg0 : f32 to i16 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @f32_to_bf16_vec(%arg0 : vector<2xf32>) ""None"" { %0 = spirv.INTEL.ConvertFToBF16 %arg0 : vector<2xf32> to vector<2xi16> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @f32_to_bf16_unsupported(%arg0 : f64) ""None"" { %0 = spirv.INTEL.ConvertFToBF16 %arg0 : f64 to i16 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @f32_to_bf16_vec_unsupported(%arg0 : vector<2xf32>) ""None"" { %0 = spirv.INTEL.ConvertFToBF16 %arg0 : vector<2xf32> to vector<4xi16> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @bf16_to_f32(%arg0 : i16) ""None"" { %0 = spirv.INTEL.ConvertBF16ToF %arg0 : i16 to f32 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @bf16_to_f32_vec(%arg0 : vector<2xi16>) ""None"" { %0 = spirv.INTEL.ConvertBF16ToF %arg0 : vector<2xi16> to vector<2xf32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @bf16_to_f32_unsupported(%arg0 : i16) ""None"" { %0 = spirv.INTEL.ConvertBF16ToF %arg0 : i16 to f16 spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "spirv.func @bf16_to_f32_vec_unsupported(%arg0 : vector<2xi16>) ""None"" { %0 = spirv.INTEL.ConvertBF16ToF %arg0 : vector<2xi16> to vector<3xf32> spirv.Return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_and(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicAnd ""Device"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_and(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = ""spirv.AtomicAnd""(%ptr, %value) {memory_scope = #spirv.scope, semantics = #spirv.memory_semantics} : (!spirv.ptr, i32) -> (i32) return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_and(%ptr : !spirv.ptr, %value : i64) -> i64 { %0 = ""spirv.AtomicAnd""(%ptr, %value) {memory_scope = #spirv.scope, semantics = #spirv.memory_semantics} : (!spirv.ptr, i64) -> (i64) return %0 : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_and(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicAnd ""Device"" ""Acquire|Release"" %ptr, %value : !spirv.ptr return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 { %0 = spirv.AtomicCompareExchange ""Workgroup"" ""Release"" ""Acquire"" %ptr, %value, %comparator: !spirv.ptr return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange(%ptr: !spirv.ptr, %value: i64, %comparator: i32) -> i32 { %0 = ""spirv.AtomicCompareExchange""(%ptr, %value, %comparator) {memory_scope = #spirv.scope, equal_semantics = #spirv.memory_semantics, unequal_semantics = #spirv.memory_semantics} : (!spirv.ptr, i64, i32) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange(%ptr: !spirv.ptr, %value: i32, %comparator: i16) -> i32 { %0 = ""spirv.AtomicCompareExchange""(%ptr, %value, %comparator) {memory_scope = #spirv.scope, equal_semantics = #spirv.memory_semantics, unequal_semantics = #spirv.memory_semantics} : (!spirv.ptr, i32, i16) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 { %0 = ""spirv.AtomicCompareExchange""(%ptr, %value, %comparator) {memory_scope = #spirv.scope, equal_semantics = #spirv.memory_semantics, unequal_semantics = #spirv.memory_semantics} : (!spirv.ptr, i32, i32) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange_weak(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 { %0 = spirv.AtomicCompareExchangeWeak ""Workgroup"" ""Release"" ""Acquire"" %ptr, %value, %comparator: !spirv.ptr return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange_weak(%ptr: !spirv.ptr, %value: i64, %comparator: i32) -> i32 { %0 = ""spirv.AtomicCompareExchangeWeak""(%ptr, %value, %comparator) {memory_scope = #spirv.scope, equal_semantics = #spirv.memory_semantics, unequal_semantics = #spirv.memory_semantics} : (!spirv.ptr, i64, i32) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange_weak(%ptr: !spirv.ptr, %value: i32, %comparator: i16) -> i32 { %0 = ""spirv.AtomicCompareExchangeWeak""(%ptr, %value, %comparator) {memory_scope = #spirv.scope, equal_semantics = #spirv.memory_semantics, unequal_semantics = #spirv.memory_semantics} : (!spirv.ptr, i32, i16) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_compare_exchange_weak(%ptr: !spirv.ptr, %value: i32, %comparator: i32) -> i32 { %0 = ""spirv.AtomicCompareExchangeWeak""(%ptr, %value, %comparator) {memory_scope = #spirv.scope, equal_semantics = #spirv.memory_semantics, unequal_semantics = #spirv.memory_semantics} : (!spirv.ptr, i32, i32) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_exchange(%ptr: !spirv.ptr, %value: i32) -> i32 { %0 = spirv.AtomicExchange ""Workgroup"" ""Release"" %ptr, %value: !spirv.ptr return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_exchange(%ptr: !spirv.ptr, %value: i64) -> i32 { %0 = ""spirv.AtomicExchange""(%ptr, %value) {memory_scope = #spirv.scope, semantics = #spirv.memory_semantics} : (!spirv.ptr, i64) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_exchange(%ptr: !spirv.ptr, %value: i32) -> i32 { %0 = ""spirv.AtomicExchange""(%ptr, %value) {memory_scope = #spirv.scope, semantics = #spirv.memory_semantics} : (!spirv.ptr, i32) -> (i32) return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_iadd(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicIAdd ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_idecrement(%ptr : !spirv.ptr) -> i32 { %0 = spirv.AtomicIDecrement ""Workgroup"" ""None"" %ptr : !spirv.ptr return %0 : i32 } func.func @atomic_iincrement(%ptr : !spirv.ptr) -> i32 { %0 = spirv.AtomicIIncrement ""Workgroup"" ""None"" %ptr : !spirv.ptr return %0 : i32 } func.func @atomic_isub(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicISub ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_or(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicOr ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_smax(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicSMax ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_smin(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicSMin ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_umax(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicUMax ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_umin(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicUMin ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 } func.func @atomic_xor(%ptr : !spirv.ptr, %value : i32) -> i32 { %0 = spirv.AtomicXor ""Workgroup"" ""None"" %ptr, %value : !spirv.ptr return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_fadd(%ptr : !spirv.ptr, %value : f32) -> f32 { %0 = spirv.EXT.AtomicFAdd ""Device"" ""None"" %ptr, %value : !spirv.ptr return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_fadd(%ptr : !spirv.ptr, %value : f32) -> f32 { %0 = ""spirv.EXT.AtomicFAdd""(%ptr, %value) {memory_scope = #spirv.scope, semantics = #spirv.memory_semantics} : (!spirv.ptr, f32) -> (f32) return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_fadd(%ptr : !spirv.ptr, %value : f64) -> f64 { %0 = ""spirv.EXT.AtomicFAdd""(%ptr, %value) {memory_scope = #spirv.scope, semantics = #spirv.memory_semantics} : (!spirv.ptr, f64) -> (f64) return %0 : f64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @atomic_fadd(%ptr : !spirv.ptr, %value : f32) -> f32 { %0 = spirv.EXT.AtomicFAdd ""Device"" ""Acquire|Release"" %ptr, %value : !spirv.ptr return %0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> { %0 = spirv.KHR.SubgroupBallot %predicate: vector<4xi32> return %0: vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_broadcast_scalar(%value: f32, %localid: i32 ) -> f32 { %0 = spirv.GroupBroadcast %value, %localid : f32, i32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_broadcast_scalar_vector(%value: f32, %localid: vector<3xi32> ) -> f32 { %0 = spirv.GroupBroadcast %value, %localid : f32, vector<3xi32> return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_broadcast_vector(%value: vector<4xf32>, %localid: vector<3xi32> ) -> vector<4xf32> { %0 = spirv.GroupBroadcast %value, %localid : vector<4xf32>, vector<3xi32> return %0: vector<4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_broadcast_negative_scope(%value: f32, %localid: vector<3xi32> ) -> f32 { %0 = spirv.GroupBroadcast %value, %localid : f32, vector<3xi32> return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_broadcast_negative_locid_dtype(%value: f32, %localid: vector<3xf32> ) -> f32 { %0 = spirv.GroupBroadcast %value, %localid : f32, vector<3xf32> return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_broadcast_negative_locid_vec4(%value: f32, %localid: vector<4xi32> ) -> f32 { %0 = spirv.GroupBroadcast %value, %localid : f32, vector<4xi32> return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @subgroup_ballot(%predicate: i1) -> vector<4xi32> { %0 = spirv.KHR.SubgroupBallot %predicate: vector<4xi32> return %0: vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @subgroup_block_read_intel(%ptr : !spirv.ptr) -> i32 { %0 = spirv.INTEL.SubgroupBlockRead ""StorageBuffer"" %ptr : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @subgroup_block_read_intel_vector(%ptr : !spirv.ptr) -> vector<3xi32> { %0 = spirv.INTEL.SubgroupBlockRead ""StorageBuffer"" %ptr : vector<3xi32> return %0: vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @subgroup_block_write_intel(%ptr : !spirv.ptr, %value: i32) -> () { spirv.INTEL.SubgroupBlockWrite ""StorageBuffer"" %ptr, %value : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @subgroup_block_write_intel_vector(%ptr : !spirv.ptr, %value: vector<3xi32>) -> () { spirv.INTEL.SubgroupBlockWrite ""StorageBuffer"" %ptr, %value : vector<3xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_iadd(%value: i32) -> i32 { %0 = spirv.GroupIAdd %value : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_fadd(%value: f32) -> f32 { %0 = spirv.GroupFAdd %value : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_fmin(%value: f32) -> f32 { %0 = spirv.GroupFMin %value : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_umin(%value: i32) -> i32 { %0 = spirv.GroupUMin %value : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_smin(%value: i32) -> i32 { %0 = spirv.GroupSMin %value : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_fmax(%value: f32) -> f32 { %0 = spirv.GroupFMax %value : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_umax(%value: i32) -> i32 { %0 = spirv.GroupUMax %value : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_smax(%value: i32) -> i32 { %0 = spirv.GroupSMax %value : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_imul(%value: i32) -> i32 { %0 = spirv.KHR.GroupIMul %value : i32 return %0: i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @group_fmul(%value: f32) -> f32 { %0 = spirv.KHR.GroupFMul %value : f32 return %0: f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : f32) -> () { %2 = spirv.CL.exp %arg0 : f32 return } func.func @expvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.CL.exp %arg0 : vector<3xf16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : i32) -> () { %2 = spirv.CL.exp %arg0 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : vector<5xf32>) -> () { %2 = spirv.CL.exp %arg0 : vector<5xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : f32, %arg1 : f32) -> () { %2 = spirv.CL.exp %arg0, %arg1 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @exp(%arg0 : i32) -> () { %2 = spirv.CL.exp %arg0 : return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fabs(%arg0 : f32) -> () { %2 = spirv.CL.fabs %arg0 : f32 return } func.func @fabsvec(%arg0 : vector<3xf16>) -> () { %2 = spirv.CL.fabs %arg0 : vector<3xf16> return } func.func @fabsf64(%arg0 : f64) -> () { %2 = spirv.CL.fabs %arg0 : f64 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fabs(%arg0 : i32) -> () { %2 = spirv.CL.fabs %arg0 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fabs(%arg0 : vector<5xf32>) -> () { %2 = spirv.CL.fabs %arg0 : vector<5xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fabs(%arg0 : f32, %arg1 : f32) -> () { %2 = spirv.CL.fabs %arg0, %arg1 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fabs(%arg0 : i32) -> () { %2 = spirv.CL.fabs %arg0 : return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sabs(%arg0 : i32) -> () { %2 = spirv.CL.s_abs %arg0 : i32 return } func.func @sabsvec(%arg0 : vector<3xi16>) -> () { %2 = spirv.CL.s_abs %arg0 : vector<3xi16> return } func.func @sabsi64(%arg0 : i64) -> () { %2 = spirv.CL.s_abs %arg0 : i64 return } func.func @sabsi8(%arg0 : i8) -> () { %2 = spirv.CL.s_abs %arg0 : i8 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sabs(%arg0 : f32) -> () { %2 = spirv.CL.s_abs %arg0 : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sabs(%arg0 : vector<5xi32>) -> () { %2 = spirv.CL.s_abs %arg0 : vector<5xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sabs(%arg0 : i32, %arg1 : i32) -> () { %2 = spirv.CL.s_abs %arg0, %arg1 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sabs(%arg0 : i32) -> () { %2 = spirv.CL.s_abs %arg0 : return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fma(%a : f32, %b : f32, %c : f32) -> () { %2 = spirv.CL.fma %a, %b, %c : f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fma(%a : vector<3xf32>, %b : vector<3xf32>, %c : vector<3xf32>) -> () { %2 = spirv.CL.fma %a, %b, %c : vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fmaxmin(%arg0 : f32, %arg1 : f32) { %1 = spirv.CL.fmax %arg0, %arg1 : f32 %2 = spirv.CL.fmin %arg0, %arg1 : f32 return } func.func @fmaxminvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) { %1 = spirv.CL.fmax %arg0, %arg1 : vector<3xf16> %2 = spirv.CL.fmin %arg0, %arg1 : vector<3xf16> return } func.func @fmaxminf64(%arg0 : f64, %arg1 : f64) { %1 = spirv.CL.fmax %arg0, %arg1 : f64 %2 = spirv.CL.fmin %arg0, %arg1 : f64 return } func.func @iminmax(%arg0: i32, %arg1: i32) { %1 = spirv.CL.s_max %arg0, %arg1 : i32 %2 = spirv.CL.u_max %arg0, %arg1 : i32 %3 = spirv.CL.s_min %arg0, %arg1 : i32 %4 = spirv.CL.u_min %arg0, %arg1 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @rint(%arg0 : f32) -> () { %0 = spirv.CL.rint %arg0 : f32 return } func.func @rintvec(%arg0 : vector<3xf16>) -> () { %0 = spirv.CL.rint %arg0 : vector<3xf16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @printf(%arg0 : !spirv.ptr, %arg1 : i32, %arg2 : i32) -> i32 { %0 = spirv.CL.printf %arg0, %arg1, %arg2 : (!spirv.ptr, (i32, i32)) -> i32 return %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitcount(%arg: i32) -> i32 { %0 = spirv.BitCount %arg : i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bit_field_insert_vec(%base: vector<3xi32>, %insert: vector<3xi32>, %offset: i32, %count: i16) -> vector<3xi32> { %0 = spirv.BitFieldInsert %base, %insert, %offset, %count : vector<3xi32>, i32, i16 spirv.ReturnValue %0 : vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bit_field_insert_invalid_insert_type(%base: vector<3xi32>, %insert: vector<2xi32>, %offset: i32, %count: i16) -> vector<3xi32> { %0 = ""spirv.BitFieldInsert"" (%base, %insert, %offset, %count) : (vector<3xi32>, vector<2xi32>, i32, i16) -> vector<3xi32> spirv.ReturnValue %0 : vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bit_field_s_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> { %0 = spirv.BitFieldSExtract %base, %offset, %count : vector<3xi32>, i8, i8 spirv.ReturnValue %0 : vector<3xi32> } func.func @bit_field_u_extract_vec(%base: vector<3xi32>, %offset: i8, %count: i8) -> vector<3xi32> { %0 = spirv.BitFieldUExtract %base, %offset, %count : vector<3xi32>, i8, i8 spirv.ReturnValue %0 : vector<3xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bit_field_u_extract_invalid_result_type(%base: vector<3xi32>, %offset: i32, %count: i16) -> vector<4xi32> { %0 = ""spirv.BitFieldUExtract"" (%base, %offset, %count) : (vector<3xi32>, i32, i16) -> vector<4xi32> spirv.ReturnValue %0 : vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitreverse(%arg: i32) -> i32 { %0 = spirv.BitReverse %arg : i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitwise_or_scalar(%arg: i32) -> i32 { %0 = spirv.BitwiseOr %arg, %arg : i32 return %0 : i32 } func.func @bitwise_or_vector(%arg: vector<4xi32>) -> vector<4xi32> { %0 = spirv.BitwiseOr %arg, %arg : vector<4xi32> return %0 : vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitwise_or_float(%arg0: f16, %arg1: f16) -> f16 { %0 = spirv.BitwiseOr %arg0, %arg1 : f16 return %0 : f16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitwise_xor_scalar(%arg: i32) -> i32 { %0 = spirv.BitwiseXor %arg, %arg : i32 return %0 : i32 } func.func @bitwise_xor_vector(%arg: vector<4xi32>) -> vector<4xi32> { %0 = spirv.BitwiseXor %arg, %arg : vector<4xi32> return %0 : vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitwise_xor_float(%arg0: f16, %arg1: f16) -> f16 { %0 = spirv.BitwiseXor %arg0, %arg1 : f16 return %0 : f16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitwise_and_scalar(%arg: i32) -> i32 { %0 = spirv.BitwiseAnd %arg, %arg : i32 return %0 : i32 } func.func @bitwise_and_vector(%arg: vector<4xi32>) -> vector<4xi32> { %0 = spirv.BitwiseAnd %arg, %arg : vector<4xi32> return %0 : vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @bitwise_and_float(%arg0: f16, %arg1: f16) -> f16 { %0 = spirv.BitwiseAnd %arg0, %arg1 : f16 return %0 : f16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @not(%arg: i32) -> i32 { %0 = spirv.Not %arg : i32 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @shift_left_logical(%arg0: i32, %arg1 : i16) -> i32 { %0 = spirv.ShiftLeftLogical %arg0, %arg1: i32, i16 spirv.ReturnValue %0 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @shift_left_logical_invalid_result_type(%arg0: i32, %arg1 : i16) -> i16 { %0 = ""spirv.ShiftLeftLogical"" (%arg0, %arg1) : (i32, i16) -> (i16) spirv.ReturnValue %0 : i16 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @shift_right_arithmetic(%arg0: vector<4xi32>, %arg1 : vector<4xi8>) -> vector<4xi32> { %0 = spirv.ShiftRightArithmetic %arg0, %arg1: vector<4xi32>, vector<4xi8> spirv.ReturnValue %0 : vector<4xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @shift_right_logical(%arg0: vector<2xi32>, %arg1 : vector<2xi8>) -> vector<2xi32> { %0 = spirv.ShiftRightLogical %arg0, %arg1: vector<2xi32>, vector<2xi8> spirv.ReturnValue %0 : vector<2xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iequal_scalar(%arg0: i32, %arg1: i32) -> i1 { %0 = spirv.IEqual %arg0, %arg1 : i32 return %0 : i1 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @iequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.IEqual %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @inotequal_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.INotEqual %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isinf_scalar(%arg0: f32) -> i1 { %0 = spirv.IsInf %arg0 : f32 return %0 : i1 } func.func @isinf_vector(%arg0: vector<2xf32>) -> vector<2xi1> { %0 = spirv.IsInf %arg0 : vector<2xf32> return %0 : vector<2xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @isnan_scalar(%arg0: f32) -> i1 { %0 = spirv.IsNan %arg0 : f32 return %0 : i1 } func.func @isnan_vector(%arg0: vector<2xf32>) -> vector<2xi1> { %0 = spirv.IsNan %arg0 : vector<2xf32> return %0 : vector<2xi1> } func.func @logicalBinary(%arg0 : i1, %arg1 : i1, %arg2 : i1) { %0 = spirv.LogicalAnd %arg0, %arg1 : i1 %1 = spirv.LogicalAnd %0, %arg2 : i1 return } func.func @logicalBinary2(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>) { %0 = spirv.LogicalAnd %arg0, %arg1 : vector<4xi1> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalBinary(%arg0 : i1, %arg1 : i1) { %0 = spirv.LogicalAnd %arg0, %arg1 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalBinary(%arg0 : i1, %arg1 : i1) { %0 = spirv.LogicalAnd %arg0, %arg1 : return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalBinary(%arg0 : i1, %arg1 : i1) { %0 = spirv.LogicalAnd %arg0 : i1 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalUnary(%arg0 : i1, %arg1 : i1) { %0 = spirv.LogicalNot %arg0 : i1 %1 = spirv.LogicalNot %0 : i1 return } func.func @logicalUnary2(%arg0 : vector<4xi1>) { %0 = spirv.LogicalNot %arg0 : vector<4xi1> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalUnary(%arg0 : i1) { %0 = spirv.LogicalNot %arg0 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalUnary(%arg0 : i1) { %0 = spirv.LogicalNot %arg0 : return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalUnary(%arg0 : i1) { %0 = spirv.LogicalNot : i1 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @logicalUnary(%arg0 : i32) { %0 = spirv.LogicalNot %arg0 : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @select_op_bool(%arg0: i1) -> () { %0 = spirv.Constant true %1 = spirv.Constant false %2 = spirv.Select %arg0, %0, %1 : i1, i1 return } func.func @select_op_int(%arg0: i1) -> () { %0 = spirv.Constant 2 : i32 %1 = spirv.Constant 3 : i32 %2 = spirv.Select %arg0, %0, %1 : i1, i32 return } func.func @select_op_float(%arg0: i1) -> () { %0 = spirv.Constant 2.0 : f32 %1 = spirv.Constant 3.0 : f32 %2 = spirv.Select %arg0, %0, %1 : i1, f32 return } func.func @select_op_ptr(%arg0: i1) -> () { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr %2 = spirv.Select %arg0, %0, %1 : i1, !spirv.ptr return } func.func @select_op_vec(%arg0: i1) -> () { %0 = spirv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32> %1 = spirv.Constant dense<[5.0, 6.0, 7.0]> : vector<3xf32> %2 = spirv.Select %arg0, %0, %1 : i1, vector<3xf32> return } func.func @select_op_vec_condn_vec(%arg0: vector<3xi1>) -> () { %0 = spirv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32> %1 = spirv.Constant dense<[5.0, 6.0, 7.0]> : vector<3xf32> %2 = spirv.Select %arg0, %0, %1 : vector<3xi1>, vector<3xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @select_op(%arg0: i1) -> () { %0 = spirv.Constant 2 : i32 %1 = spirv.Constant 3 : i32 %2 = spirv.Select %arg0, %0, %1 : i1 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @select_op(%arg1: vector<3xi1>) -> () { %0 = spirv.Constant 2 : i32 %1 = spirv.Constant 3 : i32 %2 = spirv.Select %arg1, %0, %1 : vector<3xi1>, i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @select_op(%arg1: vector<4xi1>) -> () { %0 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %1 = spirv.Constant dense<[5, 6, 7]> : vector<3xi32> %2 = spirv.Select %arg1, %0, %1 : vector<4xi1>, vector<3xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @select_op(%arg1: vector<4xi1>) -> () { %0 = spirv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32> %1 = spirv.Constant dense<[5, 6, 7]> : vector<3xi32> %2 = ""spirv.Select""(%arg1, %0, %1) : (vector<4xi1>, vector<3xf32>, vector<3xi32>) -> vector<3xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @select_op(%arg1: vector<4xi1>) -> () { %0 = spirv.Constant dense<[2.0, 3.0, 4.0]> : vector<3xf32> %1 = spirv.Constant dense<[5, 6, 7]> : vector<3xi32> %2 = ""spirv.Select""(%arg1, %1, %0) : (vector<4xi1>, vector<3xi32>, vector<3xf32>) -> vector<3xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sgt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.SGreaterThan %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @sge_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.SGreaterThanEqual %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @slt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.SLessThan %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @slte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.SLessThanEqual %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ugt_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.UGreaterThan %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ugte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.UGreaterThanEqual %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ult_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.ULessThan %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ulte_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> vector<4xi1> { %0 = spirv.ULessThanEqual %arg0, %arg1 : vector<4xi32> return %0 : vector<4xi1> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @const() -> () { %0 = spirv.Constant true %1 = spirv.Constant false %2 = spirv.Constant 42 : i32 %-2 = spirv.Constant -42 : i32 %3 = spirv.Constant 43 : i64 %9 = spirv.Constant 6 : ui8 %4 = spirv.Constant 0.5 : f32 %5 = spirv.Constant 0.5 : f64 %6 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %8 = spirv.Constant [dense<3.0> : vector<2xf32>] : !spirv.array<1xvector<2xf32>> return }", mlir-opt -split-input-file ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @global_var : !spirv.ptr spirv.func @addressof() -> () ""None"" { %0 = spirv.mlir.addressof @global_var : !spirv.ptr spirv.Return } }", mlir-opt -split-input-file ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @load_store_scalar(%index: i32) -> f32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %value = spirv.Load ""StorageBuffer"" %ac : f32 spirv.Store ""StorageBuffer"" %ac, %value : f32 spirv.ReturnValue %value : f32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @load_store_scalar_64bit(%index: i64) -> f32 ""None"" { %c0 = spirv.Constant 0 : i64 %addr = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i64, i64 %value = spirv.Load ""StorageBuffer"" %ac : f32 spirv.Store ""StorageBuffer"" %ac, %value : f32 spirv.ReturnValue %value : f32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @multiple_uses(%i0: i32, %i1: i32) -> f32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val0 = spirv.Load ""StorageBuffer"" %ac0 : f32 %ac1 = spirv.AccessChain %addr[%c0, %i1] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val1 = spirv.Load ""StorageBuffer"" %ac1 : f32 %value = spirv.FAdd %val0, %val1 : f32 spirv.ReturnValue %value : f32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @vector3(%index: i32) -> f32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %value = spirv.Load ""StorageBuffer"" %ac : f32 spirv.ReturnValue %value : f32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(1, 0) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @not_aliased(%index: i32) -> f32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %value = spirv.Load ""StorageBuffer"" %ac : f32 spirv.Store ""StorageBuffer"" %ac, %value : f32 spirv.ReturnValue %value : f32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01s_1 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.GlobalVariable @var01v_1 bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @multiple_aliases(%index: i32) -> f32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr0 = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr0[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val0 = spirv.Load ""StorageBuffer"" %ac0 : f32 %addr1 = spirv.mlir.addressof @var01s_1 : !spirv.ptr [0])>, StorageBuffer> %ac1 = spirv.AccessChain %addr1[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val1 = spirv.Load ""StorageBuffer"" %ac1 : f32 %addr2 = spirv.mlir.addressof @var01v_1 : !spirv.ptr, stride=16> [0])>, StorageBuffer> %ac2 = spirv.AccessChain %addr2[%c0, %index, %c0] : !spirv.ptr, stride=16> [0])>, StorageBuffer>, i32, i32, i32 %val2 = spirv.Load ""StorageBuffer"" %ac2 : f32 %add0 = spirv.FAdd %val0, %val1 : f32 %add1 = spirv.FAdd %add0, %val2 : f32 spirv.ReturnValue %add1 : f32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s_i32 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01s_f32 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.func @different_scalar_type(%index: i32, %val1: f32) -> i32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr0 = spirv.mlir.addressof @var01s_i32 : !spirv.ptr [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr0[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val0 = spirv.Load ""StorageBuffer"" %ac0 : i32 %addr1 = spirv.mlir.addressof @var01s_f32 : !spirv.ptr [0])>, StorageBuffer> %ac1 = spirv.AccessChain %addr1[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 spirv.Store ""StorageBuffer"" %ac1, %val1 : f32 spirv.ReturnValue %val0 : i32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01v bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @different_primitive_type(%index: i32, %val0: i32) -> i32 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01s : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val1 = spirv.Load ""StorageBuffer"" %ac : i32 spirv.Store ""StorageBuffer"" %ac, %val0 : i32 spirv.ReturnValue %val1 : i32 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s_i64 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01s_f32 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.func @load_different_scalar_bitwidth(%index: i32) -> i64 ""None"" { %c0 = spirv.Constant 0 : i32 %addr0 = spirv.mlir.addressof @var01s_i64 : !spirv.ptr [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr0[%c0, %index] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val0 = spirv.Load ""StorageBuffer"" %ac0 : i64 spirv.ReturnValue %val0 : i64 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01s_i64 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01s_f32 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.func @store_different_scalar_bitwidth(%i0: i32, %i1: i32) ""None"" { %c0 = spirv.Constant 0 : i32 %addr0 = spirv.mlir.addressof @var01s_f32 : !spirv.ptr [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr0[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %f32val = spirv.Load ""StorageBuffer"" %ac0 : f32 %f64val = spirv.FConvert %f32val : f32 to f64 %i64val = spirv.Bitcast %f64val : f64 to i64 %addr1 = spirv.mlir.addressof @var01s_i64 : !spirv.ptr [0])>, StorageBuffer> %ac1 = spirv.AccessChain %addr1[%c0, %i1] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 spirv.Store ""StorageBuffer"" %ac1, %i64val : i64 spirv.Return } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01_scalar bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01_vec2 bind(0, 1) {aliased} : !spirv.ptr, stride=8> [0])>, StorageBuffer> spirv.GlobalVariable @var01_vec4 bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.func @load_different_vector_sizes(%i0: i32) -> vector<4xf32> ""None"" { %c0 = spirv.Constant 0 : i32 %addr0 = spirv.mlir.addressof @var01_vec4 : !spirv.ptr, stride=16> [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr0[%c0, %i0] : !spirv.ptr, stride=16> [0])>, StorageBuffer>, i32, i32 %vec4val = spirv.Load ""StorageBuffer"" %ac0 : vector<4xf32> %addr1 = spirv.mlir.addressof @var01_scalar : !spirv.ptr [0])>, StorageBuffer> %ac1 = spirv.AccessChain %addr1[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %scalarval = spirv.Load ""StorageBuffer"" %ac1 : f32 %val = spirv.CompositeInsert %scalarval, %vec4val[0 : i32] : f32 into vector<4xf32> spirv.ReturnValue %val : vector<4xf32> } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01_v4f32 bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.GlobalVariable @var01_f32 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.GlobalVariable @var01_i64 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.func @load_mixed_scalar_vector_primitive_types(%i0: i32) -> vector<4xf32> ""None"" { %c0 = spirv.Constant 0 : i32 %addr0 = spirv.mlir.addressof @var01_v4f32 : !spirv.ptr, stride=16> [0])>, StorageBuffer> %ac0 = spirv.AccessChain %addr0[%c0, %i0] : !spirv.ptr, stride=16> [0])>, StorageBuffer>, i32, i32 %vec4val = spirv.Load ""StorageBuffer"" %ac0 : vector<4xf32> %addr1 = spirv.mlir.addressof @var01_f32 : !spirv.ptr [0])>, StorageBuffer> %ac1 = spirv.AccessChain %addr1[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %f32val = spirv.Load ""StorageBuffer"" %ac1 : f32 %addr2 = spirv.mlir.addressof @var01_i64 : !spirv.ptr [0])>, StorageBuffer> %ac2 = spirv.AccessChain %addr2[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %i64val = spirv.Load ""StorageBuffer"" %ac2 : i64 %i32val = spirv.SConvert %i64val : i64 to i32 %castval = spirv.Bitcast %i32val : i32 to f32 %val1 = spirv.CompositeInsert %f32val, %vec4val[0 : i32] : f32 into vector<4xf32> %val2 = spirv.CompositeInsert %castval, %val1[1 : i32] : f32 into vector<4xf32> spirv.ReturnValue %val2 : vector<4xf32> } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01_v2f2 bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.GlobalVariable @var01_i64 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.func @load_mixed_scalar_vector_primitive_types(%i0: i32) -> i64 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01_i64 : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val = spirv.Load ""StorageBuffer"" %ac : i64 spirv.ReturnValue %val : i64 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var01_v2f2 bind(0, 1) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.GlobalVariable @var01_i16 bind(0, 1) {aliased} : !spirv.ptr [0])>, StorageBuffer> spirv.func @scalar_type_bitwidth_smaller_than_vector(%i0: i32) -> i16 ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var01_i16 : !spirv.ptr [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %i0] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %val = spirv.Load ""StorageBuffer"" %ac : i16 spirv.ReturnValue %val : i16 } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var00_v4f32 bind(0, 0) {aliased} : !spirv.ptr, stride=16> [0])>, StorageBuffer> spirv.GlobalVariable @var00_v4f16 bind(0, 0) {aliased} : !spirv.ptr, stride=8> [0])>, StorageBuffer> spirv.func @vector_type_same_size_different_element_type(%i0: i32) -> vector<4xf32> ""None"" { %c0 = spirv.Constant 0 : i32 %addr = spirv.mlir.addressof @var00_v4f32 : !spirv.ptr, stride=16> [0])>, StorageBuffer> %ac = spirv.AccessChain %addr[%c0, %i0] : !spirv.ptr, stride=16> [0])>, StorageBuffer>, i32, i32 %val = spirv.Load ""StorageBuffer"" %ac : vector<4xf32> spirv.ReturnValue %val : vector<4xf32> } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @main(%arg0: !spirv.ptr [0])>, StorageBuffer>) ""None"" { %cst0_i32 = spirv.Constant 0 : i32 %0 = spirv.AccessChain %arg0[%cst0_i32, %cst0_i32] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 spirv.Return } }", mlir-opt -split-input-file -spirv-unify-aliased-resource -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { spirv.module Physical64 OpenCL { spirv.func @kernel( %arg0: f32, %arg1: !spirv.ptr)>, CrossWorkgroup>) ""None"" attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { spirv.Return } } }", mlir-opt -split-input-file -spirv-lower-abi-attrs ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { spirv.module Physical64 OpenCL { spirv.func @kernel( %arg0: f32, %arg1: !spirv.ptr)>, CrossWorkgroup>) ""None"" attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { spirv.Return } } }", mlir-opt -split-input-file -spirv-lower-abi-attrs ,1 "func.func @combine_full_access_chain() -> f32 { %c0 = spirv.Constant 0: i32 %0 = spirv.Variable : !spirv.ptr>, !spirv.array<4xi32>)>, Function> %1 = spirv.AccessChain %0[%c0] : !spirv.ptr>, !spirv.array<4xi32>)>, Function>, i32 %2 = spirv.AccessChain %1[%c0, %c0] : !spirv.ptr>, Function>, i32, i32 %3 = spirv.Load ""Function"" %2 : f32 spirv.ReturnValue %3 : f32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @combine_access_chain_multi_use() -> !spirv.array<4xf32> { %c0 = spirv.Constant 0: i32 %0 = spirv.Variable : !spirv.ptr>, !spirv.array<4xi32>)>, Function> %1 = spirv.AccessChain %0[%c0] : !spirv.ptr>, !spirv.array<4xi32>)>, Function>, i32 %2 = spirv.AccessChain %1[%c0] : !spirv.ptr>, Function>, i32 %3 = spirv.AccessChain %2[%c0] : !spirv.ptr, Function>, i32 %4 = spirv.Load ""Function"" %2 : !spirv.array<4xf32> %5 = spirv.Load ""Function"" %3 : f32 spirv.ReturnValue %4: !spirv.array<4xf32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @dont_combine_access_chain_without_common_base() -> !spirv.array<4xi32> { %c1 = spirv.Constant 1: i32 %0 = spirv.Variable : !spirv.ptr>, !spirv.array<4xi32>)>, Function> %1 = spirv.Variable : !spirv.ptr>, !spirv.array<4xi32>)>, Function> %2 = spirv.AccessChain %0[%c1] : !spirv.ptr>, !spirv.array<4xi32>)>, Function>, i32 %3 = spirv.AccessChain %1[%c1] : !spirv.ptr>, !spirv.array<4xi32>)>, Function>, i32 %4 = spirv.Load ""Function"" %2 : !spirv.array<4xi32> %5 = spirv.Load ""Function"" %3 : !spirv.array<4xi32> spirv.ReturnValue %4 : !spirv.array<4xi32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_bitcast_full(%arg0 : vector<2xf32>) -> f64 { %0 = spirv.Bitcast %arg0 : vector<2xf32> to vector<2xi32> %1 = spirv.Bitcast %0 : vector<2xi32> to i64 %2 = spirv.Bitcast %1 : i64 to f64 spirv.ReturnValue %2 : f64 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_bitcast_multi_use(%arg0 : vector<2xf32>, %arg1 : !spirv.ptr) -> f64 { %0 = spirv.Bitcast %arg0 : vector<2xf32> to i64 %1 = spirv.Bitcast %0 : i64 to f64 spirv.Store ""Uniform"" %arg1, %0 : i64 spirv.ReturnValue %1 : f64 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_bitcast_roundtip(%arg0 : i64) -> i64 { %0 = spirv.Bitcast %arg0 : i64 to f64 %1 = spirv.Bitcast %0 : f64 to i64 spirv.ReturnValue %1 : i64 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_bitcast_chained_roundtip(%arg0 : i64) -> i64 { %0 = spirv.Bitcast %arg0 : i64 to f64 %1 = spirv.Bitcast %0 : f64 to vector<2xi32> %2 = spirv.Bitcast %1 : vector<2xi32> to vector<2xf32> %3 = spirv.Bitcast %2 : vector<2xf32> to i64 spirv.ReturnValue %3 : i64 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_vector() -> (i32, i32, i32) { %0 = spirv.Constant dense<[42, -33, 6]> : vector<3xi32> %1 = spirv.CompositeExtract %0[0 : i32] : vector<3xi32> %2 = spirv.CompositeExtract %0[1 : i32] : vector<3xi32> %3 = spirv.CompositeExtract %0[2 : i32] : vector<3xi32> return %1, %2, %3 : i32, i32, i32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_array_final() -> (i32, i32) { %0 = spirv.Constant [dense<[4, -5]> : vector<2xi32>] : !spirv.array<1 x vector<2xi32>> %1 = spirv.CompositeExtract %0[0 : i32, 0 : i32] : !spirv.array<1 x vector<2 x i32>> %2 = spirv.CompositeExtract %0[0 : i32, 1 : i32] : !spirv.array<1 x vector<2 x i32>> return %1, %2 : i32, i32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_array_interm() -> (vector<2xi32>) { %0 = spirv.Constant [dense<[4, -5]> : vector<2xi32>] : !spirv.array<1 x vector<2xi32>> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.array<1 x vector<2 x i32>> return %1 : vector<2xi32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_from_not_constant() -> i32 { %0 = spirv.Variable : !spirv.ptr, Function> %1 = spirv.Load ""Function"" %0 : vector<3xi32> %2 = spirv.CompositeExtract %1[0 : i32] : vector<3xi32> spirv.ReturnValue %2 : i32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_insert(%composite: !spirv.array<1xvector<2xf32>>, %val: f32) -> (f32, f32) { %insert = spirv.CompositeInsert %val, %composite[0 : i32, 1 : i32] : f32 into !spirv.array<1xvector<2xf32>> %1 = spirv.CompositeExtract %insert[0 : i32, 0 : i32] : !spirv.array<1xvector<2xf32>> %2 = spirv.CompositeExtract %insert[0 : i32, 1 : i32] : !spirv.array<1xvector<2xf32>> return %1, %2 : f32, f32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_construct(%val1: vector<2xf32>, %val2: vector<2xf32>) -> (vector<2xf32>, vector<2xf32>) { %construct = spirv.CompositeConstruct %val1, %val2 : (vector<2xf32>, vector<2xf32>) -> !spirv.array<2xvector<2xf32>> %1 = spirv.CompositeExtract %construct[0 : i32] : !spirv.array<2xvector<2xf32>> %2 = spirv.CompositeExtract %construct[1 : i32] : !spirv.array<2xvector<2xf32>> return %1, %2 : vector<2xf32>, vector<2xf32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 " func.func @fold_composite_op(%composite: !spirv.struct<(f32, f32)>, %val1: f32, %val2: f32) -> f32 { %insert = spirv.CompositeInsert %val1, %composite[0 : i32] : f32 into !spirv.struct<(f32, f32)> %1 = spirv.CompositeInsert %val2, %insert[1 : i32] : f32 into !spirv.struct<(f32, f32)> %2 = spirv.CompositeExtract %1[0 : i32] : !spirv.struct<(f32, f32)> return %2 : f32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 " func.func @fold_composite_op(%val1: f32, %val2: f32, %val3: f32) -> f32 { %composite = spirv.CompositeConstruct %val1, %val1, %val1 : (f32, f32, f32) -> !spirv.struct<(f32, f32, f32)> %insert = spirv.CompositeInsert %val2, %composite[1 : i32] : f32 into !spirv.struct<(f32, f32, f32)> %1 = spirv.CompositeInsert %val3, %insert[2 : i32] : f32 into !spirv.struct<(f32, f32, f32)> %2 = spirv.CompositeExtract %1[0 : i32] : !spirv.struct<(f32, f32, f32)> return %2 : f32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @extract_construct(%val1: vector<3xf32>, %val2: f32) -> (f32, f32) { %construct = spirv.CompositeConstruct %val1, %val2 : (vector<3xf32>, f32) -> vector<4xf32> %1 = spirv.CompositeExtract %construct[0 : i32] : vector<4xf32> %2 = spirv.CompositeExtract %construct[1 : i32] : vector<4xf32> return %1, %2 : f32, f32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @deduplicate_scalar_constant() -> (i32, i32) { %0 = spirv.Constant 42 : i32 %1 = spirv.Constant 42 : i32 return %0, %1 : i32, i32 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @deduplicate_vector_constant() -> (vector<3xi32>, vector<3xi32>) { %0 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> return %0, %1 : vector<3xi32>, vector<3xi32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @deduplicate_composite_constant() -> (!spirv.array<1 x vector<2xi32>>, !spirv.array<1 x vector<2xi32>>) { %0 = spirv.Constant [dense<5> : vector<2xi32>] : !spirv.array<1 x vector<2xi32>> %1 = spirv.Constant [dense<5> : vector<2xi32>] : !spirv.array<1 x vector<2xi32>> return %0, %1 : !spirv.array<1 x vector<2xi32>>, !spirv.array<1 x vector<2xi32>> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @iadd_zero(%arg0: i32) -> (i32, i32) { %zero = spirv.Constant 0 : i32 %0 = spirv.IAdd %arg0, %zero : i32 %1 = spirv.IAdd %zero, %arg0 : i32 return %0, %1: i32, i32 } func.func @const_fold_scalar_iadd_normal() -> (i32, i32, i32) { %c5 = spirv.Constant 5 : i32 %cn8 = spirv.Constant -8 : i32 %0 = spirv.IAdd %c5, %c5 : i32 %1 = spirv.IAdd %cn8, %cn8 : i32 %2 = spirv.IAdd %c5, %cn8 : i32 return %0, %1, %2: i32, i32, i32 } func.func @const_fold_scalar_iadd_flow() -> (i32, i32, i32, i32) { %c1 = spirv.Constant 1 : i32 %c2 = spirv.Constant 2 : i32 %c3 = spirv.Constant 4294967295 : i32 %c4 = spirv.Constant -2147483648 : i32 %c5 = spirv.Constant -1 : i32 %c6 = spirv.Constant -2 : i32 %0 = spirv.IAdd %c1, %c3 : i32 %1 = spirv.IAdd %c2, %c3 : i32 %2 = spirv.IAdd %c4, %c5 : i32 %3 = spirv.IAdd %c4, %c6 : i32 return %0, %1, %2, %3: i32, i32, i32, i32 } func.func @const_fold_vector_iadd() -> vector<3xi32> { %vc1 = spirv.Constant dense<[42, -55, 127]> : vector<3xi32> %vc2 = spirv.Constant dense<[-3, -15, 28]> : vector<3xi32> %0 = spirv.IAdd %vc1, %vc2 : vector<3xi32> return %0: vector<3xi32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @imul_zero_one(%arg0: i32) -> (i32, i32) { %zero = spirv.Constant 0 : i32 %one = spirv.Constant 1: i32 %0 = spirv.IMul %arg0, %zero : i32 %1 = spirv.IMul %one, %arg0 : i32 return %0, %1: i32, i32 } func.func @const_fold_scalar_imul_normal() -> (i32, i32, i32) { %c5 = spirv.Constant 5 : i32 %cn8 = spirv.Constant -8 : i32 %c7 = spirv.Constant 7 : i32 %0 = spirv.IMul %c7, %c5 : i32 %1 = spirv.IMul %c5, %cn8 : i32 %2 = spirv.IMul %cn8, %c7 : i32 return %0, %1, %2: i32, i32, i32 } func.func @const_fold_scalar_imul_flow() -> (i32, i32, i32) { %c1 = spirv.Constant 2 : i32 %c2 = spirv.Constant 4 : i32 %c3 = spirv.Constant 4294967295 : i32 %c4 = spirv.Constant 2147483647 : i32 %0 = spirv.IMul %c1, %c3 : i32 %1 = spirv.IMul %c1, %c4 : i32 %2 = spirv.IMul %c4, %c2 : i32 return %0, %1, %2: i32, i32, i32 } func.func @const_fold_vector_imul() -> vector<3xi32> { %vc1 = spirv.Constant dense<[42, -55, 127]> : vector<3xi32> %vc2 = spirv.Constant dense<[-3, -15, 28]> : vector<3xi32> %0 = spirv.IMul %vc1, %vc2 : vector<3xi32> return %0: vector<3xi32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @isub_x_x(%arg0: i32) -> i32 { %0 = spirv.ISub %arg0, %arg0: i32 return %0: i32 } func.func @const_fold_scalar_isub_normal() -> (i32, i32, i32) { %c5 = spirv.Constant 5 : i32 %cn8 = spirv.Constant -8 : i32 %c7 = spirv.Constant 7 : i32 %0 = spirv.ISub %c7, %c5 : i32 %1 = spirv.ISub %c5, %cn8 : i32 %2 = spirv.ISub %cn8, %c7 : i32 return %0, %1, %2: i32, i32, i32 } func.func @const_fold_scalar_isub_flow() -> (i32, i32, i32, i32) { %c1 = spirv.Constant 0 : i32 %c2 = spirv.Constant 1 : i32 %c3 = spirv.Constant 4294967295 : i32 %c4 = spirv.Constant 2147483647 : i32 %c5 = spirv.Constant -1 : i32 %c6 = spirv.Constant -2 : i32 %0 = spirv.ISub %c1, %c3 : i32 %1 = spirv.ISub %c2, %c3 : i32 %2 = spirv.ISub %c5, %c4 : i32 %3 = spirv.ISub %c6, %c4 : i32 return %0, %1, %2, %3: i32, i32, i32, i32 } func.func @const_fold_vector_isub() -> vector<3xi32> { %vc1 = spirv.Constant dense<[42, -55, 127]> : vector<3xi32> %vc2 = spirv.Constant dense<[-3, -15, 28]> : vector<3xi32> %0 = spirv.ISub %vc1, %vc2 : vector<3xi32> return %0: vector<3xi32> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_and_true_false_scalar(%arg: i1) -> (i1, i1) { %true = spirv.Constant true %false = spirv.Constant false %0 = spirv.LogicalAnd %true, %arg: i1 %1 = spirv.LogicalAnd %arg, %false: i1 return %0, %1: i1, i1 } func.func @convert_logical_and_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>, vector<3xi1>) { %true = spirv.Constant dense : vector<3xi1> %false = spirv.Constant dense : vector<3xi1> %0 = spirv.LogicalAnd %true, %arg: vector<3xi1> %1 = spirv.LogicalAnd %arg, %false: vector<3xi1> return %0, %1: vector<3xi1>, vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_not_to_not_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi1> { %2 = spirv.IEqual %arg0, %arg1 : vector<3xi64> %3 = spirv.LogicalNot %2 : vector<3xi1> spirv.ReturnValue %3 : vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_not_equal_false(%arg: vector<4xi1>) -> vector<4xi1> { %cst = spirv.Constant dense : vector<4xi1> %0 = spirv.LogicalNotEqual %arg, %cst : vector<4xi1> spirv.ReturnValue %0 : vector<4xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_not_to_equal(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi1> { %2 = spirv.INotEqual %arg0, %arg1 : vector<3xi64> %3 = spirv.LogicalNot %2 : vector<3xi1> spirv.ReturnValue %3 : vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_not_parent_multi_use(%arg0: vector<3xi64>, %arg1: vector<3xi64>, %arg2: !spirv.ptr, Uniform>) -> vector<3xi1> { %0 = spirv.INotEqual %arg0, %arg1 : vector<3xi64> %1 = spirv.LogicalNot %0 : vector<3xi1> spirv.Store ""Uniform"" %arg2, %0 : vector<3xi1> spirv.ReturnValue %1 : vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_not_to_logical_not_equal(%arg0: vector<3xi1>, %arg1: vector<3xi1>) -> vector<3xi1> { %2 = spirv.LogicalEqual %arg0, %arg1 : vector<3xi1> %3 = spirv.LogicalNot %2 : vector<3xi1> spirv.ReturnValue %3 : vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_not_to_logical_equal(%arg0: vector<3xi1>, %arg1: vector<3xi1>) -> vector<3xi1> { %2 = spirv.LogicalNotEqual %arg0, %arg1 : vector<3xi1> %3 = spirv.LogicalNot %2 : vector<3xi1> spirv.ReturnValue %3 : vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @convert_logical_or_true_false_scalar(%arg: i1) -> (i1, i1) { %true = spirv.Constant true %false = spirv.Constant false %0 = spirv.LogicalOr %true, %arg: i1 %1 = spirv.LogicalOr %arg, %false: i1 return %0, %1: i1, i1 } func.func @convert_logical_or_true_false_vector(%arg: vector<3xi1>) -> (vector<3xi1>, vector<3xi1>) { %true = spirv.Constant dense : vector<3xi1> %false = spirv.Constant dense : vector<3xi1> %0 = spirv.LogicalOr %true, %arg: vector<3xi1> %1 = spirv.LogicalOr %arg, %false: vector<3xi1> return %0, %1: vector<3xi1>, vector<3xi1> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @canonicalize_selection_op_scalar_type(%cond: i1) -> () { %0 = spirv.Constant 0: i32 %1 = spirv.Constant 1: i32 %2 = spirv.Constant 2: i32 %3 = spirv.Variable init(%0) : !spirv.ptr spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^else: spirv.Store ""Function"" %3, %2 [""Aligned"", 4]: i32 spirv.Branch ^merge ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 4]: i32 spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @canonicalize_selection_op_vector_type(%cond: i1) -> () { %0 = spirv.Constant dense<[0, 1, 2]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %3 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 8]: vector<3xi32> spirv.Branch ^merge ^else: spirv.Store ""Function"" %3, %2 [""Aligned"", 8] : vector<3xi32> spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @cannot_canonicalize_selection_op_0(%cond: i1) -> () { %0 = spirv.Constant dense<[0, 1, 2]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %3 = spirv.Variable init(%0) : !spirv.ptr, Function> %4 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 8]: vector<3xi32> spirv.Branch ^merge ^else: spirv.Store ""Function"" %4, %2 [""Aligned"", 8] : vector<3xi32> spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @cannot_canonicalize_selection_op_1(%cond: i1) -> () { %0 = spirv.Constant dense<[0, 1, 2]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %3 = spirv.Variable init(%0) : !spirv.ptr, Function> %4 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 8] : vector<3xi32> spirv.Store ""Function"" %4, %1 [""Aligned"", 8]: vector<3xi32> spirv.Branch ^merge ^else: spirv.Store ""Function"" %4, %2 [""Aligned"", 8] : vector<3xi32> spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @cannot_canonicalize_selection_op_2(%cond: i1) -> () { %0 = spirv.Constant dense<[0, 1, 2]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %3 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 8]: vector<3xi32> spirv.Branch ^merge ^else: spirv.Store ""Function"" %3, %2 [""Aligned"", 8] : vector<3xi32> spirv.Branch ^then ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @cannot_canonicalize_selection_op_3(%cond: i1) -> () { %0 = spirv.Constant dense<[0, 1, 2]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %3 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 8]: vector<3xi32> spirv.Return ^else: spirv.Store ""Function"" %3, %2 [""Aligned"", 8] : vector<3xi32> spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @cannot_canonicalize_selection_op_4(%cond: i1) -> () { %0 = spirv.Constant dense<[0, 1, 2]> : vector<3xi32> %1 = spirv.Constant dense<[1, 2, 3]> : vector<3xi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xi32> %3 = spirv.Variable init(%0) : !spirv.ptr, Function> spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^else ^then: spirv.Store ""Function"" %3, %1 [""Aligned"", 4]: vector<3xi32> spirv.Branch ^merge ^else: spirv.Store ""Function"" %3, %2 [""Aligned"", 8] : vector<3xi32> spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 { %0 = spirv.FOrdLessThan %min, %input : f32 %mid = spirv.Select %0, %input, %min : i1, f32 %1 = spirv.FOrdLessThan %mid, %max : f32 %2 = spirv.Select %1, %mid, %max : i1, f32 spirv.ReturnValue %2 : f32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_fordlessthan(%input: f32, %min: f32, %max: f32) -> f32 { %0 = spirv.FOrdLessThan %input, %min : f32 %mid = spirv.Select %0, %min, %input : i1, f32 %1 = spirv.FOrdLessThan %max, %input : f32 %2 = spirv.Select %1, %max, %mid : i1, f32 spirv.ReturnValue %2 : f32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 { %0 = spirv.FOrdLessThanEqual %min, %input : f32 %mid = spirv.Select %0, %input, %min : i1, f32 %1 = spirv.FOrdLessThanEqual %mid, %max : f32 %2 = spirv.Select %1, %mid, %max : i1, f32 spirv.ReturnValue %2 : f32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_fordlessthanequal(%input: f32, %min: f32, %max: f32) -> f32 { %0 = spirv.FOrdLessThanEqual %input, %min : f32 %mid = spirv.Select %0, %min, %input : i1, f32 %1 = spirv.FOrdLessThanEqual %max, %input : f32 %2 = spirv.Select %1, %max, %mid : i1, f32 spirv.ReturnValue %2 : f32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 { %0 = spirv.SLessThan %min, %input : si32 %mid = spirv.Select %0, %input, %min : i1, si32 %1 = spirv.SLessThan %mid, %max : si32 %2 = spirv.Select %1, %mid, %max : i1, si32 spirv.ReturnValue %2 : si32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_slessthan(%input: si32, %min: si32, %max: si32) -> si32 { %0 = spirv.SLessThan %input, %min : si32 %mid = spirv.Select %0, %min, %input : i1, si32 %1 = spirv.SLessThan %max, %input : si32 %2 = spirv.Select %1, %max, %mid : i1, si32 spirv.ReturnValue %2 : si32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 { %0 = spirv.SLessThanEqual %min, %input : si32 %mid = spirv.Select %0, %input, %min : i1, si32 %1 = spirv.SLessThanEqual %mid, %max : si32 %2 = spirv.Select %1, %mid, %max : i1, si32 spirv.ReturnValue %2 : si32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_slessthanequal(%input: si32, %min: si32, %max: si32) -> si32 { %0 = spirv.SLessThanEqual %input, %min : si32 %mid = spirv.Select %0, %min, %input : i1, si32 %1 = spirv.SLessThanEqual %max, %input : si32 %2 = spirv.Select %1, %max, %mid : i1, si32 spirv.ReturnValue %2 : si32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 { %0 = spirv.ULessThan %min, %input : i32 %mid = spirv.Select %0, %input, %min : i1, i32 %1 = spirv.ULessThan %mid, %max : i32 %2 = spirv.Select %1, %mid, %max : i1, i32 spirv.ReturnValue %2 : i32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_ulessthan(%input: i32, %min: i32, %max: i32) -> i32 { %0 = spirv.ULessThan %input, %min : i32 %mid = spirv.Select %0, %min, %input : i1, i32 %1 = spirv.ULessThan %max, %input : i32 %2 = spirv.Select %1, %max, %mid : i1, i32 spirv.ReturnValue %2 : i32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 { %0 = spirv.ULessThanEqual %min, %input : i32 %mid = spirv.Select %0, %input, %min : i1, i32 %1 = spirv.ULessThanEqual %mid, %max : i32 %2 = spirv.Select %1, %mid, %max : i1, i32 spirv.ReturnValue %2 : i32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "func.func @clamp_ulessthanequal(%input: i32, %min: i32, %max: i32) -> i32 { %0 = spirv.ULessThanEqual %input, %min : i32 %mid = spirv.Select %0, %min, %input : i1, i32 %1 = spirv.ULessThanEqual %max, %input : i32 %2 = spirv.Select %1, %max, %mid : i1, i32 spirv.ReturnValue %2 : i32 }", mlir-opt -split-input-file -spirv-canonicalize-gl ,1 "spirv.module Logical GLSL450 { spirv.func @rewrite(%value0 : f32, %value1 : f32, %value2 : f32, %value3 : i32, %value4: !spirv.array<3xf32>) -> vector<3xf32> ""None"" { %0 = spirv.Undef : vector<3xf32> %1 = spirv.CompositeInsert %value0, %0[0 : i32] : f32 into vector<3xf32> %2 = spirv.CompositeInsert %value1, %1[1 : i32] : f32 into vector<3xf32> %3 = spirv.CompositeInsert %value2, %2[2 : i32] : f32 into vector<3xf32> %4 = spirv.Undef : !spirv.array<4xf32> %5 = spirv.CompositeInsert %value0, %4[0 : i32] : f32 into !spirv.array<4xf32> %6 = spirv.CompositeInsert %value1, %5[1 : i32] : f32 into !spirv.array<4xf32> %7 = spirv.CompositeInsert %value2, %6[2 : i32] : f32 into !spirv.array<4xf32> %8 = spirv.CompositeInsert %value0, %7[3 : i32] : f32 into !spirv.array<4xf32> %9 = spirv.Undef : !spirv.struct<(f32, i32, f32)> %10 = spirv.CompositeInsert %value0, %9[0 : i32] : f32 into !spirv.struct<(f32, i32, f32)> %11 = spirv.CompositeInsert %value3, %10[1 : i32] : i32 into !spirv.struct<(f32, i32, f32)> %12 = spirv.CompositeInsert %value1, %11[2 : i32] : f32 into !spirv.struct<(f32, i32, f32)> %13 = spirv.Undef : !spirv.struct<(f32, !spirv.array<3xf32>)> %14 = spirv.CompositeInsert %value0, %13[0 : i32] : f32 into !spirv.struct<(f32, !spirv.array<3xf32>)> %15 = spirv.CompositeInsert %value4, %14[1 : i32] : !spirv.array<3xf32> into !spirv.struct<(f32, !spirv.array<3xf32>)> spirv.ReturnValue %3 : vector<3xf32> } }", mlir-opt -spirv-rewrite-inserts -split-input-file -verify-diagnostics -o - ,1 "spirv.module Logical GLSL450 { spirv.func @umul_extended_i32(%arg0 : i32, %arg1 : i32) -> !spirv.struct<(i32, i32)> ""None"" { %0 = spirv.UMulExtended %arg0, %arg1 : !spirv.struct<(i32, i32)> spirv.ReturnValue %0 : !spirv.struct<(i32, i32)> } spirv.func @umul_extended_vector_i32(%arg0 : vector<3xi32>, %arg1 : vector<3xi32>) -> !spirv.struct<(vector<3xi32>, vector<3xi32>)> ""None"" { %0 = spirv.UMulExtended %arg0, %arg1 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> spirv.ReturnValue %0 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> } spirv.func @umul_extended_i16(%arg : i16) -> !spirv.struct<(i16, i16)> ""None"" { %0 = spirv.UMulExtended %arg, %arg : !spirv.struct<(i16, i16)> spirv.ReturnValue %0 : !spirv.struct<(i16, i16)> } spirv.func @smul_extended_i32(%arg0 : i32, %arg1 : i32) -> !spirv.struct<(i32, i32)> ""None"" { %0 = spirv.SMulExtended %arg0, %arg1 : !spirv.struct<(i32, i32)> spirv.ReturnValue %0 : !spirv.struct<(i32, i32)> } spirv.func @smul_extended_vector_i32(%arg0 : vector<3xi32>, %arg1 : vector<3xi32>) -> !spirv.struct<(vector<3xi32>, vector<3xi32>)> ""None"" { %0 = spirv.SMulExtended %arg0, %arg1 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> spirv.ReturnValue %0 : !spirv.struct<(vector<3xi32>, vector<3xi32>)> } spirv.func @smul_extended_i16(%arg : i16) -> !spirv.struct<(i16, i16)> ""None"" { %0 = spirv.SMulExtended %arg, %arg : !spirv.struct<(i16, i16)> spirv.ReturnValue %0 : !spirv.struct<(i16, i16)> } } ", mlir-opt --split-input-file --verify-diagnostics --spirv-webgpu-prepare --cse ,1 "spirv.module Logical GLSL450 { spirv.func @callee() ""None"" { spirv.Return } spirv.func @calling_single_block_ret_func() ""None"" { spirv.FunctionCall @callee() : () -> () spirv.Return } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.func @callee() -> i32 ""None"" { %0 = spirv.Constant 42 : i32 spirv.ReturnValue %0 : i32 } spirv.func @calling_single_block_retval_func() -> i32 ""None"" { %0 = spirv.FunctionCall @callee() : () -> (i32) spirv.ReturnValue %0 : i32 } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @data bind(0, 0) : !spirv.ptr [0])>, StorageBuffer> spirv.func @callee() ""None"" { %0 = spirv.mlir.addressof @data : !spirv.ptr [0])>, StorageBuffer> %1 = spirv.Constant 0: i32 %2 = spirv.AccessChain %0[%1, %1] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 spirv.Branch ^next ^next: %3 = spirv.Constant 42: i32 spirv.Store ""StorageBuffer"" %2, %3 : i32 spirv.Return } spirv.func @calling_multi_block_ret_func() ""None"" { spirv.FunctionCall @callee() : () -> () spirv.Return } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.func @callee(%cond : i1) -> () ""None"" { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: spirv.Return ^merge: spirv.mlir.merge } spirv.Return } spirv.func @calling_selection_ret_func() ""None"" { %0 = spirv.Constant true spirv.FunctionCall @callee(%0) : (i1) -> () spirv.Return } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.func @callee(%cond : i1) -> () ""None"" { spirv.mlir.selection { spirv.BranchConditional %cond, ^then, ^merge ^then: spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return } spirv.func @calling_selection_no_ret_func() ""None"" { %0 = spirv.Constant true spirv.FunctionCall @callee(%0) : (i1) -> () spirv.Return } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.func @callee(%cond : i1) -> () ""None"" { spirv.mlir.loop { spirv.Branch ^header ^header: spirv.BranchConditional %cond, ^body, ^merge ^body: spirv.Return ^continue: spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } spirv.func @calling_loop_ret_func() ""None"" { %0 = spirv.Constant true spirv.FunctionCall @callee(%0) : (i1) -> () spirv.Return } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.func @callee(%cond : i1) -> () ""None"" { spirv.mlir.loop { spirv.Branch ^header ^header: spirv.BranchConditional %cond, ^body, ^merge ^body: spirv.Branch ^continue ^continue: spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } spirv.func @calling_loop_no_ret_func() ""None"" { %0 = spirv.Constant true spirv.FunctionCall @callee(%0) : (i1) -> () spirv.Return } }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @arg_0 bind(0, 0) : !spirv.ptr, StorageBuffer> spirv.GlobalVariable @arg_1 bind(0, 1) : !spirv.ptr, StorageBuffer> spirv.func @inline_into_selection_region() ""None"" { %1 = spirv.Constant 0 : i32 %2 = spirv.mlir.addressof @arg_0 : !spirv.ptr, StorageBuffer> %3 = spirv.mlir.addressof @arg_1 : !spirv.ptr, StorageBuffer> %4 = spirv.AccessChain %2[%1] : !spirv.ptr, StorageBuffer>, i32 %5 = spirv.Load ""StorageBuffer"" %4 : i32 %6 = spirv.SGreaterThan %5, %1 : i32 spirv.mlir.selection { spirv.BranchConditional %6, ^bb1, ^bb2 ^bb1: %7 = spirv.AccessChain %3[%1] : !spirv.ptr, StorageBuffer>, i32 spirv.FunctionCall @atomic_add(%5, %7) : (i32, !spirv.ptr) -> () spirv.Branch ^bb2 ^bb2 : spirv.mlir.merge } spirv.Return } spirv.func @atomic_add(%arg0: i32, %arg1: !spirv.ptr) ""None"" { %0 = spirv.AtomicIAdd ""Device"" ""AcquireRelease"" %arg1, %arg0 : !spirv.ptr spirv.Return } spirv.EntryPoint ""GLCompute"" @inline_into_selection_region spirv.ExecutionMode @inline_into_selection_region ""LocalSize"", 32, 1, 1 }", mlir-opt -split-input-file -pass-pipeline='builtin.module(spirv.module(inline{default-pipeline=''}))' ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.module Logical GLSL450 { spirv.func @kernel( %arg0: f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0), StorageBuffer>}, %arg1: !spirv.ptr)>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>}) ""None"" attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { spirv.Return } } } ", mlir-opt --split-input-file --spirv-lower-abi-attrs --verify-diagnostics ,1 "module { spirv.module Logical GLSL450 {} } ", mlir-opt --split-input-file --spirv-lower-abi-attrs --verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.module Logical GLSL450 { spirv.GlobalVariable @__builtin_var_WorkgroupSize__ built_in(""WorkgroupSize"") : !spirv.ptr, Input> spirv.GlobalVariable @__builtin_var_NumWorkgroups__ built_in(""NumWorkgroups"") : !spirv.ptr, Input> spirv.GlobalVariable @__builtin_var_LocalInvocationId__ built_in(""LocalInvocationId"") : !spirv.ptr, Input> spirv.GlobalVariable @__builtin_var_WorkgroupId__ built_in(""WorkgroupId"") : !spirv.ptr, Input> spirv.func @load_store_kernel( %arg0: !spirv.ptr>)>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 0)>}, %arg1: !spirv.ptr>)>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 1)>}, %arg2: !spirv.ptr>)>, StorageBuffer> {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 2)>}, %arg3: i32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 3), StorageBuffer>}, %arg4: i32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 4), StorageBuffer>}, %arg5: i32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 5), StorageBuffer>}, %arg6: i32 {spirv.interface_var_abi = #spirv.interface_var_abi<(0, 6), StorageBuffer>}) ""None"" attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = spirv.mlir.addressof @__builtin_var_WorkgroupId__ : !spirv.ptr, Input> %1 = spirv.Load ""Input"" %0 : vector<3xi32> %2 = spirv.CompositeExtract %1[0 : i32] : vector<3xi32> %3 = spirv.mlir.addressof @__builtin_var_WorkgroupId__ : !spirv.ptr, Input> %4 = spirv.Load ""Input"" %3 : vector<3xi32> %5 = spirv.CompositeExtract %4[1 : i32] : vector<3xi32> %6 = spirv.mlir.addressof @__builtin_var_WorkgroupId__ : !spirv.ptr, Input> %7 = spirv.Load ""Input"" %6 : vector<3xi32> %8 = spirv.CompositeExtract %7[2 : i32] : vector<3xi32> %9 = spirv.mlir.addressof @__builtin_var_LocalInvocationId__ : !spirv.ptr, Input> %10 = spirv.Load ""Input"" %9 : vector<3xi32> %11 = spirv.CompositeExtract %10[0 : i32] : vector<3xi32> %12 = spirv.mlir.addressof @__builtin_var_LocalInvocationId__ : !spirv.ptr, Input> %13 = spirv.Load ""Input"" %12 : vector<3xi32> %14 = spirv.CompositeExtract %13[1 : i32] : vector<3xi32> %15 = spirv.mlir.addressof @__builtin_var_LocalInvocationId__ : !spirv.ptr, Input> %16 = spirv.Load ""Input"" %15 : vector<3xi32> %17 = spirv.CompositeExtract %16[2 : i32] : vector<3xi32> %18 = spirv.mlir.addressof @__builtin_var_NumWorkgroups__ : !spirv.ptr, Input> %19 = spirv.Load ""Input"" %18 : vector<3xi32> %20 = spirv.CompositeExtract %19[0 : i32] : vector<3xi32> %21 = spirv.mlir.addressof @__builtin_var_NumWorkgroups__ : !spirv.ptr, Input> %22 = spirv.Load ""Input"" %21 : vector<3xi32> %23 = spirv.CompositeExtract %22[1 : i32] : vector<3xi32> %24 = spirv.mlir.addressof @__builtin_var_NumWorkgroups__ : !spirv.ptr, Input> %25 = spirv.Load ""Input"" %24 : vector<3xi32> %26 = spirv.CompositeExtract %25[2 : i32] : vector<3xi32> %27 = spirv.mlir.addressof @__builtin_var_WorkgroupSize__ : !spirv.ptr, Input> %28 = spirv.Load ""Input"" %27 : vector<3xi32> %29 = spirv.CompositeExtract %28[0 : i32] : vector<3xi32> %30 = spirv.mlir.addressof @__builtin_var_WorkgroupSize__ : !spirv.ptr, Input> %31 = spirv.Load ""Input"" %30 : vector<3xi32> %32 = spirv.CompositeExtract %31[1 : i32] : vector<3xi32> %33 = spirv.mlir.addressof @__builtin_var_WorkgroupSize__ : !spirv.ptr, Input> %34 = spirv.Load ""Input"" %33 : vector<3xi32> %35 = spirv.CompositeExtract %34[2 : i32] : vector<3xi32> %36 = spirv.IAdd %arg3, %2 : i32 %37 = spirv.IAdd %arg4, %11 : i32 %c0 = spirv.Constant 0 : i32 %38 = spirv.AccessChain %arg0[%c0, %36, %37] : !spirv.ptr>)>, StorageBuffer>, i32, i32, i32 %39 = spirv.Load ""StorageBuffer"" %38 : f32 %40 = spirv.AccessChain %arg1[%c0, %36, %37] : !spirv.ptr>)>, StorageBuffer>, i32, i32, i32 %41 = spirv.Load ""StorageBuffer"" %40 : f32 %42 = spirv.FAdd %39, %41 : f32 %43 = spirv.AccessChain %arg2[%c0, %36, %37] : !spirv.ptr>)>, StorageBuffer>, i32, i32, i32 spirv.Store ""StorageBuffer"" %43, %42 : f32 spirv.Return } } } ", mlir-opt -spirv-lower-abi-attrs -verify-diagnostics -o - ,1 "spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd(%val : i32) -> i32 ""None"" { %0 = spirv.IAdd %val, %val: i32 spirv.ReturnValue %0: i32 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @group_non_uniform_ballot(%predicate : i1) -> vector<4xi32> ""None"" { %0 = spirv.GroupNonUniformBallot %predicate : vector<4xi32> spirv.ReturnValue %0: vector<4xi32> } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd(%val : i32) -> i32 ""None"" { %0 = spirv.IAdd %val, %val: i32 spirv.ReturnValue %0: i32 } } spirv.module PhysicalStorageBuffer64 GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @physical_ptr(%val : !spirv.ptr) ""None"" { spirv.Return } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd(%val : i32) -> i32 ""None"" { %0 = spirv.IAdd %val, %val: i32 spirv.ReturnValue %0: i32 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @group_non_uniform_iadd(%val : i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformIAdd ""Subgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @group_non_uniform_iadd(%val : i32) -> i32 ""None"" { %0 = spirv.GroupNonUniformIAdd ""Subgroup"" ""Reduce"" %val : i32 spirv.ReturnValue %0: i32 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd_function(%val : i8) -> i8 ""None"" { %0 = spirv.IAdd %val, %val : i8 spirv.ReturnValue %0: i8 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @fadd_function(%val : f16) -> f16 ""None"" { %0 = spirv.FAdd %val, %val : f16 spirv.ReturnValue %0: f16 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd_v16_function(%val : vector<16xi32>) -> vector<16xi32> ""None"" { %0 = spirv.IAdd %val, %val : vector<16xi32> spirv.ReturnValue %0: vector<16xi32> } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @subgroup_ballot(%predicate : i1) -> vector<4xi32> ""None"" { %0 = spirv.KHR.SubgroupBallot %predicate: vector<4xi32> spirv.ReturnValue %0: vector<4xi32> } } spirv.module Logical Vulkan attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd(%val : i32) -> i32 ""None"" { %0 = spirv.IAdd %val, %val: i32 spirv.ReturnValue %0: i32 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.func @iadd_storage_buffer(%ptr : !spirv.ptr) -> i16 ""None"" { %0 = spirv.Load ""StorageBuffer"" %ptr : i16 %1 = spirv.IAdd %0, %0 : i16 spirv.ReturnValue %1: i16 } } spirv.module Logical GLSL450 attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { spirv.GlobalVariable @data : !spirv.ptr, Uniform> spirv.GlobalVariable @img : !spirv.ptr, UniformConstant> }", mlir-opt -spirv-update-vce ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 bind(0,1) : !spirv.ptr, f32)>, Uniform> spirv.GlobalVariable @var1 bind(0,2) : !spirv.ptr, f32)>, StorageBuffer> spirv.GlobalVariable @var2 bind(1,0) : !spirv.ptr, f32)>, i32)>, StorageBuffer> spirv.GlobalVariable @var3 : !spirv.ptr)>>, f32)>, StorageBuffer> spirv.GlobalVariable @var4 bind(1,2) : !spirv.ptr, f32, i1)>, i1)>, StorageBuffer> spirv.GlobalVariable @var5 bind(1,3) : !spirv.ptr)>, StorageBuffer> spirv.func @kernel() -> () ""None"" { %c0 = spirv.Constant 0 : i32 %0 = spirv.mlir.addressof @var0 : !spirv.ptr, f32)>, Uniform> %1 = spirv.AccessChain %0[%c0] : !spirv.ptr, f32)>, Uniform>, i32 spirv.Return } }", mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics -o - ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr, i1)>, i1)>, i1)>, i1)>, Uniform> spirv.GlobalVariable @var1 : !spirv.ptr, f32)>, f32)>, Uniform> spirv.GlobalVariable @var2 : !spirv.ptr>)>, f32)>, f32)>, Uniform> spirv.GlobalVariable @var3 : !spirv.ptr, i1)>, i1)>, Uniform> spirv.GlobalVariable @var4 : !spirv.ptr, i1)>, Uniform> spirv.GlobalVariable @var5 : !spirv.ptr, i1)>, Uniform> spirv.GlobalVariable @var6 : !spirv.ptr, i1)>, Uniform> spirv.GlobalVariable @var7 : !spirv.ptr, i1)>, i1)>, Uniform> }", mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics -o - ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr, f32)>, StorageBuffer> spirv.GlobalVariable @var1 : !spirv.ptr, f32)>, StorageBuffer> spirv.GlobalVariable @var2 : !spirv.ptr, f32)>, StorageBuffer> }", mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics -o - ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @emptyStructAsMember : !spirv.ptr)>, StorageBuffer> spirv.GlobalVariable @arrayType : !spirv.ptr>, StorageBuffer> spirv.GlobalVariable @InputStorage : !spirv.ptr)>, Input> spirv.GlobalVariable @customLayout : !spirv.ptr, Uniform> spirv.GlobalVariable @emptyStruct : !spirv.ptr, Uniform> }", mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics -o - ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @var0 : !spirv.ptr, PushConstant> spirv.GlobalVariable @var1 : !spirv.ptr, PhysicalStorageBuffer> }", mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics -o - ,1 "spirv.module Physical64 GLSL450 { spirv.GlobalVariable @recursive: !spirv.ptr, StorageBuffer>)>, StorageBuffer> }", mlir-opt -decorate-spirv-composite-type-layout -split-input-file -verify-diagnostics -o - ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @m1_sc = 42.42 : f32 spirv.GlobalVariable @m1_gv bind(1, 0): !spirv.ptr spirv.func @no_op() -> () ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @no_op spirv.ExecutionMode @no_op ""LocalSize"", 32, 1, 1 } spirv.module Logical GLSL450 { spirv.SpecConstant @m2_sc = 42 : i32 spirv.GlobalVariable @m2_gv bind(0, 1): !spirv.ptr spirv.func @variable_init_spec_constant() -> () ""None"" { %0 = spirv.mlir.referenceof @m2_sc : i32 %1 = spirv.Variable init(%0) : !spirv.ptr spirv.Return } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Physical64 GLSL450 { } spirv.module Logical GLSL450 { } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical Simple { } spirv.module Logical GLSL450 { } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { } spirv.module Logical GLSL450 requires #spirv.vce { } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { func.func @foo(%arg0: i32) -> i32 { return %arg0 : i32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : f32) -> f32 ""None"" { spirv.ReturnValue %arg0 : f32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : f32) -> f32 ""None"" { %0 = spirv.FAdd %arg0, %arg0 : f32 spirv.ReturnValue %0 : f32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { %0 = spirv.ISub %arg0, %arg0 : i32 spirv.ReturnValue %0 : i32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : f32) -> f32 ""None"" { spirv.ReturnValue %arg0 : f32 } spirv.func @bar(%arg0 : f32) -> f32 ""None"" { %0 = spirv.FunctionCall @foo(%arg0) : (f32) -> (f32) spirv.ReturnValue %0 : f32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.func @bar(%arg0 : f32) -> f32 ""None"" { %0 = spirv.FunctionCall @foo(%arg0) : (f32) -> (f32) spirv.ReturnValue %0 : f32 } spirv.func @foo(%arg0 : f32) -> f32 ""None"" { spirv.ReturnValue %arg0 : f32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : f32) -> f32 ""None"" { spirv.ReturnValue %arg0 : f32 } spirv.EntryPoint ""GLCompute"" @foo spirv.ExecutionMode @foo ""ContractionOff"" } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } spirv.EntryPoint ""GLCompute"" @foo spirv.ExecutionMode @foo ""ContractionOff"" } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : f32) -> f32 ""None"" { spirv.ReturnValue %arg0 : f32 } spirv.EntryPoint ""GLCompute"" @foo spirv.ExecutionMode @foo ""ContractionOff"" } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr spirv.func @bar() -> f32 ""None"" { %0 = spirv.mlir.addressof @foo : !spirv.ptr %1 = spirv.Load ""Input"" %0 : f32 spirv.ReturnValue %1 : f32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr spirv.func @bar() -> f32 ""None"" { %0 = spirv.mlir.addressof @foo : !spirv.ptr %1 = spirv.Load ""Input"" %0 : f32 spirv.ReturnValue %1 : f32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.SpecConstant @foo = -5 : i32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.SpecConstant @foo = -5 : i32 spirv.func @bar() -> i32 ""None"" { %0 = spirv.mlir.referenceof @foo : i32 spirv.ReturnValue %0 : i32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @foo = -5 : i32 spirv.func @bar() -> i32 ""None"" { %0 = spirv.mlir.referenceof @foo : i32 spirv.ReturnValue %0 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.SpecConstant @bar = -5 : i32 spirv.SpecConstantComposite @foo (@bar, @bar) : !spirv.array<2 x i32> } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } spirv.module Logical GLSL450 { spirv.SpecConstant @bar = -5 : i32 spirv.SpecConstantComposite @foo (@bar, @bar) : !spirv.array<2 x i32> spirv.func @baz() -> i32 ""None"" { %0 = spirv.mlir.referenceof @foo : !spirv.array<2 x i32> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.array<2 x i32> spirv.ReturnValue %1 : i32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @bar = -5 : i32 spirv.SpecConstantComposite @foo (@bar, @bar) : !spirv.array<2 x i32> spirv.func @baz() -> i32 ""None"" { %0 = spirv.mlir.referenceof @foo : !spirv.array<2 x i32> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.array<2 x i32> spirv.ReturnValue %1 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @bar = -5 : i32 spirv.SpecConstantComposite @foo (@bar, @bar) : !spirv.array<2 x i32> spirv.func @baz() -> i32 ""None"" { %0 = spirv.mlir.referenceof @foo : !spirv.array<2 x i32> %1 = spirv.CompositeExtract %0[0 : i32] : !spirv.array<2 x i32> spirv.ReturnValue %1 : i32 } } spirv.module Logical GLSL450 { spirv.func @foo(%arg0 : i32) -> i32 ""None"" { spirv.ReturnValue %arg0 : i32 } spirv.func @bar(%arg0 : f32) -> f32 ""None"" { spirv.ReturnValue %arg0 : f32 } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(2, 0) : !spirv.ptr } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.GlobalVariable @foo built_in(""GlobalInvocationId"") : !spirv.ptr, Input> } spirv.module Logical GLSL450 { spirv.GlobalVariable @foo built_in(""LocalInvocationId"") : !spirv.ptr, Input> } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } spirv.module Logical GLSL450 { spirv.SpecConstant @foo = -5 : i32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @foo = -5 : i32 } spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } spirv.module Logical GLSL450 { spirv.SpecConstant @bar = -5 : i32 spirv.SpecConstantComposite @foo (@bar, @bar) : !spirv.array<2 x i32> } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @bar = -5 : i32 spirv.SpecConstantComposite @foo (@bar, @bar) : !spirv.array<2 x i32> } spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module @Module1 Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr spirv.func @bar() -> () ""None"" { spirv.Return } spirv.func @baz() -> () ""None"" { spirv.Return } spirv.SpecConstant @sc = -5 : i32 } spirv.module @Module2 Logical GLSL450 { spirv.func @foo() -> () ""None"" { spirv.Return } spirv.GlobalVariable @bar bind(1, 0) : !spirv.ptr spirv.func @baz() -> () ""None"" { spirv.Return } spirv.SpecConstant @sc = -5 : i32 } spirv.module @Module3 Logical GLSL450 { spirv.func @foo() -> () ""None"" { spirv.Return } spirv.GlobalVariable @bar bind(1, 0) : !spirv.ptr spirv.func @baz() -> () ""None"" { spirv.Return } spirv.SpecConstant @sc = -5 : i32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr spirv.func @use_foo() -> f32 ""None"" { %0 = spirv.mlir.addressof @foo : !spirv.ptr %1 = spirv.Load ""Input"" %0 : f32 spirv.ReturnValue %1 : f32 } } spirv.module Logical GLSL450 { spirv.GlobalVariable @bar bind(1, 0) : !spirv.ptr spirv.func @use_bar() -> f32 ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr %1 = spirv.Load ""Input"" %0 : f32 %2 = spirv.FAdd %1, %1 : f32 spirv.ReturnValue %2 : f32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @foo bind(1, 0) : !spirv.ptr } spirv.module Logical GLSL450 { spirv.GlobalVariable @bar bind(1, 0) : !spirv.ptr spirv.func @use_bar() -> f32 ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr %1 = spirv.Load ""Input"" %0 : f32 spirv.ReturnValue %1 : f32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.GlobalVariable @foo built_in(""GlobalInvocationId"") : !spirv.ptr, Input> } spirv.module Logical GLSL450 { spirv.GlobalVariable @bar built_in(""GlobalInvocationId"") : !spirv.ptr, Input> spirv.func @use_bar() -> vector<3xi32> ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr, Input> %1 = spirv.Load ""Input"" %0 : vector<3xi32> spirv.ReturnValue %1 : vector<3xi32> } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.SpecConstant @foo spec_id(5) = 1. : f32 spirv.func @use_foo() -> (f32) ""None"" { %0 = spirv.mlir.referenceof @foo : f32 spirv.ReturnValue %0 : f32 } } spirv.module Logical GLSL450 { spirv.SpecConstant @bar spec_id(5) = 1. : f32 spirv.func @use_bar() -> (f32) ""None"" { %0 = spirv.mlir.referenceof @bar : f32 %1 = spirv.FAdd %0, %0 : f32 spirv.ReturnValue %1 : f32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @foo(%a: f32, %b: f32, %c: f32) -> f32 ""None"" { %add = spirv.FAdd %a, %b: f32 %mul = spirv.FMul %add, %c: f32 spirv.ReturnValue %mul: f32 } } spirv.module Logical GLSL450 { spirv.func @foo(%a: f32, %b: f32, %c: f32) -> f32 ""None"" { %add = spirv.FAdd %a, %c: f32 %mul = spirv.FMul %add, %b: f32 spirv.ReturnValue %mul: f32 } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "module { spirv.module Logical GLSL450 { spirv.SpecConstant @bar spec_id(5) = 1. : f32 spirv.func @foo(%arg0: f32) -> (f32) ""None"" { spirv.ReturnValue %arg0 : f32 } spirv.func @foo_duplicate(%arg0: f32) -> (f32) ""None"" { spirv.ReturnValue %arg0 : f32 } spirv.func @foo_different_body(%arg0: f32) -> (f32) ""None"" { %0 = spirv.mlir.referenceof @bar : f32 spirv.ReturnValue %arg0 : f32 } spirv.func @baz(%arg0: i32) -> (i32) ""None"" { spirv.ReturnValue %arg0 : i32 } spirv.func @baz_no_return(%arg0: i32) ""None"" { spirv.Return } spirv.func @baz_no_return_duplicate(%arg0: i32) -> () ""None"" { spirv.Return } spirv.func @baz_no_return_different_control(%arg0: i32) -> () ""Inline"" { spirv.Return } spirv.func @baz_no_return_another_control(%arg0: i32) -> () ""Inline|Pure"" { spirv.Return } spirv.func @kernel( %arg0: f32, %arg1: !spirv.ptr)>, CrossWorkgroup>) ""None"" attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { spirv.Return } spirv.func @kernel_different_attr( %arg0: f32, %arg1: !spirv.ptr)>, CrossWorkgroup>) ""None"" attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { spirv.Return } } }", mlir-opt -test-spirv-module-combiner -split-input-file -verify-diagnostics ,1 "func.func @identity(%arg0: tensor) -> tensor { return %arg0 : tensor } func.func @block_arguments(%arg0: tensor) -> tensor { cf.br ^bb1(%arg0: tensor) ^bb1(%bbarg: tensor): return %bbarg : tensor } func.func private @source() -> tensor func.func @call_source() -> tensor { %0 = call @source() : () -> tensor return %0 : tensor } func.func private @sink(tensor) func.func @call_sink(%arg0: tensor) { call @sink(%arg0) : (tensor) -> () return } func.func @unconverted_op_in_body() -> tensor { %0 = ""test.source""() : () -> tensor return %0 : tensor }", mlir-opt -func-bufferize -split-input-file -verify-diagnostics ,1 "func.func @unable_to_update_terminator(%arg0: tensor) -> tensor { %0 = arith.constant true cf.cond_br %0, ^bb1(%arg0: tensor), ^bb2(%arg0: tensor) ^bb1(%bbarg0: tensor): ""test.terminator""() : () -> () ^bb2(%bbarg1: tensor): return %bbarg1 : tensor }", mlir-opt -func-bufferize -split-input-file -verify-diagnostics ,1 "func.func @bufferize_while(%arg0: i64, %arg1: i64) -> i64 { %c2_i64 = arith.constant 2 : i64 %0:2 = scf.while (%arg2 = %arg0) : (i64) -> (i64, i64) { %1 = arith.cmpi slt, %arg2, %arg1 : i64 scf.condition(%1) %arg2, %arg2 : i64, i64 } do { ^bb0(%arg2: i64, %arg3: i64): %1 = arith.muli %arg3, %c2_i64 : i64 scf.yield %1 : i64 } return %0#1 : i64 }", mlir-opt -func-bufferize -split-input-file -verify-diagnostics ,1 "func.func @not_matmul(%arg0: vector<4xf32>, %arg1: vector<4xf32>, %arg2: f32) -> f32 { %0 = vector.contract {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4xf32>, vector<4xf32> into f32 return %0 : f32 } func.func @matmul_mk_nk_mn_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_mk_kn_mn_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_mk_kn_mn_8x16xi8_extsi_i32(%arg0: vector<8x4xi8>, %arg1: vector<4x16xi8>, %arg2: vector<8x16xi32>) -> vector<8x16xi32> { %lhs = arith.extsi %arg0: vector<8x4xi8> to vector<8x4xi32> %rhs = arith.extsi %arg1: vector<4x16xi8> to vector<4x16xi32> %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %lhs, %rhs, %arg2 : vector<8x4xi32>, vector<4x16xi32> into vector<8x16xi32> return %res : vector<8x16xi32> } func.func @matmul_mk_kn_mn_4x16xi32(%arg0: vector<4x16xi32>, %arg1: vector<16x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x16xi32>, vector<16x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_mk_kn_mn_8x16xi8_extui_i32(%arg0: vector<8x4xi8>, %arg1: vector<4x16xi8>, %arg2: vector<8x16xi32>) -> vector<8x16xi32> { %lhs = arith.extui %arg0: vector<8x4xi8> to vector<8x4xi32> %rhs = arith.extui %arg1: vector<4x16xi8> to vector<4x16xi32> %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %lhs, %rhs, %arg2 : vector<8x4xi32>, vector<4x16xi32> into vector<8x16xi32> return %res : vector<8x16xi32> } func.func @matmul_km_nk_mn_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d0)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_km_kn_mn_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d0)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_km_kn_mn_8x16xi8_mixed_ext_i32(%arg0: vector<4x8xi8>, %arg1: vector<4x16xi8>, %arg2: vector<8x16xi32>) -> vector<8x16xi32> { %lhs = arith.extsi %arg0 : vector<4x8xi8> to vector<4x8xi32> %rhs = arith.extui %arg1 : vector<4x16xi8> to vector<4x16xi32> %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d0)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %lhs, %rhs, %arg2 : vector<4x8xi32>, vector<4x16xi32> into vector<8x16xi32> return %res : vector<8x16xi32> } func.func @matmul_mk_nk_nm_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_km_kn_nm_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d0)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_mk_kn_nm_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> } func.func @matmul_km_nk_nm_4x4xi32(%arg0: vector<4x4xi32>, %arg1: vector<4x4xi32>, %arg2: vector<4x4xi32>) -> vector<4x4xi32> { %res = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d2, d0)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<4x4xi32>, vector<4x4xi32> into vector<4x4xi32> return %res : vector<4x4xi32> }", mlir-opt -test-vector-contraction-prepare-for-mmt-lowering ,1 "func.func @genbool_1d() -> vector<8xi1> { %0 = vector.constant_mask [4] : vector<8xi1> return %0 : vector<8xi1> } func.func @genbool_2d() -> vector<4x4xi1> { %v = vector.constant_mask [2, 2] : vector<4x4xi1> return %v: vector<4x4xi1> } func.func @genbool_3d() -> vector<2x3x4xi1> { %v = vector.constant_mask [1, 1, 3] : vector<2x3x4xi1> return %v: vector<2x3x4xi1> } func.func @genbool_var_1d(%arg0: index) -> vector<3xi1> { %0 = vector.create_mask %arg0 : vector<3xi1> return %0 : vector<3xi1> } func.func @genbool_var_2d(%arg0: index, %arg1: index) -> vector<2x3xi1> { %0 = vector.create_mask %arg0, %arg1 : vector<2x3xi1> return %0 : vector<2x3xi1> } func.func @genbool_var_3d(%arg0: index, %arg1: index, %arg2: index) -> vector<2x1x7xi1> { %0 = vector.create_mask %arg0, %arg1, %arg2 : vector<2x1x7xi1> return %0 : vector<2x1x7xi1> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op transform.vector.lower_masks %f : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_read_3d( %t: tensor, %arg0: index, %arg1: index, %arg2: index) -> vector<2x1x7xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.create_mask %arg0, %arg1, %arg2 : vector<2x1x7xi1> %1 = vector.mask %0 { vector.transfer_read %t[%c0, %c0, %c0], %f0 {in_bounds = [true, true, true]} : tensor, vector<2x1x7xf32> } : vector<2x1x7xi1> -> vector<2x1x7xf32> return %1: vector<2x1x7xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op transform.vector.lower_masked_transfers %f : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @vector_multi_reduction(%arg0: vector<2x4xf32>, %acc: vector<2xf32>) -> vector<2xf32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xf32> to vector<2xf32> return %0 : vector<2xf32> } func.func @vector_multi_reduction_min(%arg0: vector<2x4xf32>, %acc: vector<2xf32>) -> vector<2xf32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xf32> to vector<2xf32> return %0 : vector<2xf32> } func.func @vector_multi_reduction_max(%arg0: vector<2x4xf32>, %acc: vector<2xf32>) -> vector<2xf32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xf32> to vector<2xf32> return %0 : vector<2xf32> } func.func @vector_multi_reduction_and(%arg0: vector<2x4xi32>, %acc: vector<2xi32>) -> vector<2xi32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xi32> to vector<2xi32> return %0 : vector<2xi32> } func.func @vector_multi_reduction_or(%arg0: vector<2x4xi32>, %acc: vector<2xi32>) -> vector<2xi32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xi32> to vector<2xi32> return %0 : vector<2xi32> } func.func @vector_multi_reduction_xor(%arg0: vector<2x4xi32>, %acc: vector<2xi32>) -> vector<2xi32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xi32> to vector<2xi32> return %0 : vector<2xi32> } func.func @vector_reduction_outer(%arg0: vector<2x3x4x5xi32>, %acc: vector<2x3xi32>) -> vector<2x3xi32> { %0 = vector.multi_reduction , %arg0, %acc [2, 3] : vector<2x3x4x5xi32> to vector<2x3xi32> return %0 : vector<2x3xi32> } func.func @vector_multi_reduction_parallel_middle(%arg0: vector<3x4x5xf32>, %acc: vector<4xf32>) -> vector<4xf32> { %0 = vector.multi_reduction , %arg0, %acc [0, 2] : vector<3x4x5xf32> to vector<4xf32> return %0 : vector<4xf32> } func.func @vector_reduction_1D(%arg0 : vector<2xf32>, %acc: f32) -> f32 { %0 = vector.multi_reduction #vector.kind, %arg0, %acc [0] : vector<2xf32> to f32 return %0 : f32 } func.func @vector_multi_reduction_to_scalar(%arg0: vector<2x3xf32>, %acc: f32) -> f32 { %0 = vector.multi_reduction , %arg0, %acc [0, 1] : vector<2x3xf32> to f32 return %0 : f32 } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_multi_reduction %module_op lowering_strategy = ""innerparallel"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @matmul_tensors( %arg0: tensor<8x16xf32>, %arg1: tensor<16x32xf32>, %arg2: tensor<8x32xf32>) -> tensor<8x32xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<8x16xf32>, tensor<16x32xf32>) outs(%arg2: tensor<8x32xf32>) -> tensor<8x32xf32> return %0 : tensor<8x32xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %module_op : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [8, 4, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2 = get_closest_isolated_parent %1 : (!transform.any_op) -> !transform.any_op transform.structured.vectorize %2 : (!transform.any_op) -> !transform.any_op %b = transform.bufferization.one_shot_bufferize layout{IdentityLayoutMap} %module_op {bufferize_function_boundaries = true, allow_return_allocs = true} : (!transform.any_op) -> !transform.any_op %f = transform.structured.match ops{[""func.func""]} in %b : (!transform.any_op) -> !transform.any_op %func = transform.vector.lower_contraction %f lowering_strategy = ""outerproduct"" : (!transform.any_op) -> !transform.any_op %func_2 = transform.vector.apply_transfer_permutation_patterns %func : (!transform.any_op) -> !transform.any_op %func_3 = transform.vector.lower_multi_reduction %func_2 lowering_strategy = ""innerparallel"" : (!transform.any_op) -> !transform.any_op %func_4 = transform.vector.split_transfer_full_partial %func_3 split_transfer_strategy = ""linalg-copy"" : (!transform.any_op) -> !transform.any_op %func_5 = transform.vector.transfer_to_scf %func_4 max_transfer_rank = 1 full_unroll = true : (!transform.any_op) -> !transform.any_op %func_6 = transform.vector.lower_transfer %func_5 max_transfer_rank = 1 : (!transform.any_op) -> !transform.any_op %func_7 = transform.vector.lower_shape_cast %func_6 : (!transform.any_op) -> !transform.any_op %func_8 = transform.vector.lower_transpose %func_7 lowering_strategy = ""shuffle_1d"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @parallel_contract_lowering(%arg0: vector<1x1x4xf32>, %arg1: vector<1x1x4xf32>, %arg2: vector<4xf32>) -> vector<4xf32> { %0 = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d2, d0)>, affine_map<(d0, d1, d2) -> (d1, d2, d0)>, affine_map<(d0, d1, d2) -> (d0)>], iterator_types = [""parallel"", ""reduction"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<1x1x4xf32>, vector<1x1x4xf32> into vector<4xf32> return %0 : vector<4xf32> } func.func @parallel_contract_lowering_broadcast(%arg0: vector<1x1xf32>, %arg1: vector<1x1x4xf32>, %arg2: vector<4xf32>) -> vector<4xf32> { %0 = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d2, d0)>, affine_map<(d0, d1, d2) -> (d0)>], iterator_types = [""parallel"", ""reduction"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<1x1xf32>, vector<1x1x4xf32> into vector<4xf32> return %0 : vector<4xf32> } func.func @parallel_contract_lowering_transpose(%arg0: vector<1x1xf32>, %arg1: vector<1x4x1xf32>, %arg2: vector<4xf32>) -> vector<4xf32> { %0 = vector.contract {indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d0, d2)>, affine_map<(d0, d1, d2) -> (d0)>], iterator_types = [""parallel"", ""reduction"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<1x1xf32>, vector<1x4x1xf32> into vector<4xf32> return %0 : vector<4xf32> } func.func @parallel_contract_lowering_scalar(%arg0: vector<1x1xf32>, %arg1: vector<1x1xf32>, %arg2: f32) -> f32 { %0 = vector.contract { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>], iterator_types = [""reduction"", ""reduction""], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<1x1xf32>, vector<1x1xf32> into f32 return %0 : f32 } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op %f2 = transform.vector.lower_contraction %f lowering_strategy = ""parallelarith"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @contiguous_inner_most_view(%in: memref<1x1x8x1xf32, strided<[3072, 8, 1, 1], offset: ?>>) -> vector<1x8x1xf32>{ %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %in[%c0, %c0, %c0, %c0], %cst {in_bounds = [true, true, true]} : memref<1x1x8x1xf32, strided<[3072, 8, 1, 1], offset: ?>>, vector<1x8x1xf32> return %0 : vector<1x8x1xf32> }", mlir-opt -test-vector-transfer-collapse-inner-most-dims -split-input-file ,1 "func.func @contiguous_inner_most_dim(%A: memref<16x1xf32>, %i:index, %j:index) -> (vector<8x1xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %1 = vector.transfer_read %A[%i, %j], %f0 : memref<16x1xf32>, vector<8x1xf32> return %1 : vector<8x1xf32> }", mlir-opt -test-vector-transfer-collapse-inner-most-dims -split-input-file ,1 "func.func @contiguous_inner_most_dim_bounds(%A: memref<1000x1xf32>, %i:index, %ii:index) -> (vector<4x1xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = memref.subview %A[%i, 0] [40, 1] [1, 1] : memref<1000x1xf32> to memref<40x1xf32, strided<[1, 1], offset: ?>> %1 = vector.transfer_read %0[%ii, %c0], %cst {in_bounds = [true, true]} : memref<40x1xf32, strided<[1, 1], offset: ?>>, vector<4x1xf32> return %1 : vector<4x1xf32> }", mlir-opt -test-vector-transfer-collapse-inner-most-dims -split-input-file ,1 "func.func @contiguous_inner_most_dim_bounds_2d(%A: memref<1000x1x1xf32>, %i:index, %ii:index) -> (vector<4x1x1xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = memref.subview %A[%i, 0, 0] [40, 1, 1] [1, 1, 1] : memref<1000x1x1xf32> to memref<40x1x1xf32, strided<[1, 1, 1], offset: ?>> %1 = vector.transfer_read %0[%ii, %c0, %c0], %cst {in_bounds = [true, true, true]} : memref<40x1x1xf32, strided<[1, 1, 1], offset: ?>>, vector<4x1x1xf32> return %1 : vector<4x1x1xf32> }", mlir-opt -test-vector-transfer-collapse-inner-most-dims -split-input-file ,1 "func.func @multidimreduction_contract( %arg0: vector<8x32x16xf32>,%arg1: vector<8x32x16xf32>, %acc: vector<8x16xf32>) -> vector<8x16xf32> { %0 = arith.mulf %arg0, %arg1 : vector<8x32x16xf32> %1 = vector.multi_reduction , %0, %acc [1] : vector<8x32x16xf32> to vector<8x16xf32> return %1 : vector<8x16xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @multidimreduction_contract_int( %arg0: vector<8x32x16xi32>,%arg1: vector<8x32x16xi32>, %acc: vector<8x16xi32>) -> vector<8x16xi32> { %0 = arith.muli %arg0, %arg1 : vector<8x32x16xi32> %1 = vector.multi_reduction , %0, %acc [1] : vector<8x32x16xi32> to vector<8x16xi32> return %1 : vector<8x16xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @contract_transpose( %arg0: vector<32x16x8xf32>, %arg1: vector<8x32x16xf32>) -> vector<8x32xf32> { %cst = arith.constant dense<0.000000e+00> : vector<8x32xf32> %0 = vector.transpose %arg0, [2, 0, 1] : vector<32x16x8xf32> to vector<8x32x16xf32> %1 = vector.contract {indexing_maps = [#map0, #map0, #map1], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %0, %arg1, %cst : vector<8x32x16xf32>, vector<8x32x16xf32> into vector<8x32xf32> return %1 : vector<8x32xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @contract_broadcast( %arg0: vector<32x16xf32>, %arg1: vector<8x32x16xf32>) -> vector<8x32xf32> { %cst = arith.constant dense<0.000000e+00> : vector<8x32xf32> %0 = vector.broadcast %arg0 : vector<32x16xf32> to vector<8x32x16xf32> %1 = vector.contract {indexing_maps = [#map0, #map0, #map1], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %0, %arg1, %cst : vector<8x32x16xf32>, vector<8x32x16xf32> into vector<8x32xf32> return %1 : vector<8x32xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d3)> #map2 = affine_map<(d0, d1, d2, d3) -> (d1, d2)> func.func @contract_broadcast_unit_dim_reduction(%arg0 : vector<8x4xi32>, %arg1 : vector<8x4xi32>, %arg2 : vector<8x8xi32>) -> vector<8x8xi32> { %0 = vector.broadcast %arg0 : vector<8x4xi32> to vector<1x8x4xi32> %1 = vector.broadcast %arg1 : vector<8x4xi32> to vector<1x8x4xi32> %result = vector.contract { indexing_maps = [#map0, #map1, #map2], iterator_types = [""reduction"", ""parallel"", ""parallel"", ""reduction""], kind = #vector.kind } %0, %1, %arg2 : vector<1x8x4xi32>, vector<1x8x4xi32> into vector<8x8xi32> return %result : vector<8x8xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d1, d0, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d1, d2, d3)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d2)> func.func @contract_broadcast_non_unit_dim_reduction_with_permutation(%arg0 : vector<8x4xi32>, %arg1 : vector<8x4xi32>, %arg2 : vector<8x8xi32>) -> vector<8x8xi32> { %0 = vector.broadcast %arg0 : vector<8x4xi32> to vector<2x8x4xi32> %1 = vector.broadcast %arg1 : vector<8x4xi32> to vector<2x8x4xi32> %result = vector.contract { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""reduction"", ""parallel"", ""reduction""], kind = #vector.kind } %0, %1, %arg2 : vector<2x8x4xi32>, vector<2x8x4xi32> into vector<8x8xi32> return %result : vector<8x8xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> func.func @contract_broadcast_unit_dim_reduction_as_only_reduction(%arg0 : vector<8xi32>, %arg1 : vector<8xi32>, %arg2 : vector<8x8xi32>) -> vector<8x8xi32> { %0 = vector.broadcast %arg0 : vector<8xi32> to vector<1x8xi32> %1 = vector.broadcast %arg1 : vector<8xi32> to vector<1x8xi32> %result = vector.contract { indexing_maps = [#map0, #map1, #map2], iterator_types = [""reduction"", ""parallel"", ""parallel""], kind = #vector.kind } %0, %1, %arg2 : vector<1x8xi32>, vector<1x8xi32> into vector<8x8xi32> return %result : vector<8x8xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1)> func.func @contract_broadcast_dimension_would_go_unused_in_lhs_rhs(%arg0 : vector<1x2xi32>, %arg1 : vector<2xi32>, %arg2 : vector<1xi32>) -> vector<1xi32> { %1 = vector.broadcast %arg1 : vector<2xi32> to vector<1x1x2xi32> %result = vector.contract { indexing_maps = [#map0, #map1, #map2], iterator_types = [""reduction"", ""parallel"", ""reduction""], kind = #vector.kind } %arg0, %1, %arg2 : vector<1x2xi32>, vector<1x1x2xi32> into vector<1xi32> return %result : vector<1xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> #map2 = affine_map<(d0, d1) -> (d0)> func.func @contract_broadcast_would_have_no_reduction_dim_pair(%arg0 : vector<1xf32>, %arg1 : vector<1xf32>, %arg2 : vector<1xf32>) -> vector<1xf32> { %1 = vector.broadcast %arg1 : vector<1xf32> to vector<1x1xf32> %result = vector.contract { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""reduction""], kind = #vector.kind } %arg0, %1, %arg2 : vector<1xf32>, vector<1x1xf32> into vector<1xf32> return %result : vector<1xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @broadcast_vector_extsi(%a : vector<4xi8>) -> vector<2x4xi32> { %b = vector.broadcast %a : vector<4xi8> to vector<2x4xi8> %r = arith.extsi %b : vector<2x4xi8> to vector<2x4xi32> return %r : vector<2x4xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @broadcast_scalar_extsi(%a : i8) -> vector<2x4xi32> { %b = vector.broadcast %a : i8 to vector<2x4xi8> %r = arith.extsi %b : vector<2x4xi8> to vector<2x4xi32> return %r : vector<2x4xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @transpose_extsi(%a : vector<4x2xi8>) -> vector<2x4xi32> { %b = vector.transpose %a, [1, 0]: vector<4x2xi8> to vector<2x4xi8> %r = arith.extsi %b : vector<2x4xi8> to vector<2x4xi32> return %r : vector<2x4xi32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @transpose_elementwise_same_type(%a : vector<4x2xf32>, %b : vector<4x2xf32>) -> vector<2x4xf32> { %at = vector.transpose %a, [1, 0]: vector<4x2xf32> to vector<2x4xf32> %bt = vector.transpose %b, [1, 0]: vector<4x2xf32> to vector<2x4xf32> %r = arith.addf %at, %bt : vector<2x4xf32> return %r : vector<2x4xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @transpose_elementwise_diff_operand_types(%cond: vector<4x2xi1>, %a : vector<4x2xf32>, %b : vector<4x2xf32>) -> vector<2x4xf32> { %condt = vector.transpose %cond, [1, 0]: vector<4x2xi1> to vector<2x4xi1> %at = vector.transpose %a, [1, 0]: vector<4x2xf32> to vector<2x4xf32> %bt = vector.transpose %b, [1, 0]: vector<4x2xf32> to vector<2x4xf32> %r = arith.select %condt, %at, %bt : vector<2x4xi1>, vector<2x4xf32> return %r : vector<2x4xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @transpose_elementwise_diff_operand_result_type(%a : vector<4x2xf32>, %b : vector<4x2xf32>) -> vector<2x4xi1> { %at = vector.transpose %a, [1, 0]: vector<4x2xf32> to vector<2x4xf32> %bt = vector.transpose %b, [1, 0]: vector<4x2xf32> to vector<2x4xf32> %r = arith.cmpf olt, %at, %bt : vector<2x4xf32> return %r : vector<2x4xi1> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @transpose_elementwise_splat_constant(%a : vector<4x6x3x2xf32>) -> vector<6x4x2x3xf32> { %b = arith.constant dense<5.0> : vector<6x4x2x3xf32> %at = vector.transpose %a, [1, 0, 3, 2]: vector<4x6x3x2xf32> to vector<6x4x2x3xf32> %r = arith.addf %at, %b : vector<6x4x2x3xf32> return %r : vector<6x4x2x3xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @transpose_elementwise_diff_map(%a : vector<4x6x3x2xf32>, %b: vector<6x2x4x3xf32>) -> vector<6x4x2x3xf32> { %at = vector.transpose %a, [1, 0, 3, 2]: vector<4x6x3x2xf32> to vector<6x4x2x3xf32> %bt = vector.transpose %b, [0, 2, 1, 3]: vector<6x2x4x3xf32> to vector<6x4x2x3xf32> %r = arith.addf %at, %bt : vector<6x4x2x3xf32> return %r : vector<6x4x2x3xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @contract_result_transpose(%lhs : vector<2x4x4xf32>, %rhs: vector<4x8xf32>, %acc: vector<2x8x4xf32>) -> vector<2x8x4xf32> { %accT = vector.transpose %acc, [0, 2, 1] : vector<2x8x4xf32> to vector<2x4x8xf32> %contract = vector.contract { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d0, d3, d1)>, affine_map<(d0, d1, d2, d3) -> (d3, d2)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2)> ], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""], kind = #vector.kind } %lhs, %rhs, %accT : vector<2x4x4xf32>, vector<4x8xf32> into vector<2x4x8xf32> %resT = vector.transpose %contract, [0, 2, 1] : vector<2x4x8xf32> to vector<2x8x4xf32> return %resT : vector<2x8x4xf32> }", mlir-opt -test-vector-reduction-to-contract-patterns -split-input-file ,1 "func.func @create_vector_mask_to_constant_mask() -> (vector<4x3xi1>) { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %0 = vector.create_mask %c3, %c2 : vector<4x3xi1> return %0 : vector<4x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @create_scalable_vector_mask_to_constant_mask() -> (vector<[8]xi1>) { %c-1 = arith.constant -1 : index %0 = vector.create_mask %c-1 : vector<[8]xi1> return %0 : vector<[8]xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @create_vector_mask_to_constant_mask_truncation() -> (vector<4x3xi1>) { %c2 = arith.constant 2 : index %c5 = arith.constant 5 : index %0 = vector.create_mask %c5, %c2 : vector<4x3xi1> return %0 : vector<4x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @create_vector_mask_to_constant_mask_truncation_neg() -> (vector<4x3xi1>) { %cneg2 = arith.constant -2 : index %c5 = arith.constant 5 : index %0 = vector.create_mask %c5, %cneg2 : vector<4x3xi1> return %0 : vector<4x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @create_vector_mask_to_constant_mask_truncation_zero() -> (vector<4x3xi1>) { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %0 = vector.create_mask %c0, %c2 : vector<4x3xi1> return %0 : vector<4x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @create_mask_transpose_to_transposed_create_mask( %dim0: index, %dim1: index, %dim2: index) -> (vector<2x3x4xi1>, vector<4x2x3xi1>) { %0 = vector.create_mask %dim0, %dim1, %dim2 : vector<2x3x4xi1> %1 = vector.transpose %0, [2, 0, 1] : vector<2x3x4xi1> to vector<4x2x3xi1> return %0, %1 : vector<2x3x4xi1>, vector<4x2x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @constant_mask_transpose_to_transposed_constant_mask() -> (vector<2x3x4xi1>, vector<4x2x3xi1>) { %0 = vector.constant_mask [1, 2, 3] : vector<2x3x4xi1> %1 = vector.transpose %0, [2, 0, 1] : vector<2x3x4xi1> to vector<4x2x3xi1> return %0, %1 : vector<2x3x4xi1>, vector<4x2x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x3xi1> to vector<2x2xi1> return %1 : vector<2x2xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [1, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x3xi1> to vector<2x2xi1> return %1 : vector<2x2xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [0, 1], sizes = [2, 2], strides = [1, 1]} : vector<4x3xi1> to vector<2x2xi1> return %1 : vector<2x2xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x2xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [2, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x3xi1> to vector<2x2xi1> return %1 : vector<2x2xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [0, 2], sizes = [2, 1], strides = [1, 1]} : vector<4x3xi1> to vector<2x1xi1> return %1 : vector<2x1xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [0, 1], sizes = [2, 1], strides = [1, 1]} : vector<4x3xi1> to vector<2x1xi1> return %1 : vector<2x1xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> (vector<2x1xi1>) { %0 = vector.constant_mask [2, 2] : vector<4x3xi1> %1 = vector.extract_strided_slice %0 {offsets = [1, 1], sizes = [2, 1], strides = [1, 1]} : vector<4x3xi1> to vector<2x1xi1> return %1 : vector<2x1xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_fold(%arg : vector<4x3xi1>) -> (vector<4x3xi1>) { %0 = vector.extract_strided_slice %arg {offsets = [0, 0], sizes = [4, 3], strides = [1, 1]} : vector<4x3xi1> to vector<4x3xi1> return %0 : vector<4x3xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_fold_insert(%a: vector<4x4xf32>, %b: vector<8x16xf32>) -> (vector<4x4xf32>) { %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]} : vector<4x4xf32> into vector<8x16xf32> %1 = vector.extract_strided_slice %0 {offsets = [2, 2], sizes = [4, 4], strides = [1, 1]} : vector<8x16xf32> to vector<4x4xf32> return %1 : vector<4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_fold_insert(%a: vector<6x4xf32>, %b: vector<8x16xf32>) -> (vector<4x4xf32>) { %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]} : vector<6x4xf32> into vector<8x16xf32> %1 = vector.extract_strided_slice %0 {offsets = [2, 2], sizes = [4, 4], strides = [1, 1]} : vector<8x16xf32> to vector<4x4xf32> return %1 : vector<4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_fold_negative(%a: vector<4x4xf32>, %b: vector<8x16xf32>) -> (vector<6x4xf32>) { %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]} : vector<4x4xf32> into vector<8x16xf32> %1 = vector.extract_strided_slice %0 {offsets = [2, 2], sizes = [6, 4], strides = [1, 1]} : vector<8x16xf32> to vector<6x4xf32> return %1 : vector<6x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_fold_insert(%a: vector<2x8xf32>, %b: vector<1x4xf32>, %c : vector<1x4xf32>) -> (vector<1x1xf32>) { %0 = vector.insert_strided_slice %b, %a {offsets = [0, 1], strides = [1, 1]} : vector<1x4xf32> into vector<2x8xf32> %1 = vector.insert_strided_slice %c, %0 {offsets = [1, 0], strides = [1, 1]} : vector<1x4xf32> into vector<2x8xf32> %2 = vector.extract_strided_slice %1 {offsets = [0, 1], sizes = [1, 1], strides = [1, 1]} : vector<2x8xf32> to vector<1x1xf32> return %2 : vector<1x1xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_1D_identity(%arg : vector<4xf32>) -> vector<4xf32> { %0 = vector.transpose %arg, [0] : vector<4xf32> to vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_2D_identity(%arg : vector<4x3xf32>) -> vector<4x3xf32> { %0 = vector.transpose %arg, [0, 1] : vector<4x3xf32> to vector<4x3xf32> return %0 : vector<4x3xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_3D_identity(%arg : vector<4x3x2xf32>) -> vector<4x3x2xf32> { %0 = vector.transpose %arg, [0, 1, 2] : vector<4x3x2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_2D_sequence(%arg : vector<4x3xf32>) -> vector<4x3xf32> { %0 = vector.transpose %arg, [1, 0] : vector<4x3xf32> to vector<3x4xf32> %1 = vector.transpose %0, [0, 1] : vector<3x4xf32> to vector<3x4xf32> %2 = vector.transpose %1, [1, 0] : vector<3x4xf32> to vector<4x3xf32> %3 = vector.transpose %2, [0, 1] : vector<4x3xf32> to vector<4x3xf32> %4 = arith.addf %2, %3 : vector<4x3xf32> return %4 : vector<4x3xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_3D_sequence(%arg : vector<4x3x2xf32>) -> vector<4x3x2xf32> { %0 = vector.transpose %arg, [1, 2, 0] : vector<4x3x2xf32> to vector<3x2x4xf32> %1 = vector.transpose %0, [1, 0, 2] : vector<3x2x4xf32> to vector<2x3x4xf32> %2 = vector.transpose %1, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32> %3 = vector.transpose %2, [2, 1, 0] : vector<4x3x2xf32> to vector<2x3x4xf32> %4 = arith.mulf %1, %3 : vector<2x3x4xf32> %5 = vector.transpose %4, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32> %6 = vector.transpose %3, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32> %7 = arith.addf %5, %6 : vector<4x3x2xf32> return %7 : vector<4x3x2xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @cast_transfers(%A: memref<4x8xf32>) -> (vector<4x8xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = memref.cast %A : memref<4x8xf32> to memref %1 = vector.transfer_read %0[%c0, %c0], %f0 : memref, vector<4x8xf32> vector.transfer_write %1, %0[%c0, %c0] : vector<4x8xf32>, memref return %1 : vector<4x8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @cast_transfers(%A: tensor<4x8xf32>) -> (vector<4x8xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = tensor.cast %A : tensor<4x8xf32> to tensor %1 = vector.transfer_read %0[%c0, %c0], %f0 : tensor, vector<4x8xf32> return %1 : vector<4x8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_extract_transpose_2d( %v: vector<2x3xf32>, %f0: f32, %f1: f32, %f2: f32, %f3: f32) -> (f32, f32, f32) { %0 = vector.insert %f0, %v[0, 0] : f32 into vector<2x3xf32> %1 = vector.insert %f1, %0[0, 1] : f32 into vector<2x3xf32> %2 = vector.insert %f2, %1[1, 0] : f32 into vector<2x3xf32> %3 = vector.insert %f3, %2[1, 1] : f32 into vector<2x3xf32> %4 = vector.transpose %3, [1, 0] : vector<2x3xf32> to vector<3x2xf32> %5 = vector.insert %f3, %4[1, 0] : f32 into vector<3x2xf32> %6 = vector.transpose %5, [1, 0] : vector<3x2xf32> to vector<2x3xf32> %r1 = vector.extract %3[1, 0] : vector<2x3xf32> %r2 = vector.extract %4[1, 0] : vector<3x2xf32> %r3 = vector.extract %6[1, 0] : vector<2x3xf32> return %r1, %r2, %r3 : f32, f32, f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_extract_chain(%v234: vector<2x3x4xf32>, %v34: vector<3x4xf32>, %v4: vector<4xf32>) -> (vector<4xf32>, vector<4xf32>, vector<3x4xf32>, vector<3x4xf32>) { %A34 = vector.insert %v34, %v234[0]: vector<3x4xf32> into vector<2x3x4xf32> %B34 = vector.insert %v34, %A34[1]: vector<3x4xf32> into vector<2x3x4xf32> %A4 = vector.insert %v4, %B34[1, 0]: vector<4xf32> into vector<2x3x4xf32> %B4 = vector.insert %v4, %A4[1, 1]: vector<4xf32> into vector<2x3x4xf32> %r0 = vector.extract %B4[1, 1]: vector<2x3x4xf32> %r1 = vector.extract %B34[1, 0]: vector<2x3x4xf32> %r2 = vector.extract %B4[1]: vector<2x3x4xf32> %r3 = vector.extract %B4[0]: vector<2x3x4xf32> return %r0, %r1, %r2, %r3: vector<4xf32>, vector<4xf32>, vector<3x4xf32>, vector<3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_extract_transpose_3d( %v234: vector<2x3x4xf32>, %v43: vector<4x3xf32>, %f0: f32) -> (vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<3x4xf32>) { %a432 = vector.transpose %v234, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32> %b432 = vector.insert %f0, %a432[0, 0, 1] : f32 into vector<4x3x2xf32> %c234 = vector.transpose %b432, [2, 1, 0] : vector<4x3x2xf32> to vector<2x3x4xf32> %r0 = vector.extract %c234[1, 2] : vector<2x3x4xf32> %d432 = vector.transpose %v234, [2, 1, 0] : vector<2x3x4xf32> to vector<4x3x2xf32> %e432 = vector.insert %f0, %d432[0, 2, 1] : f32 into vector<4x3x2xf32> %f234 = vector.transpose %e432, [2, 1, 0] : vector<4x3x2xf32> to vector<2x3x4xf32> %r1 = vector.extract %f234[1, 2] : vector<2x3x4xf32> %g243 = vector.transpose %v234, [0, 2, 1] : vector<2x3x4xf32> to vector<2x4x3xf32> %h243 = vector.insert %v43, %g243[0] : vector<4x3xf32> into vector<2x4x3xf32> %i234 = vector.transpose %h243, [0, 2, 1] : vector<2x4x3xf32> to vector<2x3x4xf32> %r2 = vector.extract %i234[0, 1] : vector<2x3x4xf32> %j243 = vector.transpose %v234, [0, 2, 1] : vector<2x3x4xf32> to vector<2x4x3xf32> %k243 = vector.insert %v43, %j243[0] : vector<4x3xf32> into vector<2x4x3xf32> %l234 = vector.transpose %k243, [0, 2, 1] : vector<2x4x3xf32> to vector<2x3x4xf32> %r3 = vector.extract %l234[0] : vector<2x3x4xf32> return %r0, %r1, %r2, %r3: vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extracts(%a : vector<3x4x5x6xf32>) -> (f32, vector<4x5x6xf32>) { %b = vector.extract %a[0] : vector<3x4x5x6xf32> %c = vector.extract %b[1, 2] : vector<4x5x6xf32> %d = vector.extract %c[3] : vector<6xf32> %e = vector.extract %a[0] : vector<3x4x5x6xf32> return %d, %e : f32, vector<4x5x6xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_transpose( %a : vector<3x4x5x6xf32>, %b : vector<3x6x5x6xf32>) -> ( vector<6xf32>, vector<6xf32>, vector<6xf32>) { %0 = vector.transpose %a, [0, 2, 1, 3] : vector<3x4x5x6xf32> to vector<3x5x4x6xf32> %1 = vector.extract %0[0, 1, 2] : vector<3x5x4x6xf32> %2 = vector.transpose %a, [1, 2, 0, 3] : vector<3x4x5x6xf32> to vector<4x5x3x6xf32> %3 = vector.extract %2[0, 1, 2] : vector<4x5x3x6xf32> %4 = vector.transpose %b, [0, 2, 3, 1] : vector<3x6x5x6xf32> to vector<3x5x6x6xf32> %5 = vector.extract %4[0, 1, 2] : vector<3x5x6x6xf32> return %1, %3, %5 : vector<6xf32>, vector<6xf32>, vector<6xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast(%a : f32) -> f32 { %b = vector.broadcast %a : f32 to vector<1x2x4xf32> %r = vector.extract %b[0, 1, 2] : vector<1x2x4xf32> return %r : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast_0dvec(%a : vector) -> f32 { %b = vector.broadcast %a : vector to vector<1x2x4xf32> %r = vector.extract %b[0, 1, 2] : vector<1x2x4xf32> return %r : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast_negative(%a : vector<1x1xf32>) -> vector<4xf32> { %b = vector.broadcast %a : vector<1x1xf32> to vector<1x1x4xf32> %r = vector.extract %b[0, 0] : vector<1x1x4xf32> return %r : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_splat(%a : f32) -> f32 { %b = vector.splat %a : vector<1x2x4xf32> %r = vector.extract %b[0, 1, 2] : vector<1x2x4xf32> return %r : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast_vector(%a : vector<4xf32>) -> vector<4xf32> { %b = vector.broadcast %a : vector<4xf32> to vector<1x2x4xf32> %r = vector.extract %b[0, 1] : vector<1x2x4xf32> return %r : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast(%a : vector<4xf32>) -> f32 { %b = vector.broadcast %a : vector<4xf32> to vector<1x2x4xf32> %r = vector.extract %b[0, 1, 2] : vector<1x2x4xf32> return %r : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast(%a : f32) -> vector<4xf32> { %b = vector.broadcast %a : f32 to vector<1x2x4xf32> %r = vector.extract %b[0, 1] : vector<1x2x4xf32> return %r : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_broadcast(%a : vector<1xf32>) -> vector<8xf32> { %b = vector.broadcast %a : vector<1xf32> to vector<1x8xf32> %r = vector.extract %b[0] : vector<1x8xf32> return %r : vector<8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_shapecast(%arg0 : vector<5x1x3x2xf32>, %arg1 : vector<8x4x2xf32>) -> (f32, vector<2xf32>, vector<4x2xf32>, vector<8x4x2xf32>) { %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<15x2xf32> %1 = vector.shape_cast %arg1 : vector<8x4x2xf32> to vector<4x2x4x2xf32> %2 = vector.shape_cast %arg1 : vector<8x4x2xf32> to vector<1x8x4x2xf32> %r1 = vector.extract %0[4, 1] : vector<15x2xf32> %r2 = vector.extract %0[5] : vector<15x2xf32> %r3 = vector.extract %1[3, 1] : vector<4x2x4x2xf32> %r4 = vector.extract %2[0] : vector<1x8x4x2xf32> return %r1, %r2, %r3, %r4 : f32, vector<2xf32>, vector<4x2xf32>, vector<8x4x2xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extract_shapecast_negative(%arg0 : vector<16xf32>) -> vector<4x2xf32> { %0 = vector.shape_cast %arg0 : vector<16xf32> to vector<2x4x2xf32> %r = vector.extract %0[1] : vector<2x4x2xf32> return %r : vector<4x2xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dont_fold_0d_extract_shapecast(%arg0 : vector) -> f32 { %0 = vector.shape_cast %arg0 : vector to vector<1xf32> %r = vector.extract %0[0] : vector<1xf32> return %r : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dont_fold_expand_collapse(%arg0: vector<1x1x64xf32>) -> vector<8x8xf32> { %0 = vector.shape_cast %arg0 : vector<1x1x64xf32> to vector<1x1x8x8xf32> %1 = vector.shape_cast %0 : vector<1x1x8x8xf32> to vector<8x8xf32> return %1 : vector<8x8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_broadcast_shapecast(%arg0: vector<4xf32>) -> vector<4xf32> { %0 = vector.broadcast %arg0 : vector<4xf32> to vector<1x1x4xf32> %1 = vector.shape_cast %0 : vector<1x1x4xf32> to vector<4xf32> return %1 : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @canonicalize_broadcast_shapecast_scalar(%arg0: f32) -> vector<1xf32> { %0 = vector.broadcast %arg0 : f32 to vector<1x1x1xf32> %1 = vector.shape_cast %0 : vector<1x1x1xf32> to vector<1xf32> return %1 : vector<1xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dont_fold_broadcast_shapecast_diff_shape(%arg0: vector<4xf32>) -> vector<8xf32> { %0 = vector.broadcast %arg0 : vector<4xf32> to vector<1x2x4xf32> %1 = vector.shape_cast %0 : vector<1x2x4xf32> to vector<8xf32> return %1 : vector<8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @canonicalize_broadcast_shapecast(%arg0: vector<3xf32>) -> vector<8x3xf32> { %0 = vector.broadcast %arg0 : vector<3xf32> to vector<2x4x3xf32> %1 = vector.shape_cast %0 : vector<2x4x3xf32> to vector<8x3xf32> return %1 : vector<8x3xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_vector_transfers(%A: memref) -> (vector<4x8xf32>, vector<4x9xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %1 = vector.transfer_read %A[%c0, %c0], %f0 : memref, vector<4x8xf32> vector.transfer_write %1, %A[%c0, %c0] : vector<4x8xf32>, memref %2 = vector.transfer_read %A[%c0, %c0], %f0 : memref, vector<4x9xf32> vector.transfer_write %2, %A[%c0, %c0] : vector<4x9xf32>, memref return %1, %2 : vector<4x8xf32>, vector<4x9xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @bitcast_folding(%I1: vector<4x8xf32>, %I2: vector<2xi32>) -> (vector<4x8xf32>, vector<2xi32>) { %0 = vector.bitcast %I1 : vector<4x8xf32> to vector<4x8xf32> %1 = vector.bitcast %I2 : vector<2xi32> to vector<4xi16> %2 = vector.bitcast %1 : vector<4xi16> to vector<2xi32> return %0, %2 : vector<4x8xf32>, vector<2xi32> } func.func @bitcast_f16_to_f32() -> (vector<4xf32>, vector<4xf32>) { %cst0 = arith.constant dense<0.0> : vector<8xf16> %cst1 = arith.constant dense<2.0> : vector<8xf16> %cast0 = vector.bitcast %cst0: vector<8xf16> to vector<4xf32> %cast1 = vector.bitcast %cst1: vector<8xf16> to vector<4xf32> return %cast0, %cast1: vector<4xf32>, vector<4xf32> } func.func @bitcast_i8_to_i32() -> (vector<4xi32>, vector<4xi32>) { %cst0 = arith.constant dense<0> : vector<16xi8> %cst1 = arith.constant dense<160> : vector<16xi8> %cast0 = vector.bitcast %cst0: vector<16xi8> to vector<4xi32> %cast1 = vector.bitcast %cst1: vector<16xi8> to vector<4xi32> return %cast0, %cast1: vector<4xi32>, vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @broadcast_folding1() -> vector<4xi32> { %0 = arith.constant 42 : i32 %1 = vector.broadcast %0 : i32 to vector<4xi32> return %1 : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @broadcast_folding2() -> vector<4x16xi32> { %0 = arith.constant 42 : i32 %1 = vector.broadcast %0 : i32 to vector<16xi32> %2 = vector.broadcast %1 : vector<16xi32> to vector<4x16xi32> return %2 : vector<4x16xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_consecutive_broadcasts(%a : i32) -> vector<4x16xi32> { %1 = vector.broadcast %a : i32 to vector<16xi32> %2 = vector.broadcast %1 : vector<16xi32> to vector<4x16xi32> return %2 : vector<4x16xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @shape_cast_constant() -> (vector<20x2xf32>, vector<3x4x2xi32>) { %cst = arith.constant dense<2.000000e+00> : vector<5x4x2xf32> %cst_1 = arith.constant dense<1> : vector<12x2xi32> %0 = vector.shape_cast %cst : vector<5x4x2xf32> to vector<20x2xf32> %1 = vector.shape_cast %cst_1 : vector<12x2xi32> to vector<3x4x2xi32> return %0, %1 : vector<20x2xf32>, vector<3x4x2xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_constant() -> (vector<12x2xf32>, vector<2x13x3xi32>) { %cst = arith.constant dense<2.000000e+00> : vector<29x7xf32> %cst_1 = arith.constant dense<1> : vector<4x37x9xi32> %0 = vector.extract_strided_slice %cst {offsets = [2, 3], sizes = [12, 2], strides = [1, 1]} : vector<29x7xf32> to vector<12x2xf32> %1 = vector.extract_strided_slice %cst_1 {offsets = [1, 2, 5], sizes = [2, 13, 3], strides = [1, 1, 1]} : vector<4x37x9xi32> to vector<2x13x3xi32> return %0, %1 : vector<12x2xf32>, vector<2x13x3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_broadcast(%arg0: vector<4xf16>) -> vector<2x4xf16> { %0 = vector.broadcast %arg0 : vector<4xf16> to vector<16x4xf16> %1 = vector.extract_strided_slice %0 {offsets = [0, 0], sizes = [2, 4], strides = [1, 1]} : vector<16x4xf16> to vector<2x4xf16> return %1 : vector<2x4xf16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_broadcast2(%arg0: vector<4xf16>) -> vector<2x2xf16> { %0 = vector.broadcast %arg0 : vector<4xf16> to vector<16x4xf16> %1 = vector.extract_strided_slice %0 {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<16x4xf16> to vector<2x2xf16> return %1 : vector<2x2xf16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_broadcast3(%arg0: vector<1xf32>) -> vector<1x4xf32> { %0 = vector.broadcast %arg0 : vector<1xf32> to vector<1x8xf32> %1 = vector.extract_strided_slice %0 {offsets = [0, 4], sizes = [1, 4], strides = [1, 1]} : vector<1x8xf32> to vector<1x4xf32> return %1 : vector<1x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_broadcast4(%arg0: f32) -> vector<1x4xf32> { %0 = vector.broadcast %arg0 : f32 to vector<1x8xf32> %1 = vector.extract_strided_slice %0 {offsets = [0, 4], sizes = [1, 4], strides = [1, 1]} : vector<1x8xf32> to vector<1x4xf32> return %1 : vector<1x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @consecutive_shape_cast(%arg0: vector<16xf16>) -> vector<4x4xf16> { %0 = vector.shape_cast %arg0 : vector<16xf16> to vector<2x8xf16> %1 = vector.shape_cast %0 : vector<2x8xf16> to vector<4x4xf16> return %1 : vector<4x4xf16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dead_transfer_op(%arg0 : tensor<4x4xf32>, %arg1 : memref<4x4xf32>, %v0 : vector<1x4xf32>) { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %r = vector.transfer_read %arg1[%c0, %c0], %cf0 : memref<4x4xf32>, vector<1x4xf32> %w = vector.transfer_write %v0, %arg0[%c0, %c0] : vector<1x4xf32>, tensor<4x4xf32> return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dead_load(%base: memref, %indices: vector<16xi32>, %mask: vector<16xi1>, %passthru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.maskedload %base[%c0], %mask, %passthru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> %1 = vector.gather %base[%c0][%indices], %mask, %passthru : memref, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> %2 = vector.expandload %base[%c0], %mask, %passthru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "#contraction_accesses0 = [ affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (k, j)>, affine_map<(i, j, k) -> (i, j)> ] #contraction_trait0 = { indexing_maps = #contraction_accesses0, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @contractions(%a: vector<2x3xf32>, %b: vector<3x4xf32>, %c: vector<2x4xf32>, %a_i8: vector<2x3xi8>, %b_i8: vector<3x4xi8>, %c_i8: vector<2x4xi8>) -> (vector<2x4xf32>, vector<2x4xi8>) { %vf_0 = arith.constant dense <0.0>: vector<2x4xf32> %0 = vector.contract #contraction_trait0 %a, %b, %vf_0: vector<2x3xf32>, vector<3x4xf32> into vector<2x4xf32> %1 = arith.addf %0, %c: vector<2x4xf32> %vi8_0 = arith.constant dense <0>: vector<2x4xi8> %i8_0 = vector.contract #contraction_trait0 %a_i8, %b_i8, %vi8_0: vector<2x3xi8>, vector<3x4xi8> into vector<2x4xi8> %i8_1 = arith.addi %i8_0, %c_i8: vector<2x4xi8> return %1, %i8_1: vector<2x4xf32>, vector<2x4xi8> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_folding_1(%t0: tensor<2x3x4xf32>, %t1: tensor<2x3x4xf32>) -> (tensor<2x3x4xf32>, tensor<2x3x4xf32>, tensor<2x3x4xf32>) { %c0 = arith.constant 0 : index %pad = arith.constant 0.0 : f32 %v = vector.transfer_read %t0[%c0, %c0, %c0], %pad {in_bounds = [true, true, true]} : tensor<2x3x4xf32>, vector<2x3x4xf32> %r0 = vector.transfer_write %v, %t1[%c0, %c0, %c0] {in_bounds = [true, true, true]} : vector<2x3x4xf32>, tensor<2x3x4xf32> %t2 = ""test.constant""() { value = dense<6.0> : tensor<2x3x4xf32>} : () -> (tensor<2x3x4xf32>) %r1 = vector.transfer_write %v, %t2[%c0, %c0, %c0] {in_bounds = [true, true, true]} : vector<2x3x4xf32>, tensor<2x3x4xf32> %t3 = ""some_op_that_may_have_side_effects""() : () -> (tensor<2x3x4xf32>) %r2 = vector.transfer_write %v, %t0[%c0, %c0, %c0] {in_bounds = [true, true, true]} : vector<2x3x4xf32>, tensor<2x3x4xf32> return %r0, %r1, %r2: tensor<2x3x4xf32>, tensor<2x3x4xf32>, tensor<2x3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @store_after_load_tensor(%arg0 : tensor<4x4xf32>) -> tensor<4x4xf32> { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c1, %c0], %cf0 : tensor<4x4xf32>, vector<1x4xf32> %w0 = vector.transfer_write %0, %arg0[%c1, %c0] : vector<1x4xf32>, tensor<4x4xf32> return %w0 : tensor<4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @store_after_load_tensor_negative(%arg0 : tensor<4x4xf32>) -> tensor<4x4xf32> { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c1, %c0], %cf0 : tensor<4x4xf32>, vector<1x4xf32> %w0 = vector.transfer_write %0, %arg0[%c0, %c0] : vector<1x4xf32>, tensor<4x4xf32> return %w0 : tensor<4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @store_to_load_tensor(%arg0 : tensor<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>) -> vector<1x4xf32> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %w0 = vector.transfer_write %v0, %arg0[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %w1 = vector.transfer_write %v1, %w0[%c2, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %0 = vector.transfer_read %w1[%c1, %c0], %cf0 {in_bounds = [true, true]} : tensor<4x4xf32>, vector<1x4xf32> return %0 : vector<1x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @store_to_load_negative_tensor(%arg0 : tensor<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) -> vector<1x4xf32> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %w0 = vector.transfer_write %v0, %arg0[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %w1 = vector.transfer_write %v0, %w0[%i, %i] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %0 = vector.transfer_read %w1[%c1, %c0], %cf0 {in_bounds = [true, true]} : tensor<4x4xf32>, vector<1x4xf32> return %0 : vector<1x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @store_to_load_tensor_broadcast(%arg0 : tensor<4x4xf32>, %v0 : vector<4x2xf32>) -> vector<4x2x6xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %w0 = vector.transfer_write %v0, %arg0[%c0, %c0] {in_bounds = [true, true]} : vector<4x2xf32>, tensor<4x4xf32> %0 = vector.transfer_read %w0[%c0, %c0], %cf0 {in_bounds = [true, true, true], permutation_map = affine_map<(d0, d1) -> (d0, d1, 0)>} : tensor<4x4xf32>, vector<4x2x6xf32> return %0 : vector<4x2x6xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @store_to_load_tensor_perm_broadcast(%arg0 : tensor<4x4x4xf32>, %v0 : vector<4x1xf32>) -> vector<1x100x4x5xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %w0 = vector.transfer_write %v0, %arg0[%c0, %c0, %c0] {in_bounds = [true, true], permutation_map = affine_map<(d0, d1, d2) -> (d2, d1)>} : vector<4x1xf32>, tensor<4x4x4xf32> %0 = vector.transfer_read %w0[%c0, %c0, %c0], %cf0 {in_bounds = [true, true, true, true], permutation_map = affine_map<(d0, d1, d2) -> (d1, 0, d2, 0)>} : tensor<4x4x4xf32>, vector<1x100x4x5xf32> return %0 : vector<1x100x4x5xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dead_store_tensor(%arg0 : tensor<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) -> tensor<4x4xf32> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %w0 = vector.transfer_write %v0, %arg0[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %w1 = vector.transfer_write %v0, %w0[%c2, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %w2 = vector.transfer_write %v1, %w1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> return %w2 : tensor<4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dead_store_tensor_negative(%arg0 : tensor<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) -> tensor<4x4xf32> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %w0 = vector.transfer_write %v0, %arg0[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %w1 = vector.transfer_write %v0, %w0[%c2, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> %0 = vector.transfer_read %w1[%i, %i], %cf0 {in_bounds = [true, true]} : tensor<4x4xf32>, vector<1x4xf32> %x = arith.addf %0, %0 : vector<1x4xf32> %w2 = vector.transfer_write %x, %w0[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, tensor<4x4xf32> return %w2 : tensor<4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @swap_extract_slice_transfer_write(%arg0 : vector<8x4xf32>, %arg1 : tensor<4x8xf32>, %arg2 : tensor<64x64xf32>, %iv : index, %sz : index) -> tensor<64x64xf32> { %c0 = arith.constant 0 : index %0 = vector.transfer_write %arg0, %arg1[%c0, %c0] {in_bounds = [true, true], permutation_map = affine_map<(d0, d1) -> (d1, d0)>} : vector<8x4xf32>, tensor<4x8xf32> %1 = tensor.extract_slice %0[0, 0] [%sz, 8] [1, 1] : tensor<4x8xf32> to tensor %2 = tensor.insert_slice %1 into %arg2[%iv, 16] [%sz, 8] [1, 1] : tensor into tensor<64x64xf32> func.return %2 : tensor<64x64xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @do_not_swap_extract_slice_transfer_write(%arg0 : vector<8xf32>, %arg1 : vector<4xf32>, %arg2 : tensor<8xf32>, %arg3 : tensor<64xf32>, %iv : index, %sz : index) -> (tensor<64xf32>, tensor<64xf32>, tensor<64xf32>) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %arg0, %arg2[%c0] {in_bounds = [true]} : vector<8xf32>, tensor<8xf32> %1 = tensor.extract_slice %0[0] [%iv] [1] : tensor<8xf32> to tensor %2 = tensor.insert_slice %1 into %arg3[%iv] [%sz] [1] : tensor into tensor<64xf32> %3 = vector.transfer_write %arg1, %arg2[%c0] {in_bounds = [true]} : vector<4xf32>, tensor<8xf32> %4 = tensor.extract_slice %3[0] [%sz] [1] : tensor<8xf32> to tensor %5 = tensor.insert_slice %4 into %arg3[%iv] [%sz] [1] : tensor into tensor<64xf32> %6 = vector.transfer_write %arg0, %arg2[%c0] {in_bounds = [true]} : vector<8xf32>, tensor<8xf32> %7 = tensor.extract_slice %6[0] [1] [1] : tensor<8xf32> to tensor %8 = tensor.insert_slice %7 into %arg3[%iv] [1] [1] : tensor into tensor<64xf32> func.return %2, %5, %8 : tensor<64xf32>, tensor<64xf32>, tensor<64xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @vector_multi_reduction_single_parallel(%arg0: vector<2xf32>, %acc: vector<2xf32>) -> vector<2xf32> { %0 = vector.multi_reduction , %arg0, %acc [] : vector<2xf32> to vector<2xf32> return %0 : vector<2xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @masked_vector_multi_reduction_single_parallel(%arg0: vector<2xf32>, %acc: vector<2xf32>, %mask: vector<2xi1>) -> vector<2xf32> { %0 = vector.mask %mask { vector.multi_reduction , %arg0, %acc [] : vector<2xf32> to vector<2xf32> } : vector<2xi1> -> vector<2xf32> return %0 : vector<2xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @vector_multi_reduction_unit_dimensions(%source: vector<5x1x4x1x20xf32>, %acc: vector<5x4x20xf32>) -> vector<5x4x20xf32> { %0 = vector.multi_reduction , %source, %acc [1, 3] : vector<5x1x4x1x20xf32> to vector<5x4x20xf32> return %0 : vector<5x4x20xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @masked_vector_multi_reduction_unit_dimensions(%source: vector<5x1x4x1x20xf32>, %acc: vector<5x4x20xf32>, %mask: vector<5x1x4x1x20xi1>) -> vector<5x4x20xf32> { %0 = vector.mask %mask { vector.multi_reduction , %source, %acc [1, 3] : vector<5x1x4x1x20xf32> to vector<5x4x20xf32> } : vector<5x1x4x1x20xi1> -> vector<5x4x20xf32> return %0 : vector<5x4x20xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @vector_multi_reduction_unit_dimensions_fail(%source: vector<5x1x4x1x20xf32>, %acc: vector<5x1x20xf32>) -> vector<5x1x20xf32> { %0 = vector.multi_reduction , %source, %acc [1, 2] : vector<5x1x4x1x20xf32> to vector<5x1x20xf32> return %0 : vector<5x1x20xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @vector_multi_reduction_unit_dimensions_single_elem(%source: vector<1x1x1xf32>, %acc: f32) -> f32 { %0 = vector.multi_reduction , %source, %acc [0,1,2] : vector<1x1x1xf32> to f32 return %0 : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @masked_vector_multi_reduction_unit_dimensions_single_elem(%source: vector<1x1x1xf32>, %acc: f32, %mask: vector<1x1x1xi1>) -> f32 { %0 = vector.mask %mask { vector.multi_reduction , %source, %acc [0,1,2] : vector<1x1x1xf32> to f32 } : vector<1x1x1xi1> -> f32 return %0 : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_strided_slice_full_range(%source: vector<16x16xf16>, %dest: vector<16x16xf16>) -> vector<16x16xf16> { %0 = vector.insert_strided_slice %source, %dest {offsets = [0, 0], strides = [1, 1]} : vector<16x16xf16> into vector<16x16xf16> return %0: vector<16x16xf16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_splat(%arg0: f16) -> vector<2x4xf16> { %0 = vector.splat %arg0 : vector<16x4xf16> %1 = vector.extract_strided_slice %0 {offsets = [1, 0], sizes = [2, 4], strides = [1, 1]} : vector<16x4xf16> to vector<2x4xf16> return %1 : vector<2x4xf16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_extract_to_broadcast(%arg0 : vector<1x1x4xf32>, %arg1 : vector<4xf32>) -> (vector<4xf32>, vector<1x1x4xf32>) { %0 = vector.extract %arg0[0, 0] : vector<1x1x4xf32> %1 = vector.insert %arg1, %arg0 [0, 0] : vector<4xf32> into vector<1x1x4xf32> return %0, %1 : vector<4xf32>, vector<1x1x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_splat_constant() -> (vector<7xf32>, i32) { %cst = arith.constant dense<2.000000e+00> : vector<29x7xf32> %cst_1 = arith.constant dense<1> : vector<4x37x9xi32> %0 = vector.extract %cst[2] : vector<29x7xf32> %1 = vector.extract %cst_1[1, 4, 5] : vector<4x37x9xi32> return %0, %1 : vector<7xf32>, i32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_1d_constant() -> (i32, index, f32) { %icst = arith.constant dense<[1, 2, 3, 4]> : vector<4xi32> %e = vector.extract %icst[2] : vector<4xi32> %idx_cst = arith.constant dense<[0, 1, 2]> : vector<3xindex> %f = vector.extract %idx_cst[1] : vector<3xindex> %fcst = arith.constant dense<[2.000000e+00, 3.000000e+00, 4.000000e+00]> : vector<3xf32> %g = vector.extract %fcst[0] : vector<3xf32> return %e, %f, %g : i32, index, f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_2d_constant() -> (i32, i32, i32, i32) { %cst = arith.constant dense<[[0, 1, 2], [3, 4, 5]]> : vector<2x3xi32> %a = vector.extract %cst[0, 0] : vector<2x3xi32> %b = vector.extract %cst[0, 2] : vector<2x3xi32> %c = vector.extract %cst[1, 0] : vector<2x3xi32> %d = vector.extract %cst[1, 2] : vector<2x3xi32> return %a, %b, %c, %d : i32, i32, i32, i32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_vector_2d_constant() -> (vector<3xi32>, vector<3xi32>) { %cst = arith.constant dense<[[0, 1, 2], [3, 4, 5]]> : vector<2x3xi32> %a = vector.extract %cst[0] : vector<2x3xi32> %b = vector.extract %cst[1] : vector<2x3xi32> return %a, %b : vector<3xi32>, vector<3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_3d_constant() -> (i32, i32, i32, i32) { %cst = arith.constant dense<[[[0, 1], [2, 3], [4, 5]], [[6, 7], [8, 9], [10, 11]]]> : vector<2x3x2xi32> %a = vector.extract %cst[0, 0, 0] : vector<2x3x2xi32> %b = vector.extract %cst[0, 0, 1] : vector<2x3x2xi32> %c = vector.extract %cst[1, 1, 1] : vector<2x3x2xi32> %d = vector.extract %cst[1, 2, 0] : vector<2x3x2xi32> return %a, %b, %c, %d : i32, i32, i32, i32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_vector_3d_constant() -> (vector<3x2xi32>, vector<3x2xi32>, vector<2xi32>, vector<2xi32>) { %cst = arith.constant dense<[[[0, 1], [2, 3], [4, 5]], [[6, 7], [8, 9], [10, 11]]]> : vector<2x3x2xi32> %a = vector.extract %cst[0] : vector<2x3x2xi32> %b = vector.extract %cst[1] : vector<2x3x2xi32> %c = vector.extract %cst[1, 1] : vector<2x3x2xi32> %d = vector.extract %cst[1, 2] : vector<2x3x2xi32> return %a, %b, %c, %d : vector<3x2xi32>, vector<3x2xi32>, vector<2xi32>, vector<2xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_splat_vector_3d_constant() -> (vector<2xi32>, vector<2xi32>, vector<2xi32>) { %cst = arith.constant dense<[[[0, 0], [1, 1], [2, 2]], [[3, 3], [4, 4], [5, 5]]]> : vector<2x3x2xi32> %a = vector.extract %cst[0, 0] : vector<2x3x2xi32> %b = vector.extract %cst[1, 1] : vector<2x3x2xi32> %c = vector.extract %cst[1, 2] : vector<2x3x2xi32> return %a, %b, %c : vector<2xi32>, vector<2xi32>, vector<2xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_1d_constant() -> (vector<3xi32>, vector<2xi32>, vector<1xi32>) { %cst = arith.constant dense<[0, 1, 2]> : vector<3xi32> %a = vector.extract_strided_slice %cst {offsets = [0], sizes = [3], strides = [1]} : vector<3xi32> to vector<3xi32> %b = vector.extract_strided_slice %cst {offsets = [1], sizes = [2], strides = [1]} : vector<3xi32> to vector<2xi32> %c = vector.extract_strided_slice %cst {offsets = [2], sizes = [1], strides = [1]} : vector<3xi32> to vector<1xi32> return %a, %b, %c : vector<3xi32>, vector<2xi32>, vector<1xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_2d_constant() -> (vector<1x1xi32>, vector<1x2xi32>, vector<2x2xi32>) { %cst = arith.constant dense<[[0, 1, 2], [3, 4, 5]]> : vector<2x3xi32> %a = vector.extract_strided_slice %cst {offsets = [0, 0], sizes = [1, 1], strides = [1, 1]} : vector<2x3xi32> to vector<1x1xi32> %b = vector.extract_strided_slice %cst {offsets = [1, 1], sizes = [1, 2], strides = [1, 1]} : vector<2x3xi32> to vector<1x2xi32> %c = vector.extract_strided_slice %cst {offsets = [0, 1], sizes = [2, 2], strides = [1, 1]} : vector<2x3xi32> to vector<2x2xi32> return %a, %b, %c : vector<1x1xi32>, vector<1x2xi32>, vector<2x2xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_3d_constant() -> (vector<1x2x2xi32>, vector<1x1x2xi32>, vector<2x1x2xi32>, vector<1x1x1xi32>) { %cst = arith.constant dense<[[[0, 1], [2, 3]], [[4, 5], [6, 7]], [[8, 9], [10, 11]]]> : vector<3x2x2xi32> %a = vector.extract_strided_slice %cst {offsets = [2], sizes = [1], strides = [1]} : vector<3x2x2xi32> to vector<1x2x2xi32> %b = vector.extract_strided_slice %cst {offsets = [0, 1], sizes = [1, 1], strides = [1, 1]} : vector<3x2x2xi32> to vector<1x1x2xi32> %c = vector.extract_strided_slice %cst {offsets = [1, 1, 0], sizes = [2, 1, 2], strides = [1, 1, 1]} : vector<3x2x2xi32> to vector<2x1x2xi32> %d = vector.extract_strided_slice %cst {offsets = [2, 1, 1], sizes = [1, 1, 1], strides = [1, 1, 1]} : vector<3x2x2xi32> to vector<1x1x1xi32> return %a, %b, %c, %d : vector<1x2x2xi32>, vector<1x1x2xi32>, vector<2x1x2xi32>, vector<1x1x1xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_extract_strided(%arg0: vector<32x16x4xf16>) -> vector<4xf16> { %1 = vector.extract_strided_slice %arg0 {offsets = [7, 3], sizes = [10, 8], strides = [1, 1]} : vector<32x16x4xf16> to vector<10x8x4xf16> %2 = vector.extract %1[2, 4] : vector<10x8x4xf16> return %2 : vector<4xf16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_insert_strided(%a: vector<6x4xf32>, %b: vector<8x16xf32>) -> f32 { %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]} : vector<6x4xf32> into vector<8x16xf32> %2 = vector.extract %0[2, 4] : vector<8x16xf32> return %2 : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_insert_rank_reduce(%a: vector<4xf32>, %b: vector<8x16xf32>) -> f32 { %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1]} : vector<4xf32> into vector<8x16xf32> %2 = vector.extract %0[2, 4] : vector<8x16xf32> return %2 : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_insert_negative(%a: vector<2x15xf32>, %b: vector<12x8x16xf32>) -> vector<16xf32> { %0 = vector.insert_strided_slice %a, %b {offsets = [4, 2, 0], strides = [1, 1]} : vector<2x15xf32> into vector<12x8x16xf32> %2 = vector.extract %0[4, 2] : vector<12x8x16xf32> return %2 : vector<16xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_insert_chain(%a: vector<2x16xf32>, %b: vector<12x8x16xf32>, %c: vector<2x16xf32>) -> vector<16xf32> { %0 = vector.insert_strided_slice %c, %b {offsets = [4, 2, 0], strides = [1, 1]} : vector<2x16xf32> into vector<12x8x16xf32> %1 = vector.insert_strided_slice %a, %0 {offsets = [0, 2, 0], strides = [1, 1]} : vector<2x16xf32> into vector<12x8x16xf32> %2 = vector.extract %1[4, 2] : vector<12x8x16xf32> return %2 : vector<16xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_extract_strided2(%A: vector<2x4xf32>) -> (vector<4xf32>) { %0 = vector.extract_strided_slice %A {offsets = [1, 0], sizes = [1, 4], strides = [1, 1]} : vector<2x4xf32> to vector<1x4xf32> %1 = vector.extract %0[0] : vector<1x4xf32> return %1 : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @splat_fold() -> vector<4xf32> { %c = arith.constant 1.0 : f32 %v = vector.splat %c : vector<4xf32> return %v : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @shuffle_1d() -> vector<4xi32> { %v0 = arith.constant dense<[0, 1, 2]> : vector<3xi32> %v1 = arith.constant dense<[3, 4, 5]> : vector<3xi32> %shuffle = vector.shuffle %v0, %v1 [3, 2, 5, 1] : vector<3xi32>, vector<3xi32> return %shuffle : vector<4xi32> } func.func @shuffle_canonicalize_0d(%v0 : vector, %v1 : vector) -> vector<1xi32> { %shuffle = vector.shuffle %v0, %v1 [0] : vector, vector return %shuffle : vector<1xi32> } func.func @shuffle_fold1(%v0 : vector<4xi32>, %v1 : vector<2xi32>) -> vector<4xi32> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 2, 3] : vector<4xi32>, vector<2xi32> return %shuffle : vector<4xi32> } func.func @shuffle_fold2(%v0 : vector<4xi32>, %v1 : vector<2xi32>) -> vector<2xi32> { %shuffle = vector.shuffle %v0, %v1 [4, 5] : vector<4xi32>, vector<2xi32> return %shuffle : vector<2xi32> } func.func @shuffle_fold3(%v0 : vector<4x5x6xi32>, %v1 : vector<2x5x6xi32>) -> vector<4x5x6xi32> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 2, 3] : vector<4x5x6xi32>, vector<2x5x6xi32> return %shuffle : vector<4x5x6xi32> } func.func @shuffle_fold4(%v0 : vector<4x5x6xi32>, %v1 : vector<2x5x6xi32>) -> vector<2x5x6xi32> { %shuffle = vector.shuffle %v0, %v1 [4, 5] : vector<4x5x6xi32>, vector<2x5x6xi32> return %shuffle : vector<2x5x6xi32> } func.func @shuffle_nofold1(%v0 : vector<4xi32>, %v1 : vector<2xi32>) -> vector<5xi32> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 2, 3, 4] : vector<4xi32>, vector<2xi32> return %shuffle : vector<5xi32> } func.func @shuffle_nofold2(%v0 : vector<[4]xi32>, %v1 : vector<[2]xi32>) -> vector<4xi32> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 2, 3] : vector<[4]xi32>, vector<[2]xi32> return %shuffle : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_scalar_broadcast1(%value: vector<1xf32>) -> vector<1x8xf32> { %bcast = vector.broadcast %value : vector<1xf32> to vector<8x1xf32> %t = vector.transpose %bcast, [1, 0] : vector<8x1xf32> to vector<1x8xf32> return %t : vector<1x8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_scalar_broadcast2(%value: f32) -> vector<1x8xf32> { %bcast = vector.broadcast %value : f32 to vector<8x1xf32> %t = vector.transpose %bcast, [1, 0] : vector<8x1xf32> to vector<1x8xf32> return %t : vector<1x8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transpose_splat_constant() -> vector<8x4xf32> { %cst = arith.constant dense<5.0> : vector<4x8xf32> %0 = vector.transpose %cst, [1, 0] : vector<4x8xf32> to vector<8x4xf32> return %0 : vector<8x4xf32> } func.func @transpose_splat2(%arg : f32) -> vector<3x4xf32> { %splat = vector.splat %arg : vector<4x3xf32> %0 = vector.transpose %splat, [1, 0] : vector<4x3xf32> to vector<3x4xf32> return %0 : vector<3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_1d_constant() -> (vector<3xi32>, vector<3xi32>, vector<3xi32>) { %vcst = arith.constant dense<[0, 1, 2]> : vector<3xi32> %icst = arith.constant 9 : i32 %a = vector.insert %icst, %vcst[0] : i32 into vector<3xi32> %b = vector.insert %icst, %vcst[1] : i32 into vector<3xi32> %c = vector.insert %icst, %vcst[2] : i32 into vector<3xi32> return %a, %b, %c : vector<3xi32>, vector<3xi32>, vector<3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_2d_constant() -> (vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>) { %vcst = arith.constant dense<[[0, 1, 2], [3, 4, 5]]> : vector<2x3xi32> %cst_scalar = arith.constant 99 : i32 %cst_1d = arith.constant dense<[90, 91, 92]> : vector<3xi32> %a = vector.insert %cst_scalar, %vcst[0, 0] : i32 into vector<2x3xi32> %b = vector.insert %cst_scalar, %vcst[1, 2] : i32 into vector<2x3xi32> %c = vector.insert %cst_1d, %vcst[0] : vector<3xi32> into vector<2x3xi32> %d = vector.insert %cst_1d, %vcst[1] : vector<3xi32> into vector<2x3xi32> return %a, %b, %c, %d : vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_2d_splat_constant() -> (vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>) { %vcst = arith.constant dense<0> : vector<2x3xi32> %cst_zero = arith.constant 0 : i32 %cst_scalar = arith.constant 99 : i32 %cst_1d = arith.constant dense<33> : vector<3xi32> %a = vector.insert %cst_zero, %vcst[0, 0] : i32 into vector<2x3xi32> %b = vector.insert %cst_scalar, %vcst[0, 0] : i32 into vector<2x3xi32> %c = vector.insert %cst_scalar, %vcst[1, 1] : i32 into vector<2x3xi32> %d = vector.insert %cst_1d, %vcst[0] : vector<3xi32> into vector<2x3xi32> %e = vector.insert %cst_1d, %vcst[1] : vector<3xi32> into vector<2x3xi32> return %a, %b, %c, %d, %e : vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32>, vector<2x3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_element_fold() -> vector<4xi32> { %v = arith.constant dense<[0, 1, 2, 3]> : vector<4xi32> %s = arith.constant 7 : i32 %i = arith.constant 2 : i32 %1 = vector.insertelement %s, %v[%i : i32] : vector<4xi32> return %1 : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_element_fold() -> i32 { %v = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %i = arith.constant 2 : i32 %1 = vector.extractelement %v[%i : i32] : vector<4xi32> return %1 : i32 } func.func @extract_element_splat_fold(%a : i32) -> i32 { %v = vector.splat %a : vector<4xi32> %i = arith.constant 2 : i32 %1 = vector.extractelement %v[%i : i32] : vector<4xi32> return %1 : i32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @reduce_one_element_vector_extract(%a : vector<1xf32>) -> f32 { %s = vector.reduction , %a : vector<1xf32> into f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @masked_reduce_one_element_vector_extract(%a : vector<1xf32>, %mask : vector<1xi1>) -> f32 { %s = vector.mask %mask { vector.reduction , %a : vector<1xf32> into f32 } : vector<1xi1> -> f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @reduce_one_element_vector_addf(%a : vector<1xf32>, %b: f32) -> f32 { %s = vector.reduction , %a, %b : vector<1xf32> into f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @masked_reduce_one_element_vector_addf(%a: vector<1xf32>, %b: f32, %mask: vector<1xi1>) -> f32 { %s = vector.mask %mask { vector.reduction , %a, %b : vector<1xf32> into f32 } : vector<1xi1> -> f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @reduce_one_element_vector_mulf(%a : vector<1xf32>, %b: f32) -> f32 { %s = vector.reduction , %a, %b : vector<1xf32> into f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @dont_reduce_one_element_vector(%a : vector<4xf32>) -> f32 { %s = vector.reduction , %a : vector<4xf32> into f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @reduce_one_element_vector_maxf(%a : vector<1xf32>, %b: f32) -> f32 { %s = vector.reduction , %a, %b : vector<1xf32> into f32 return %s : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @bitcast(%a: vector<4x8xf32>) -> vector<4x16xi16> { %0 = vector.bitcast %a : vector<4x8xf32> to vector<4x8xi32> %1 = vector.bitcast %0 : vector<4x8xi32> to vector<4x16xi16> return %1 : vector<4x16xi16> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_strided_slice_splat(%x: f32) -> (vector<8x16xf32>) { %splat0 = vector.splat %x : vector<4x4xf32> %splat1 = vector.splat %x : vector<8x16xf32> %0 = vector.insert_strided_slice %splat0, %splat1 {offsets = [2, 2], strides = [1, 1]} : vector<4x4xf32> into vector<8x16xf32> return %0 : vector<8x16xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_extract_strided_slice(%x: vector<8x16xf32>) -> (vector<8x16xf32>) { %0 = vector.extract_strided_slice %x {offsets = [0, 8], sizes = [2, 4], strides = [1, 1]} : vector<8x16xf32> to vector<2x4xf32> %1 = vector.insert_strided_slice %0, %x {offsets = [0, 8], strides = [1, 1]} : vector<2x4xf32> into vector<8x16xf32> return %1 : vector<8x16xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_strided_1d_constant() -> (vector<3xi32>, vector<3xi32>, vector<3xi32>, vector<3xi32>, vector<3xi32>) { %vcst = arith.constant dense<[0, 1, 2]> : vector<3xi32> %cst_1 = arith.constant dense<4> : vector<1xi32> %cst_2 = arith.constant dense<[5, 6]> : vector<2xi32> %cst_3 = arith.constant dense<[7, 8, 9]> : vector<3xi32> %a = vector.insert_strided_slice %cst_1, %vcst {offsets = [0], strides = [1]} : vector<1xi32> into vector<3xi32> %b = vector.insert_strided_slice %cst_1, %vcst {offsets = [2], strides = [1]} : vector<1xi32> into vector<3xi32> %c = vector.insert_strided_slice %cst_2, %vcst {offsets = [0], strides = [1]} : vector<2xi32> into vector<3xi32> %d = vector.insert_strided_slice %cst_2, %vcst {offsets = [1], strides = [1]} : vector<2xi32> into vector<3xi32> %e = vector.insert_strided_slice %cst_3, %vcst {offsets = [0], strides = [1]} : vector<3xi32> into vector<3xi32> return %a, %b, %c, %d, %e : vector<3xi32>, vector<3xi32>, vector<3xi32>, vector<3xi32>, vector<3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_strided_2d_constant() -> (vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>) { %vcst = arith.constant dense<[[0, 1], [2, 3], [4, 5]]> : vector<3x2xi32> %cst_1 = arith.constant dense<9> : vector<1xi32> %cst_2 = arith.constant dense<[18, 19]> : vector<2xi32> %cst_3 = arith.constant dense<[[28, 29], [38, 39]]> : vector<2x2xi32> %a = vector.insert_strided_slice %cst_1, %vcst {offsets = [1, 0], strides = [1]} : vector<1xi32> into vector<3x2xi32> %b = vector.insert_strided_slice %cst_1, %vcst {offsets = [2, 1], strides = [1]} : vector<1xi32> into vector<3x2xi32> %c = vector.insert_strided_slice %cst_2, %vcst {offsets = [0, 0], strides = [1]} : vector<2xi32> into vector<3x2xi32> %d = vector.insert_strided_slice %cst_2, %vcst {offsets = [1, 0], strides = [1]} : vector<2xi32> into vector<3x2xi32> %e = vector.insert_strided_slice %cst_2, %vcst {offsets = [2, 0], strides = [1]} : vector<2xi32> into vector<3x2xi32> %f = vector.insert_strided_slice %cst_3, %vcst {offsets = [0, 0], strides = [1, 1]} : vector<2x2xi32> into vector<3x2xi32> %g = vector.insert_strided_slice %cst_3, %vcst {offsets = [1, 0], strides = [1, 1]} : vector<2x2xi32> into vector<3x2xi32> return %a, %b, %c, %d, %e, %f, %g : vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32>, vector<3x2xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @shuffle_splat(%x : i32) -> vector<4xi32> { %v0 = vector.splat %x : vector<4xi32> %v1 = vector.splat %x : vector<2xi32> %shuffle = vector.shuffle %v0, %v1 [2, 3, 4, 5] : vector<4xi32>, vector<2xi32> return %shuffle : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @insert_splat(%x : i32) -> vector<2x4x3xi32> { %v0 = vector.splat %x : vector<4x3xi32> %v1 = vector.splat %x : vector<2x4x3xi32> %insert = vector.insert %v0, %v1[0] : vector<4x3xi32> into vector<2x4x3xi32> return %insert : vector<2x4x3xi32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_from_rank_reducing_extract_slice(%src: tensor<1x8x8x8xf32>, %i1: index, %i2: index, %i3: index, %i4: index) -> vector<4xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.000000e+00 : f32 %0 = tensor.extract_slice %src[0, %i1, %i2, %i3] [1, 4, 1, 4] [1, 1, 1, 1] : tensor<1x8x8x8xf32> to tensor<1x4x4xf32> %1 = vector.transfer_read %0[%c0, %i4, %c0], %f0 {in_bounds = [true]} : tensor<1x4x4xf32>, vector<4xf32> return %1 : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_from_broadcast(%src: vector<1x1x1xf32>) -> vector<1xf32> { %0 = vector.broadcast %src : vector<1x1x1xf32> to vector<1x1x32x1xf32> %1 = vector.extract %0[0, 0, 31] : vector<1x1x32x1xf32> return %1: vector<1xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @extract_strided_slice_of_constant_mask() -> vector<5x7xi1>{ %c4 = arith.constant 4 : index %c10 = arith.constant 10 : index %mask = vector.create_mask %c10, %c4 : vector<12x7xi1> %res = vector.extract_strided_slice %mask {offsets = [3], sizes = [5], strides = [1]} : vector<12x7xi1> to vector<5x7xi1> return %res : vector<5x7xi1> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_extractelement_of_broadcast(%f: f32) -> f32 { %0 = vector.broadcast %f : f32 to vector<15xf32> %c5 = arith.constant 5 : index %1 = vector.extractelement %0 [%c5 : index] : vector<15xf32> return %1 : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @fold_0d_vector_reduction(%arg0: vector) -> f32 { %0 = vector.reduction , %arg0 : vector into f32 return %0 : f32 }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @empty_vector_mask(%mask : vector<8xi1>) { vector.mask %mask { } : vector<8xi1> return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @empty_vector_mask_with_return(%a : vector<8xf32>, %mask : vector<8xi1>) -> vector<8xf32> { %0 = vector.mask %mask { vector.yield %a : vector<8xf32> } : vector<8xi1> -> vector<8xf32> return %0 : vector<8xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @all_true_vector_mask(%a : vector<3x4xf32>) -> vector<3x4xf32> { %all_true = vector.constant_mask [3, 4] : vector<3x4xi1> %0 = vector.mask %all_true { arith.addf %a, %a : vector<3x4xf32> } : vector<3x4xi1> -> vector<3x4xf32> return %0 : vector<3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file -allow-unregistered-dialect ",1 "func.func @nop_shape_cast(%arg0: vector<16xf32>) -> vector<16xf32> { %0 = vector.shape_cast %arg0 : vector<16xf32> to vector<16xf32> return %0 : vector<16xf32> } func.func @cancel_shape_cast(%arg0: vector<16xf32>) -> vector<16xf32> { %0 = vector.shape_cast %arg0 : vector<16xf32> to vector<4x4xf32> %1 = vector.shape_cast %0 : vector<4x4xf32> to vector<16xf32> return %1 : vector<16xf32> } func.func @shape_casts(%a: vector<2x2xf32>) -> (vector<4xf32>, vector<2x2xf32>) { %0 = vector.shape_cast %a : vector<2x2xf32> to vector<4xf32> %r0 = arith.addf %0, %0: vector<4xf32> %1 = vector.shape_cast %r0 : vector<4xf32> to vector<2x2xf32> return %r0, %1 : vector<4xf32>, vector<2x2xf32> } func.func @shape_cast_2d2d(%arg0 : vector<3x2xf32>) -> vector<2x3xf32> { %s = vector.shape_cast %arg0: vector<3x2xf32> to vector<2x3xf32> return %s : vector<2x3xf32> } func.func @shape_cast_3d1d(%arg0 : vector<1x3x2xf32>) -> vector<6xf32> { %s = vector.shape_cast %arg0 : vector<1x3x2xf32> to vector<6xf32> return %s : vector<6xf32> } func.func @shape_cast_1d3d(%arg0 : vector<6xf32>) -> vector<2x1x3xf32> { %s = vector.shape_cast %arg0 : vector<6xf32> to vector<2x1x3xf32> return %s : vector<2x1x3xf32> } func.func @shape_cast_0d1d(%arg0 : vector) -> vector<1xf32> { %s = vector.shape_cast %arg0 : vector to vector<1xf32> return %s : vector<1xf32> } func.func @shape_cast_1d0d(%arg0 : vector<1xf32>) -> vector { %s = vector.shape_cast %arg0 : vector<1xf32> to vector return %s : vector } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op %f2 = transform.vector.lower_shape_cast %f : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @split_vector_transfer_read_2d(%A: memref, %i: index, %j: index) -> vector<4x8xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %1 = vector.transfer_read %A[%i, %j], %f0 : memref, vector<4x8xf32> return %1: vector<4x8xf32> } func.func @split_vector_transfer_read_strided_2d( %A: memref<7x8xf32, strided<[?, 1], offset: ?>>, %i: index, %j: index) -> vector<4x8xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %1 = vector.transfer_read %A[%i, %j], %f0 : memref<7x8xf32, strided<[?, 1], offset: ?>>, vector<4x8xf32> return %1 : vector<4x8xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""vector-transfer"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @split_vector_transfer_write_2d(%V: vector<4x8xf32>, %A: memref, %i: index, %j: index) { vector.transfer_write %V, %A[%i, %j] : vector<4x8xf32>, memref return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""vector-transfer"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @split_vector_transfer_write_strided_2d( %V: vector<4x8xf32>, %A: memref<7x8xf32, strided<[?, 1], offset: ?>>, %i: index, %j: index) { vector.transfer_write %V, %A[%i, %j] : vector<4x8xf32>, memref<7x8xf32, strided<[?, 1], offset: ?>> return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""vector-transfer"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func private @fake_side_effecting_fun(%0: vector<2x2xf32>) -> () func.func @transfer_read_within_async_execute(%A : memref) -> !async.token { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %token = async.execute { %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref, vector<2x2xf32> func.call @fake_side_effecting_fun(%0) : (vector<2x2xf32>) -> () async.yield } return %token : !async.token } func.func @transfer_read_within_scf_for(%A : memref, %lb : index, %ub : index, %step : index) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 scf.for %i = %lb to %ub step %step { %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref, vector<2x2xf32> func.call @fake_side_effecting_fun(%0) : (vector<2x2xf32>) -> () } return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""vector-transfer"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_read_of_extract_slice(%t : tensor, %s1 : index, %s2 : index) -> vector<5x6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1] [10, %s2] [1, 1] : tensor to tensor<10x?xf32> %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true, true]} : tensor<10x?xf32>, vector<5x6xf32> return %1 : vector<5x6xf32> }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @transfer_read_of_extract_slice(%t : tensor, %s1 : index, %s2 : index) -> vector<6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1] [10, %s2] [1, 1] : tensor to tensor<10x?xf32> %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true]} : tensor<10x?xf32>, vector<6xf32> return %1 : vector<6xf32> }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @transfer_read_of_extract_slice_rank_reducing(%t : tensor, %s1 : index, %s2 : index) -> vector<5x6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1, 6] [1, %s2, 12] [1, 1, 1] : tensor to tensor %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true, true]} : tensor, vector<5x6xf32> return %1 : vector<5x6xf32> }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @transfer_read_of_extract_slice_illegal_rank_reducing(%t : tensor, %s1 : index, %s2 : index) -> vector<5x6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1, 6] [%s2, 1, 12] [1, 1, 1] : tensor to tensor %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true, true]} : tensor, vector<5x6xf32> return %1 : vector<5x6xf32> }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @insert_slice_of_transfer_write(%t1 : tensor, %v : vector<5x6xf32>, %s : index, %t2 : tensor<5x6xf32>) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %t2[%c0, %c0] {in_bounds = [true, true]} : vector<5x6xf32>, tensor<5x6xf32> %1 = tensor.insert_slice %0 into %t1[3, %s] [5, 6] [1, 1] : tensor<5x6xf32> into tensor return %1 : tensor }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @insert_slice_of_transfer_write_illegal_rank_extending(%t1 : tensor, %v : vector<5x6xf32>, %s : index, %t2 : tensor<5x6xf32>) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %t2[%c0, %c0] {in_bounds = [true, true]} : vector<5x6xf32>, tensor<5x6xf32> %1 = tensor.insert_slice %0 into %t1[4, 3, %s] [5, 1, 6] [1, 1, 1] : tensor<5x6xf32> into tensor return %1 : tensor }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @insert_slice_of_transfer_write_rank_extending(%t1 : tensor, %v : vector<5x6xf32>, %s : index, %t2 : tensor<5x6xf32>) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %t2[%c0, %c0] {in_bounds = [true, true]} : vector<5x6xf32>, tensor<5x6xf32> %1 = tensor.insert_slice %0 into %t1[4, 3, %s] [1, 5, 6] [1, 1, 1] : tensor<5x6xf32> into tensor return %1 : tensor }", mlir-opt -split-input-file -test-vector-transfer-tensor-slice-patterns ,1 "func.func @transfer_read(%t: tensor, %o1: index, %o2: index, %pad: f32) -> vector<5x6xf32> { %0 = vector.transfer_read %t[%o1, %o2], %pad {in_bounds = [true, false]} : tensor, vector<5x6xf32> return %0 : vector<5x6xf32> }", mlir-opt -vector-bufferize -split-input-file ,1 "func.func @transfer_write(%t: tensor, %o1: index, %o2: index, %vec: vector<5x6xf32>, %mask: vector<5x6xi1>) -> tensor { %0 = vector.transfer_write %vec, %t[%o1, %o2], %mask {in_bounds = [true, false]} : vector<5x6xf32>, tensor return %0 : tensor }", mlir-opt -vector-bufferize -split-input-file ,1 "func.func @gather(%base: tensor, %v: vector<16xi32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0, %c0][%v], %mask, %pass_thru : tensor, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %0 : vector<16xf32> }", mlir-opt -vector-bufferize -split-input-file ,1 "#matvec_accesses = [ affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (i)> ] #matvec_trait = { indexing_maps = #matvec_accesses, iterator_types = [""parallel"", ""reduction""] } #matmat_accesses = [ affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (k, j)>, affine_map<(i, j, k) -> (i, j)> ] #matmat_trait = { indexing_maps = #matmat_accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } #matmat_accesses_0 = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (m, n)> ] #matmat_trait_0 = { indexing_maps = #matmat_accesses_0, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @masked_extract_contract2(%arg0: vector<2x3xf32>, %arg1: vector<3xf32>, %arg2: vector<2xf32>, %m: vector<2x3xi1>) -> vector<2xf32> { %0 = vector.mask %m { vector.contract #matvec_trait %arg0, %arg1, %arg2 : vector<2x3xf32>, vector<3xf32> into vector<2xf32> } : vector<2x3xi1> -> vector<2xf32> return %0 : vector<2xf32> } func.func @masked_extract_contract4(%arg0: vector<3x5xf32>, %arg1: vector<5x7xf32>, %arg2: vector<3x7xf32>, %m : vector<3x7x5xi1>) -> vector<3x7xf32> { %0 = vector.mask %m { vector.contract #matmat_trait %arg0, %arg1, %arg2 : vector<3x5xf32>, vector<5x7xf32> into vector<3x7xf32> } : vector<3x7x5xi1> -> vector<3x7xf32> return %0 : vector<3x7xf32> } func.func @matmul(%arg0: vector<2x4xf32>, %arg1: vector<4x3xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait %arg0, %arg1, %arg2 : vector<2x4xf32>, vector<4x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @matmul_0(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait_0 %arg0, %arg1, %arg2 : vector<2x1xf32>, vector<1x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @matmul_0_mixed(%arg0: vector<2x1xf16>, %arg1: vector<1x3xf16>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait_0 %arg0, %arg1, %arg2 : vector<2x1xf16>, vector<1x3xf16> into vector<2x3xf32> return %0 : vector<2x3xf32> } #matmat_accesses_1 = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (n, k)>, affine_map<(m, n, k) -> (m, n)> ] #matmat_trait_1 = { indexing_maps = #matmat_accesses_1, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_1(%arg0: vector<2x1xf32>, %arg1: vector<3x1xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait_1 %arg0, %arg1, %arg2 : vector<2x1xf32>, vector<3x1xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } #matmat_accesses_2 = [ affine_map<(m, n, k) -> (k, m)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (m, n)> ] #matmat_trait_2 = { indexing_maps = #matmat_accesses_2, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_2(%arg0: vector<1x2xf32>, %arg1: vector<1x3xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait_2 %arg0, %arg1, %arg2 : vector<1x2xf32>, vector<1x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } #matmat_accesses_3 = [ affine_map<(m, n, k) -> (k, m)>, affine_map<(m, n, k) -> (n, k)>, affine_map<(m, n, k) -> (m, n)> ] #matmat_trait_3 = { indexing_maps = #matmat_accesses_3, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_3(%arg0: vector<1x2xf32>, %arg1: vector<3x1xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait_3 %arg0, %arg1, %arg2 : vector<1x2xf32>, vector<3x1xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } #matmat_accesses_4 = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (n, m)> ] #matmat_trait_4 = { indexing_maps = #matmat_accesses_4, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_4(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<3x2xf32>) -> vector<3x2xf32> { %0 = vector.contract #matmat_trait_4 %arg0, %arg1, %arg2 : vector<2x1xf32>, vector<1x3xf32> into vector<3x2xf32> return %0 : vector<3x2xf32> } #matmat_accesses_5 = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (n, m)> ] #matmat_trait_5 = { indexing_maps = #matmat_accesses_5, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_5(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<3x2xf32>) -> vector<3x2xf32> { %0 = vector.contract #matmat_trait_5 %arg0, %arg1, %arg2 : vector<2x1xf32>, vector<1x3xf32> into vector<3x2xf32> return %0 : vector<3x2xf32> } #matmat_accesses_6 = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (n, m)> ] #matmat_trait_6 = { indexing_maps = #matmat_accesses_6, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_6(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<3x2xf32>) -> vector<3x2xf32> { %0 = vector.contract #matmat_trait_6 %arg0, %arg1, %arg2 : vector<2x1xf32>, vector<1x3xf32> into vector<3x2xf32> return %0 : vector<3x2xf32> } #matmat_accesses_7 = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (n, m)> ] #matmat_trait_7 = { indexing_maps = #matmat_accesses_7, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_7(%arg0: vector<2x1xf32>, %arg1: vector<1x3xf32>, %arg2: vector<3x2xf32>) -> vector<3x2xf32> { %0 = vector.contract #matmat_trait_7 %arg0, %arg1, %arg2 : vector<2x1xf32>, vector<1x3xf32> into vector<3x2xf32> return %0 : vector<3x2xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op %f2 = transform.vector.lower_contraction %f lowering_strategy = ""outerproduct"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @vector_transfer_read(%t0: tensor, %idx: index, %m0: vector<16xi1>) -> vector<16xf32> { %ft0 = arith.constant 0.0 : f32 %0 = vector.mask %m0 { vector.transfer_read %t0[%idx], %ft0 : tensor, vector<16xf32> } : vector<16xi1> -> vector<16xf32> return %0 : vector<16xf32> }", mlir-opt -lower-vector-mask -split-input-file ,1 "func.func @vector_transfer_write_on_memref(%val: vector<16xf32>, %t0: memref, %idx: index, %m0: vector<16xi1>) { vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, memref } : vector<16xi1> return }", mlir-opt -lower-vector-mask -split-input-file ,1 "func.func @vector_transfer_write_on_tensor(%val: vector<16xf32>, %t0: tensor, %idx: index, %m0: vector<16xi1>) -> tensor { %res = vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor } : vector<16xi1> -> tensor return %res : tensor }", mlir-opt -lower-vector-mask -split-input-file ,1 "func.func @vector_gather(%arg0: tensor<64xf32>, %arg1: tensor<3xf32>) -> tensor<3xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %c3 = arith.constant 3 : index %0 = vector.create_mask %c3 : vector<4xi1> %1 = vector.mask %0 { vector.transfer_read %arg1[%c0], %cst {in_bounds = [true]} : tensor<3xf32>, vector<4xf32> } : vector<4xi1> -> vector<4xf32> %cst_0 = arith.constant dense<[0, 1, 2, 3]> : vector<4xindex> %cst_1 = arith.constant dense : vector<4xi1> %cst_2 = arith.constant dense<0.000000e+00> : vector<4xf32> %c0_3 = arith.constant 0 : index %2 = vector.mask %0 { vector.gather %arg0[%c0_3] [%cst_0], %cst_1, %cst_2 : tensor<64xf32>, vector<4xindex>, vector<4xi1>, vector<4xf32> into vector<4xf32> } : vector<4xi1> -> vector<4xf32> %c0_4 = arith.constant 0 : index %3 = vector.mask %0 { vector.transfer_write %2, %arg1[%c0_4] {in_bounds = [true]} : vector<4xf32>, tensor<3xf32> } : vector<4xi1> -> tensor<3xf32> return %3 : tensor<3xf32> }", mlir-opt -lower-vector-mask -split-input-file ,1 "func.func @maskedload0(%base: memref, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> %ld = vector.maskedload %base[%c0], %mask, %pass_thru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @maskedload1(%base: memref<16xf32>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> %ld = vector.maskedload %base[%c0], %mask, %pass_thru : memref<16xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @maskedload2(%base: memref<16xf32>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [0] : vector<16xi1> %ld = vector.maskedload %base[%c0], %mask, %pass_thru : memref<16xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @maskedload3(%base: memref, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c8 = arith.constant 8 : index %mask = vector.constant_mask [16] : vector<16xi1> %ld = vector.maskedload %base[%c8], %mask, %pass_thru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @maskedstore1(%base: memref<16xf32>, %value: vector<16xf32>) { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> vector.maskedstore %base[%c0], %mask, %value : memref<16xf32>, vector<16xi1>, vector<16xf32> return } func.func @maskedstore2(%base: memref<16xf32>, %value: vector<16xf32>) { %c0 = arith.constant 0 : index %mask = vector.constant_mask [0] : vector<16xi1> vector.maskedstore %base[%c0], %mask, %value : memref<16xf32>, vector<16xi1>, vector<16xf32> return } func.func @gather1(%base: memref<16xf32>, %indices: vector<16xi32>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> %ld = vector.gather %base[%c0][%indices], %mask, %pass_thru : memref<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @gather2(%base: memref<16xf32>, %indices: vector<16xi32>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [0] : vector<16xi1> %ld = vector.gather %base[%c0][%indices], %mask, %pass_thru : memref<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @scatter1(%base: memref<16xf32>, %indices: vector<16xi32>, %value: vector<16xf32>) { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> vector.scatter %base[%c0][%indices], %mask, %value : memref<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> return } func.func @scatter2(%base: memref<16xf32>, %indices: vector<16xi32>, %value: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.type_cast %base : memref<16xf32> to memref> %mask = vector.constant_mask [0] : vector<16xi1> vector.scatter %base[%c0][%indices], %mask, %value : memref<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> return } func.func @expand1(%base: memref<16xf32>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> %ld = vector.expandload %base[%c0], %mask, %pass_thru : memref<16xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @expand2(%base: memref<16xf32>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %mask = vector.constant_mask [0] : vector<16xi1> %ld = vector.expandload %base[%c0], %mask, %pass_thru : memref<16xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %ld : vector<16xf32> } func.func @compress1(%base: memref<16xf32>, %value: vector<16xf32>) { %c0 = arith.constant 0 : index %mask = vector.constant_mask [16] : vector<16xi1> vector.compressstore %base[%c0], %mask, %value : memref<16xf32>, vector<16xi1>, vector<16xf32> return } func.func @compress2(%base: memref<16xf32>, %value: vector<16xf32>) { %c0 = arith.constant 0 : index %mask = vector.constant_mask [0] : vector<16xi1> vector.compressstore %base[%c0], %mask, %value : memref<16xf32>, vector<16xi1>, vector<16xf32> return }", mlir-opt -test-vector-to-vector-lowering ,1 "#dotp_accesses = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> ()> ] #dotp_trait = { indexing_maps = #dotp_accesses, iterator_types = [""reduction""] } func.func @extract_contract1(%arg0: vector<4xf32>, %arg1: vector<4xf32>, %arg2: f32) -> f32 { %0 = vector.contract #dotp_trait %arg0, %arg1, %arg2 : vector<4xf32>, vector<4xf32> into f32 return %0 : f32 } func.func @masked_extract_contract1(%arg0: vector<4xf32>, %arg1: vector<4xf32>, %arg2: f32, %mask: vector<4xi1>) -> f32 { %0 = vector.mask %mask { vector.contract #dotp_trait %arg0, %arg1, %arg2 : vector<4xf32>, vector<4xf32> into f32 } : vector<4xi1> -> f32 return %0 : f32 } func.func @extract_contract1_int(%arg0: vector<4xi32>, %arg1: vector<4xi32>, %arg2: i32) -> i32 { %0 = vector.contract #dotp_trait %arg0, %arg1, %arg2 : vector<4xi32>, vector<4xi32> into i32 return %0 : i32 } #matvec_accesses = [ affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (i)> ] #matvec_trait = { indexing_maps = #matvec_accesses, iterator_types = [""parallel"", ""reduction""] } func.func @extract_contract2(%arg0: vector<2x3xf32>, %arg1: vector<3xf32>, %arg2: vector<2xf32>) -> vector<2xf32> { %0 = vector.contract #matvec_trait %arg0, %arg1, %arg2 : vector<2x3xf32>, vector<3xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @extract_contract2_int(%arg0: vector<2x3xi32>, %arg1: vector<3xi32>, %arg2: vector<2xi32>) -> vector<2xi32> { %0 = vector.contract #matvec_trait %arg0, %arg1, %arg2 : vector<2x3xi32>, vector<3xi32> into vector<2xi32> return %0 : vector<2xi32> } #vecmat_accesses = [ affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i)> ] #vecmat_trait = { indexing_maps = #vecmat_accesses, iterator_types = [""parallel"", ""reduction""] } func.func @extract_contract3(%arg0: vector<3xf32>, %arg1: vector<2x3xf32>, %arg2: vector<2xf32>) -> vector<2xf32> { %0 = vector.contract #vecmat_trait %arg0, %arg1, %arg2 : vector<3xf32>, vector<2x3xf32> into vector<2xf32> return %0 : vector<2xf32> } #matmat_accesses = [ affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (k, j)>, affine_map<(i, j, k) -> (i, j)> ] #matmat_trait = { indexing_maps = #matmat_accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @extract_contract4(%arg0: vector<2x2xf32>, %arg1: vector<2x2xf32>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %0 = vector.contract #matmat_trait %arg0, %arg1, %arg2 : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32> return %0 : vector<2x2xf32> } #contraction2d_accesses = [ affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> ()> ] #contraction2d_trait = { indexing_maps = #contraction2d_accesses, iterator_types = [""reduction"", ""reduction""] } func.func @full_contract1(%arg0: vector<2x3xf32>, %arg1: vector<2x3xf32>, %arg2: f32) -> f32 { %0 = vector.contract #contraction2d_trait %arg0, %arg1, %arg2 : vector<2x3xf32>, vector<2x3xf32> into f32 return %0 : f32 } #contraction2d_trans_accesses = [ affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (j, i)>, affine_map<(i, j) -> ()> ] #contraction2d_trans_trait = { indexing_maps = #contraction2d_trans_accesses, iterator_types = [""reduction"", ""reduction""] } func.func @full_contract2(%arg0: vector<2x3xf32>, %arg1: vector<3x2xf32>, %arg2: f32) -> f32 { %0 = vector.contract #contraction2d_trans_trait %arg0, %arg1, %arg2 : vector<2x3xf32>, vector<3x2xf32> into f32 return %0 : f32 } func.func @contract_one_sided_unit_reduction_dim(%arg0 : vector<1x2xi32>, %arg1 : vector<2x2xi32>, %arg2 : vector<2xi32>) -> vector<2xi32> { %res = vector.contract { indexing_maps = [ affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d1)> ], iterator_types = [""reduction"", ""parallel"", ""reduction""], kind = #vector.kind } %arg0, %arg1, %arg2 : vector<1x2xi32>, vector<2x2xi32>, vector<2xi32> into vector<2xi32> return %res : vector<2xi32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op %f2 = transform.vector.lower_contraction %f lowering_strategy = ""dot"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @extract_strided_slice_1D(%input: vector<8xf16>) -> vector<4xf16> { %0 = vector.extract_strided_slice %input {offsets = [1], sizes = [4], strides = [1]} : vector<8xf16> to vector<4xf16> return %0: vector<4xf16> }", mlir-opt -split-input-file -test-vector-extract-strided-slice-lowering ,1 "func.func @extract_strided_slice_2D(%input: vector<1x8xf16>) -> vector<1x4xf16> { %0 = vector.extract_strided_slice %input {offsets = [0, 1], sizes = [1, 4], strides = [1, 1]} : vector<1x8xf16> to vector<1x4xf16> return %0: vector<1x4xf16> }", mlir-opt -split-input-file -test-vector-extract-strided-slice-lowering ,1 "#matvec_accesses = [ affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (i)> ] #matvec_trait = { indexing_maps = #matvec_accesses, iterator_types = [""parallel"", ""reduction""] } #matvecmax_trait = { indexing_maps = #matvec_accesses, iterator_types = [""parallel"", ""reduction""], kind = #vector.kind } #mattransvec_accesses = [ affine_map<(i, j) -> (j, i)>, affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (i)> ] #mattransvec_trait = { indexing_maps = #mattransvec_accesses, iterator_types = [""parallel"", ""reduction""] } #vecmat_accesses = [ affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i)> ] #vecmat_trait = { indexing_maps = #vecmat_accesses, iterator_types = [""parallel"", ""reduction""] } #vecmattrans_accesses = [ affine_map<(i, j) -> (j)>, affine_map<(i, j) -> (j, i)>, affine_map<(i, j) -> (i)> ] #vecmattrans_trait = { indexing_maps = #vecmattrans_accesses, iterator_types = [""parallel"", ""reduction""] } #redpar_vecmattrans_accesses = [ affine_map<(i, j) -> (i)>, affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (j)> ] #redpar_vecmattrans_trait = { indexing_maps = #redpar_vecmattrans_accesses, iterator_types = [""reduction"", ""parallel""] } func.func @matvec2x2(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %A = memref.load %arg0[] : memref> %x = memref.load %arg1[] : memref> %b = memref.load %arg2[] : memref> %0 = vector.contract #matvec_trait %A, %x, %b : vector<2x2xf32>, vector<2xf32> into vector<2xf32> memref.store %0, %arg2[] : memref> return } func.func @matvecmax2x2(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %A = memref.load %arg0[] : memref> %x = memref.load %arg1[] : memref> %b = memref.load %arg2[] : memref> %0 = vector.contract #matvecmax_trait %A, %x, %b : vector<2x2xf32>, vector<2xf32> into vector<2xf32> memref.store %0, %arg2[] : memref> return } func.func @mattransvec2x2(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %A = memref.load %arg0[] : memref> %x = memref.load %arg1[] : memref> %b = memref.load %arg2[] : memref> %0 = vector.contract #mattransvec_trait %A, %x, %b : vector<2x2xf32>, vector<2xf32> into vector<2xf32> memref.store %0, %arg2[] : memref> return } func.func @vecmat2x2(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %A = memref.load %arg0[] : memref> %x = memref.load %arg1[] : memref> %b = memref.load %arg2[] : memref> %0 = vector.contract #vecmat_trait %x, %A, %b : vector<2xf32>, vector<2x2xf32> into vector<2xf32> memref.store %0, %arg2[] : memref> return } func.func @vecmattrans2x2(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %A = memref.load %arg0[] : memref> %x = memref.load %arg1[] : memref> %b = memref.load %arg2[] : memref> %0 = vector.contract #vecmattrans_trait %x, %A, %b : vector<2xf32>, vector<2x2xf32> into vector<2xf32> memref.store %0, %arg2[] : memref> return } func.func @redpar_vecmattrans2x2(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %A = memref.load %arg0[] : memref> %x = memref.load %arg1[] : memref> %b = memref.load %arg2[] : memref> %0 = vector.contract #redpar_vecmattrans_trait %x, %A, %b : vector<2xf32>, vector<2x2xf32> into vector<2xf32> memref.store %0, %arg2[] : memref> return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_contraction %module_op lowering_strategy = ""outerproduct"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_read_0d(%m: memref, %idx: index) -> f32 { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %m[%idx, %idx, %idx], %cst : memref, vector %1 = vector.extractelement %0[] : vector return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_read_0d(%m: memref, %idx: index) -> f32 { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %m[%idx, %idx, %idx], %cst : memref, vector %1 = vector.extractelement %0[] : vector return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @transfer_read_1d(%m: memref, %idx: index, %idx2: index) -> f32 { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %0 = vector.transfer_read %m[%idx, %idx, %idx], %cst {in_bounds = [true]} : memref, vector<5xf32> %1 = vector.extractelement %0[%idx2 : index] : vector<5xf32> return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_read_1d(%m: memref, %idx: index, %idx2: index) -> f32 { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %0 = vector.transfer_read %m[%idx, %idx, %idx], %cst {in_bounds = [true]} : memref, vector<5xf32> %1 = vector.extractelement %0[%idx2 : index] : vector<5xf32> return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @tensor_transfer_read_0d(%t: tensor, %idx: index) -> f32 { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %t[%idx, %idx, %idx], %cst : tensor, vector %1 = vector.extractelement %0[] : vector return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @tensor_transfer_read_0d(%t: tensor, %idx: index) -> f32 { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %t[%idx, %idx, %idx], %cst : tensor, vector %1 = vector.extractelement %0[] : vector return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @transfer_write_0d(%m: memref, %idx: index, %f: f32) { %0 = vector.broadcast %f : f32 to vector vector.transfer_write %0, %m[%idx, %idx, %idx] : vector, memref return }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_write_0d(%m: memref, %idx: index, %f: f32) { %0 = vector.broadcast %f : f32 to vector vector.transfer_write %0, %m[%idx, %idx, %idx] : vector, memref return }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @transfer_write_1d(%m: memref, %idx: index, %f: f32) { %0 = vector.broadcast %f : f32 to vector<1xf32> vector.transfer_write %0, %m[%idx, %idx, %idx] : vector<1xf32>, memref return }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_write_1d(%m: memref, %idx: index, %f: f32) { %0 = vector.broadcast %f : f32 to vector<1xf32> vector.transfer_write %0, %m[%idx, %idx, %idx] : vector<1xf32>, memref return }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @tensor_transfer_write_0d(%t: tensor, %idx: index, %f: f32) -> tensor { %0 = vector.broadcast %f : f32 to vector %1 = vector.transfer_write %0, %t[%idx, %idx, %idx] : vector, tensor return %1 : tensor }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @tensor_transfer_write_0d(%t: tensor, %idx: index, %f: f32) -> tensor { %0 = vector.broadcast %f : f32 to vector %1 = vector.transfer_write %0, %t[%idx, %idx, %idx] : vector, tensor return %1 : tensor }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @transfer_read_2d_extract(%m: memref, %idx: index, %idx2: index) -> f32 { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %0 = vector.transfer_read %m[%idx, %idx, %idx, %idx], %cst {in_bounds = [true, true]} : memref, vector<10x5xf32> %1 = vector.extract %0[8, 1] : vector<10x5xf32> return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_read_2d_extract(%m: memref, %idx: index, %idx2: index) -> f32 { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %0 = vector.transfer_read %m[%idx, %idx, %idx, %idx], %cst {in_bounds = [true, true]} : memref, vector<10x5xf32> %1 = vector.extract %0[8, 1] : vector<10x5xf32> return %1 : f32 }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @transfer_write_arith_constant(%m: memref, %idx: index) { %cst = arith.constant dense<5.000000e+00> : vector<1x1xf32> vector.transfer_write %cst, %m[%idx, %idx, %idx] : vector<1x1xf32>, memref return }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_write_arith_constant(%m: memref, %idx: index) { %cst = arith.constant dense<5.000000e+00> : vector<1x1xf32> vector.transfer_write %cst, %m[%idx, %idx, %idx] : vector<1x1xf32>, memref return }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @transfer_read_multi_use(%m: memref, %idx: index) -> (f32, f32) { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %m[%idx], %cst {in_bounds = [true]} : memref, vector<16xf32> %1 = vector.extract %0[0] : vector<16xf32> %2 = vector.extract %0[1] : vector<16xf32> return %1, %2 : f32, f32 }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @transfer_read_multi_use(%m: memref, %idx: index) -> (f32, f32) { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %m[%idx], %cst {in_bounds = [true]} : memref, vector<16xf32> %1 = vector.extract %0[0] : vector<16xf32> %2 = vector.extract %0[1] : vector<16xf32> return %1, %2 : f32, f32 }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @subvector_extract(%m: memref, %idx: index) -> vector<16xf32> { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %m[%idx, %idx], %cst {in_bounds = [true, true]} : memref, vector<8x16xf32> %1 = vector.extract %0[0] : vector<8x16xf32> return %1 : vector<16xf32> }", mlir-opt -test-scalar-vector-transfer-lowering -split-input-file ,1 "func.func @subvector_extract(%m: memref, %idx: index) -> vector<16xf32> { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_read %m[%idx, %idx], %cst {in_bounds = [true, true]} : memref, vector<8x16xf32> %1 = vector.extract %0[0] : vector<8x16xf32> return %1 : vector<16xf32> }", mlir-opt -test-scalar-vector-transfer-lowering=allow-multiple-uses -split-input-file ,1 "func.func @outerproduct_noacc(%arg0: vector<2xf32>, %arg1: vector<3xf32>) -> vector<2x3xf32> { %0 = vector.outerproduct %arg0, %arg1 : vector<2xf32>, vector<3xf32> return %0: vector<2x3xf32> } func.func @outerproduct_acc(%arg0: vector<2xf32>, %arg1: vector<3xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.outerproduct %arg0, %arg1, %arg2 : vector<2xf32>, vector<3xf32> return %0: vector<2x3xf32> } func.func @outerproduct_noacc_int(%arg0: vector<2xi32>, %arg1: vector<3xi32>) -> vector<2x3xi32> { %0 = vector.outerproduct %arg0, %arg1 : vector<2xi32>, vector<3xi32> return %0: vector<2x3xi32> } func.func @outerproduct_acc_int(%arg0: vector<2xi32>, %arg1: vector<3xi32>, %arg2: vector<2x3xi32>) -> vector<2x3xi32> { %0 = vector.outerproduct %arg0, %arg1, %arg2 : vector<2xi32>, vector<3xi32> return %0: vector<2x3xi32> } func.func @axpy_fp(%arg0: vector<16xf32>, %arg1: f32) -> vector<16xf32> { %0 = vector.outerproduct %arg0, %arg1: vector<16xf32>, f32 return %0: vector<16xf32> } func.func @axpy_fp_add(%arg0: vector<16xf32>, %arg1: f32, %arg2 : vector<16xf32>) -> vector<16xf32> { %0 = vector.outerproduct %arg0, %arg1, %arg2: vector<16xf32>, f32 return %0: vector<16xf32> } func.func @axpy_int(%arg0: vector<16xi32>, %arg1: i32) -> vector<16xi32> { %0 = vector.outerproduct %arg0, %arg1: vector<16xi32>, i32 return %0: vector<16xi32> } func.func @axpy_int_add(%arg0: vector<16xi32>, %arg1: i32, %arg2: vector<16xi32>) -> vector<16xi32> { %0 = vector.outerproduct %arg0, %arg1, %arg2: vector<16xi32>, i32 return %0: vector<16xi32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op %f2 = transform.vector.lower_outerproduct %f : (!transform.any_op) -> !transform.any_op %f3 = transform.vector.lower_broadcast %f2 : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @vector_transfer_ops_0d(%arg0: tensor, %arg1: memref) -> tensor { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[], %f0 {permutation_map = affine_map<()->()>} : tensor, vector %1 = vector.transfer_write %0, %arg0[] {permutation_map = affine_map<()->()>} : vector, tensor %2 = vector.transfer_read %arg1[], %f0 {permutation_map = affine_map<()->()>} : memref, vector vector.transfer_write %2, %arg1[] {permutation_map = affine_map<()->()>} : vector, memref return %1: tensor } func.func @vector_transfer_ops_0d_from_higher_d(%arg0: tensor, %arg1: memref) -> tensor { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0], %f0 {permutation_map = affine_map<(d0)->()>} : tensor, vector %1 = vector.transfer_write %0, %arg0[%c0] {permutation_map = affine_map<(d0)->()>} : vector, tensor %2 = vector.transfer_read %arg1[%c0, %c0], %f0 {permutation_map = affine_map<(d0, d1)->()>} : memref, vector vector.transfer_write %2, %arg1[%c0, %c0] {permutation_map = affine_map<(d0, d1)->()>} : vector, memref return %1: tensor } func.func @vector_transfer_ops(%arg0: memref, %arg1 : memref>, %arg2 : memref>, %arg3 : memref>, %arg4 : memref) { %c3 = arith.constant 3 : index %cst = arith.constant 3.0 : f32 %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : i32 %i0 = arith.constant 0 : index %i1 = arith.constant 1 : i1 %vf0 = vector.splat %f0 : vector<4x3xf32> %v0 = vector.splat %c0 : vector<4x3xi32> %vi0 = vector.splat %i0 : vector<4x3xindex> %m = arith.constant dense<[0, 0, 1, 0, 1]> : vector<5xi1> %m2 = vector.splat %i1 : vector<4x5xi1> %0 = vector.transfer_read %arg0[%c3, %c3], %f0 {permutation_map = affine_map<(d0, d1)->(d0)>} : memref, vector<128xf32> %1 = vector.transfer_read %arg0[%c3, %c3], %f0 {permutation_map = affine_map<(d0, d1)->(d1, d0)>} : memref, vector<3x7xf32> %2 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0)>} : memref, vector<128xf32> %3 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d1)>} : memref, vector<128xf32> %4 = vector.transfer_read %arg1[%c3, %c3], %vf0 {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref>, vector<1x1x4x3xf32> %5 = vector.transfer_read %arg1[%c3, %c3], %vf0 {in_bounds = [false, true]} : memref>, vector<1x1x4x3xf32> %6 = vector.transfer_read %arg2[%c3, %c3], %v0 : memref>, vector<5x24xi8> %7 = vector.transfer_read %arg3[%c3, %c3], %vi0 : memref>, vector<5x48xi8> %8 = vector.transfer_read %arg0[%c3, %c3], %f0, %m : memref, vector<5xf32> %9 = vector.transfer_read %arg4[%c3, %c3, %c3], %f0, %m2 {permutation_map = affine_map<(d0, d1, d2)->(d1, d0, 0)>} : memref, vector<5x4x8xf32> vector.transfer_write %0, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0)>} : vector<128xf32>, memref vector.transfer_write %1, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d1, d0)>} : vector<3x7xf32>, memref vector.transfer_write %4, %arg1[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : vector<1x1x4x3xf32>, memref> vector.transfer_write %5, %arg1[%c3, %c3] {in_bounds = [false, false]} : vector<1x1x4x3xf32>, memref> vector.transfer_write %6, %arg2[%c3, %c3] : vector<5x24xi8>, memref> vector.transfer_write %7, %arg3[%c3, %c3] : vector<5x48xi8>, memref> vector.transfer_write %8, %arg0[%c3, %c3], %m : vector<5xf32>, memref return } func.func @vector_transfer_ops_tensor(%arg0: tensor, %arg1 : tensor>, %arg2 : tensor>, %arg3 : tensor>) -> (tensor, tensor, tensor>, tensor>, tensor>, tensor>){ %c3 = arith.constant 3 : index %cst = arith.constant 3.0 : f32 %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : i32 %i0 = arith.constant 0 : index %vf0 = vector.splat %f0 : vector<4x3xf32> %v0 = vector.splat %c0 : vector<4x3xi32> %vi0 = vector.splat %i0 : vector<4x3xindex> %0 = vector.transfer_read %arg0[%c3, %c3], %f0 {permutation_map = affine_map<(d0, d1)->(d0)>} : tensor, vector<128xf32> %1 = vector.transfer_read %arg0[%c3, %c3], %f0 {permutation_map = affine_map<(d0, d1)->(d1, d0)>} : tensor, vector<3x7xf32> %2 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0)>} : tensor, vector<128xf32> %3 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d1)>} : tensor, vector<128xf32> %4 = vector.transfer_read %arg1[%c3, %c3], %vf0 {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : tensor>, vector<1x1x4x3xf32> %5 = vector.transfer_read %arg1[%c3, %c3], %vf0 {in_bounds = [false, true]} : tensor>, vector<1x1x4x3xf32> %6 = vector.transfer_read %arg2[%c3, %c3], %v0 : tensor>, vector<5x24xi8> %7 = vector.transfer_read %arg3[%c3, %c3], %vi0 : tensor>, vector<5x48xi8> %8 = vector.transfer_write %0, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0)>} : vector<128xf32>, tensor %9 = vector.transfer_write %1, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d1, d0)>} : vector<3x7xf32>, tensor %10 = vector.transfer_write %4, %arg1[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : vector<1x1x4x3xf32>, tensor> %11 = vector.transfer_write %5, %arg1[%c3, %c3] {in_bounds = [false, false]} : vector<1x1x4x3xf32>, tensor> %12 = vector.transfer_write %6, %arg2[%c3, %c3] : vector<5x24xi8>, tensor> %13 = vector.transfer_write %7, %arg3[%c3, %c3] : vector<5x48xi8>, tensor> return %8, %9, %10, %11, %12, %13 : tensor, tensor, tensor>, tensor>, tensor>, tensor> } func.func @vector_broadcast(%a: f32, %b: vector, %c: vector<16xf32>, %d: vector<1x16xf32>, %e: vector<8x1xf32>) -> vector<8x16xf32> { %0 = vector.broadcast %a : f32 to vector %1 = vector.broadcast %b : vector to vector<4xf32> %2 = vector.broadcast %a : f32 to vector<16xf32> %3 = vector.broadcast %c : vector<16xf32> to vector<8x16xf32> %4 = vector.broadcast %d : vector<1x16xf32> to vector<8x16xf32> %5 = vector.broadcast %e : vector<8x1xf32> to vector<8x16xf32> return %4 : vector<8x16xf32> } func.func @shuffle0D(%a: vector) -> vector<3xf32> { %1 = vector.shuffle %a, %a[0, 1, 0] : vector, vector return %1 : vector<3xf32> } func.func @shuffle1D(%a: vector<2xf32>, %b: vector<4xf32>) -> vector<2xf32> { %1 = vector.shuffle %a, %a[0, 1, 2, 3] : vector<2xf32>, vector<2xf32> %2 = vector.shuffle %1, %b[0, 1, 2] : vector<4xf32>, vector<4xf32> %3 = vector.shuffle %2, %b[0, 6] : vector<3xf32>, vector<4xf32> return %3 : vector<2xf32> } func.func @shuffle2D(%a: vector<1x4xf32>, %b: vector<2x4xf32>) -> vector<3x4xf32> { %1 = vector.shuffle %a, %b[0, 1, 2] : vector<1x4xf32>, vector<2x4xf32> return %1 : vector<3x4xf32> } func.func @extract_element_0d(%a: vector) -> f32 { %1 = vector.extractelement %a[] : vector return %1 : f32 } func.func @extract_element(%a: vector<16xf32>) -> f32 { %c = arith.constant 15 : i32 %1 = vector.extractelement %a[%c : i32] : vector<16xf32> return %1 : f32 } func.func @extract(%arg0: vector<4x8x16xf32>) -> (vector<4x8x16xf32>, vector<8x16xf32>, vector<16xf32>, f32) { %0 = vector.extract %arg0[] : vector<4x8x16xf32> %1 = vector.extract %arg0[3] : vector<4x8x16xf32> %2 = vector.extract %arg0[3, 3] : vector<4x8x16xf32> %3 = vector.extract %arg0[3, 3, 3] : vector<4x8x16xf32> return %0, %1, %2, %3 : vector<4x8x16xf32>, vector<8x16xf32>, vector<16xf32>, f32 } func.func @insert_element_0d(%a: f32, %b: vector) -> vector { %1 = vector.insertelement %a, %b[] : vector return %1 : vector } func.func @insert_element(%a: f32, %b: vector<16xf32>) -> vector<16xf32> { %c = arith.constant 15 : i32 %1 = vector.insertelement %a, %b[%c : i32] : vector<16xf32> return %1 : vector<16xf32> } func.func @insert(%a: f32, %b: vector<16xf32>, %c: vector<8x16xf32>, %res: vector<4x8x16xf32>) -> vector<4x8x16xf32> { %1 = vector.insert %c, %res[3] : vector<8x16xf32> into vector<4x8x16xf32> %2 = vector.insert %b, %res[3, 3] : vector<16xf32> into vector<4x8x16xf32> %3 = vector.insert %a, %res[3, 3, 3] : f32 into vector<4x8x16xf32> %4 = vector.insert %3, %3[] : vector<4x8x16xf32> into vector<4x8x16xf32> return %4 : vector<4x8x16xf32> } func.func @outerproduct(%arg0: vector<4xf32>, %arg1: vector<8xf32>, %arg2: vector<4x8xf32>) -> vector<4x8xf32> { %0 = vector.outerproduct %arg0, %arg1 : vector<4xf32>, vector<8xf32> %1 = vector.outerproduct %arg0, %arg1, %arg2 : vector<4xf32>, vector<8xf32> return %1 : vector<4x8xf32> } func.func @insert_strided_slice(%a: vector<4x4xf32>, %b: vector<4x8x16xf32>) { %1 = vector.insert_strided_slice %a, %b {offsets = [2, 2, 2], strides = [1, 1]} : vector<4x4xf32> into vector<4x8x16xf32> return } func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) -> vector<2x2x16xf32> { %1 = vector.extract_strided_slice %arg0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8x16xf32> to vector<2x2x16xf32> return %1: vector<2x2x16xf32> } #contraction_to_scalar_accesses = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> ()> ] #contraction_to_scalar_trait = { indexing_maps = #contraction_to_scalar_accesses, iterator_types = [""reduction""] } func.func @contraction_to_scalar(%arg0: vector<10xf32>, %arg1: vector<10xf32>) -> f32 { %f0 = arith.constant 0.0: f32 %0 = vector.contract #contraction_to_scalar_trait %arg0, %arg1, %f0 : vector<10xf32>, vector<10xf32> into f32 return %0 : f32 } func.func @contraction_extra_attrs(%arg0: vector<10xf32>, %arg1: vector<10xf32>) -> f32 { %f0 = arith.constant 0.0: f32 %0 = vector.contract #contraction_to_scalar_trait %arg0, %arg1, %f0 {first_attr = 1 : i32, second_attr = ""string""} : vector<10xf32>, vector<10xf32> into f32 return %0 : f32 } #contraction_to_scalar_max_accesses = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> ()> ] #contraction_to_scalar_max_trait = { indexing_maps = #contraction_to_scalar_max_accesses, iterator_types = [""reduction""], kind = #vector.kind } func.func @contraction_to_scalar_with_max(%arg0: vector<10xf32>, %arg1: vector<10xf32>) -> f32 { %f0 = arith.constant 0.0: f32 %0 = vector.contract #contraction_to_scalar_max_trait %arg0, %arg1, %f0 : vector<10xf32>, vector<10xf32> into f32 return %0 : f32 } #contraction_accesses0 = [ affine_map<(b0, f0, f1, c0, c1) -> (c0, b0, c1, f0)>, affine_map<(b0, f0, f1, c0, c1) -> (b0, c1, c0, f1)>, affine_map<(b0, f0, f1, c0, c1) -> (b0, f0, f1)> ] #contraction_trait0 = { indexing_maps = #contraction_accesses0, iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction"", ""reduction""] } #contraction_accesses1 = [ affine_map<(f0, f1, f2, f3, c0, c1) -> (c0, f0, c1, f2)>, affine_map<(f0, f1, f2, f3, c0, c1) -> (f1, c1, c0, f3)>, affine_map<(f0, f1, f2, f3, c0, c1) -> (f0, f1, f2, f3)> ] #iterator_types1 = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""reduction"", ""reduction""] #contraction_trait1 = { indexing_maps = #contraction_accesses1, iterator_types = #iterator_types1 } #contraction_trait2 = { indexing_maps = #contraction_accesses1, iterator_types = #iterator_types1, kind = #vector.kind } func.func @contraction(%arg0 : vector<7x8x16x15xf32>, %arg1 : vector<8x16x7x5xf32>, %arg2 : vector<8x15x5xf32>, %arg3 : vector<8x8x15x5xf32>, %arg4 : vector<7x8x16x15xf16>, %arg5 : vector<8x16x7x5xf16>) { %0 = vector.contract #contraction_trait0 %arg0, %arg1, %arg2 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x15x5xf32> %1 = vector.contract #contraction_trait1 %arg0, %arg1, %arg3 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x8x15x5xf32> %3 = vector.contract #contraction_trait1 %arg4, %arg5, %arg3 : vector<7x8x16x15xf16>, vector<8x16x7x5xf16> into vector<8x8x15x5xf32> %4 = vector.contract #contraction_trait2 %arg0, %arg1, %arg3 : vector<7x8x16x15xf32>, vector<8x16x7x5xf32> into vector<8x8x15x5xf32> return } func.func @create_vector_mask() { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %0 = vector.create_mask %c3, %c2 : vector<4x3xi1> return } func.func @constant_vector_mask_0d() { %0 = vector.constant_mask [0] : vector %1 = vector.constant_mask [1] : vector return } func.func @constant_vector_mask() { %0 = vector.constant_mask [3, 2] : vector<4x3xi1> %1 = vector.constant_mask [0] : vector<[4]xi1> return } func.func @vector_print_on_vector(%arg0: vector<8x4xf32>) { vector.print %arg0 : vector<8x4xf32> return } func.func @vector_print_on_scalar(%arg0: i64) { vector.print %arg0 : i64 return } func.func @reshape(%arg0 : vector<3x2x4xf32>) -> (vector<2x3x4xf32>) { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c9 = arith.constant 9 : index %1 = vector.reshape %arg0, [%c3, %c6], [%c2, %c9], [4] : vector<3x2x4xf32> to vector<2x3x4xf32> return %1 : vector<2x3x4xf32> } func.func @shape_cast(%arg0 : vector<5x1x3x2xf32>, %arg1 : vector<8x1xf32>, %arg2 : vector<16x1x1xf32>) -> (vector<15x2xf32>, vector<8xf32>, vector<16xf32>, vector<16x1xf32>) { %0 = vector.shape_cast %arg0 : vector<5x1x3x2xf32> to vector<15x2xf32> %1 = vector.shape_cast %arg1 : vector<8x1xf32> to vector<8xf32> %2 = vector.shape_cast %arg2 : vector<16x1x1xf32> to vector<16xf32> %3 = vector.shape_cast %arg2 : vector<16x1x1xf32> to vector<16x1xf32> return %0, %1, %2, %3 : vector<15x2xf32>, vector<8xf32>, vector<16xf32>, vector<16x1xf32> } func.func @shape_cast_0d(%arg0 : vector<1x1x1x1xf32>) -> (vector<1x1x1x1xf32>) { %0 = vector.shape_cast %arg0 : vector<1x1x1x1xf32> to vector %1 = vector.shape_cast %0 : vector to vector<1x1x1x1xf32> return %1 : vector<1x1x1x1xf32> } func.func @bitcast(%arg0 : vector<5x1x3x2xf32>, %arg1 : vector<8x1xi32>, %arg2 : vector<16x1x8xi8>, %arg3 : vector<8x2x1xindex>, %arg4 : vector) -> (vector<5x1x3x4xf16>, vector<5x1x3x8xi8>, vector<8x4xi8>, vector<8x1xf32>, vector<16x1x2xi32>, vector<16x1x4xi16>, vector<16x1x1xindex>, vector<8x2x2xf32>, vector) { %0 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x1x3x4xf16> %1 = vector.bitcast %arg0 : vector<5x1x3x2xf32> to vector<5x1x3x8xi8> %2 = vector.bitcast %arg1 : vector<8x1xi32> to vector<8x4xi8> %3 = vector.bitcast %arg1 : vector<8x1xi32> to vector<8x1xf32> %4 = vector.bitcast %arg2 : vector<16x1x8xi8> to vector<16x1x2xi32> %5 = vector.bitcast %arg2 : vector<16x1x8xi8> to vector<16x1x4xi16> %6 = vector.bitcast %arg2 : vector<16x1x8xi8> to vector<16x1x1xindex> %7 = vector.bitcast %arg3 : vector<8x2x1xindex> to vector<8x2x2xf32> %8 = vector.bitcast %arg4 : vector to vector return %0, %1, %2, %3, %4, %5, %6, %7, %8 : vector<5x1x3x4xf16>, vector<5x1x3x8xi8>, vector<8x4xi8>, vector<8x1xf32>, vector<16x1x2xi32>, vector<16x1x4xi16>, vector<16x1x1xindex>, vector<8x2x2xf32>, vector } func.func @vector_fma(%a: vector<8xf32>, %b: vector<8x4xf32>, %c: vector) { vector.fma %a, %a, %a : vector<8xf32> vector.fma %b, %b, %b : vector<8x4xf32> vector.fma %c, %c, %c : vector return } func.func @reduce_fp(%arg0: vector<16xf32>, %arg1: f32) -> f32 { vector.reduction , %arg0 : vector<16xf32> into f32 vector.reduction , %arg0, %arg1 : vector<16xf32> into f32 vector.reduction , %arg0 : vector<16xf32> into f32 vector.reduction , %arg0, %arg1 : vector<16xf32> into f32 vector.reduction , %arg0 : vector<16xf32> into f32 %0 = vector.reduction , %arg0 : vector<16xf32> into f32 return %0 : f32 } func.func @reduce_int(%arg0: vector<16xi32>) -> i32 { vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 vector.reduction , %arg0 : vector<16xi32> into i32 %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 } func.func @reduce_int_0d(%arg0: vector) -> i32 { vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 vector.reduction , %arg0 : vector into i32 %0 = vector.reduction , %arg0 : vector into i32 return %0 : i32 } func.func @transpose_fp(%arg0: vector<3x7xf32>) -> vector<7x3xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<3x7xf32> to vector<7x3xf32> return %0 : vector<7x3xf32> } func.func @transpose_int(%arg0: vector<11x7x3x2xi32>) -> vector<2x11x7x3xi32> { %0 = vector.transpose %arg0, [3, 0, 1, 2] : vector<11x7x3x2xi32> to vector<2x11x7x3xi32> return %0 : vector<2x11x7x3xi32> } func.func @transpose_fp_0d(%arg0: vector) -> vector { %0 = vector.transpose %arg0, [] : vector to vector return %0 : vector } func.func @transpose_int_0d(%arg0: vector) -> vector { %0 = vector.transpose %arg0, [] : vector to vector return %0 : vector } func.func @flat_transpose_fp(%arg0: vector<16xf32>) -> vector<16xf32> { %0 = vector.flat_transpose %arg0 { rows = 4: i32, columns = 4: i32 } : vector<16xf32> -> vector<16xf32> return %0 : vector<16xf32> } func.func @flat_transpose_int(%arg0: vector<16xi32>) -> vector<16xi32> { %0 = vector.flat_transpose %arg0 { rows = 2: i32, columns = 8: i32 } : vector<16xi32> -> vector<16xi32> return %0 : vector<16xi32> } func.func @vector_load_and_store_1d_scalar_memref(%memref : memref<200x100xf32>, %i : index, %j : index) { %0 = vector.load %memref[%i, %j] : memref<200x100xf32>, vector<8xf32> vector.store %0, %memref[%i, %j] : memref<200x100xf32>, vector<8xf32> return } func.func @vector_load_and_store_1d_vector_memref(%memref : memref<200x100xvector<8xf32>>, %i : index, %j : index) { %0 = vector.load %memref[%i, %j] : memref<200x100xvector<8xf32>>, vector<8xf32> vector.store %0, %memref[%i, %j] : memref<200x100xvector<8xf32>>, vector<8xf32> return } func.func @vector_load_and_store_scalable_vector_memref(%v: vector<[4]xi32>, %m: memref) -> vector<[4]xi32> { %c0 = arith.constant 0 : index %0 = vector.load %m[%c0] : memref, vector<[4]xi32> vector.store %v, %m[%c0] : memref, vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @vector_load_and_store_1d_scalable_vector_memref(%memref : memref<200x100xvector<8xf32>>, %i : index, %j : index) { %0 = vector.load %memref[%i, %j] : memref<200x100xvector<8xf32>>, vector<8xf32> vector.store %0, %memref[%i, %j] : memref<200x100xvector<8xf32>>, vector<8xf32> return } func.func @vector_load_and_store_out_of_bounds(%memref : memref<7xf32>) { %c0 = arith.constant 0 : index %0 = vector.load %memref[%c0] : memref<7xf32>, vector<8xf32> vector.store %0, %memref[%c0] : memref<7xf32>, vector<8xf32> return } func.func @vector_load_and_store_2d_scalar_memref(%memref : memref<200x100xf32>, %i : index, %j : index) { %0 = vector.load %memref[%i, %j] : memref<200x100xf32>, vector<4x8xf32> vector.store %0, %memref[%i, %j] : memref<200x100xf32>, vector<4x8xf32> return } func.func @vector_load_and_store_2d_vector_memref(%memref : memref<200x100xvector<4x8xf32>>, %i : index, %j : index) { %0 = vector.load %memref[%i, %j] : memref<200x100xvector<4x8xf32>>, vector<4x8xf32> vector.store %0, %memref[%i, %j] : memref<200x100xvector<4x8xf32>>, vector<4x8xf32> return } func.func @masked_load_and_store(%base: memref, %mask: vector<16xi1>, %passthru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.maskedload %base[%c0], %mask, %passthru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> vector.maskedstore %base[%c0], %mask, %0 : memref, vector<16xi1>, vector<16xf32> return } func.func @masked_load_and_store2d(%base: memref, %mask: vector<16xi1>, %passthru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.maskedload %base[%c0, %c0], %mask, %passthru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> vector.maskedstore %base[%c0, %c0], %mask, %0 : memref, vector<16xi1>, vector<16xf32> return } func.func @gather_and_scatter(%base: memref, %v: vector<16xi32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : memref, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> vector.scatter %base[%c0][%v], %mask, %0 : memref, vector<16xi32>, vector<16xi1>, vector<16xf32> return } func.func @gather_and_scatter2d(%base: memref, %v: vector<16xi32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0, %c0][%v], %mask, %pass_thru : memref, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> vector.scatter %base[%c0, %c0][%v], %mask, %0 : memref, vector<16xi32>, vector<16xi1>, vector<16xf32> return } func.func @gather_on_tensor(%base: tensor, %v: vector<16xi32>, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<16xi32>, vector<16xi1>, vector<16xf32> into vector<16xf32> return %0 : vector<16xf32> } func.func @gather_multi_dims(%base: tensor, %v: vector<2x16xi32>, %mask: vector<2x16xi1>, %pass_thru: vector<2x16xf32>) -> vector<2x16xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2x16xi32>, vector<2x16xi1>, vector<2x16xf32> into vector<2x16xf32> return %0 : vector<2x16xf32> } func.func @expand_and_compress(%base: memref, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.expandload %base[%c0], %mask, %pass_thru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> vector.compressstore %base[%c0], %mask, %0 : memref, vector<16xi1>, vector<16xf32> return } func.func @expand_and_compress2d(%base: memref, %mask: vector<16xi1>, %pass_thru: vector<16xf32>) { %c0 = arith.constant 0 : index %0 = vector.expandload %base[%c0, %c0], %mask, %pass_thru : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> vector.compressstore %base[%c0, %c0], %mask, %0 : memref, vector<16xi1>, vector<16xf32> return } func.func @multi_reduction(%0: vector<4x8x16x32xf32>, %acc0: vector<4x16xf32>, %acc1: f32) -> f32 { %1 = vector.multi_reduction , %0, %acc0 [1, 3] : vector<4x8x16x32xf32> to vector<4x16xf32> %2 = vector.multi_reduction , %1, %acc1 [0, 1] : vector<4x16xf32> to f32 return %2 : f32 } func.func @get_vector_scale() -> index { %0 = vector.vscale return %0 : index } func.func @vector_scan(%0: vector<4x8x16x32xf32>) -> vector<4x8x16x32xf32> { %1 = arith.constant dense<0.0> : vector<4x16x32xf32> %2:2 = vector.scan , %0, %1 {reduction_dim = 1 : i64, inclusive = true} : vector<4x8x16x32xf32>, vector<4x16x32xf32> return %2#0 : vector<4x8x16x32xf32> } func.func @test_splat_op(%s : f32) { %v = vector.splat %s : vector<8xf32> %u = ""vector.splat""(%s) : (f32) -> vector<4xf32> return } func.func @vector_splat_0d(%a: f32) -> vector { %0 = vector.splat %a : vector return %0 : vector } func.func @warp_execute_on_lane_0(%laneid: index) { vector.warp_execute_on_lane_0(%laneid)[32] { } return } func.func @warp_operand_result(%laneid: index, %v0 : vector<4xi32>) -> (vector<4xi32>) { %2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0 : vector<4xi32>) -> (vector<4xi32>) { ^bb0(%arg0 : vector<128xi32>) : %0 = arith.constant dense<2>: vector<128xi32> %1 = arith.addi %arg0, %0 : vector<128xi32> vector.yield %1 : vector<128xi32> } return %2 : vector<4xi32> } func.func @vector_mask(%a: vector<8xi32>, %m0: vector<8xi1>) -> i32 { %0 = vector.mask %m0 { vector.reduction , %a : vector<8xi32> into i32 } : vector<8xi1> -> i32 return %0 : i32 } func.func @vector_mask_passthru(%t0: tensor, %idx: index, %m0: vector<16xi1>, %pt0: vector<16xf32>) -> vector<16xf32> { %ft0 = arith.constant 0.0 : f32 %0 = vector.mask %m0, %pt0 { vector.transfer_read %t0[%idx], %ft0 : tensor, vector<16xf32> } : vector<16xi1> -> vector<16xf32> return %0 : vector<16xf32> } func.func @vector_mask_no_return(%val: vector<16xf32>, %t0: memref, %idx: index, %m0: vector<16xi1>) { vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, memref } : vector<16xi1> return } func.func @vector_mask_tensor_return(%val: vector<16xf32>, %t0: tensor, %idx: index, %m0: vector<16xi1>) { vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor } : vector<16xi1> -> tensor return } func.func @vector_mask_empty(%m0: vector<16xi1>) { vector.mask %m0 { } : vector<16xi1> return } func.func @vector_mask_empty_with_yield(%m0: vector<16xi1>) { vector.mask %m0 { vector.yield } : vector<16xi1> return } func.func @vector_mask_empty_return(%m0: vector<16xi1>, %arg0: vector<16xf32>) -> vector<16xf32> { %0 = vector.mask %m0 { vector.yield %arg0 : vector<16xf32> } : vector<16xi1> -> vector<16xf32> return %0 : vector<16xf32> } func.func @vector_scalable_insert(%sub0: vector<4xi32>, %sub1: vector<8xi32>, %sub2: vector<[4]xi32>, %sv: vector<[8]xi32>) { %0 = vector.scalable.insert %sub0, %sv[12] : vector<4xi32> into vector<[8]xi32> %1 = vector.scalable.insert %sub1, %sv[0] : vector<8xi32> into vector<[8]xi32> %2 = vector.scalable.insert %sub2, %sv[0] : vector<[4]xi32> into vector<[8]xi32> return } func.func @vector_scalable_extract(%sv: vector<[8]xi32>) { %0 = vector.scalable.extract %sv[0] : vector<16xi32> from vector<[8]xi32> %1 = vector.scalable.extract %sv[0] : vector<[4]xi32> from vector<[8]xi32> %2 = vector.scalable.extract %sv[4] : vector<4xi32> from vector<[8]xi32> return }", mlir-opt | mlir-opt ,1 "func.func @mask(%t0: tensor, %val: vector<16xf32>, %idx: index, %m0: vector<16xi1>) -> tensor { %0 = vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor } : vector<16xi1> -> tensor return %0 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries"" -split-input-file ",1 "func.func @split_vector_transfer_read_2d(%A: memref, %i: index, %j: index) -> vector<4x8xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %1 = vector.transfer_read %A[%i, %j], %f0 : memref, vector<4x8xf32> return %1: vector<4x8xf32> } func.func @split_vector_transfer_read_strided_2d( %A: memref<7x8xf32, strided<[?, 1], offset: ?>>, %i: index, %j: index) -> vector<4x8xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %1 = vector.transfer_read %A[%i, %j], %f0 : memref<7x8xf32, strided<[?, 1], offset: ?>>, vector<4x8xf32> return %1 : vector<4x8xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""linalg-copy"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @split_vector_transfer_write_2d(%V: vector<4x8xf32>, %A: memref, %i: index, %j: index) { vector.transfer_write %V, %A[%i, %j] : vector<4x8xf32>, memref return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""linalg-copy"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @split_vector_transfer_write_strided_2d( %V: vector<4x8xf32>, %A: memref<7x8xf32, strided<[?, 1], offset: ?>>, %i: index, %j: index) { vector.transfer_write %V, %A[%i, %j] : vector<4x8xf32>, memref<7x8xf32, strided<[?, 1], offset: ?>> return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.split_transfer_full_partial %module_op split_transfer_strategy = ""linalg-copy"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @vector_multi_reduction(%arg0: vector<2x4xf32>, %acc: vector<2xf32>) -> vector<2xf32> { %0 = vector.multi_reduction , %arg0, %acc [1] : vector<2x4xf32> to vector<2xf32> return %0 : vector<2xf32> }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vector_multi_reduction_to_scalar(%arg0: vector<2x4xf32>, %acc: f32) -> f32 { %0 = vector.multi_reduction , %arg0, %acc [0, 1] : vector<2x4xf32> to f32 return %0 : f32 }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vector_reduction_inner(%arg0: vector<2x3x4x5xi32>, %acc: vector<2x3xi32>) -> vector<2x3xi32> { %0 = vector.multi_reduction , %arg0, %acc [2, 3] : vector<2x3x4x5xi32> to vector<2x3xi32> return %0 : vector<2x3xi32> }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vector_multi_reduction_transposed(%arg0: vector<2x3x4x5xf32>, %acc: vector<2x5xf32>) -> vector<2x5xf32> { %0 = vector.multi_reduction , %arg0, %acc [1, 2] : vector<2x3x4x5xf32> to vector<2x5xf32> return %0 : vector<2x5xf32> }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vector_multi_reduction_ordering(%arg0: vector<3x2x4xf32>, %acc: vector<2x4xf32>) -> vector<2x4xf32> { %0 = vector.multi_reduction , %arg0, %acc [0] : vector<3x2x4xf32> to vector<2x4xf32> return %0 : vector<2x4xf32> }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vectorize_dynamic_reduction(%arg0: tensor, %arg1: tensor) -> tensor { %c0 = arith.constant 0 : index %dim = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %dim_0 = tensor.dim %arg0, %c1 : tensor %c0_1 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = vector.create_mask %dim, %dim_0 : vector<4x8xi1> %1 = vector.mask %0 { vector.transfer_read %arg0[%c0_1, %c0_1], %cst {in_bounds = [true, true]} : tensor, vector<4x8xf32> } : vector<4x8xi1> -> vector<4x8xf32> %cst_2 = arith.constant 0.000000e+00 : f32 %2 = vector.create_mask %dim : vector<4xi1> %3 = vector.mask %2 { vector.transfer_read %arg1[%c0_1], %cst_2 {in_bounds = [true]} : tensor, vector<4xf32> } : vector<4xi1> -> vector<4xf32> %4 = vector.mask %0 { vector.multi_reduction , %1, %3 [1] : vector<4x8xf32> to vector<4xf32> } : vector<4x8xi1> -> vector<4xf32> %c0_3 = arith.constant 0 : index %5 = vector.mask %2 { vector.transfer_write %4, %arg1[%c0_3] {in_bounds = [true]} : vector<4xf32>, tensor } : vector<4xi1> -> tensor return %5 : tensor }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vectorize_1d_dynamic_reduction(%arg0: tensor) -> f32 { %c0 = arith.constant 0 : index %dim = tensor.dim %arg0, %c0 : tensor %c0_1 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = vector.create_mask %dim : vector<8xi1> %1 = vector.mask %0 { vector.transfer_read %arg0[%c0_1], %cst {in_bounds = [true]} : tensor, vector<8xf32> } : vector<8xi1> -> vector<8xf32> %4 = vector.mask %0 { vector.multi_reduction , %1, %cst [0] : vector<8xf32> to f32 } : vector<8xi1> -> f32 return %4 : f32 }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vectorize_dynamic_transpose_reduction(%arg0: tensor, %arg1: tensor) -> tensor { %c0 = arith.constant 0 : index %dim = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %dim_0 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %dim_1 = tensor.dim %arg0, %c2 : tensor %c0_2 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = vector.create_mask %dim, %dim_0, %dim_1 : vector<4x8x16xi1> %1 = vector.mask %0 { vector.transfer_read %arg0[%c0_2, %c0_2, %c0_2], %cst {in_bounds = [true, true, true]} : tensor, vector<4x8x16xf32> } : vector<4x8x16xi1> -> vector<4x8x16xf32> %cst_3 = arith.constant 0.000000e+00 : f32 %2 = vector.create_mask %dim_1, %dim_0 : vector<16x8xi1> %3 = vector.mask %2 { vector.transfer_read %arg1[%c0_2, %c0_2], %cst_3 {in_bounds = [true, true], permutation_map = affine_map<(d0, d1) -> (d1, d0)>} : tensor, vector<8x16xf32> } : vector<16x8xi1> -> vector<8x16xf32> %4 = vector.mask %0 { vector.multi_reduction , %1, %3 [0] : vector<4x8x16xf32> to vector<8x16xf32> } : vector<4x8x16xi1> -> vector<8x16xf32> %c0_4 = arith.constant 0 : index %5 = vector.mask %2 { vector.transfer_write %4, %arg1[%c0_4, %c0_4] {in_bounds = [true, true], permutation_map = affine_map<(d0, d1) -> (d1, d0)>} : vector<8x16xf32>, tensor } : vector<16x8xi1> -> tensor return %5 : tensor }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @vector_multi_reduction_parallel_middle(%arg0: vector<3x4x5xf32>, %acc: vector<4xf32>) -> vector<4xf32> { %0 = vector.multi_reduction , %arg0, %acc [0, 2] : vector<3x4x5xf32> to vector<4xf32> return %0 : vector<4xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_multi_reduction %module_op lowering_strategy = ""innerreduction"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @transpose23(%arg0: vector<2x3xf32>) -> vector<3x2xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<2x3xf32> to vector<3x2xf32> return %0 : vector<3x2xf32> } func.func @transpose102_1x8x8xf32(%arg0: vector<1x8x8xf32>) -> vector<8x1x8xf32> { %0 = vector.transpose %arg0, [1, 0, 2] : vector<1x8x8xf32> to vector<8x1x8xf32> return %0 : vector<8x1x8xf32> } func.func @transpose102_8x1x8xf32(%arg0: vector<8x1x8xf32>) -> vector<1x8x8xf32> { %0 = vector.transpose %arg0, [1, 0, 2] : vector<8x1x8xf32> to vector<1x8x8xf32> return %0 : vector<1x8x8xf32> } func.func @transpose1023_1x1x8x8xf32(%arg0: vector<1x1x8x8xf32>) -> vector<1x1x8x8xf32> { %0 = vector.transpose %arg0, [1, 0, 2, 3] : vector<1x1x8x8xf32> to vector<1x1x8x8xf32> return %0 : vector<1x1x8x8xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_transpose %module_op lowering_strategy = ""eltwise"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transpose(%arg0: vector<2x4xf32>) -> vector<4x2xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<2x4xf32> to vector<4x2xf32> return %0 : vector<4x2xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_transpose %module_op lowering_strategy = ""shuffle_1d"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transpose(%arg0: vector<2x4xf32>) -> vector<4x2xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<2x4xf32> to vector<4x2xf32> return %0 : vector<4x2xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_transpose %module_op lowering_strategy = ""flat_transpose"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transpose4x8xf32(%arg0: vector<4x8xf32>) -> vector<8x4xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<4x8xf32> to vector<8x4xf32> return %0 : vector<8x4xf32> } func.func @transpose021_1x4x8xf32(%arg0: vector<1x4x8xf32>) -> vector<1x8x4xf32> { %0 = vector.transpose %arg0, [0, 2, 1] : vector<1x4x8xf32> to vector<1x8x4xf32> return %0 : vector<1x8x4xf32> } func.func @transpose8x8xf32(%arg0: vector<8x8xf32>) -> vector<8x8xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<8x8xf32> to vector<8x8xf32> return %0 : vector<8x8xf32> } func.func @transpose021_1x8x8xf32(%arg0: vector<1x8x8xf32>) -> vector<1x8x8xf32> { %0 = vector.transpose %arg0, [0, 2, 1] : vector<1x8x8xf32> to vector<1x8x8xf32> return %0 : vector<1x8x8xf32> } func.func @transpose120_8x1x8xf32(%arg0: vector<8x1x8xf32>) -> vector<1x8x8xf32> { %0 = vector.transpose %arg0, [1, 2, 0] : vector<8x1x8xf32> to vector<1x8x8xf32> return %0 : vector<1x8x8xf32> } func.func @transpose120_8x8x1xf32(%arg0: vector<8x8x1xf32>) -> vector<8x1x8xf32> { %0 = vector.transpose %arg0, [1, 2, 0] : vector<8x8x1xf32> to vector<8x1x8xf32> return %0 : vector<8x1x8xf32> } func.func @transpose102_8x8x1xf32(%arg0: vector<8x8x1xf32>) -> vector<8x8x1xf32> { %0 = vector.transpose %arg0, [1, 0, 2] : vector<8x8x1xf32> to vector<8x8x1xf32> return %0 : vector<8x8x1xf32> } func.func @transpose201_8x1x8xf32(%arg0: vector<8x1x8xf32>) -> vector<8x8x1xf32> { %0 = vector.transpose %arg0, [2, 0, 1] : vector<8x1x8xf32> to vector<8x8x1xf32> return %0 : vector<8x8x1xf32> } func.func @transpose201_1x8x8xf32(%arg0: vector<1x8x8xf32>) -> vector<8x1x8xf32> { %0 = vector.transpose %arg0, [2, 0, 1] : vector<1x8x8xf32> to vector<8x1x8xf32> return %0 : vector<8x1x8xf32> } func.func @transpose210_8x1x8xf32(%arg0: vector<8x1x8xf32>) -> vector<8x1x8xf32> { %0 = vector.transpose %arg0, [2, 1, 0] : vector<8x1x8xf32> to vector<8x1x8xf32> return %0 : vector<8x1x8xf32> } func.func @transpose210_8x8x1xf32(%arg0: vector<8x8x1xf32>) -> vector<1x8x8xf32> { %0 = vector.transpose %arg0, [2, 1, 0] : vector<8x8x1xf32> to vector<1x8x8xf32> return %0 : vector<1x8x8xf32> } func.func @transpose210_1x8x8xf32(%arg0: vector<1x8x8xf32>) -> vector<8x8x1xf32> { %0 = vector.transpose %arg0, [2, 1, 0] : vector<1x8x8xf32> to vector<8x8x1xf32> return %0 : vector<8x8x1xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_transpose %module_op avx2_lowering_strategy = true : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transpose_shuffle16x16xf32(%arg0: vector<16x16xf32>) -> vector<16x16xf32> { %0 = vector.transpose %arg0, [1, 0] : vector<16x16xf32> to vector<16x16xf32> return %0 : vector<16x16xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_transpose %module_op lowering_strategy = ""shuffle_16x16"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transpose021_shuffle16x16xf32(%arg0: vector<1x16x16xf32>) -> vector<1x16x16xf32> { %0 = vector.transpose %arg0, [0, 2, 1] : vector<1x16x16xf32> to vector<1x16x16xf32> return %0 : vector<1x16x16xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.lower_transpose %module_op lowering_strategy = ""shuffle_16x16"" : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @add4x2(%0: vector<4x2xf32>) -> vector<4x2xf32> { %1 = arith.addf %0, %0: vector<4x2xf32> return %1: vector<4x2xf32> } func.func @add4x4(%0: vector<4x4xf32>, %1: vector<4x4xf32>) -> vector<4x4xf32> { %2 = arith.addf %0, %1: vector<4x4xf32> %3 = arith.addf %1, %2: vector<4x4xf32> return %3: vector<4x4xf32> } #contraction_accesses1 = [ affine_map<(i, k, j) -> (i, k)>, affine_map<(i, k, j) -> (k, j)>, affine_map<(i, k, j) -> (i, j)> ] #contraction_trait1 = { indexing_maps = #contraction_accesses1, iterator_types = [""parallel"", ""reduction"", ""parallel""] } func.func @contraction4x4_ikj_xfer_read(%arg0 : memref<4x2xf32>, %arg1 : memref<2x4xf32>, %arg2 : memref<4x4xf32>) { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 { permutation_map = affine_map<(d0, d1) -> (d0, d1)> } : memref<4x2xf32>, vector<4x2xf32> %1 = vector.transfer_read %arg1[%c0, %c0], %cf0 { permutation_map = affine_map<(d0, d1) -> (d0, d1)> } : memref<2x4xf32>, vector<2x4xf32> %2 = vector.transfer_read %arg2[%c0, %c0], %cf0 { permutation_map = affine_map<(d0, d1) -> (d0, d1)> } : memref<4x4xf32>, vector<4x4xf32> %3 = vector.contract #contraction_trait1 %0, %1, %2 : vector<4x2xf32>, vector<2x4xf32> into vector<4x4xf32> vector.transfer_write %3, %arg2[%c0, %c0] {permutation_map = affine_map<(d0, d1) -> (d0, d1)>} : vector<4x4xf32>, memref<4x4xf32> return } func.func @vector_transfers(%arg0: index, %arg1: index) { %cst = arith.constant 0.000000e+00 : f32 %0 = memref.alloc(%arg0, %arg1) : memref %1 = memref.alloc(%arg0, %arg1) : memref %2 = memref.alloc(%arg0, %arg1) : memref %cst_0 = arith.constant 1.000000e+00 : f32 %cst_1 = arith.constant 2.000000e+00 : f32 affine.for %arg2 = 0 to %arg0 step 4 { affine.for %arg3 = 0 to %arg1 step 4 { %4 = vector.transfer_read %0[%arg2, %arg3], %cst {permutation_map = affine_map<(d0, d1) -> (d0, d1)>} : memref, vector<4x4xf32> %5 = vector.transfer_read %1[%arg2, %arg3], %cst {permutation_map = affine_map<(d0, d1) -> (d0, d1)>} : memref, vector<4x4xf32> %6 = arith.addf %4, %5 : vector<4x4xf32> vector.transfer_write %6, %2[%arg2, %arg3] {permutation_map = affine_map<(d0, d1) -> (d0, d1)>} : vector<4x4xf32>, memref } } return } func.func @cancelling_shape_cast_ops(%arg0 : vector<2x4xf32>) -> vector<2x4xf32> { %0 = vector.shape_cast %arg0 : vector<2x4xf32> to vector<8xf32> %1 = vector.shape_cast %0 : vector<8xf32> to vector<2x4xf32> return %1 : vector<2x4xf32> } func.func @elementwise_unroll(%arg0 : memref<4x4xf32>, %arg1 : memref<4x4xf32>) { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> %1 = vector.transfer_read %arg1[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> %cond = arith.cmpf ult, %0, %1 : vector<4x4xf32> %2 = vector.transfer_read %arg0[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> %3 = vector.transfer_read %arg1[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> %4 = arith.select %cond, %2, %3 : vector<4x4xi1>, vector<4x4xf32> vector.transfer_write %4, %arg0[%c0, %c0] : vector<4x4xf32>, memref<4x4xf32> return } func.func @contraction4x4_ikj_xfer_read_tensor(%arg0 : tensor<4x2xf32>, %arg1 : tensor<2x4xf32>, %arg2 : tensor<4x4xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : tensor<4x2xf32>, vector<4x2xf32> %1 = vector.transfer_read %arg1[%c0, %c0], %cf0 : tensor<2x4xf32>, vector<2x4xf32> %2 = vector.transfer_read %arg2[%c0, %c0], %cf0 : tensor<4x4xf32>, vector<4x4xf32> %3 = vector.contract #contraction_trait1 %0, %1, %2 : vector<4x2xf32>, vector<2x4xf32> into vector<4x4xf32> %r = vector.transfer_write %3, %arg2[%c0, %c0] : vector<4x4xf32>, tensor<4x4xf32> return %r : tensor<4x4xf32> } func.func @bubble_down_bitcast_in_extract(%src: vector<4xf32>) -> (f16, f16) { %0 = vector.bitcast %src : vector<4xf32> to vector<8xf16> %1 = vector.extract %0[3] : vector<8xf16> %2 = vector.extract %0[4] : vector<8xf16> return %1, %2: f16, f16 } func.func @bubble_down_bitcast_in_strided_slice_extract(%arg0: vector<4xf32>) -> vector<4xf16> { %cast = vector.bitcast %arg0: vector<4xf32> to vector<8xf16> %0 = vector.extract_strided_slice %cast {offsets = [4], sizes = [4], strides = [1]} : vector<8xf16> to vector<4xf16> return %0: vector<4xf16> } func.func @bubble_down_bitcast_in_strided_slice_extract_full_last_dim(%arg0: vector<4x2xf32>) -> vector<2x4xf16> { %cast = vector.bitcast %arg0: vector<4x2xf32> to vector<4x4xf16> %0 = vector.extract_strided_slice %cast {offsets = [1], sizes = [2], strides = [1]} : vector<4x4xf16> to vector<2x4xf16> return %0: vector<2x4xf16> } func.func @bubble_down_bitcast_in_strided_slice_extract_odd_offset(%arg0: vector<4xf32>) -> vector<4xf16> { %cast = vector.bitcast %arg0: vector<4xf32> to vector<8xf16> %0 = vector.extract_strided_slice %cast {offsets = [3], sizes = [4], strides = [1]} : vector<8xf16> to vector<4xf16> return %0: vector<4xf16> } func.func @bubble_down_bitcast_in_strided_slice_extract_odd_size(%arg0: vector<4xf32>) -> vector<3xf16> { %cast = vector.bitcast %arg0: vector<4xf32> to vector<8xf16> %0 = vector.extract_strided_slice %cast {offsets = [0], sizes = [3], strides = [1]} : vector<8xf16> to vector<3xf16> return %0: vector<3xf16> } func.func @bubble_up_bitcast_in_strided_slice_insert(%dst: vector<8xf16>, %src1: vector<4xf16>, %src2: vector<4xf16>) -> vector<4xf32> { %0 = vector.insert_strided_slice %src1, %dst {offsets = [0], strides = [1]} : vector<4xf16> into vector<8xf16> %1 = vector.insert_strided_slice %src2, %0 {offsets = [4], strides = [1]} : vector<4xf16> into vector<8xf16> %cast = vector.bitcast %1: vector<8xf16> to vector<4xf32> return %cast: vector<4xf32> } func.func @bubble_up_bitcast_in_strided_slice_insert_odd_offset(%dst: vector<8xf16>, %src: vector<4xf16>) -> vector<4xf32> { %0 = vector.insert_strided_slice %src, %dst {offsets = [3], strides = [1]} : vector<4xf16> into vector<8xf16> %cast = vector.bitcast %0: vector<8xf16> to vector<4xf32> return %cast: vector<4xf32> } func.func @bubble_up_bitcast_in_strided_slice_insert_different_rank(%dst: vector<16x4x8xf16>, %src: vector<2x4xf16>) -> vector<16x4x4xf32> { %0 = vector.insert_strided_slice %src, %dst {offsets = [0, 0, 2], strides = [1, 1]} : vector<2x4xf16> into vector<16x4x8xf16> %cast = vector.bitcast %0: vector<16x4x8xf16> to vector<16x4x4xf32> return %cast: vector<16x4x4xf32> } func.func @bubble_up_bitcast_in_strided_slice_insert_odd_shape(%dst: vector<2xf16>, %src: vector<1xf16>) -> vector<1xf32> { %0 = vector.insert_strided_slice %src, %dst {offsets = [0], strides = [1]} : vector<1xf16> into vector<2xf16> %cast = vector.bitcast %0: vector<2xf16> to vector<1xf32> return %cast: vector<1xf32> } func.func @bubble_up_bitcast_in_strided_slice_insert_larger_odd_shape(%dst: vector<8xf16>, %src: vector<3xf16>) -> vector<4xf32> { %0 = vector.insert_strided_slice %src, %dst {offsets = [0], strides = [1]} : vector<3xf16> into vector<8xf16> %cast = vector.bitcast %0: vector<8xf16> to vector<4xf32> return %cast: vector<4xf32> } func.func @vec_0D(%arg0: vector) -> vector { %0 = vector.bitcast %arg0 : vector to vector return %0 : vector }"," mlir-opt -test-vector-to-vector-lowering=""unroll"" ",1 "func.func @foo(%a : f32) -> vector<1x2xf32> { %0 = ""test_create_broadcast""(%a) {broadcast_dims = array} : (f32) -> vector<1x2xf32> return %0: vector<1x2xf32> }", mlir-opt --test-create-vector-broadcast --allow-unregistered-dialect --split-input-file ,1 "func.func @foo(%a : vector<2x2xf32>) -> vector<2x2x3xf32> { %0 = ""test_create_broadcast""(%a) {broadcast_dims = array} : (vector<2x2xf32>) -> vector<2x2x3xf32> return %0: vector<2x2x3xf32> }", mlir-opt --test-create-vector-broadcast --allow-unregistered-dialect --split-input-file ,1 "func.func @foo(%a : vector<3x3xf32>) -> vector<4x3x3xf32> { %0 = ""test_create_broadcast""(%a) {broadcast_dims = array} : (vector<3x3xf32>) -> vector<4x3x3xf32> return %0: vector<4x3x3xf32> }", mlir-opt --test-create-vector-broadcast --allow-unregistered-dialect --split-input-file ,1 "func.func @foo(%a : vector<2x4xf32>) -> vector<1x2x3x4x5xf32> { %0 = ""test_create_broadcast""(%a) {broadcast_dims = array} : (vector<2x4xf32>) -> vector<1x2x3x4x5xf32> return %0: vector<1x2x3x4x5xf32> }", mlir-opt --test-create-vector-broadcast --allow-unregistered-dialect --split-input-file ,1 "func.func @transfer_read_rank_reducing( %arg : memref<1x1x3x2xi8, strided<[6, 6, 2, 1], offset: ?>>) -> vector<3x2xi8> { %c0 = arith.constant 0 : index %cst = arith.constant 0 : i8 %v = vector.transfer_read %arg[%c0, %c0, %c0, %c0], %cst : memref<1x1x3x2xi8, strided<[6, 6, 2, 1], offset: ?>>, vector<3x2xi8> return %v : vector<3x2xi8> } transform.sequence failures(propagate) { ^bb1(%module_op: !pdl.operation): transform.vector.apply_rank_reducing_subview_patterns %module_op : (!pdl.operation) -> !pdl.operation }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_write_rank_reducing(%arg : memref<1x1x3x2xi8, strided<[6, 6, 2, 1], offset: ?>>, %vec : vector<3x2xi8>) { %c0 = arith.constant 0 : index vector.transfer_write %vec, %arg [%c0, %c0, %c0, %c0] : vector<3x2xi8>, memref<1x1x3x2xi8, strided<[6, 6, 2, 1], offset: ?>> return } transform.sequence failures(propagate) { ^bb1(%module_op: !pdl.operation): transform.vector.apply_rank_reducing_subview_patterns %module_op : (!pdl.operation) -> !pdl.operation }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_read_and_vector_rank_reducing( %arg : memref<1x1x3x2x1xf32>) -> vector<3x2x1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %v = vector.transfer_read %arg[%c0, %c0, %c0, %c0, %c0], %cst : memref<1x1x3x2x1xf32>, vector<3x2x1xf32> return %v : vector<3x2x1xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !pdl.operation): transform.vector.apply_rank_reducing_subview_patterns %module_op : (!pdl.operation) -> !pdl.operation }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_write_and_vector_rank_reducing( %arg : memref<1x1x3x2x1xf32>, %vec : vector<3x2x1xf32>) { %c0 = arith.constant 0 : index vector.transfer_write %vec, %arg [%c0, %c0, %c0, %c0, %c0] : vector<3x2x1xf32>, memref<1x1x3x2x1xf32> return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.apply_rank_reducing_subview_patterns %module_op : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_read_and_vector_rank_reducing_to_0d( %arg : memref<1x1x1x1x1xf32>) -> vector<1x1x1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %v = vector.transfer_read %arg[%c0, %c0, %c0, %c0, %c0], %cst : memref<1x1x1x1x1xf32>, vector<1x1x1xf32> return %v : vector<1x1x1xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !pdl.operation): transform.vector.apply_rank_reducing_subview_patterns %module_op : (!pdl.operation) -> !pdl.operation }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_write_and_vector_rank_reducing_to_0d( %arg : memref<1x1x1x1x1xf32>, %vec : vector<1x1x1xf32>) { %c0 = arith.constant 0 : index vector.transfer_write %vec, %arg [%c0, %c0, %c0, %c0, %c0] : vector<1x1x1xf32>, memref<1x1x1x1x1xf32> return } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): transform.vector.apply_rank_reducing_subview_patterns %module_op : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @gather_memref_1d(%base: memref, %v: vector<2xindex>, %mask: vector<2xi1>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : memref, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_memref_1d_i32_index(%base: memref, %v: vector<2xi32>, %mask: vector<2xi1>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %c0 = arith.constant 42 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : memref, vector<2xi32>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_memref_2d(%base: memref, %v: vector<2x3xindex>, %mask: vector<2x3xi1>, %pass_thru: vector<2x3xf32>) -> vector<2x3xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = vector.gather %base[%c0, %c1][%v], %mask, %pass_thru : memref, vector<2x3xindex>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @gather_tensor_1d(%base: tensor, %v: vector<2xindex>, %mask: vector<2xi1>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_tensor_2d(%base: tensor, %v: vector<2x3xindex>, %mask: vector<2x3xi1>, %pass_thru: vector<2x3xf32>) -> vector<2x3xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = vector.gather %base[%c0, %c1][%v], %mask, %pass_thru : tensor, vector<2x3xindex>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @gather_tensor_1d_all_set(%base: tensor, %v: vector<2xindex>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %mask = arith.constant dense : vector<2xi1> %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_tensor_1d_none_set(%base: tensor, %v: vector<2xindex>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %mask = arith.constant dense : vector<2xi1> %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> }", mlir-opt --test-vector-gather-lowering ,1 "func.func @gather_memref_1d(%base: memref, %v: vector<2xindex>, %mask: vector<2xi1>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : memref, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_memref_1d_i32_index(%base: memref, %v: vector<2xi32>, %mask: vector<2xi1>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %c0 = arith.constant 42 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : memref, vector<2xi32>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_memref_2d(%base: memref, %v: vector<2x3xindex>, %mask: vector<2x3xi1>, %pass_thru: vector<2x3xf32>) -> vector<2x3xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = vector.gather %base[%c0, %c1][%v], %mask, %pass_thru : memref, vector<2x3xindex>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @gather_tensor_1d(%base: tensor, %v: vector<2xindex>, %mask: vector<2xi1>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_tensor_2d(%base: tensor, %v: vector<2x3xindex>, %mask: vector<2x3xi1>, %pass_thru: vector<2x3xf32>) -> vector<2x3xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = vector.gather %base[%c0, %c1][%v], %mask, %pass_thru : tensor, vector<2x3xindex>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @gather_tensor_1d_all_set(%base: tensor, %v: vector<2xindex>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %mask = arith.constant dense : vector<2xi1> %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> } func.func @gather_tensor_1d_none_set(%base: tensor, %v: vector<2xindex>, %pass_thru: vector<2xf32>) -> vector<2xf32> { %mask = arith.constant dense : vector<2xi1> %c0 = arith.constant 0 : index %0 = vector.gather %base[%c0][%v], %mask, %pass_thru : tensor, vector<2xindex>, vector<2xi1>, vector<2xf32> into vector<2xf32> return %0 : vector<2xf32> }", mlir-opt --test-vector-gather-lowering --canonicalize ,1 "func.func @forward_dead_store(%arg0: i1, %arg1 : memref<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) { %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> %0 = vector.transfer_read %arg1[%c1, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> %x = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%acc = %0) -> (vector<1x4xf32>) { %1 = arith.addf %acc, %acc : vector<1x4xf32> scf.yield %1 : vector<1x4xf32> } vector.transfer_write %x, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> return } func.func @forward_nested(%arg0: i1, %arg1 : memref<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf0 = arith.constant 0.0 : f32 vector.transfer_write %v1, %arg1[%i, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> %x = scf.if %arg0 -> (vector<1x4xf32>) { %0 = vector.transfer_read %arg1[%c1, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> scf.yield %0 : vector<1x4xf32> } else { scf.yield %v1 : vector<1x4xf32> } vector.transfer_write %x, %arg1[%c0, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> return } func.func @forward_nested_negative(%arg0: i1, %arg1 : memref<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf0 = arith.constant 0.0 : f32 vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> %x = scf.if %arg0 -> (vector<1x4xf32>) { %0 = vector.transfer_read %arg1[%c1, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> scf.yield %0 : vector<1x4xf32> } else { vector.transfer_write %v1, %arg1[%i, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> scf.yield %v1 : vector<1x4xf32> } vector.transfer_write %x, %arg1[%c0, %i] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> return } func.func @dead_store_region(%arg0: i1, %arg1 : memref<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) -> (vector<1x4xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf0 = arith.constant 0.0 : f32 vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> %x = scf.if %arg0 -> (vector<1x4xf32>) { scf.yield %v1 : vector<1x4xf32> } else { %0 = vector.transfer_read %arg1[%i, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> scf.yield %0 : vector<1x4xf32> } scf.if %arg0 { vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> } vector.transfer_write %x, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> vector.transfer_write %x, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> %1 = vector.transfer_read %arg1[%i, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> return %1 : vector<1x4xf32> } func.func @dead_store_negative(%arg0: i1, %arg1 : memref<4x4xf32>, %v0 :vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf0 = arith.constant 0.0 : f32 %x = scf.if %arg0 -> (vector<1x4xf32>) { vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> %0 = vector.transfer_read %arg1[%i, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> scf.yield %0 : vector<1x4xf32> } else { scf.yield %v1 : vector<1x4xf32> } vector.transfer_write %x, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> return } func.func @dead_store_nested_region(%arg0: i1, %arg1: i1, %arg2 : memref<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x4xf32>, %i : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf0 = arith.constant 0.0 : f32 scf.if %arg0 { %0 = vector.transfer_read %arg2[%i, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> scf.if %arg1 { vector.transfer_write %v1, %arg2[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> } vector.transfer_write %v0, %arg2[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> } return } func.func @forward_dead_store_negative(%arg0: i1, %arg1 : memref<4x4xf32>, %v0 : vector<1x4xf32>, %v1 : vector<1x1xf32>, %v2 : vector<1x4xf32>, %i : index) -> vector<1x4xf32> { %alias = memref.subview %arg1[0, 0] [2, 2] [1, 1] : memref<4x4xf32> to memref<2x2xf32, strided<[4, 1]>> %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 vector.transfer_write %v0, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> vector.transfer_write %v1, %alias[%c0, %c0] {in_bounds = [true, true]} : vector<1x1xf32>, memref<2x2xf32, strided<[4, 1]>> vector.transfer_write %v2, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> vector.transfer_write %v1, %alias[%c1, %c0] {in_bounds = [true, true]} : vector<1x1xf32>, memref<2x2xf32, strided<[4, 1]>> %0 = vector.transfer_read %arg1[%c1, %c0], %cf0 {in_bounds = [true, true]} : memref<4x4xf32>, vector<1x4xf32> vector.transfer_write %v2, %arg1[%c1, %c0] {in_bounds = [true, true]} : vector<1x4xf32>, memref<4x4xf32> return %0 : vector<1x4xf32> }", mlir-opt -test-vector-transferop-opt ,1 "#matmat_accesses = [ affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (k, j)>, affine_map<(i, j, k) -> (i, j)> ] #matmat_trait = { indexing_maps = #matmat_accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul(%arg0: vector<2x4xf32>, %arg1: vector<4x3xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = vector.contract #matmat_trait %arg0, %arg1, %arg2 : vector<2x4xf32>, vector<4x3xf32> into vector<2x3xf32> return %0 : vector<2x3xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op %f2 = transform.vector.lower_contraction %f lowering_strategy = ""matmulintrinsics"" : (!transform.any_op) -> !transform.any_op %f3 = transform.vector.lower_shape_cast %f2 : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @fold_extract_transpose_negative(%arg0: vector<4x4xf16>) -> vector<4x4xf16> { %cst = arith.constant dense<0.000000e+00> : vector<1x4x4xf16> %0 = vector.insert %arg0, %cst [0] : vector<4x4xf16> into vector<1x4x4xf16> %1 = vector.transpose %0, [0, 2, 1] : vector<1x4x4xf16> to vector<1x4x4xf16> %2 = vector.extract %1[0] : vector<1x4x4xf16> return %2 : vector<4x4xf16> }", mlir-opt -split-input-file -test-constant-fold ,1 "#contraction_accesses0 = [ affine_map<(l, i, j, k) -> (l, i, k)>, affine_map<(l, i, j, k) -> (l, k, j)>, affine_map<(l, i, j, k) -> (l, i, j)> ] #contraction_trait0 = { indexing_maps = #contraction_accesses0, iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""] } func.func @cast_away_contraction_leading_one_dims(%arg0: vector<1x16x8xf32>, %arg1: vector<1x8x16xf32>, %arg2: vector<1x16x16xf32>) -> vector<1x16x16xf32> { %0 = vector.contract #contraction_trait0 %arg0, %arg1, %arg2 : vector<1x16x8xf32>, vector<1x8x16xf32> into vector<1x16x16xf32> return %0: vector<1x16x16xf32> }", mlir-opt -test-vector-to-vector-lowering -split-input-file,1 "#contraction_accesses1 = [ affine_map<(l, i, j, k) -> (i, l, k)>, affine_map<(l, i, j, k) -> (l, k, j)>, affine_map<(l, i, j, k) -> (l, i, j)> ] #contraction_trait1 = { indexing_maps = #contraction_accesses1, iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""], kind = #vector.kind } func.func @cast_away_contraction_leading_one_dims_transposeneeded(%arg0: vector<1x1x8xf32>, %arg1: vector<1x8x16xf32>, %arg2: vector<1x1x16xf32>) -> vector<1x1x16xf32> { %0 = vector.contract #contraction_trait1 %arg0, %arg1, %arg2 : vector<1x1x8xf32>, vector<1x8x16xf32> into vector<1x1x16xf32> return %0: vector<1x1x16xf32> }", mlir-opt -test-vector-to-vector-lowering -split-input-file,1 "#contraction_accesses2 = [ affine_map<(l, i, j, k) -> (k, l, j)>, affine_map<(l, i, j, k) -> (i, k, l)>, affine_map<(l, i, j, k) -> (l, i, j)> ] #contraction_trait2 = { indexing_maps = #contraction_accesses2, iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""] } func.func @cast_away_contraction_leading_one_dims_transposeneeded2(%arg0: vector<8x1x16xf32>, %arg1: vector<2x8x1xf32>, %arg2: vector<1x2x16xf32>) -> vector<1x2x16xf32> { %0 = vector.contract #contraction_trait2 %arg0, %arg1, %arg2 : vector<8x1x16xf32>, vector<2x8x1xf32> into vector<1x2x16xf32> return %0: vector<1x2x16xf32> }", mlir-opt -test-vector-to-vector-lowering -split-input-file,1 "#contraction_accesses2 = [ affine_map<(m, l, i, j, k) -> (m, k, l, j)>, affine_map<(m, l, i, j, k) -> (m, i, k, l)>, affine_map<(m, l, i, j, k) -> (m, l, i, j)> ] #contraction_trait2 = { indexing_maps = #contraction_accesses2, iterator_types = [""parallel"",""parallel"", ""parallel"", ""parallel"", ""reduction""] } func.func @cast_away_contraction_leading_one_dims_nonleadingunitdim_rank4(%arg0: vector<1x8x1x16xf32>, %arg1: vector<1x2x8x1xf32>, %arg2: vector<1x1x2x16xf32>) -> vector<1x1x2x16xf32> { %0 = vector.contract #contraction_trait2 %arg0, %arg1, %arg2 : vector<1x8x1x16xf32>, vector<1x2x8x1xf32> into vector<1x1x2x16xf32> return %0: vector<1x1x2x16xf32> }", mlir-opt -test-vector-to-vector-lowering -split-input-file,1 "#contraction_accesses3 = [ affine_map<(m, l, i, j, k) -> (m, k, l, j)>, affine_map<(m, l, i, j, k) -> (m, i, k, l)>, affine_map<(m, l, i, j, k) -> (l, m, i, j)> ] #contraction_trait3 = { indexing_maps = #contraction_accesses3, iterator_types = [""parallel"",""parallel"", ""parallel"", ""parallel"", ""reduction""] } func.func @cast_away_contraction_leading_one_dims_nonleadingunitdim_rank4_acctranspose(%arg0: vector<1x8x1x16xf32>, %arg1: vector<1x2x8x1xf32>, %arg2: vector<1x1x2x16xf32>) -> vector<1x1x2x16xf32> { %0 = vector.contract #contraction_trait3 %arg0, %arg1, %arg2 : vector<1x8x1x16xf32>, vector<1x2x8x1xf32> into vector<1x1x2x16xf32> return %0: vector<1x1x2x16xf32> }", mlir-opt -test-vector-to-vector-lowering -split-input-file,1 "func.func @cast_away_extract_strided_slice_leading_one_dims(%arg0: vector<1x8x8xf16>) -> vector<1x1x8xf16> { %0 = vector.extract_strided_slice %arg0 {offsets = [0, 4], sizes = [1, 1], strides = [1, 1]} : vector<1x8x8xf16> to vector<1x1x8xf16> return %0: vector<1x1x8xf16> } func.func @cast_away_insert_strided_slice_leading_one_dims(%arg0: vector<1x8xf16>, %arg1: vector<1x8x8xf16>) -> vector<1x8x8xf16> { %0 = vector.insert_strided_slice %arg0, %arg1 {offsets = [0, 0, 0], strides = [1, 1]} : vector<1x8xf16> into vector<1x8x8xf16> return %0: vector<1x8x8xf16> } func.func @cast_away_insert_strided_slice_leading_one_dims_one_element(%arg0: vector<1x1xf16>, %arg1: vector<1x1x1xf16>) -> vector<1x1x1xf16> { %0 = vector.insert_strided_slice %arg0, %arg1 {offsets = [0, 0, 0], strides = [1, 1]} : vector<1x1xf16> into vector<1x1x1xf16> return %0: vector<1x1x1xf16> } func.func @cast_away_transfer_read_leading_one_dims(%arg0: memref<1x4x8x16xf16>) -> vector<1x4xf16> { %c0 = arith.constant 0 : index %f0 = arith.constant 0. : f16 %0 = vector.transfer_read %arg0[%c0, %c0, %c0, %c0], %f0 {in_bounds = [true, true]} : memref<1x4x8x16xf16>, vector<1x4xf16> return %0: vector<1x4xf16> } func.func @cast_away_transfer_read_leading_one_dims_one_element(%arg0: memref<1x1x1x1xf16>) -> vector<1x1xf16> { %c0 = arith.constant 0 : index %f0 = arith.constant 0. : f16 %0 = vector.transfer_read %arg0[%c0, %c0, %c0, %c0], %f0 {in_bounds = [true, true]} : memref<1x1x1x1xf16>, vector<1x1xf16> return %0: vector<1x1xf16> } func.func @cast_away_transfer_write_leading_one_dims(%arg0: memref<1x4x8x16xf16>, %arg1: vector<1x4xf16>) { %c0 = arith.constant 0 : index vector.transfer_write %arg1, %arg0[%c0, %c0, %c0, %c0] {in_bounds = [true, true]} : vector<1x4xf16>, memref<1x4x8x16xf16> return } func.func @cast_away_transfer_write_leading_one_dims_one_element(%arg0: memref<1x1x1x1xf16>, %arg1: vector<1x1xf16>) { %c0 = arith.constant 0 : index vector.transfer_write %arg1, %arg0[%c0, %c0, %c0, %c0] {in_bounds = [true, true]} : vector<1x1xf16>, memref<1x1x1x1xf16> return } func.func @cast_away_elementwise_leading_one_dims( %arg0: vector<1x1x8xf32>, %arg1: f32, %arg2: vector<1x4xf32>, %arg3: vector<1x4xf32>, %arg4: i1) -> (vector<1x1x8xf32>, vector<1x4xi1>, vector<1x4xf32>, vector<1x4xf32>) { %0 = arith.addf %arg0, %arg0 : vector<1x1x8xf32> %1 = arith.cmpf ogt, %arg2, %arg3 : vector<1x4xf32> %2 = arith.select %1, %arg3, %arg2 : vector<1x4xi1>, vector<1x4xf32> %3 = arith.select %arg4, %arg3, %arg2 : vector<1x4xf32> return %0, %1, %2, %3: vector<1x1x8xf32>, vector<1x4xi1>, vector<1x4xf32>, vector<1x4xf32> } func.func @cast_away_insert_leading_one_dims_scalar(%s: f32, %v: vector<1x1x4xf32>) -> vector<1x1x4xf32> { %0 = vector.insert %s, %v [0, 0, 0] : f32 into vector<1x1x4xf32> return %0: vector<1x1x4xf32> } func.func @cast_away_insert_leading_one_dims_rank1(%s: vector<4xf32>, %v: vector<1x1x4xf32>) -> vector<1x1x4xf32> { %0 = vector.insert %s, %v [0, 0] : vector<4xf32> into vector<1x1x4xf32> return %0: vector<1x1x4xf32> } func.func @cast_away_insert_leading_one_dims_rank2(%s: vector<1x4xf32>, %v: vector<1x1x4xf32>) -> vector<1x1x4xf32> { %0 = vector.insert %s, %v [0] : vector<1x4xf32> into vector<1x1x4xf32> return %0: vector<1x1x4xf32> } func.func @cast_away_insert_leading_one_dims_rank2_one_dest(%s: vector<1x4xf32>, %v: vector<1x2x1x4xf32>) -> vector<1x2x1x4xf32> { %0 = vector.insert %s, %v [0, 1] : vector<1x4xf32> into vector<1x2x1x4xf32> return %0: vector<1x2x1x4xf32> } func.func @cast_away_insert_leading_one_dims_non_one_dest(%s: vector<1x4xf32>, %v: vector<8x1x4xf32>) -> vector<8x1x4xf32> { %0 = vector.insert %s, %v [5] : vector<1x4xf32> into vector<8x1x4xf32> return %0: vector<8x1x4xf32> } func.func @cast_away_insert_leading_one_dims_one_two_dest(%s: vector<1x8xi1>, %v: vector<1x1x8x1x8xi1>) -> vector<1x1x8x1x8xi1> { %0 = vector.insert %s, %v [0, 0, 7] : vector<1x8xi1> into vector<1x1x8x1x8xi1> return %0: vector<1x1x8x1x8xi1> }", mlir-opt -test-vector-to-vector-lowering -split-input-file,1 "func.func @vector_contract_f32(%lhs : vector<8x4xf32>, %rhs : vector<8x4xf32>, %init : vector<8x8xf32>) -> vector<8x8xf32> { %0 = vector.contract {indexing_maps = [affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (j, k)>, affine_map<(i, j, k) -> (i, j)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x4xf32>, vector<8x4xf32> into vector<8x8xf32> return %0 : vector<8x8xf32> } func.func @vector_contract_f16(%lhs : vector<8x8xf16>, %rhs : vector<8x8xf16>, %init : vector<8x8xf16>) -> vector<8x8xf16> { %0 = vector.contract {indexing_maps = [affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (j, k)>, affine_map<(i, j, k) -> (i, j)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x8xf16>, vector<8x8xf16> into vector<8x8xf16> return %0 : vector<8x8xf16> } func.func @vector_fma(%a: vector<4x4xf32>, %b: vector<4x4xf32>, %c: vector<4x4xf32>) -> vector<4x4xf32> { %0 = vector.fma %a, %b, %c: vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @vector_multi_reduction(%v : vector<4x6xf32>, %acc: vector<4xf32>) -> vector<4xf32> { %0 = vector.multi_reduction #vector.kind, %v, %acc [1] : vector<4x6xf32> to vector<4xf32> return %0 : vector<4xf32> } func.func @vector_reduction(%v : vector<8xf32>) -> f32 { %0 = vector.reduction , %v : vector<8xf32> into f32 return %0 : f32 } func.func @vector_tranpose(%v : vector<2x4x3x8xf32>) -> vector<2x3x8x4xf32> { %t = vector.transpose %v, [0, 2, 3, 1] : vector<2x4x3x8xf32> to vector<2x3x8x4xf32> return %t : vector<2x3x8x4xf32> }", mlir-opt -test-vector-unrolling-patterns=unroll-based-on-type ,1 "func.func @vector_contract_f32(%lhs : vector<8x4xf32>, %rhs : vector<8x4xf32>, %init : vector<8x8xf32>) -> vector<8x8xf32> { %0 = vector.contract {indexing_maps = [affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (j, k)>, affine_map<(i, j, k) -> (i, j)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x4xf32>, vector<8x4xf32> into vector<8x8xf32> return %0 : vector<8x8xf32> } func.func @vector_contract_f16(%lhs : vector<8x8xf16>, %rhs : vector<8x8xf16>, %init : vector<8x8xf16>) -> vector<8x8xf16> { %0 = vector.contract {indexing_maps = [affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (j, k)>, affine_map<(i, j, k) -> (i, j)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x8xf16>, vector<8x8xf16> into vector<8x8xf16> return %0 : vector<8x8xf16> } func.func @vector_fma(%a: vector<4x4xf32>, %b: vector<4x4xf32>, %c: vector<4x4xf32>) -> vector<4x4xf32> { %0 = vector.fma %a, %b, %c: vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @vector_multi_reduction(%v : vector<4x6xf32>, %acc: vector<4xf32>) -> vector<4xf32> { %0 = vector.multi_reduction #vector.kind, %v, %acc [1] : vector<4x6xf32> to vector<4xf32> return %0 : vector<4xf32> } func.func @vector_reduction(%v : vector<8xf32>) -> f32 { %0 = vector.reduction , %v : vector<8xf32> into f32 return %0 : f32 } func.func @vector_tranpose(%v : vector<2x4x3x8xf32>) -> vector<2x3x8x4xf32> { %t = vector.transpose %v, [0, 2, 3, 1] : vector<2x4x3x8xf32> to vector<2x3x8x4xf32> return %t : vector<2x3x8x4xf32> }"," mlir-opt -test-vector-unrolling-patterns=""unroll-based-on-type unroll-order=2,0,1"" ",1 "func.func @vector_contract_f32(%lhs : vector<8x4xf32>, %rhs : vector<8x4xf32>, %init : vector<8x8xf32>) -> vector<8x8xf32> { %0 = vector.contract {indexing_maps = [affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (j, k)>, affine_map<(i, j, k) -> (i, j)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x4xf32>, vector<8x4xf32> into vector<8x8xf32> return %0 : vector<8x8xf32> } func.func @vector_contract_f16(%lhs : vector<8x8xf16>, %rhs : vector<8x8xf16>, %init : vector<8x8xf16>) -> vector<8x8xf16> { %0 = vector.contract {indexing_maps = [affine_map<(i, j, k) -> (i, k)>, affine_map<(i, j, k) -> (j, k)>, affine_map<(i, j, k) -> (i, j)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x8xf16>, vector<8x8xf16> into vector<8x8xf16> return %0 : vector<8x8xf16> } func.func @vector_fma(%a: vector<4x4xf32>, %b: vector<4x4xf32>, %c: vector<4x4xf32>) -> vector<4x4xf32> { %0 = vector.fma %a, %b, %c: vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @vector_multi_reduction(%v : vector<4x6xf32>, %acc: vector<4xf32>) -> vector<4xf32> { %0 = vector.multi_reduction #vector.kind, %v, %acc [1] : vector<4x6xf32> to vector<4xf32> return %0 : vector<4xf32> } func.func @vector_reduction(%v : vector<8xf32>) -> f32 { %0 = vector.reduction , %v : vector<8xf32> into f32 return %0 : f32 } func.func @vector_tranpose(%v : vector<2x4x3x8xf32>) -> vector<2x3x8x4xf32> { %t = vector.transpose %v, [0, 2, 3, 1] : vector<2x4x3x8xf32> to vector<2x3x8x4xf32> return %t : vector<2x3x8x4xf32> }"," mlir-opt -test-vector-unrolling-patterns=""unroll-based-on-type unroll-order=0,3,1,2"" ",1 "func.func @vector_contract_batched(%lhs: vector<8x8x4xf32>, %rhs: vector<8x8x4xf32>, %init: vector<8x8x8xf32>) -> vector<8x8x8xf32> { %0 = vector.contract {indexing_maps = [affine_map<(d0,d1,d2,c0) -> (d0,d1,c0)>, affine_map<(d0,d1,d2,c0) -> (d0,d2,c0)>, affine_map<(d0,d1,d2,c0) -> (d0,d1,d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x8x4xf32>, vector<8x8x4xf32> into vector<8x8x8xf32> return %0 : vector<8x8x8xf32> }", mlir-opt -test-vector-unrolling-patterns=unroll-based-on-type ,1 "func.func @vector_contract_batched(%lhs: vector<8x8x4xf32>, %rhs: vector<8x8x4xf32>, %init: vector<8x8x8xf32>) -> vector<8x8x8xf32> { %0 = vector.contract {indexing_maps = [affine_map<(d0,d1,d2,c0) -> (d0,d1,c0)>, affine_map<(d0,d1,d2,c0) -> (d0,d2,c0)>, affine_map<(d0,d1,d2,c0) -> (d0,d1,d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x8x4xf32>, vector<8x8x4xf32> into vector<8x8x8xf32> return %0 : vector<8x8x8xf32> }"," mlir-opt -test-vector-unrolling-patterns=""unroll-based-on-type unroll-order=2,0,1"" ",1 "func.func @vector_contract_batched(%lhs: vector<8x8x4xf32>, %rhs: vector<8x8x4xf32>, %init: vector<8x8x8xf32>) -> vector<8x8x8xf32> { %0 = vector.contract {indexing_maps = [affine_map<(d0,d1,d2,c0) -> (d0,d1,c0)>, affine_map<(d0,d1,d2,c0) -> (d0,d2,c0)>, affine_map<(d0,d1,d2,c0) -> (d0,d1,d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""reduction""]} %lhs, %rhs, %init : vector<8x8x4xf32>, vector<8x8x4xf32> into vector<8x8x8xf32> return %0 : vector<8x8x8xf32> }"," mlir-opt -test-vector-unrolling-patterns=""unroll-based-on-type unroll-order=0,3,1,2"" ",1 "func.func @transfer_read_unroll(%arg0 : memref<4x4xf32>) -> vector<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @transfer_write_unroll(%arg0 : memref<4x4xf32>, %arg1 : vector<4x4xf32>) { %c0 = arith.constant 0 : index vector.transfer_write %arg1, %arg0[%c0, %c0] : vector<4x4xf32>, memref<4x4xf32> return } func.func @transfer_readwrite_unroll(%arg0 : memref<4x4xf32>) { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> vector.transfer_write %0, %arg0[%c0, %c0] : vector<4x4xf32>, memref<4x4xf32> return } func.func @transfer_read_unroll_tensor(%arg0 : tensor<4x4xf32>) -> vector<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : tensor<4x4xf32>, vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @transfer_write_unroll_tensor(%arg0 : tensor<4x4xf32>, %arg1 : vector<4x4xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0 : index %r = vector.transfer_write %arg1, %arg0[%c0, %c0] : vector<4x4xf32>, tensor<4x4xf32> return %r: tensor<4x4xf32> } func.func @transfer_readwrite_unroll_tensor(%arg0 : tensor<4x4xf32>, %arg1 : tensor<4x4xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : tensor<4x4xf32>, vector<4x4xf32> %r = vector.transfer_write %0, %arg1[%c0, %c0] : vector<4x4xf32>, tensor<4x4xf32> return %r: tensor<4x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns --split-input-file ,1 "func.func @transfer_read_unroll(%arg0 : memref<4x4xf32>) -> vector<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @transfer_write_unroll(%arg0 : memref<4x4xf32>, %arg1 : vector<4x4xf32>) { %c0 = arith.constant 0 : index vector.transfer_write %arg1, %arg0[%c0, %c0] : vector<4x4xf32>, memref<4x4xf32> return } func.func @transfer_readwrite_unroll(%arg0 : memref<4x4xf32>) { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : memref<4x4xf32>, vector<4x4xf32> vector.transfer_write %0, %arg0[%c0, %c0] : vector<4x4xf32>, memref<4x4xf32> return } func.func @transfer_read_unroll_tensor(%arg0 : tensor<4x4xf32>) -> vector<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : tensor<4x4xf32>, vector<4x4xf32> return %0 : vector<4x4xf32> } func.func @transfer_write_unroll_tensor(%arg0 : tensor<4x4xf32>, %arg1 : vector<4x4xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0 : index %r = vector.transfer_write %arg1, %arg0[%c0, %c0] : vector<4x4xf32>, tensor<4x4xf32> return %r: tensor<4x4xf32> } func.func @transfer_readwrite_unroll_tensor(%arg0 : tensor<4x4xf32>, %arg1 : tensor<4x4xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 : tensor<4x4xf32>, vector<4x4xf32> %r = vector.transfer_write %0, %arg1[%c0, %c0] : vector<4x4xf32>, tensor<4x4xf32> return %r: tensor<4x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns=reverse-unroll-order --split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> func.func @transfer_read_unroll_permutation(%arg0 : memref<6x4xf32>) -> vector<4x6xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 {permutation_map = #map0} : memref<6x4xf32>, vector<4x6xf32> return %0 : vector<4x6xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns --split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> func.func @transfer_read_unroll_permutation(%arg0 : memref<6x4xf32>) -> vector<4x6xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 {permutation_map = #map0} : memref<6x4xf32>, vector<4x6xf32> return %0 : vector<4x6xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns=reverse-unroll-order --split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (0, d1)> func.func @transfer_read_unroll_broadcast(%arg0 : memref<6x4xf32>) -> vector<6x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 {permutation_map = #map0} : memref<6x4xf32>, vector<6x4xf32> return %0 : vector<6x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns --split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (0, d1)> func.func @transfer_read_unroll_broadcast(%arg0 : memref<6x4xf32>) -> vector<6x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 {permutation_map = #map0} : memref<6x4xf32>, vector<6x4xf32> return %0 : vector<6x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns=reverse-unroll-order --split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (0, d0)> func.func @transfer_read_unroll_broadcast_permuation(%arg0 : memref<6x4xf32>) -> vector<4x6xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 {permutation_map = #map0} : memref<6x4xf32>, vector<4x6xf32> return %0 : vector<4x6xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns --split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (0, d0)> func.func @transfer_read_unroll_broadcast_permuation(%arg0 : memref<6x4xf32>) -> vector<4x6xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0], %cf0 {permutation_map = #map0} : memref<6x4xf32>, vector<4x6xf32> return %0 : vector<4x6xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns=reverse-unroll-order --split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d2, d0)> func.func @transfer_read_unroll_different_rank(%arg0 : memref) -> vector<6x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0, %c0], %cf0 {permutation_map = #map0} : memref, vector<6x4xf32> return %0 : vector<6x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns --split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d2, d0)> func.func @transfer_read_unroll_different_rank(%arg0 : memref) -> vector<6x4xf32> { %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg0[%c0, %c0, %c0], %cf0 {permutation_map = #map0} : memref, vector<6x4xf32> return %0 : vector<6x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns=reverse-unroll-order --split-input-file ,1 "func.func @vector_gather_unroll(%arg0 : memref, %indices : vector<6x4xindex>, %mask : vector<6x4xi1>, %pass_thru : vector<6x4xf32>) -> vector<6x4xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %arg0[%c0, %c0, %c0] [%indices], %mask, %pass_thru : memref, vector<6x4xindex>, vector<6x4xi1>, vector<6x4xf32> into vector<6x4xf32> return %0 : vector<6x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns --split-input-file ,1 "func.func @vector_gather_unroll(%arg0 : memref, %indices : vector<6x4xindex>, %mask : vector<6x4xi1>, %pass_thru : vector<6x4xf32>) -> vector<6x4xf32> { %c0 = arith.constant 0 : index %0 = vector.gather %arg0[%c0, %c0, %c0] [%indices], %mask, %pass_thru : memref, vector<6x4xindex>, vector<6x4xi1>, vector<6x4xf32> into vector<6x4xf32> return %0 : vector<6x4xf32> }", mlir-opt -test-vector-transfer-unrolling-patterns=reverse-unroll-order --split-input-file ,1 "func.func @rewrite_warp_op_to_scf_if(%laneid: index, %v0: vector<4xf32>, %v1: vector<8xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<8xf32>) -> (vector<1xf32>, vector<2xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<256xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> %3 = ""some_def""(%arg1) : (vector<256xf32>) -> vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } ""some_use""(%r#0) : (vector<1xf32>) -> () ""some_use""(%r#1) : (vector<2xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @rewrite_warp_op_to_scf_if(%laneid: index, %v0: vector<4xf32>, %v1: vector<8xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<8xf32>) -> (vector<1xf32>, vector<2xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<256xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> %3 = ""some_def""(%arg1) : (vector<256xf32>) -> vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } ""some_use""(%r#0) : (vector<1xf32>) -> () ""some_use""(%r#1) : (vector<2xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @rewrite_warp_op_to_scf_if(%laneid: index, %v0: vector<4xf32>, %v1: vector<8xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<8xf32>) -> (vector<1xf32>, vector<2xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<256xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> %3 = ""some_def""(%arg1) : (vector<256xf32>) -> vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } ""some_use""(%r#0) : (vector<1xf32>) -> () ""some_use""(%r#1) : (vector<2xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @rewrite_warp_op_to_scf_if(%laneid: index, %v0: vector<4xf32>, %v1: vector<8xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<8xf32>) -> (vector<1xf32>, vector<2xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<256xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> %3 = ""some_def""(%arg1) : (vector<256xf32>) -> vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } ""some_use""(%r#0) : (vector<1xf32>) -> () ""some_use""(%r#1) : (vector<2xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @rewrite_warp_op_to_scf_if(%laneid: index, %v0: vector<4xf32>, %v1: vector<8xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<8xf32>) -> (vector<1xf32>, vector<2xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<256xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> %3 = ""some_def""(%arg1) : (vector<256xf32>) -> vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } ""some_use""(%r#0) : (vector<1xf32>) -> () ""some_use""(%r#1) : (vector<2xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp(%laneid: index, %arg1: memref<1024xf32>, %arg2: memref<1024xf32>, %arg3: memref<1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %sa = memref.subview %arg1[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sb = memref.subview %arg2[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sc = memref.subview %arg3[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %2 = vector.transfer_read %sa[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %3 = vector.transfer_read %sa[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %4 = vector.transfer_read %sb[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %5 = vector.transfer_read %sb[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.transfer_write %6, %sc[%c0] : vector<32xf32>, memref<128xf32, strided<[1], offset: ?>> vector.transfer_write %7, %sc[%c32] : vector<64xf32>, memref<128xf32, strided<[1], offset: ?>> } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp(%laneid: index, %arg1: memref<1024xf32>, %arg2: memref<1024xf32>, %arg3: memref<1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %sa = memref.subview %arg1[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sb = memref.subview %arg2[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sc = memref.subview %arg3[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %2 = vector.transfer_read %sa[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %3 = vector.transfer_read %sa[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %4 = vector.transfer_read %sb[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %5 = vector.transfer_read %sb[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.transfer_write %6, %sc[%c0] : vector<32xf32>, memref<128xf32, strided<[1], offset: ?>> vector.transfer_write %7, %sc[%c32] : vector<64xf32>, memref<128xf32, strided<[1], offset: ?>> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp(%laneid: index, %arg1: memref<1024xf32>, %arg2: memref<1024xf32>, %arg3: memref<1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %sa = memref.subview %arg1[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sb = memref.subview %arg2[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sc = memref.subview %arg3[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %2 = vector.transfer_read %sa[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %3 = vector.transfer_read %sa[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %4 = vector.transfer_read %sb[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %5 = vector.transfer_read %sb[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.transfer_write %6, %sc[%c0] : vector<32xf32>, memref<128xf32, strided<[1], offset: ?>> vector.transfer_write %7, %sc[%c32] : vector<64xf32>, memref<128xf32, strided<[1], offset: ?>> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp(%laneid: index, %arg1: memref<1024xf32>, %arg2: memref<1024xf32>, %arg3: memref<1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %sa = memref.subview %arg1[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sb = memref.subview %arg2[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sc = memref.subview %arg3[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %2 = vector.transfer_read %sa[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %3 = vector.transfer_read %sa[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %4 = vector.transfer_read %sb[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %5 = vector.transfer_read %sb[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.transfer_write %6, %sc[%c0] : vector<32xf32>, memref<128xf32, strided<[1], offset: ?>> vector.transfer_write %7, %sc[%c32] : vector<64xf32>, memref<128xf32, strided<[1], offset: ?>> } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp(%laneid: index, %arg1: memref<1024xf32>, %arg2: memref<1024xf32>, %arg3: memref<1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %sa = memref.subview %arg1[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sb = memref.subview %arg2[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %sc = memref.subview %arg3[%gid] [128] [1] : memref<1024xf32> to memref<128xf32, strided<[1], offset: ?>> %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %2 = vector.transfer_read %sa[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %3 = vector.transfer_read %sa[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<32xf32> %4 = vector.transfer_read %sb[%c0], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %5 = vector.transfer_read %sb[%c32], %cst : memref<128xf32, strided<[1], offset: ?>>, vector<64xf32> %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.transfer_write %6, %sc[%c0] : vector<32xf32>, memref<128xf32, strided<[1], offset: ?>> vector.transfer_write %7, %sc[%c32] : vector<64xf32>, memref<128xf32, strided<[1], offset: ?>> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_extract(%laneid: index, %arg1: memref<1024x1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %c0 = arith.constant 0 : index %v = ""test.dummy_op""() : () -> (vector<1xf32>) %v1 = ""test.dummy_op""() : () -> (vector<1x1xf32>) vector.transfer_write %v1, %arg1[%c0, %c0] : vector<1x1xf32>, memref<1024x1024xf32> vector.transfer_write %v, %arg1[%c0, %c0] : vector<1xf32>, memref<1024x1024xf32> } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_extract(%laneid: index, %arg1: memref<1024x1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %c0 = arith.constant 0 : index %v = ""test.dummy_op""() : () -> (vector<1xf32>) %v1 = ""test.dummy_op""() : () -> (vector<1x1xf32>) vector.transfer_write %v1, %arg1[%c0, %c0] : vector<1x1xf32>, memref<1024x1024xf32> vector.transfer_write %v, %arg1[%c0, %c0] : vector<1xf32>, memref<1024x1024xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_extract(%laneid: index, %arg1: memref<1024x1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %c0 = arith.constant 0 : index %v = ""test.dummy_op""() : () -> (vector<1xf32>) %v1 = ""test.dummy_op""() : () -> (vector<1x1xf32>) vector.transfer_write %v1, %arg1[%c0, %c0] : vector<1x1xf32>, memref<1024x1024xf32> vector.transfer_write %v, %arg1[%c0, %c0] : vector<1xf32>, memref<1024x1024xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_extract(%laneid: index, %arg1: memref<1024x1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %c0 = arith.constant 0 : index %v = ""test.dummy_op""() : () -> (vector<1xf32>) %v1 = ""test.dummy_op""() : () -> (vector<1x1xf32>) vector.transfer_write %v1, %arg1[%c0, %c0] : vector<1x1xf32>, memref<1024x1024xf32> vector.transfer_write %v, %arg1[%c0, %c0] : vector<1xf32>, memref<1024x1024xf32> } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_extract(%laneid: index, %arg1: memref<1024x1024xf32>, %gid : index) { vector.warp_execute_on_lane_0(%laneid)[32] { %c0 = arith.constant 0 : index %v = ""test.dummy_op""() : () -> (vector<1xf32>) %v1 = ""test.dummy_op""() : () -> (vector<1x1xf32>) vector.transfer_write %v1, %arg1[%c0, %c0] : vector<1x1xf32>, memref<1024x1024xf32> vector.transfer_write %v, %arg1[%c0, %c0] : vector<1xf32>, memref<1024x1024xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_dead_result(%laneid: index) -> (vector<1xf32>) { %r:3 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<32xf32>) vector.yield %2, %3, %4 : vector<32xf32>, vector<32xf32>, vector<32xf32> } return %r#1 : vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_dead_result(%laneid: index) -> (vector<1xf32>) { %r:3 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<32xf32>) vector.yield %2, %3, %4 : vector<32xf32>, vector<32xf32>, vector<32xf32> } return %r#1 : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_dead_result(%laneid: index) -> (vector<1xf32>) { %r:3 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<32xf32>) vector.yield %2, %3, %4 : vector<32xf32>, vector<32xf32>, vector<32xf32> } return %r#1 : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_dead_result(%laneid: index) -> (vector<1xf32>) { %r:3 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<32xf32>) vector.yield %2, %3, %4 : vector<32xf32>, vector<32xf32>, vector<32xf32> } return %r#1 : vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_dead_result(%laneid: index) -> (vector<1xf32>) { %r:3 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<32xf32>) vector.yield %2, %3, %4 : vector<32xf32>, vector<32xf32>, vector<32xf32> } return %r#1 : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_propagate_operand(%laneid: index, %v0: vector<4xf32>) -> (vector<4xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0 : vector<4xf32>) -> (vector<4xf32>) { ^bb0(%arg0 : vector<128xf32>) : vector.yield %arg0 : vector<128xf32> } return %r : vector<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_propagate_operand(%laneid: index, %v0: vector<4xf32>) -> (vector<4xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0 : vector<4xf32>) -> (vector<4xf32>) { ^bb0(%arg0 : vector<128xf32>) : vector.yield %arg0 : vector<128xf32> } return %r : vector<4xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_propagate_operand(%laneid: index, %v0: vector<4xf32>) -> (vector<4xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0 : vector<4xf32>) -> (vector<4xf32>) { ^bb0(%arg0 : vector<128xf32>) : vector.yield %arg0 : vector<128xf32> } return %r : vector<4xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_propagate_operand(%laneid: index, %v0: vector<4xf32>) -> (vector<4xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0 : vector<4xf32>) -> (vector<4xf32>) { ^bb0(%arg0 : vector<128xf32>) : vector.yield %arg0 : vector<128xf32> } return %r : vector<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_propagate_operand(%laneid: index, %v0: vector<4xf32>) -> (vector<4xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0 : vector<4xf32>) -> (vector<4xf32>) { ^bb0(%arg0 : vector<128xf32>) : vector.yield %arg0 : vector<128xf32> } return %r : vector<4xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_elementwise(%laneid: index, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<2xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<64xf32>) %5 = ""some_def""() : () -> (vector<64xf32>) %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.yield %6, %7 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_elementwise(%laneid: index, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<2xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<64xf32>) %5 = ""some_def""() : () -> (vector<64xf32>) %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.yield %6, %7 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_elementwise(%laneid: index, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<2xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<64xf32>) %5 = ""some_def""() : () -> (vector<64xf32>) %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.yield %6, %7 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_elementwise(%laneid: index, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<2xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<64xf32>) %5 = ""some_def""() : () -> (vector<64xf32>) %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.yield %6, %7 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_elementwise(%laneid: index, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<2xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = ""some_def""() : () -> (vector<64xf32>) %5 = ""some_def""() : () -> (vector<64xf32>) %6 = arith.addf %2, %3 : vector<32xf32> %7 = arith.addf %4, %5 : vector<64xf32> vector.yield %6, %7 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_propagate_scalar_arith(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (f32) %1 = ""some_def""() : () -> (f32) %2 = arith.addf %0, %1 : f32 vector.yield %2 : f32 } vector.print %r : f32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_propagate_scalar_arith(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (f32) %1 = ""some_def""() : () -> (f32) %2 = arith.addf %0, %1 : f32 vector.yield %2 : f32 } vector.print %r : f32 return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_propagate_scalar_arith(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (f32) %1 = ""some_def""() : () -> (f32) %2 = arith.addf %0, %1 : f32 vector.yield %2 : f32 } vector.print %r : f32 return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_propagate_scalar_arith(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (f32) %1 = ""some_def""() : () -> (f32) %2 = arith.addf %0, %1 : f32 vector.yield %2 : f32 } vector.print %r : f32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_propagate_scalar_arith(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (f32) %1 = ""some_def""() : () -> (f32) %2 = arith.addf %0, %1 : f32 vector.yield %2 : f32 } vector.print %r : f32 return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_propagate_cast(%laneid : index, %i : i32) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %casted = arith.sitofp %i : i32 to f32 vector.yield %casted : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_propagate_cast(%laneid : index, %i : i32) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %casted = arith.sitofp %i : i32 to f32 vector.yield %casted : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_propagate_cast(%laneid : index, %i : i32) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %casted = arith.sitofp %i : i32 to f32 vector.yield %casted : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_propagate_cast(%laneid : index, %i : i32) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %casted = arith.sitofp %i : i32 to f32 vector.yield %casted : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_propagate_cast(%laneid : index, %i : i32) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %casted = arith.sitofp %i : i32 to f32 vector.yield %casted : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_read(%laneid: index, %src: memref<1024xf32>, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] ->(vector<1xf32>, vector<2xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> %3 = vector.transfer_read %src[%c32], %cst : memref<1024xf32>, vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_read(%laneid: index, %src: memref<1024xf32>, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] ->(vector<1xf32>, vector<2xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> %3 = vector.transfer_read %src[%c32], %cst : memref<1024xf32>, vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_read(%laneid: index, %src: memref<1024xf32>, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] ->(vector<1xf32>, vector<2xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> %3 = vector.transfer_read %src[%c32], %cst : memref<1024xf32>, vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_read(%laneid: index, %src: memref<1024xf32>, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] ->(vector<1xf32>, vector<2xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> %3 = vector.transfer_read %src[%c32], %cst : memref<1024xf32>, vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "#map0 = affine_map<()[s0] -> (s0 * 2)> func.func @warp_propagate_read(%laneid: index, %src: memref<1024xf32>, %dest: memref<1024xf32>) { %c0 = arith.constant 0 : index %c32 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] ->(vector<1xf32>, vector<2xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> %3 = vector.transfer_read %src[%c32], %cst : memref<1024xf32>, vector<64xf32> vector.yield %2, %3 : vector<32xf32>, vector<64xf32> } %id2 = affine.apply #map0()[%laneid] vector.transfer_write %r#0, %dest[%laneid] : vector<1xf32>, memref<1024xf32> vector.transfer_write %r#1, %dest[%id2] : vector<2xf32>, memref<1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @fold_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<32xf32> vector.yield %1 : vector<32xf32> } vector.print %r : vector<1xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @fold_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<32xf32> vector.yield %1 : vector<32xf32> } vector.print %r : vector<1xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @fold_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<32xf32> vector.yield %1 : vector<32xf32> } vector.print %r : vector<1xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @fold_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<32xf32> vector.yield %1 : vector<32xf32> } vector.print %r : vector<1xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @fold_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<32xf32> vector.yield %1 : vector<32xf32> } vector.print %r : vector<1xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @extract_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @extract_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @extract_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @extract_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @extract_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (vector<1xf32>) %1 = vector.broadcast %0 : vector<1xf32> to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @extract_scalar_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (f32) %1 = vector.broadcast %0 : f32 to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @extract_scalar_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (f32) %1 = vector.broadcast %0 : f32 to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @extract_scalar_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (f32) %1 = vector.broadcast %0 : f32 to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @extract_scalar_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (f32) %1 = vector.broadcast %0 : f32 to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @extract_scalar_vector_broadcast(%laneid: index) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<2xf32>) { %0 = ""some_def""() : () -> (f32) %1 = vector.broadcast %0 : f32 to vector<64xf32> vector.yield %1 : vector<64xf32> } vector.print %r : vector<2xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_scf_for(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_scf_for(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_scf_for(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_scf_for(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_scf_for(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_scf_for_use_from_above(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %use_from_above = ""some_def_above""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4, %use_from_above) : (vector<128xf32>, vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_scf_for_use_from_above(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %use_from_above = ""some_def_above""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4, %use_from_above) : (vector<128xf32>, vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_scf_for_use_from_above(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %use_from_above = ""some_def_above""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4, %use_from_above) : (vector<128xf32>, vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_scf_for_use_from_above(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %use_from_above = ""some_def_above""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4, %use_from_above) : (vector<128xf32>, vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_scf_for_use_from_above(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>) { %ini = ""some_def""() : () -> (vector<128xf32>) %use_from_above = ""some_def_above""() : () -> (vector<128xf32>) %3 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<128xf32>) { %acc = ""some_def""(%arg4, %use_from_above) : (vector<128xf32>, vector<128xf32>) -> (vector<128xf32>) scf.yield %acc : vector<128xf32> } vector.yield %3 : vector<128xf32> } ""some_use""(%0) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_scf_for_swap(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0:2 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>, vector<4xf32>) { %ini1 = ""some_def""() : () -> (vector<128xf32>) %ini2 = ""some_def""() : () -> (vector<128xf32>) %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini1, %arg5 = %ini2) -> (vector<128xf32>, vector<128xf32>) { %acc1 = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) %acc2 = ""some_def""(%arg5) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc2, %acc1 : vector<128xf32>, vector<128xf32> } vector.yield %3#0, %3#1 : vector<128xf32>, vector<128xf32> } ""some_use""(%0#0) : (vector<4xf32>) -> () ""some_use""(%0#1) : (vector<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_scf_for_swap(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0:2 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>, vector<4xf32>) { %ini1 = ""some_def""() : () -> (vector<128xf32>) %ini2 = ""some_def""() : () -> (vector<128xf32>) %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini1, %arg5 = %ini2) -> (vector<128xf32>, vector<128xf32>) { %acc1 = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) %acc2 = ""some_def""(%arg5) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc2, %acc1 : vector<128xf32>, vector<128xf32> } vector.yield %3#0, %3#1 : vector<128xf32>, vector<128xf32> } ""some_use""(%0#0) : (vector<4xf32>) -> () ""some_use""(%0#1) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_scf_for_swap(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0:2 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>, vector<4xf32>) { %ini1 = ""some_def""() : () -> (vector<128xf32>) %ini2 = ""some_def""() : () -> (vector<128xf32>) %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini1, %arg5 = %ini2) -> (vector<128xf32>, vector<128xf32>) { %acc1 = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) %acc2 = ""some_def""(%arg5) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc2, %acc1 : vector<128xf32>, vector<128xf32> } vector.yield %3#0, %3#1 : vector<128xf32>, vector<128xf32> } ""some_use""(%0#0) : (vector<4xf32>) -> () ""some_use""(%0#1) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_scf_for_swap(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0:2 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>, vector<4xf32>) { %ini1 = ""some_def""() : () -> (vector<128xf32>) %ini2 = ""some_def""() : () -> (vector<128xf32>) %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini1, %arg5 = %ini2) -> (vector<128xf32>, vector<128xf32>) { %acc1 = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) %acc2 = ""some_def""(%arg5) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc2, %acc1 : vector<128xf32>, vector<128xf32> } vector.yield %3#0, %3#1 : vector<128xf32>, vector<128xf32> } ""some_use""(%0#0) : (vector<4xf32>) -> () ""some_use""(%0#1) : (vector<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_scf_for_swap(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0:2 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<4xf32>, vector<4xf32>) { %ini1 = ""some_def""() : () -> (vector<128xf32>) %ini2 = ""some_def""() : () -> (vector<128xf32>) %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini1, %arg5 = %ini2) -> (vector<128xf32>, vector<128xf32>) { %acc1 = ""some_def""(%arg4) : (vector<128xf32>) -> (vector<128xf32>) %acc2 = ""some_def""(%arg5) : (vector<128xf32>) -> (vector<128xf32>) scf.yield %acc2, %acc1 : vector<128xf32>, vector<128xf32> } vector.yield %3#0, %3#1 : vector<128xf32>, vector<128xf32> } ""some_use""(%0#0) : (vector<4xf32>) -> () ""some_use""(%0#1) : (vector<4xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_scf_for_swap_no_yield(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index vector.warp_execute_on_lane_0(%arg0)[32] { scf.for %arg3 = %c0 to %c128 step %c1 { ""some_op""() : () -> () } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_scf_for_swap_no_yield(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index vector.warp_execute_on_lane_0(%arg0)[32] { scf.for %arg3 = %c0 to %c128 step %c1 { ""some_op""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_scf_for_swap_no_yield(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index vector.warp_execute_on_lane_0(%arg0)[32] { scf.for %arg3 = %c0 to %c128 step %c1 { ""some_op""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_scf_for_swap_no_yield(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index vector.warp_execute_on_lane_0(%arg0)[32] { scf.for %arg3 = %c0 to %c128 step %c1 { ""some_op""() : () -> () } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_scf_for_swap_no_yield(%arg0: index) { %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index vector.warp_execute_on_lane_0(%arg0)[32] { scf.for %arg3 = %c0 to %c128 step %c1 { ""some_op""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "#map = affine_map<()[s0] -> (s0 * 4)> #map1 = affine_map<()[s0] -> (s0 * 128 + 128)> #map2 = affine_map<()[s0] -> (s0 * 4 + 128)> func.func @warp_scf_for_multiple_yield(%arg0: index, %arg1: memref, %arg2: memref) { %c256 = arith.constant 256 : index %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0:3 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>, vector<4xf32>, vector<4xf32>) { %def = ""some_def""() : () -> (vector<32xf32>) %r1 = vector.transfer_read %arg2[%c0], %cst {in_bounds = [true]} : memref, vector<128xf32> %r2 = vector.transfer_read %arg2[%c128], %cst {in_bounds = [true]} : memref, vector<128xf32> %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %r1, %arg5 = %r2) -> (vector<128xf32>, vector<128xf32>) { %o1 = affine.apply #map1()[%arg3] %o2 = affine.apply #map2()[%arg3] %4 = vector.transfer_read %arg1[%o1], %cst {in_bounds = [true]} : memref, vector<128xf32> %5 = vector.transfer_read %arg1[%o2], %cst {in_bounds = [true]} : memref, vector<128xf32> %6 = arith.addf %4, %arg4 : vector<128xf32> %7 = arith.addf %5, %arg5 : vector<128xf32> scf.yield %6, %7 : vector<128xf32>, vector<128xf32> } vector.yield %def, %3#0, %3#1 : vector<32xf32>, vector<128xf32>, vector<128xf32> } %1 = affine.apply #map()[%arg0] vector.transfer_write %0#1, %arg2[%1] {in_bounds = [true]} : vector<4xf32>, memref %2 = affine.apply #map2()[%arg0] vector.transfer_write %0#2, %arg2[%2] {in_bounds = [true]} : vector<4xf32>, memref ""some_use""(%0#0) : (vector<1xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "#map = affine_map<()[s0] -> (s0 * 4)> #map1 = affine_map<()[s0] -> (s0 * 128 + 128)> #map2 = affine_map<()[s0] -> (s0 * 4 + 128)> func.func @warp_scf_for_multiple_yield(%arg0: index, %arg1: memref, %arg2: memref) { %c256 = arith.constant 256 : index %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0:3 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>, vector<4xf32>, vector<4xf32>) { %def = ""some_def""() : () -> (vector<32xf32>) %r1 = vector.transfer_read %arg2[%c0], %cst {in_bounds = [true]} : memref, vector<128xf32> %r2 = vector.transfer_read %arg2[%c128], %cst {in_bounds = [true]} : memref, vector<128xf32> %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %r1, %arg5 = %r2) -> (vector<128xf32>, vector<128xf32>) { %o1 = affine.apply #map1()[%arg3] %o2 = affine.apply #map2()[%arg3] %4 = vector.transfer_read %arg1[%o1], %cst {in_bounds = [true]} : memref, vector<128xf32> %5 = vector.transfer_read %arg1[%o2], %cst {in_bounds = [true]} : memref, vector<128xf32> %6 = arith.addf %4, %arg4 : vector<128xf32> %7 = arith.addf %5, %arg5 : vector<128xf32> scf.yield %6, %7 : vector<128xf32>, vector<128xf32> } vector.yield %def, %3#0, %3#1 : vector<32xf32>, vector<128xf32>, vector<128xf32> } %1 = affine.apply #map()[%arg0] vector.transfer_write %0#1, %arg2[%1] {in_bounds = [true]} : vector<4xf32>, memref %2 = affine.apply #map2()[%arg0] vector.transfer_write %0#2, %arg2[%2] {in_bounds = [true]} : vector<4xf32>, memref ""some_use""(%0#0) : (vector<1xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "#map = affine_map<()[s0] -> (s0 * 4)> #map1 = affine_map<()[s0] -> (s0 * 128 + 128)> #map2 = affine_map<()[s0] -> (s0 * 4 + 128)> func.func @warp_scf_for_multiple_yield(%arg0: index, %arg1: memref, %arg2: memref) { %c256 = arith.constant 256 : index %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0:3 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>, vector<4xf32>, vector<4xf32>) { %def = ""some_def""() : () -> (vector<32xf32>) %r1 = vector.transfer_read %arg2[%c0], %cst {in_bounds = [true]} : memref, vector<128xf32> %r2 = vector.transfer_read %arg2[%c128], %cst {in_bounds = [true]} : memref, vector<128xf32> %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %r1, %arg5 = %r2) -> (vector<128xf32>, vector<128xf32>) { %o1 = affine.apply #map1()[%arg3] %o2 = affine.apply #map2()[%arg3] %4 = vector.transfer_read %arg1[%o1], %cst {in_bounds = [true]} : memref, vector<128xf32> %5 = vector.transfer_read %arg1[%o2], %cst {in_bounds = [true]} : memref, vector<128xf32> %6 = arith.addf %4, %arg4 : vector<128xf32> %7 = arith.addf %5, %arg5 : vector<128xf32> scf.yield %6, %7 : vector<128xf32>, vector<128xf32> } vector.yield %def, %3#0, %3#1 : vector<32xf32>, vector<128xf32>, vector<128xf32> } %1 = affine.apply #map()[%arg0] vector.transfer_write %0#1, %arg2[%1] {in_bounds = [true]} : vector<4xf32>, memref %2 = affine.apply #map2()[%arg0] vector.transfer_write %0#2, %arg2[%2] {in_bounds = [true]} : vector<4xf32>, memref ""some_use""(%0#0) : (vector<1xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "#map = affine_map<()[s0] -> (s0 * 4)> #map1 = affine_map<()[s0] -> (s0 * 128 + 128)> #map2 = affine_map<()[s0] -> (s0 * 4 + 128)> func.func @warp_scf_for_multiple_yield(%arg0: index, %arg1: memref, %arg2: memref) { %c256 = arith.constant 256 : index %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0:3 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>, vector<4xf32>, vector<4xf32>) { %def = ""some_def""() : () -> (vector<32xf32>) %r1 = vector.transfer_read %arg2[%c0], %cst {in_bounds = [true]} : memref, vector<128xf32> %r2 = vector.transfer_read %arg2[%c128], %cst {in_bounds = [true]} : memref, vector<128xf32> %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %r1, %arg5 = %r2) -> (vector<128xf32>, vector<128xf32>) { %o1 = affine.apply #map1()[%arg3] %o2 = affine.apply #map2()[%arg3] %4 = vector.transfer_read %arg1[%o1], %cst {in_bounds = [true]} : memref, vector<128xf32> %5 = vector.transfer_read %arg1[%o2], %cst {in_bounds = [true]} : memref, vector<128xf32> %6 = arith.addf %4, %arg4 : vector<128xf32> %7 = arith.addf %5, %arg5 : vector<128xf32> scf.yield %6, %7 : vector<128xf32>, vector<128xf32> } vector.yield %def, %3#0, %3#1 : vector<32xf32>, vector<128xf32>, vector<128xf32> } %1 = affine.apply #map()[%arg0] vector.transfer_write %0#1, %arg2[%1] {in_bounds = [true]} : vector<4xf32>, memref %2 = affine.apply #map2()[%arg0] vector.transfer_write %0#2, %arg2[%2] {in_bounds = [true]} : vector<4xf32>, memref ""some_use""(%0#0) : (vector<1xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "#map = affine_map<()[s0] -> (s0 * 4)> #map1 = affine_map<()[s0] -> (s0 * 128 + 128)> #map2 = affine_map<()[s0] -> (s0 * 4 + 128)> func.func @warp_scf_for_multiple_yield(%arg0: index, %arg1: memref, %arg2: memref) { %c256 = arith.constant 256 : index %c128 = arith.constant 128 : index %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0:3 = vector.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>, vector<4xf32>, vector<4xf32>) { %def = ""some_def""() : () -> (vector<32xf32>) %r1 = vector.transfer_read %arg2[%c0], %cst {in_bounds = [true]} : memref, vector<128xf32> %r2 = vector.transfer_read %arg2[%c128], %cst {in_bounds = [true]} : memref, vector<128xf32> %3:2 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %r1, %arg5 = %r2) -> (vector<128xf32>, vector<128xf32>) { %o1 = affine.apply #map1()[%arg3] %o2 = affine.apply #map2()[%arg3] %4 = vector.transfer_read %arg1[%o1], %cst {in_bounds = [true]} : memref, vector<128xf32> %5 = vector.transfer_read %arg1[%o2], %cst {in_bounds = [true]} : memref, vector<128xf32> %6 = arith.addf %4, %arg4 : vector<128xf32> %7 = arith.addf %5, %arg5 : vector<128xf32> scf.yield %6, %7 : vector<128xf32>, vector<128xf32> } vector.yield %def, %3#0, %3#1 : vector<32xf32>, vector<128xf32>, vector<128xf32> } %1 = affine.apply #map()[%arg0] vector.transfer_write %0#1, %arg2[%1] {in_bounds = [true]} : vector<4xf32>, memref %2 = affine.apply #map2()[%arg0] vector.transfer_write %0#2, %arg2[%2] {in_bounds = [true]} : vector<4xf32>, memref ""some_use""(%0#0) : (vector<1xf32>) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_reduction(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<32xf32>) %1 = vector.reduction , %0 : vector<32xf32> into f32 vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_reduction(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<32xf32>) %1 = vector.reduction , %0 : vector<32xf32> into f32 vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_reduction(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<32xf32>) %1 = vector.reduction , %0 : vector<32xf32> into f32 vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_reduction(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<32xf32>) %1 = vector.reduction , %0 : vector<32xf32> into f32 vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_reduction(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<32xf32>) %1 = vector.reduction , %0 : vector<32xf32> into f32 vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_reduction(%laneid: index, %m0: memref<4x2x32xf32>, %m1: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 vector.warp_execute_on_lane_0(%laneid)[32] { %0 = vector.transfer_read %m0[%c0, %c0, %c0], %f0 {in_bounds = [true]} : memref<4x2x32xf32>, vector<32xf32> %1 = vector.transfer_read %m1[], %f0 : memref, vector %2 = vector.extractelement %1[] : vector %3 = vector.reduction , %0 : vector<32xf32> into f32 %4 = arith.addf %3, %2 : f32 %5 = vector.broadcast %4 : f32 to vector vector.transfer_write %5, %m1[] : vector, memref } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_reduction(%laneid: index, %m0: memref<4x2x32xf32>, %m1: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 vector.warp_execute_on_lane_0(%laneid)[32] { %0 = vector.transfer_read %m0[%c0, %c0, %c0], %f0 {in_bounds = [true]} : memref<4x2x32xf32>, vector<32xf32> %1 = vector.transfer_read %m1[], %f0 : memref, vector %2 = vector.extractelement %1[] : vector %3 = vector.reduction , %0 : vector<32xf32> into f32 %4 = arith.addf %3, %2 : f32 %5 = vector.broadcast %4 : f32 to vector vector.transfer_write %5, %m1[] : vector, memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_reduction(%laneid: index, %m0: memref<4x2x32xf32>, %m1: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 vector.warp_execute_on_lane_0(%laneid)[32] { %0 = vector.transfer_read %m0[%c0, %c0, %c0], %f0 {in_bounds = [true]} : memref<4x2x32xf32>, vector<32xf32> %1 = vector.transfer_read %m1[], %f0 : memref, vector %2 = vector.extractelement %1[] : vector %3 = vector.reduction , %0 : vector<32xf32> into f32 %4 = arith.addf %3, %2 : f32 %5 = vector.broadcast %4 : f32 to vector vector.transfer_write %5, %m1[] : vector, memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_reduction(%laneid: index, %m0: memref<4x2x32xf32>, %m1: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 vector.warp_execute_on_lane_0(%laneid)[32] { %0 = vector.transfer_read %m0[%c0, %c0, %c0], %f0 {in_bounds = [true]} : memref<4x2x32xf32>, vector<32xf32> %1 = vector.transfer_read %m1[], %f0 : memref, vector %2 = vector.extractelement %1[] : vector %3 = vector.reduction , %0 : vector<32xf32> into f32 %4 = arith.addf %3, %2 : f32 %5 = vector.broadcast %4 : f32 to vector vector.transfer_write %5, %m1[] : vector, memref } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_reduction(%laneid: index, %m0: memref<4x2x32xf32>, %m1: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 vector.warp_execute_on_lane_0(%laneid)[32] { %0 = vector.transfer_read %m0[%c0, %c0, %c0], %f0 {in_bounds = [true]} : memref<4x2x32xf32>, vector<32xf32> %1 = vector.transfer_read %m1[], %f0 : memref, vector %2 = vector.extractelement %1[] : vector %3 = vector.reduction , %0 : vector<32xf32> into f32 %4 = arith.addf %3, %2 : f32 %5 = vector.broadcast %4 : f32 to vector vector.transfer_write %5, %m1[] : vector, memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_reduction_large(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.reduction , %0 : vector<64xf32> into f32 vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_reduction_large(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.reduction , %0 : vector<64xf32> into f32 vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_reduction_large(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.reduction , %0 : vector<64xf32> into f32 vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_reduction_large(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.reduction , %0 : vector<64xf32> into f32 vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_reduction_large(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.reduction , %0 : vector<64xf32> into f32 vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_reduction_acc(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = ""some_def""() : () -> (f32) %2 = vector.reduction , %0, %1 : vector<64xf32> into f32 vector.yield %2 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_reduction_acc(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = ""some_def""() : () -> (f32) %2 = vector.reduction , %0, %1 : vector<64xf32> into f32 vector.yield %2 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_reduction_acc(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = ""some_def""() : () -> (f32) %2 = vector.reduction , %0, %1 : vector<64xf32> into f32 vector.yield %2 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_reduction_acc(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = ""some_def""() : () -> (f32) %2 = vector.reduction , %0, %1 : vector<64xf32> into f32 vector.yield %2 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_reduction_acc(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = ""some_def""() : () -> (f32) %2 = vector.reduction , %0, %1 : vector<64xf32> into f32 vector.yield %2 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_duplicate_yield(%laneid: index) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = arith.addf %2, %3 : vector<32xf32> %5 = arith.addf %2, %2 : vector<32xf32> vector.yield %4, %5 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_duplicate_yield(%laneid: index) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = arith.addf %2, %3 : vector<32xf32> %5 = arith.addf %2, %2 : vector<32xf32> vector.yield %4, %5 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_duplicate_yield(%laneid: index) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = arith.addf %2, %3 : vector<32xf32> %5 = arith.addf %2, %2 : vector<32xf32> vector.yield %4, %5 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_duplicate_yield(%laneid: index) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = arith.addf %2, %3 : vector<32xf32> %5 = arith.addf %2, %2 : vector<32xf32> vector.yield %4, %5 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_duplicate_yield(%laneid: index) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>, vector<1xf32>) { %2 = ""some_def""() : () -> (vector<32xf32>) %3 = ""some_def""() : () -> (vector<32xf32>) %4 = arith.addf %2, %3 : vector<32xf32> %5 = arith.addf %2, %2 : vector<32xf32> vector.yield %4, %5 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_constant(%laneid: index) -> (vector<1xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %cst = arith.constant dense<2.0> : vector<32xf32> vector.yield %cst : vector<32xf32> } return %r : vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_constant(%laneid: index) -> (vector<1xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %cst = arith.constant dense<2.0> : vector<32xf32> vector.yield %cst : vector<32xf32> } return %r : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_constant(%laneid: index) -> (vector<1xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %cst = arith.constant dense<2.0> : vector<32xf32> vector.yield %cst : vector<32xf32> } return %r : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_constant(%laneid: index) -> (vector<1xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %cst = arith.constant dense<2.0> : vector<32xf32> vector.yield %cst : vector<32xf32> } return %r : vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_constant(%laneid: index) -> (vector<1xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %cst = arith.constant dense<2.0> : vector<32xf32> vector.yield %cst : vector<32xf32> } return %r : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extract_1d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.extract %0[9] : vector<64xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extract_1d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.extract %0[9] : vector<64xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extract_1d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.extract %0[9] : vector<64xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extract_1d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.extract %0[9] : vector<64xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extract_1d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<64xf32>) %1 = vector.extract %0[9] : vector<64xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extract_2d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extract_2d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extract_2d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extract_2d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extract_2d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extract_2d_broadcast_scalar(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[1, 2] : vector<5x96xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extract_2d_broadcast_scalar(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[1, 2] : vector<5x96xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extract_2d_broadcast_scalar(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[1, 2] : vector<5x96xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extract_2d_broadcast_scalar(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[1, 2] : vector<5x96xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extract_2d_broadcast_scalar(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[1, 2] : vector<5x96xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extract_2d_broadcast(%laneid: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extract_2d_broadcast(%laneid: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extract_2d_broadcast(%laneid: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extract_2d_broadcast(%laneid: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extract_2d_broadcast(%laneid: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<5x96xf32>) %1 = vector.extract %0[2] : vector<5x96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extract_3d(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<8x128x96xf32>) %1 = vector.extract %0[2] : vector<8x128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extract_3d(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<8x128x96xf32>) %1 = vector.extract %0[2] : vector<8x128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extract_3d(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<8x128x96xf32>) %1 = vector.extract %0[2] : vector<8x128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extract_3d(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<8x128x96xf32>) %1 = vector.extract %0[2] : vector<8x128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extract_3d(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<8x128x96xf32>) %1 = vector.extract %0[2] : vector<8x128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extractelement_0d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector) %1 = vector.extractelement %0[] : vector vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extractelement_0d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector) %1 = vector.extractelement %0[] : vector vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extractelement_0d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector) %1 = vector.extractelement %0[] : vector vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extractelement_0d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector) %1 = vector.extractelement %0[] : vector vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extractelement_0d(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector) %1 = vector.extractelement %0[] : vector vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extractelement_1element(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<1xf32>) %c0 = arith.constant 0 : index %1 = vector.extractelement %0[%c0 : index] : vector<1xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extractelement_1element(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<1xf32>) %c0 = arith.constant 0 : index %1 = vector.extractelement %0[%c0 : index] : vector<1xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extractelement_1element(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<1xf32>) %c0 = arith.constant 0 : index %1 = vector.extractelement %0[%c0 : index] : vector<1xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extractelement_1element(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<1xf32>) %c0 = arith.constant 0 : index %1 = vector.extractelement %0[%c0 : index] : vector<1xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extractelement_1element(%laneid: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<1xf32>) %c0 = arith.constant 0 : index %1 = vector.extractelement %0[%c0 : index] : vector<1xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_extractelement_1d(%laneid: index, %pos: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<96xf32>) %1 = vector.extractelement %0[%pos : index] : vector<96xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_extractelement_1d(%laneid: index, %pos: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<96xf32>) %1 = vector.extractelement %0[%pos : index] : vector<96xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_extractelement_1d(%laneid: index, %pos: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<96xf32>) %1 = vector.extractelement %0[%pos : index] : vector<96xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_extractelement_1d(%laneid: index, %pos: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<96xf32>) %1 = vector.extractelement %0[%pos : index] : vector<96xf32> vector.yield %1 : f32 } return %r : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_extractelement_1d(%laneid: index, %pos: index) -> (f32) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (f32) { %0 = ""some_def""() : () -> (vector<96xf32>) %1 = vector.extractelement %0[%pos : index] : vector<96xf32> vector.yield %1 : f32 } return %r : f32 }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @lane_dependent_warp_propagate_read( %laneid: index, %src: memref<1x1024xf32>, %dest: memref<1x1024xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1x1xf32>) { %2 = vector.transfer_read %src[%c0, %c0], %cst : memref<1x1024xf32>, vector<1x32xf32> vector.yield %2 : vector<1x32xf32> } vector.transfer_write %r, %dest[%c0, %laneid] : vector<1x1xf32>, memref<1x1024xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @lane_dependent_warp_propagate_read( %laneid: index, %src: memref<1x1024xf32>, %dest: memref<1x1024xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1x1xf32>) { %2 = vector.transfer_read %src[%c0, %c0], %cst : memref<1x1024xf32>, vector<1x32xf32> vector.yield %2 : vector<1x32xf32> } vector.transfer_write %r, %dest[%c0, %laneid] : vector<1x1xf32>, memref<1x1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @lane_dependent_warp_propagate_read( %laneid: index, %src: memref<1x1024xf32>, %dest: memref<1x1024xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1x1xf32>) { %2 = vector.transfer_read %src[%c0, %c0], %cst : memref<1x1024xf32>, vector<1x32xf32> vector.yield %2 : vector<1x32xf32> } vector.transfer_write %r, %dest[%c0, %laneid] : vector<1x1xf32>, memref<1x1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @lane_dependent_warp_propagate_read( %laneid: index, %src: memref<1x1024xf32>, %dest: memref<1x1024xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1x1xf32>) { %2 = vector.transfer_read %src[%c0, %c0], %cst : memref<1x1024xf32>, vector<1x32xf32> vector.yield %2 : vector<1x32xf32> } vector.transfer_write %r, %dest[%c0, %laneid] : vector<1x1xf32>, memref<1x1024xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @lane_dependent_warp_propagate_read( %laneid: index, %src: memref<1x1024xf32>, %dest: memref<1x1024xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1x1xf32>) { %2 = vector.transfer_read %src[%c0, %c0], %cst : memref<1x1024xf32>, vector<1x32xf32> vector.yield %2 : vector<1x32xf32> } vector.transfer_write %r, %dest[%c0, %laneid] : vector<1x1xf32>, memref<1x1024xf32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @dont_duplicate_read( %laneid: index, %src: memref<1024xf32>) -> vector<1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> ""blocking_use""(%2) : (vector<32xf32>) -> () vector.yield %2 : vector<32xf32> } return %r : vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @dont_duplicate_read( %laneid: index, %src: memref<1024xf32>) -> vector<1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> ""blocking_use""(%2) : (vector<32xf32>) -> () vector.yield %2 : vector<32xf32> } return %r : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @dont_duplicate_read( %laneid: index, %src: memref<1024xf32>) -> vector<1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> ""blocking_use""(%2) : (vector<32xf32>) -> () vector.yield %2 : vector<32xf32> } return %r : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @dont_duplicate_read( %laneid: index, %src: memref<1024xf32>) -> vector<1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> ""blocking_use""(%2) : (vector<32xf32>) -> () vector.yield %2 : vector<32xf32> } return %r : vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @dont_duplicate_read( %laneid: index, %src: memref<1024xf32>) -> vector<1xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xf32>) { %2 = vector.transfer_read %src[%c0], %cst : memref<1024xf32>, vector<32xf32> ""blocking_use""(%2) : (vector<32xf32>) -> () vector.yield %2 : vector<32xf32> } return %r : vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @dedup(%laneid: index, %v0: vector<4xf32>, %v1: vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<128xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> vector.yield %2, %2 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @dedup(%laneid: index, %v0: vector<4xf32>, %v1: vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<128xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> vector.yield %2, %2 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @dedup(%laneid: index, %v0: vector<4xf32>, %v1: vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<128xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> vector.yield %2, %2 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @dedup(%laneid: index, %v0: vector<4xf32>, %v1: vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<128xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> vector.yield %2, %2 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @dedup(%laneid: index, %v0: vector<4xf32>, %v1: vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<4xf32>, vector<4xf32>) -> (vector<1xf32>, vector<1xf32>) { ^bb0(%arg0: vector<128xf32>, %arg1: vector<128xf32>): %2 = ""some_def""(%arg0) : (vector<128xf32>) -> vector<32xf32> vector.yield %2, %2 : vector<32xf32>, vector<32xf32> } return %r#0, %r#1 : vector<1xf32>, vector<1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_execute_has_broadcast_semantics(%laneid: index, %s0: f32, %v0: vector, %v1: vector<1xf32>, %v2: vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { %r:4 = vector.warp_execute_on_lane_0(%laneid)[32] args(%s0, %v0, %v1, %v2 : f32, vector, vector<1xf32>, vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { ^bb0(%bs0: f32, %bv0: vector, %bv1: vector<1xf32>, %bv2: vector<1x1xf32>): %rs0 = ""some_def_0""(%bs0) : (f32) -> f32 %rv0 = ""some_def_1""(%bv0) : (vector) -> vector %rv1 = ""some_def_1""(%bv1) : (vector<1xf32>) -> vector<1xf32> %rv2 = ""some_def_1""(%bv2) : (vector<1x1xf32>) -> vector<1x1xf32> vector.yield %rs0, %rv0, %rv1, %rv2 : f32, vector, vector<1xf32>, vector<1x1xf32> } return %r#0, %r#1, %r#2, %r#3 : f32, vector, vector<1xf32>, vector<1x1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_execute_has_broadcast_semantics(%laneid: index, %s0: f32, %v0: vector, %v1: vector<1xf32>, %v2: vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { %r:4 = vector.warp_execute_on_lane_0(%laneid)[32] args(%s0, %v0, %v1, %v2 : f32, vector, vector<1xf32>, vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { ^bb0(%bs0: f32, %bv0: vector, %bv1: vector<1xf32>, %bv2: vector<1x1xf32>): %rs0 = ""some_def_0""(%bs0) : (f32) -> f32 %rv0 = ""some_def_1""(%bv0) : (vector) -> vector %rv1 = ""some_def_1""(%bv1) : (vector<1xf32>) -> vector<1xf32> %rv2 = ""some_def_1""(%bv2) : (vector<1x1xf32>) -> vector<1x1xf32> vector.yield %rs0, %rv0, %rv1, %rv2 : f32, vector, vector<1xf32>, vector<1x1xf32> } return %r#0, %r#1, %r#2, %r#3 : f32, vector, vector<1xf32>, vector<1x1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_execute_has_broadcast_semantics(%laneid: index, %s0: f32, %v0: vector, %v1: vector<1xf32>, %v2: vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { %r:4 = vector.warp_execute_on_lane_0(%laneid)[32] args(%s0, %v0, %v1, %v2 : f32, vector, vector<1xf32>, vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { ^bb0(%bs0: f32, %bv0: vector, %bv1: vector<1xf32>, %bv2: vector<1x1xf32>): %rs0 = ""some_def_0""(%bs0) : (f32) -> f32 %rv0 = ""some_def_1""(%bv0) : (vector) -> vector %rv1 = ""some_def_1""(%bv1) : (vector<1xf32>) -> vector<1xf32> %rv2 = ""some_def_1""(%bv2) : (vector<1x1xf32>) -> vector<1x1xf32> vector.yield %rs0, %rv0, %rv1, %rv2 : f32, vector, vector<1xf32>, vector<1x1xf32> } return %r#0, %r#1, %r#2, %r#3 : f32, vector, vector<1xf32>, vector<1x1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_execute_has_broadcast_semantics(%laneid: index, %s0: f32, %v0: vector, %v1: vector<1xf32>, %v2: vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { %r:4 = vector.warp_execute_on_lane_0(%laneid)[32] args(%s0, %v0, %v1, %v2 : f32, vector, vector<1xf32>, vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { ^bb0(%bs0: f32, %bv0: vector, %bv1: vector<1xf32>, %bv2: vector<1x1xf32>): %rs0 = ""some_def_0""(%bs0) : (f32) -> f32 %rv0 = ""some_def_1""(%bv0) : (vector) -> vector %rv1 = ""some_def_1""(%bv1) : (vector<1xf32>) -> vector<1xf32> %rv2 = ""some_def_1""(%bv2) : (vector<1x1xf32>) -> vector<1x1xf32> vector.yield %rs0, %rv0, %rv1, %rv2 : f32, vector, vector<1xf32>, vector<1x1xf32> } return %r#0, %r#1, %r#2, %r#3 : f32, vector, vector<1xf32>, vector<1x1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_execute_has_broadcast_semantics(%laneid: index, %s0: f32, %v0: vector, %v1: vector<1xf32>, %v2: vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { %r:4 = vector.warp_execute_on_lane_0(%laneid)[32] args(%s0, %v0, %v1, %v2 : f32, vector, vector<1xf32>, vector<1x1xf32>) -> (f32, vector, vector<1xf32>, vector<1x1xf32>) { ^bb0(%bs0: f32, %bv0: vector, %bv1: vector<1xf32>, %bv2: vector<1x1xf32>): %rs0 = ""some_def_0""(%bs0) : (f32) -> f32 %rv0 = ""some_def_1""(%bv0) : (vector) -> vector %rv1 = ""some_def_1""(%bv1) : (vector<1xf32>) -> vector<1xf32> %rv2 = ""some_def_1""(%bv2) : (vector<1x1xf32>) -> vector<1x1xf32> vector.yield %rs0, %rv0, %rv1, %rv2 : f32, vector, vector<1xf32>, vector<1x1xf32> } return %r#0, %r#1, %r#2, %r#3 : f32, vector, vector<1xf32>, vector<1x1xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @warp_execute_nd_distribute(%laneid: index, %v0: vector<1x64x1xf32>, %v1: vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<1x64x1xf32>, vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { ^bb0(%arg0: vector<32x64x1xf32>, %arg1: vector<1x64x128xf32>): %r0 = ""some_def_0""(%arg0) : (vector<32x64x1xf32>) -> vector<32x64x1xf32> %r1 = ""some_def_1""(%arg1) : (vector<1x64x128xf32>) -> vector<1x64x128xf32> vector.yield %r0, %r1 : vector<32x64x1xf32>, vector<1x64x128xf32> } return %r#0, %r#1 : vector<1x64x1xf32>, vector<1x2x128xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @warp_execute_nd_distribute(%laneid: index, %v0: vector<1x64x1xf32>, %v1: vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<1x64x1xf32>, vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { ^bb0(%arg0: vector<32x64x1xf32>, %arg1: vector<1x64x128xf32>): %r0 = ""some_def_0""(%arg0) : (vector<32x64x1xf32>) -> vector<32x64x1xf32> %r1 = ""some_def_1""(%arg1) : (vector<1x64x128xf32>) -> vector<1x64x128xf32> vector.yield %r0, %r1 : vector<32x64x1xf32>, vector<1x64x128xf32> } return %r#0, %r#1 : vector<1x64x1xf32>, vector<1x2x128xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @warp_execute_nd_distribute(%laneid: index, %v0: vector<1x64x1xf32>, %v1: vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<1x64x1xf32>, vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { ^bb0(%arg0: vector<32x64x1xf32>, %arg1: vector<1x64x128xf32>): %r0 = ""some_def_0""(%arg0) : (vector<32x64x1xf32>) -> vector<32x64x1xf32> %r1 = ""some_def_1""(%arg1) : (vector<1x64x128xf32>) -> vector<1x64x128xf32> vector.yield %r0, %r1 : vector<32x64x1xf32>, vector<1x64x128xf32> } return %r#0, %r#1 : vector<1x64x1xf32>, vector<1x2x128xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @warp_execute_nd_distribute(%laneid: index, %v0: vector<1x64x1xf32>, %v1: vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<1x64x1xf32>, vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { ^bb0(%arg0: vector<32x64x1xf32>, %arg1: vector<1x64x128xf32>): %r0 = ""some_def_0""(%arg0) : (vector<32x64x1xf32>) -> vector<32x64x1xf32> %r1 = ""some_def_1""(%arg1) : (vector<1x64x128xf32>) -> vector<1x64x128xf32> vector.yield %r0, %r1 : vector<32x64x1xf32>, vector<1x64x128xf32> } return %r#0, %r#1 : vector<1x64x1xf32>, vector<1x2x128xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @warp_execute_nd_distribute(%laneid: index, %v0: vector<1x64x1xf32>, %v1: vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { %r:2 = vector.warp_execute_on_lane_0(%laneid)[32] args(%v0, %v1 : vector<1x64x1xf32>, vector<1x2x128xf32>) -> (vector<1x64x1xf32>, vector<1x2x128xf32>) { ^bb0(%arg0: vector<32x64x1xf32>, %arg1: vector<1x64x128xf32>): %r0 = ""some_def_0""(%arg0) : (vector<32x64x1xf32>) -> vector<32x64x1xf32> %r1 = ""some_def_1""(%arg1) : (vector<1x64x128xf32>) -> vector<1x64x128xf32> vector.yield %r0, %r1 : vector<32x64x1xf32>, vector<1x64x128xf32> } return %r#0, %r#1 : vector<1x64x1xf32>, vector<1x2x128xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insertelement_1d(%laneid: index, %pos: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insertelement_1d(%laneid: index, %pos: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insertelement_1d(%laneid: index, %pos: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insertelement_1d(%laneid: index, %pos: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insertelement_1d(%laneid: index, %pos: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insertelement_1d_broadcast(%laneid: index, %pos: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insertelement_1d_broadcast(%laneid: index, %pos: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insertelement_1d_broadcast(%laneid: index, %pos: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insertelement_1d_broadcast(%laneid: index, %pos: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insertelement_1d_broadcast(%laneid: index, %pos: index) -> (vector<96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<96xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[%pos : index] : vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insertelement_0d(%laneid: index) -> (vector) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector) { %0 = ""some_def""() : () -> (vector) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[] : vector vector.yield %1 : vector } return %r : vector }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insertelement_0d(%laneid: index) -> (vector) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector) { %0 = ""some_def""() : () -> (vector) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[] : vector vector.yield %1 : vector } return %r : vector }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insertelement_0d(%laneid: index) -> (vector) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector) { %0 = ""some_def""() : () -> (vector) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[] : vector vector.yield %1 : vector } return %r : vector }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insertelement_0d(%laneid: index) -> (vector) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector) { %0 = ""some_def""() : () -> (vector) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[] : vector vector.yield %1 : vector } return %r : vector }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insertelement_0d(%laneid: index) -> (vector) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector) { %0 = ""some_def""() : () -> (vector) %f = ""another_def""() : () -> (f32) %1 = vector.insertelement %f, %0[] : vector vector.yield %1 : vector } return %r : vector }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insert_1d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insert %f, %0[76] : f32 into vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insert_1d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insert %f, %0[76] : f32 into vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insert_1d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insert %f, %0[76] : f32 into vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insert_1d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insert %f, %0[76] : f32 into vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insert_1d(%laneid: index) -> (vector<3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<3xf32>) { %0 = ""some_def""() : () -> (vector<96xf32>) %f = ""another_def""() : () -> (f32) %1 = vector.insert %f, %0[76] : f32 into vector<96xf32> vector.yield %1 : vector<96xf32> } return %r : vector<3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insert_2d_distr_src(%laneid: index) -> (vector<4x3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x3xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insert_2d_distr_src(%laneid: index) -> (vector<4x3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x3xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insert_2d_distr_src(%laneid: index) -> (vector<4x3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x3xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insert_2d_distr_src(%laneid: index) -> (vector<4x3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x3xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insert_2d_distr_src(%laneid: index) -> (vector<4x3xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x3xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x3xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insert_2d_distr_pos(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<128x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[79] : vector<96xf32> into vector<128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insert_2d_distr_pos(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<128x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[79] : vector<96xf32> into vector<128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insert_2d_distr_pos(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<128x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[79] : vector<96xf32> into vector<128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insert_2d_distr_pos(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<128x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[79] : vector<96xf32> into vector<128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insert_2d_distr_pos(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<128x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[79] : vector<96xf32> into vector<128x96xf32> vector.yield %1 : vector<128x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_insert_2d_broadcast(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if ,1 "func.func @vector_insert_2d_broadcast(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform"" ",1 "func.func @vector_insert_2d_broadcast(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write"" ",1 "func.func @vector_insert_2d_broadcast(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x96xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=propagate-distribution -canonicalize ,1 "func.func @vector_insert_2d_broadcast(%laneid: index) -> (vector<4x96xf32>) { %r = vector.warp_execute_on_lane_0(%laneid)[32] -> (vector<4x96xf32>) { %0 = ""some_def""() : () -> (vector<4x96xf32>) %s = ""another_def""() : () -> (vector<96xf32>) %1 = vector.insert %s, %0[2] : vector<96xf32> into vector<4x96xf32> vector.yield %1 : vector<4x96xf32> } return %r : vector<4x96xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -test-vector-warp-distribute=""hoist-uniform distribute-transfer-write propagate-distribution"" -canonicalize ",1 "func.func @vector_transfer_ops_0d_memref(%M: memref, %v: vector<1x1x1xf32>) { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %M[], %f0 : memref, vector vector.transfer_write %0, %M[] : vector, memref vector.store %v, %M[] : memref, vector<1x1x1xf32> return } func.func @vector_transfer_ops_0d_tensor(%M: tensor) -> vector<1xf32> { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %M[], %f0 {permutation_map = affine_map<()->(0)>} : tensor, vector<1xf32> return %0: vector<1xf32> } func.func @transfer_to_load(%mem : memref<8x8xf32>, %i : index) -> vector<4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true]} : memref<8x8xf32>, vector<4xf32> vector.transfer_write %res, %mem[%i, %i] {in_bounds = [true]} : vector<4xf32>, memref<8x8xf32> return %res : vector<4xf32> } func.func @transfer_2D(%mem : memref<8x8xf32>, %i : index) -> vector<2x4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true, true]} : memref<8x8xf32>, vector<2x4xf32> vector.transfer_write %res, %mem[%i, %i] {in_bounds = [true, true]} : vector<2x4xf32>, memref<8x8xf32> return %res : vector<2x4xf32> } func.func @transfer_vector_element(%mem : memref<8x8xvector<2x4xf32>>, %i : index) -> vector<2x4xf32> { %cf0 = arith.constant dense<0.0> : vector<2x4xf32> %res = vector.transfer_read %mem[%i, %i], %cf0 : memref<8x8xvector<2x4xf32>>, vector<2x4xf32> vector.transfer_write %res, %mem[%i, %i] : vector<2x4xf32>, memref<8x8xvector<2x4xf32>> return %res : vector<2x4xf32> } func.func @transfer_vector_element_different_types(%mem : memref<8x8xvector<2x4xf32>>, %i : index) -> vector<1x2x4xf32> { %cf0 = arith.constant dense<0.0> : vector<2x4xf32> %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true]} : memref<8x8xvector<2x4xf32>>, vector<1x2x4xf32> vector.transfer_write %res, %mem[%i, %i] {in_bounds = [true]} : vector<1x2x4xf32>, memref<8x8xvector<2x4xf32>> return %res : vector<1x2x4xf32> } func.func @transfer_2D_not_inbounds(%mem : memref<8x8xf32>, %i : index) -> vector<2x4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true, false]} : memref<8x8xf32>, vector<2x4xf32> vector.transfer_write %res, %mem[%i, %i] {in_bounds = [false, true]} : vector<2x4xf32>, memref<8x8xf32> return %res : vector<2x4xf32> } func.func @transfer_not_inbounds(%mem : memref<8x8xf32>, %i : index) -> vector<4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 : memref<8x8xf32>, vector<4xf32> vector.transfer_write %res, %mem[%i, %i] : vector<4xf32>, memref<8x8xf32> return %res : vector<4xf32> } #layout = affine_map<(d0, d1) -> (d0*16 + d1)> func.func @transfer_nondefault_layout(%mem : memref<8x8xf32, #layout>, %i : index) -> vector<4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true]} : memref<8x8xf32, #layout>, vector<4xf32> vector.transfer_write %res, %mem[%i, %i] {in_bounds = [true]} : vector<4xf32>, memref<8x8xf32, #layout> return %res : vector<4xf32> } func.func @transfer_perm_map(%mem : memref<8x8xf32>, %i : index) -> vector<4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true], permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<8x8xf32>, vector<4xf32> return %res : vector<4xf32> } #broadcast_1d = affine_map<(d0, d1) -> (0)> func.func @transfer_broadcasting(%mem : memref<8x8xf32>, %i : index) -> vector<4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true], permutation_map = #broadcast_1d} : memref<8x8xf32>, vector<4xf32> return %res : vector<4xf32> } func.func @transfer_scalar(%mem : memref, %i : index) -> vector<1xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true]} : memref, vector<1xf32> return %res : vector<1xf32> } #broadcast_2d = affine_map<(d0, d1) -> (0, 0)> func.func @transfer_broadcasting_2D(%mem : memref<8x8xf32>, %i : index) -> vector<4x4xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i], %cf0 {in_bounds = [true, true], permutation_map = #broadcast_2d} : memref<8x8xf32>, vector<4x4xf32> return %res : vector<4x4xf32> } #broadcast_2d_in_4d = affine_map<(d0, d1, d2, d3, d4) -> (d1, 0, 0, d4)> func.func @transfer_broadcasting_complex(%mem : memref<10x20x30x8x8xf32>, %i : index) -> vector<3x2x4x5xf32> { %cf0 = arith.constant 0.0 : f32 %res = vector.transfer_read %mem[%i, %i, %i, %i, %i], %cf0 {in_bounds = [true, true, true, true], permutation_map = #broadcast_2d_in_4d} : memref<10x20x30x8x8xf32>, vector<3x2x4x5xf32> return %res : vector<3x2x4x5xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %m2 = transform.vector.lower_transfer %module_op max_transfer_rank = 99 : (!transform.any_op) -> !transform.any_op transform.vector.apply_transfer_permutation_patterns %m2 : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize --split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d1, d0, 0, 0)> #map1 = affine_map<(d0, d1, d2, d3) -> (0, d1, 0, d0)> #map2 = affine_map<(d0, d1, d2, d3) -> (d3, d1, 0, 0)> #map3 = affine_map<(d0, d1) -> (d1, d0, 0, 0)> #map4 = affine_map<(d0, d1) -> (0, d1, 0, d0)> #map5 = affine_map<(d0, d1, d2, d3) -> (d2, d1, d3, d0)> #map6 = affine_map<(d0, d1) -> (0)> func.func @transfer_read_permutations(%arg0 : memref, %arg1 : memref, %m: i1) -> (vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<8xf32>) { %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index %mask0 = vector.splat %m : vector<14x7xi1> %0 = vector.transfer_read %arg1[%c0, %c0, %c0, %c0], %cst, %mask0 {in_bounds = [true, false, true, true], permutation_map = #map0} : memref, vector<7x14x8x16xf32> %mask1 = vector.splat %m : vector<16x14xi1> %1 = vector.transfer_read %arg1[%c0, %c0, %c0, %c0], %cst, %mask1 {permutation_map = #map1} : memref, vector<7x14x8x16xf32> %mask2 = vector.splat %m : vector<14x7xi1> %2 = vector.transfer_read %arg1[%c0, %c0, %c0, %c0], %cst, %mask2 {in_bounds = [true, false, true, true], permutation_map = #map2} : memref, vector<7x14x8x16xf32> %3 = vector.transfer_read %arg0[%c0, %c0], %cst {permutation_map = #map3} : memref, vector<7x14x8x16xf32> %4 = vector.transfer_read %arg0[%c0, %c0], %cst {permutation_map = #map4} : memref, vector<7x14x8x16xf32> %5 = vector.transfer_read %arg1[%c0, %c0, %c0, %c0], %cst {permutation_map = #map5} : memref, vector<7x14x8x16xf32> %6 = vector.transfer_read %arg0[%c0, %c0], %cst {permutation_map = #map6} : memref, vector<8xf32> return %0, %1, %2, %3, %4, %5, %6 : vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<7x14x8x16xf32>, vector<8xf32> } func.func @transfer_write_permutations( %arg0 : memref, %arg1 : tensor, %v1 : vector<7x14x8x16xf32>, %v2 : vector<8x16xf32>, %m: i1) -> tensor { %c0 = arith.constant 0 : index %mask0 = vector.splat %m : vector<16x14x7x8xi1> %0 = vector.transfer_write %v1, %arg1[%c0, %c0, %c0, %c0], %mask0 {in_bounds = [true, false, false, true], permutation_map = affine_map<(d0, d1, d2, d3) -> (d2, d1, d3, d0)>} : vector<7x14x8x16xf32>, tensor vector.transfer_write %v2, %arg0[%c0, %c0, %c0, %c0] {permutation_map = affine_map<(d0, d1, d2, d3) -> (d3, d2)>} : vector<8x16xf32>, memref return %0 : tensor } func.func @transfer_write_broadcast_unit_dim( %arg0 : memref, %arg1 : tensor, %v1 : vector<14x8x16xf32>, %v2 : vector<8x16xf32>, %m: i1) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v1, %arg1[%c0, %c0, %c0, %c0] {in_bounds = [false, false, true], permutation_map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d3)>} : vector<14x8x16xf32>, tensor vector.transfer_write %v2, %arg0[%c0, %c0, %c0, %c0] {permutation_map = affine_map<(d0, d1, d2, d3) -> (d1, d2)>} : vector<8x16xf32>, memref return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %m2 = transform.vector.lower_transfer %module_op max_transfer_rank = 99 : (!transform.any_op) -> !transform.any_op transform.vector.apply_transfer_permutation_patterns %m2 : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize --split-input-file ,1 "func.func @bitcast_f16_to_f32(%input: vector<8xf16>) -> vector<4xf32> { %0 = vector.bitcast %input : vector<8xf16> to vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -test-vector-break-down-bitcast ,1 "func.func @bitcast_i8_to_i32(%input: vector<16xi8>) -> vector<4xi32> { %0 = vector.bitcast %input : vector<16xi8> to vector<4xi32> return %0: vector<4xi32> }", mlir-opt -split-input-file -test-vector-break-down-bitcast ,1 "func.func @broadcast_vec1d_from_scalar(%arg0: f32) -> vector<2xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2xf32> return %0 : vector<2xf32> } func.func @broadcast_vec2d_from_scalar(%arg0: f32) -> vector<2x3xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2x3xf32> return %0 : vector<2x3xf32> } func.func @broadcast_vec3d_from_scalar(%arg0: f32) -> vector<2x3x4xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2x3x4xf32> return %0 : vector<2x3x4xf32> } func.func @broadcast_vec1d_from_vec1d(%arg0: vector<2xf32>) -> vector<2xf32> { %0 = vector.broadcast %arg0 : vector<2xf32> to vector<2xf32> return %0 : vector<2xf32> } func.func @broadcast_vec2d_from_vec1d(%arg0: vector<2xf32>) -> vector<3x2xf32> { %0 = vector.broadcast %arg0 : vector<2xf32> to vector<3x2xf32> return %0 : vector<3x2xf32> } func.func @broadcast_vec3d_from_vec1d(%arg0: vector<2xf32>) -> vector<4x3x2xf32> { %0 = vector.broadcast %arg0 : vector<2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> } func.func @broadcast_vec3d_from_vec2d(%arg0: vector<3x2xf32>) -> vector<4x3x2xf32> { %0 = vector.broadcast %arg0 : vector<3x2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> } func.func @broadcast_stretch(%arg0: vector<1xf32>) -> vector<4xf32> { %0 = vector.broadcast %arg0 : vector<1xf32> to vector<4xf32> return %0 : vector<4xf32> } func.func @broadcast_stretch_at_start(%arg0: vector<1x4xf32>) -> vector<3x4xf32> { %0 = vector.broadcast %arg0 : vector<1x4xf32> to vector<3x4xf32> return %0 : vector<3x4xf32> } func.func @broadcast_stretch_at_end(%arg0: vector<4x1xf32>) -> vector<4x3xf32> { %0 = vector.broadcast %arg0 : vector<4x1xf32> to vector<4x3xf32> return %0 : vector<4x3xf32> } func.func @broadcast_stretch_in_middle(%arg0: vector<4x1x2xf32>) -> vector<4x3x2xf32> { %0 = vector.broadcast %arg0 : vector<4x1x2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %f = transform.structured.match ops{[""func.func""]} in %module_op : (!transform.any_op) -> !transform.any_op transform.vector.lower_broadcast %f : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @transfer_read_flattenable_with_offset( %arg : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>) -> vector<5x4x3x2xi8> { %c0 = arith.constant 0 : index %cst = arith.constant 0 : i8 %v = vector.transfer_read %arg[%c0, %c0, %c0, %c0], %cst : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>, vector<5x4x3x2xi8> return %v : vector<5x4x3x2xi8> }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_write_flattenable_with_offset( %arg : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>, %vec : vector<5x4x3x2xi8>) { %c0 = arith.constant 0 : index vector.transfer_write %vec, %arg [%c0, %c0, %c0, %c0] : vector<5x4x3x2xi8>, memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>> return }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_write_0d(%arg : memref, %vec : vector) { vector.transfer_write %vec, %arg[] : vector, memref return }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_read_0d(%arg : memref) -> vector { %cst = arith.constant 0 : i8 %0 = vector.transfer_read %arg[], %cst : memref, vector return %0 : vector }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_read_flattenable_with_dynamic_dims_and_indices(%arg0 : memref>, %arg1 : index, %arg2 : index) -> vector<8x4xi8> { %c0_i8 = arith.constant 0 : i8 %c0 = arith.constant 0 : index %result = vector.transfer_read %arg0[%arg1, %arg2, %c0, %c0], %c0_i8 {in_bounds = [true, true]} : memref>, vector<8x4xi8> return %result : vector<8x4xi8> }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_write_flattenable_with_dynamic_dims_and_indices(%vec : vector<8x4xi8>, %dst : memref>, %arg1 : index, %arg2 : index) { %c0 = arith.constant 0 : index vector.transfer_write %vec, %dst[%arg1, %arg2, %c0, %c0] {in_bounds = [true, true]} : vector<8x4xi8>, memref> return }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_read_flattenable_negative( %arg : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>) -> vector<2x2x2x2xi8> { %c0 = arith.constant 0 : index %cst = arith.constant 0 : i8 %v = vector.transfer_read %arg[%c0, %c0, %c0, %c0], %cst : memref<5x4x3x2xi8, strided<[24, 6, 2, 1], offset: ?>>, vector<2x2x2x2xi8> return %v : vector<2x2x2x2xi8> }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @transfer_read_flattenable_negative2( %arg : memref<5x4x3x2xi8, strided<[24, 8, 2, 1], offset: ?>>) -> vector<5x4x3x2xi8> { %c0 = arith.constant 0 : index %cst = arith.constant 0 : i8 %v = vector.transfer_read %arg[%c0, %c0, %c0, %c0], %cst : memref<5x4x3x2xi8, strided<[24, 8, 2, 1], offset: ?>>, vector<5x4x3x2xi8> return %v : vector<5x4x3x2xi8> }", mlir-opt -test-vector-transfer-flatten-patterns -split-input-file ,1 "func.func @mask(%t0: tensor, %val: vector<16xf32>, %idx: index, %m0: vector<16xi1>) -> tensor { %0 = vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor } : vector<16xi1> -> tensor return %0 : tensor }"," mlir-opt -vector-bufferize -split-input-file -verify-diagnostics // ",1 "func.func @scan1d_inc(%arg0 : vector<2xi32>, %arg1 : vector) -> (vector<2xi32>, vector) { %0:2 = vector.scan , %arg0, %arg1 {inclusive = true, reduction_dim = 0} : vector<2xi32>, vector return %0#0, %0#1 : vector<2xi32>, vector } func.func @scan1d_exc(%arg0 : vector<2xi32>, %arg1 : vector) -> (vector<2xi32>, vector) { %0:2 = vector.scan , %arg0, %arg1 {inclusive = false, reduction_dim = 0} : vector<2xi32>, vector return %0#0, %0#1 : vector<2xi32>, vector } func.func @scan2d_mul_dim0(%arg0 : vector<2x3xi32>, %arg1 : vector<3xi32>) -> (vector<2x3xi32>, vector<3xi32>) { %0:2 = vector.scan , %arg0, %arg1 {inclusive = true, reduction_dim = 0} : vector<2x3xi32>, vector<3xi32> return %0#0, %0#1 : vector<2x3xi32>, vector<3xi32> } func.func @scan2d_mul_dim1(%arg0 : vector<2x3xi32>, %arg1 : vector<2xi32>) -> (vector<2x3xi32>, vector<2xi32>) { %0:2 = vector.scan , %arg0, %arg1 {inclusive = true, reduction_dim = 1} : vector<2x3xi32>, vector<2xi32> return %0#0, %0#1 : vector<2x3xi32>, vector<2xi32> } func.func @scan3d_mul_dim1(%arg0 : vector<4x2x3xf32>, %arg1 : vector<4x3xf32>) -> (vector<4x2x3xf32>, vector<4x3xf32>) { %0:2 = vector.scan , %arg0, %arg1 {inclusive = false, reduction_dim = 1} : vector<4x2x3xf32>, vector<4x3xf32> return %0#0, %0#1 : vector<4x2x3xf32>, vector<4x3xf32> }", mlir-opt --test-vector-scan-lowering ,1 "emitc.include <""test.h""> emitc.include ""test.h"" func.func @f(%arg0: i32, %f: !emitc.opaque<""int32_t"">) { %1 = ""emitc.call""() {callee = ""blah""} : () -> i64 emitc.call ""foo"" (%1) {args = [ 0 : index, dense<[0, 1]> : tensor<2xi32>, 0 : index ]} : (i64) -> () return } func.func @cast(%arg0: i32) { %1 = emitc.cast %arg0: i32 to f32 return } func.func @c() { %1 = ""emitc.constant""(){value = 42 : i32} : () -> i32 return } func.func @a(%arg0: i32, %arg1: i32) { %1 = ""emitc.apply""(%arg0) {applicableOperator = ""&""} : (i32) -> !emitc.ptr %2 = emitc.apply ""&""(%arg1) : (i32) -> !emitc.ptr return }", mlir-opt | mlir-opt ,1 "emitc.include <""test.h""> emitc.include ""test.h"" func.func @f(%arg0: i32, %f: !emitc.opaque<""int32_t"">) { %1 = ""emitc.call""() {callee = ""blah""} : () -> i64 emitc.call ""foo"" (%1) {args = [ 0 : index, dense<[0, 1]> : tensor<2xi32>, 0 : index ]} : (i64) -> () return } func.func @cast(%arg0: i32) { %1 = emitc.cast %arg0: i32 to f32 return } func.func @c() { %1 = ""emitc.constant""(){value = 42 : i32} : () -> i32 return } func.func @a(%arg0: i32, %arg1: i32) { %1 = ""emitc.apply""(%arg0) {applicableOperator = ""&""} : (i32) -> !emitc.ptr %2 = emitc.apply ""&""(%arg1) : (i32) -> !emitc.ptr return }", mlir-opt -canonicalize ,1 "func.func @opaque_types() { emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc.opaque<""std::vector"">]} : () -> () emitc.call ""f""() {template_args = [!emitc.opaque<""SmallVector"">]} : () -> () return } func.func @pointer_types() { emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () %0 = emitc.call ""f""() : () -> (!emitc.ptr) %1 = emitc.call ""f""(%0) : (!emitc.ptr) -> (!emitc.ptr>) emitc.call ""f""() {template_args = [!emitc.ptr>]} : () -> () return }", mlir-opt -verify-diagnostics ,1 "func.func @opaque_types() { emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc>]} : () -> () emitc.call ""f""() {template_args = [!emitc.opaque<""std::vector"">]} : () -> () emitc.call ""f""() {template_args = [!emitc.opaque<""SmallVector"">]} : () -> () return } func.func @pointer_types() { emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () emitc.call ""f""() {template_args = [!emitc.ptr]} : () -> () %0 = emitc.call ""f""() : () -> (!emitc.ptr) %1 = emitc.call ""f""(%0) : (!emitc.ptr) -> (!emitc.ptr>) emitc.call ""f""() {template_args = [!emitc.ptr>]} : () -> () return }", mlir-opt -verify-diagnostics | mlir-opt -verify-diagnostics ,1 "func.func @opaque_attrs() { emitc.call ""f""() {args = [#emitc.opaque<""attr"">]} : () -> () emitc.call ""f""() {args = [#emitc.opaque<""\""quoted_attr\"""">]} : () -> () return }", mlir-opt -verify-diagnostics ,1 "func.func @opaque_attrs() { emitc.call ""f""() {args = [#emitc.opaque<""attr"">]} : () -> () emitc.call ""f""() {args = [#emitc.opaque<""\""quoted_attr\"""">]} : () -> () return }", mlir-opt -verify-diagnostics | mlir-opt -verify-diagnostics ,1 "func.func @fold_static_stride_subview_with_load(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> f32 { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][2, 3] : memref<12x32xf32> to memref<4x4xf32, strided<[64, 3], offset: ?>> %1 = memref.load %0[%arg3, %arg4] : memref<4x4xf32, strided<[64, 3], offset: ?>> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_dynamic_stride_subview_with_load(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index) -> f32 { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][%arg5, %arg6] : memref<12x32xf32> to memref<4x4xf32, strided<[?, ?], offset: ?>> %1 = memref.load %0[%arg3, %arg4] : memref<4x4xf32, strided<[?, ?], offset: ?>> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_store(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : f32) { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][2, 3] : memref<12x32xf32> to memref<4x4xf32, strided<[64, 3], offset: ?>> memref.store %arg5, %0[%arg3, %arg4] : memref<4x4xf32, strided<[64, 3], offset: ?>> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_dynamic_stride_subview_with_store(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index, %arg7 : f32) { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][%arg5, %arg6] : memref<12x32xf32> to memref<4x4xf32, strided<[?, ?], offset: ?>> memref.store %arg7, %0[%arg3, %arg4] : memref<4x4xf32, strided<[?, ?], offset: ?>> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_subview_with_transfer_read_0d( %arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index) -> vector { %f1 = arith.constant 1.0 : f32 %0 = memref.subview %arg0[%arg1, %arg2][1, 1][1, 1] : memref<12x32xf32> to memref> %1 = vector.transfer_read %0[], %f1 : memref>, vector return %1 : vector }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_subview_with_transfer_read(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index) -> vector<4xf32> { %f1 = arith.constant 1.0 : f32 %0 = memref.subview %arg0[%arg1, %arg2][4, 4][%arg5, %arg6] : memref<12x32xf32> to memref<4x4xf32, strided<[?, ?], offset: ?>> %1 = vector.transfer_read %0[%arg3, %arg4], %f1 {in_bounds = [true]} : memref<4x4xf32, strided<[?, ?], offset: ?>>, vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_transfer_write_0d( %arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %v : vector) { %f1 = arith.constant 1.0 : f32 %0 = memref.subview %arg0[%arg1, %arg2][1, 1][1, 1] : memref<12x32xf32> to memref> vector.transfer_write %v, %0[] {in_bounds = []} : vector, memref> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_transfer_write(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5: index, %arg6 : index, %arg7 : vector<4xf32>) { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][%arg5, %arg6] : memref<12x32xf32> to memref<4x4xf32, strided<[?, ?], offset: ?>> vector.transfer_write %arg7, %0[%arg3, %arg4] {in_bounds = [true]} : vector<4xf32>, memref<4x4xf32, strided<[?, ?], offset: ?>> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_rank_reducing_subview_with_load (%arg0 : memref, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index, %arg7 : index, %arg8 : index, %arg9 : index, %arg10: index, %arg11 : index, %arg12 : index, %arg13 : index, %arg14: index, %arg15 : index, %arg16 : index) -> f32 { %0 = memref.subview %arg0[%arg1, %arg2, %arg3, %arg4, %arg5, %arg6][4, 1, 1, 4, 1, 1][%arg7, %arg8, %arg9, %arg10, %arg11, %arg12] : memref to memref<4x1x4x1xf32, strided<[?, ?, ?, ?], offset: ?>> %1 = memref.load %0[%arg13, %arg14, %arg15, %arg16] : memref<4x1x4x1xf32, strided<[?, ?, ?, ?], offset: ?>> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_vector_transfer_read_with_rank_reduced_subview( %arg0 : memref>, %arg1: index, %arg2 : index, %arg3 : index, %arg4: index, %arg5 : index, %arg6 : index) -> vector<4xf32> { %cst = arith.constant 0.0 : f32 %0 = memref.subview %arg0[0, %arg1, %arg2] [1, %arg3, %arg4] [1, 1, 1] : memref> to memref> %1 = vector.transfer_read %0[%arg5, %arg6], %cst {in_bounds = [true]} : memref>, vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_vector_transfer_write_with_rank_reduced_subview( %arg0 : memref>, %arg1 : vector<4xf32>, %arg2: index, %arg3 : index, %arg4 : index, %arg5: index, %arg6 : index, %arg7 : index) { %cst = arith.constant 0.0 : f32 %0 = memref.subview %arg0[0, %arg2, %arg3] [1, %arg4, %arg5] [1, 1, 1] : memref> to memref> vector.transfer_write %arg1, %0[%arg6, %arg7] {in_bounds = [true]} : vector<4xf32>, memref> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_vector_transfer_write_with_inner_rank_reduced_subview( %arg0 : memref>, %arg1 : vector<4xf32>, %arg2: index, %arg3 : index, %arg4 : index, %arg5: index, %arg6 : index, %arg7 : index) { %cst = arith.constant 0.0 : f32 %0 = memref.subview %arg0[%arg2, %arg3, 0] [%arg4, %arg5, 1] [1, 1, 1] : memref> to memref> vector.transfer_write %arg1, %0[%arg6, %arg7] {in_bounds = [true]} : vector<4xf32>, memref> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> f32 { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][2, 3] : memref<12x32xf32> to memref<4x4xf32, strided<[64, 3], offset: ?>> %1 = affine.load %0[%arg3, %arg4] : memref<4x4xf32, strided<[64, 3], offset: ?>> affine.store %1, %0[%arg3, %arg4] : memref<4x4xf32, strided<[64, 3], offset: ?>> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_expand_shape(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index) -> f32 { %0 = memref.expand_shape %arg0 [[0, 1], [2]] : memref<12x32xf32> into memref<2x6x32xf32> %1 = affine.load %0[%arg1, %arg2, %arg3] : memref<2x6x32xf32> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_collapse_shape(%arg0 : memref<2x6x32xf32>, %arg1 : index, %arg2 : index) -> f32 { %0 = memref.collapse_shape %arg0 [[0, 1], [2]] : memref<2x6x32xf32> into memref<12x32xf32> %1 = affine.load %0[%arg1, %arg2] : memref<12x32xf32> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_expand_shape_3d(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4: index) -> f32 { %0 = memref.expand_shape %arg0 [[0, 1, 2], [3]] : memref<12x32xf32> into memref<2x2x3x32xf32> %1 = affine.load %0[%arg1, %arg2, %arg3, %arg4] : memref<2x2x3x32xf32> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_expand_shape(%arg0: memref<1024x1024xf32>, %arg1: memref<1xf32>, %arg2: index) -> f32 { %0 = memref.expand_shape %arg0 [[0, 1], [2, 3]] : memref<1024x1024xf32> into memref<1x1024x1024x1xf32> affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 1024 { affine.for %arg5 = 0 to 1020 { affine.for %arg6 = 0 to 1 { %1 = affine.load %0[%arg3, %arg4, %arg5, %arg6] : memref<1x1024x1024x1xf32> affine.store %1, %arg1[%arg2] : memref<1xf32> } } } } %2 = affine.load %arg1[%arg2] : memref<1xf32> return %2 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_expand_shape_when_access_index_is_an_expression(%arg0: memref<1024x1024xf32>, %arg1: memref<1xf32>, %arg2: index) -> f32 { %0 = memref.expand_shape %arg0 [[0, 1], [2, 3]] : memref<1024x1024xf32> into memref<1x1024x1024x1xf32> affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 1024 { affine.for %arg5 = 0 to 1020 { affine.for %arg6 = 0 to 1 { %1 = affine.load %0[%arg3, %arg4 + %arg3, %arg5, %arg6] : memref<1x1024x1024x1xf32> affine.store %1, %arg1[%arg2] : memref<1xf32> } } } } %2 = affine.load %arg1[%arg2] : memref<1xf32> return %2 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_expand_shape_with_constant_access_index(%arg0: memref<1024x1024xf32>, %arg1: memref<1xf32>, %arg2: index) -> f32 { %0 = memref.expand_shape %arg0 [[0, 1], [2, 3]] : memref<1024x1024xf32> into memref<1x1024x1024x1xf32> %cst = arith.constant 0 : index affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 1024 { affine.for %arg5 = 0 to 1020 { affine.for %arg6 = 0 to 1 { %1 = memref.load %0[%arg3, %cst, %arg5, %arg6] : memref<1x1024x1024x1xf32> memref.store %1, %arg1[%arg2] : memref<1xf32> } } } } %2 = memref.load %arg1[%arg2] : memref<1xf32> return %2 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_static_stride_subview_with_affine_load_store_collapse_shape_with_0d_result(%arg0: memref<1xf32>, %arg1: memref<1xf32>) -> memref<1xf32> { %0 = memref.collapse_shape %arg0 [] : memref<1xf32> into memref affine.for %arg2 = 0 to 3 { %1 = affine.load %0[] : memref affine.store %1, %arg1[0] : memref<1xf32> } return %arg1 : memref<1xf32> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @subview_of_subview(%m: memref<1x1024xf32, 3>, %pos: index) -> memref, 3> { %0 = memref.subview %m[3, %pos] [1, 2] [1, 1] : memref<1x1024xf32, 3> to memref<1x2xf32, strided<[1024, 2], offset: ?>, 3> %1 = memref.subview %0[1, 2] [1, 1] [1, 1] : memref<1x2xf32, strided<[1024, 2], offset: ?>, 3> to memref, 3> return %1 : memref, 3> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @subview_of_subview_rank_reducing(%m: memref, %sz: index, %pos: index) -> memref> { %0 = memref.subview %m[3, 1, 8] [1, %sz, 1] [1, 1, 1] : memref to memref> %1 = memref.subview %0[6] [1] [1] : memref> to memref> return %1 : memref> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_load_keep_nontemporal(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> f32 { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][2, 3] : memref<12x32xf32> to memref<4x4xf32, strided<[64, 3], offset: ?>> %1 = memref.load %0[%arg3, %arg4] {nontemporal = true }: memref<4x4xf32, strided<[64, 3], offset: ?>> return %1 : f32 }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_store_keep_nontemporal(%arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : f32) { %0 = memref.subview %arg0[%arg1, %arg2][4, 4][2, 3] : memref<12x32xf32> to memref<4x4xf32, strided<[64, 3], offset: ?>> memref.store %arg5, %0[%arg3, %arg4] {nontemporal=true}: memref<4x4xf32, strided<[64, 3], offset: ?>> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_gpu_subgroup_mma_load_matrix_1d(%src: memref>, %offset: index, %i: index) -> !gpu.mma_matrix<16x16xf16, ""COp""> { %subview = memref.subview %src[%offset] [81920] [1] : memref> to memref<81920xvector<4xf32>, strided<[1], offset: ?>> %matrix = gpu.subgroup_mma_load_matrix %subview[%i] {leadDimension = 160 : index} : memref<81920xvector<4xf32>, strided<[1], offset: ?>> -> !gpu.mma_matrix<16x16xf16, ""COp""> return %matrix: !gpu.mma_matrix<16x16xf16, ""COp""> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_gpu_subgroup_mma_store_matrix_1d(%dst: memref>, %offset: index, %i: index, %matrix: !gpu.mma_matrix<16x16xf16, ""COp"">) { %subview = memref.subview %dst[%offset] [81920] [1] : memref> to memref<81920xvector<4xf32>, strided<[1], offset: ?>> gpu.subgroup_mma_store_matrix %matrix, %subview[%i] {leadDimension = 160 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<81920xvector<4xf32>, strided<[1], offset: ?>> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_gpu_subgroup_mma_load_matrix_2d(%arg0 : memref<128x128xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> !gpu.mma_matrix<16x16xf16, ""COp""> { %subview = memref.subview %arg0[%arg1, %arg2][64, 32][2, 1] : memref<128x128xf32> to memref<64x32xf32, strided<[64, 1], offset: ?>> %matrix = gpu.subgroup_mma_load_matrix %subview[%arg3, %arg4] {leadDimension = 32 : index} : memref<64x32xf32, strided<[64, 1], offset: ?>> -> !gpu.mma_matrix<16x16xf16, ""COp""> return %matrix : !gpu.mma_matrix<16x16xf16, ""COp""> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_gpu_subgroup_mma_load_matrix_2d(%arg0 : memref<128x128xf32>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %matrix: !gpu.mma_matrix<16x16xf16, ""COp"">) { %subview = memref.subview %arg0[%arg1, %arg2][64, 32][2, 1] : memref<128x128xf32> to memref<64x32xf32, strided<[64, 1], offset: ?>> gpu.subgroup_mma_store_matrix %matrix, %subview[%arg3, %arg4] {leadDimension = 32 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<64x32xf32, strided<[64, 1], offset: ?>> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_nvgpu_device_async_copy_zero_sub_idx(%gmem_memref_3d : memref<2x128x768xf16>, %idx_1 : index, %idx_2 : index, %idx_3 : index) { %c0 = arith.constant 0 : index %smem_memref_4d = memref.alloc() : memref<5x1x64x64xf16, #gpu.address_space> %gmem_memref_subview_2d = memref.subview %gmem_memref_3d[%idx_1, %idx_2, %idx_3] [1, 1, 8] [1, 1, 1] : memref<2x128x768xf16> to memref<1x8xf16, strided<[98304, 1], offset: ?>> %async_token = nvgpu.device_async_copy %gmem_memref_subview_2d[%c0, %c0], %smem_memref_4d[%c0, %c0, %c0, %c0], 8 {bypassL1} : memref<1x8xf16, strided<[98304, 1], offset: ?>> to memref<5x1x64x64xf16, #gpu.address_space> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_src_nvgpu_device_async_copy(%gmem_memref_3d : memref<2x128x768xf16>, %src_idx_0 : index, %src_idx_1 : index, %src_idx_2 : index, %src_sub_idx_0 : index, %src_sub_idx_1 : index) { %c0 = arith.constant 0 : index %smem_memref_4d = memref.alloc() : memref<5x1x64x64xf16, #gpu.address_space> %gmem_memref_subview_2d = memref.subview %gmem_memref_3d[%src_idx_0, %src_idx_1, %src_idx_2] [1, 1, 8] [1, 1, 1] : memref<2x128x768xf16> to memref<1x8xf16, strided<[98304, 1], offset: ?>> %async_token = nvgpu.device_async_copy %gmem_memref_subview_2d[%src_sub_idx_0, %src_sub_idx_1], %smem_memref_4d[%c0, %c0, %c0, %c0], 8 {bypassL1} : memref<1x8xf16, strided<[98304, 1], offset: ?>> to memref<5x1x64x64xf16, #gpu.address_space> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_src_fold_dest_nvgpu_device_async_copy(%gmem_memref_3d : memref<2x128x768xf16>, %src_idx_0 : index, %src_idx_1 : index, %src_idx_2 : index, %src_sub_idx_0 : index, %src_sub_idx_1 : index, %dest_idx_0 : index, %dest_idx_1 : index, %dest_idx_2 : index, %dest_idx_3 : index, %dest_sub_idx_0 : index, %dest_sub_idx_1 : index) { %c0 = arith.constant 0 : index %smem_memref_4d = memref.alloc() : memref<5x1x64x64xf16, #gpu.address_space> %gmem_memref_subview_2d = memref.subview %gmem_memref_3d[%src_idx_0, %src_idx_1, %src_idx_2] [1, 1, 8] [1, 1, 1] : memref<2x128x768xf16> to memref<1x8xf16, strided<[98304, 1], offset: ?>> %smem_memref_2d = memref.subview %smem_memref_4d[%dest_idx_0, %dest_idx_1, %dest_idx_2, %dest_idx_3] [1, 1, 1, 8] [1, 1, 1, 1] : memref<5x1x64x64xf16, #gpu.address_space> to memref<1x8xf16, strided<[4096, 1], offset: ?>, #gpu.address_space> %async_token = nvgpu.device_async_copy %gmem_memref_subview_2d[%src_sub_idx_0, %src_sub_idx_1], %smem_memref_2d[%dest_sub_idx_0, %dest_sub_idx_1], 8 {bypassL1} : memref<1x8xf16, strided<[98304, 1], offset: ?>> to memref<1x8xf16, strided<[4096, 1], offset: ?>, #gpu.address_space> return }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "#map = affine_map<()[s0] -> (-s0 + 4)> #map1 = affine_map<()[s0] -> (-s0 + 32)> func.func @test_ldmatrix(%arg0: memref<4x32x32xf16, 3>, %arg1: index, %arg2: index, %arg3: index) -> vector<4x2xf16> { %c0 = arith.constant 0 : index %0 = affine.apply #map()[%arg1] %1 = affine.apply #map1()[%arg2] %2 = affine.apply #map1()[%arg3] %subview = memref.subview %arg0[%arg1, %arg2, %arg3] [%0, %1, %2] [1, 1, 1] : memref<4x32x32xf16, 3> to memref, 3> %3 = nvgpu.ldmatrix %subview[%c0, %c0, %c0] {numTiles = 4 : i32, transpose = false} : memref, 3> -> vector<4x2xf16> return %3 : vector<4x2xf16> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @fold_vector_load( %arg0 : memref<12x32xf32>, %arg1 : index, %arg2 : index) -> vector<12x32xf32> { %0 = memref.subview %arg0[%arg1, %arg2][1, 1][1, 1] : memref<12x32xf32> to memref> %1 = vector.load %0[] : memref>, vector<12x32xf32> return %1 : vector<12x32xf32> }", mlir-opt -fold-memref-alias-ops -split-input-file ,1 "func.func @test_load(%base : memref<2x16x16xf32>, %offset : index) -> f32 { %c0 = arith.constant 0 : index %c8 = arith.constant 8 : index %loaded_val = memref.load %base[%offset, %c0, %c8] : memref<2x16x16xf32> return %loaded_val : f32 } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op transform.test_print_remark_at_operand %1, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_load_nontemporal(%base : memref<2x16x16xf32>, %offset : index) -> f32 { %c0 = arith.constant 0 : index %c8 = arith.constant 8 : index %loaded_val = memref.load %base[%offset, %c0, %c8] {nontemporal = true } : memref<2x16x16xf32> return %loaded_val : f32 } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_store(%base : memref<2x16x16xf32>, %offset : index) -> () { %cf0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %c8 = arith.constant 8 : index memref.store %cf0, %base[%offset, %c0, %c8] : memref<2x16x16xf32> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_store_nontemporal(%base : memref<2x16x16xf32>, %offset : index) -> () { %cf0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %c8 = arith.constant 8 : index memref.store %cf0, %base[%offset, %c0, %c8] { nontemporal = true } : memref<2x16x16xf32> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @testWithLoop(%base : memref>) -> f32 { %sum_all = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %upper_bound0 = memref.dim %base, %c0 : memref> %upper_bound1 = memref.dim %base, %c1 : memref> %upper_bound2 = memref.dim %base, %c2 : memref> %sum_res2 = scf.for %iv2 = %c0 to %upper_bound2 step %c1 iter_args(%sum_iter2 = %sum_all) -> (f32) { %sum_res1 = scf.for %iv1 = %c0 to %upper_bound1 step %c1 iter_args(%sum_iter1 = %sum_iter2) -> (f32) { %sum_res0 = scf.for %iv0 = %c0 to %upper_bound0 step %c1 iter_args(%sum_iter0 = %sum_iter1) -> (f32) { %loaded_val = memref.load %base[%iv0, %iv1, %iv2] : memref> %res = arith.addf %loaded_val, %sum_iter2 : f32 scf.yield %res : f32 } scf.yield %sum_res0 : f32 } scf.yield %sum_res1 : f32 } return %sum_res2 : f32 } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_ldmatrix(%base : memref<4x32x32xf16, 3>, %offset0 : index, %offset1: index, %offset2: index) -> vector<4x2xf16> { %loaded_val = nvgpu.ldmatrix %base[%offset0, %offset1, %offset2] {numTiles = 4 : i32, transpose = false} : memref<4x32x32xf16, 3> -> vector<4x2xf16> return %loaded_val : vector<4x2xf16> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_ldmatrix(%base : memref, %offset0 : index, %offset1: index, %offset2: index) -> vector<4x2xf16> { %loaded_val = nvgpu.ldmatrix %base[%offset0, %offset1, %offset2] {numTiles = 4 : i32, transpose = false} : memref -> vector<4x2xf16> return %loaded_val : vector<4x2xf16> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_transfer_read_op(%base : memref, %offset0 : index, %offset1: index, %offset2: index) -> vector<4x2xf16> { %cf0 = arith.constant 0.0 : f16 %loaded_val = vector.transfer_read %base[%offset0, %offset1, %offset2], %cf0 { permutation_map = affine_map<(d0,d1,d2) -> (d2,d0)> } : memref, vector<4x2xf16> return %loaded_val : vector<4x2xf16> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_transfer_read_op_with_tensor(%base : tensor, %offset0 : index, %offset1: index, %offset2: index) -> vector<4x2xf16> { %cf0 = arith.constant 0.0 : f16 %loaded_val = vector.transfer_read %base[%offset0, %offset1, %offset2], %cf0 { permutation_map = affine_map<(d0,d1,d2) -> (d2,d0)> } : tensor, vector<4x2xf16> return %loaded_val : vector<4x2xf16> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_transfer_write_op(%base : memref, %offset0 : index, %offset1: index, %offset2: index) { %vcf0 = arith.constant dense<0.000000e+00> : vector<4x2xf16> vector.transfer_write %vcf0, %base[%offset0, %offset1, %offset2] { permutation_map = affine_map<(d0,d1,d2) -> (d2,d0)> } : vector<4x2xf16>, memref return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_transfer_write_op_with_strides(%base : memref>, %offset0 : index, %offset1: index, %offset2: index) { %vcf0 = arith.constant dense<0.000000e+00> : vector<4x2xf16> vector.transfer_write %vcf0, %base[%offset0, %offset1, %offset2] { permutation_map = affine_map<(d0,d1,d2) -> (d2,d0)> } : vector<4x2xf16>, memref> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @test_transfer_write_op_with_tensor(%base : tensor, %offset0 : index, %offset1: index, %offset2: index) -> tensor { %vcf0 = arith.constant dense<0.000000e+00> : vector<4x2xf16> %res = vector.transfer_write %vcf0, %base[%offset0, %offset1, %offset2] { permutation_map = affine_map<(d0,d1,d2) -> (d2,d0)> } : vector<4x2xf16>, tensor return %res : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.extract_address_computations %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @atomic_rmw_to_generic(%F: memref<10xf32>, %f: f32, %i: index) -> f32 { %x = memref.atomic_rmw maxf %f, %F[%i] : (f32, memref<10xf32>) -> f32 return %x : f32 }", mlir-opt -memref-expand -split-input-file ,1 "func.func @atomic_rmw_no_conversion(%F: memref<10xf32>, %f: f32, %i: index) -> f32 { %x = memref.atomic_rmw addf %f, %F[%i] : (f32, memref<10xf32>) -> f32 return %x : f32 }", mlir-opt -memref-expand -split-input-file ,1 "func.func @memref_reshape(%input: memref<*xf32>, %shape: memref<3xi32>) -> memref { %result = memref.reshape %input(%shape) : (memref<*xf32>, memref<3xi32>) -> memref return %result : memref }", mlir-opt -memref-expand -split-input-file ,1 "func.func @memref_alloc(%sz: index) -> (index, index) { %0 = memref.alloc(%sz) : memref<6x?xf32> %1 = ""test.reify_bound""(%0) {dim = 0} : (memref<6x?xf32>) -> (index) %2 = ""test.reify_bound""(%0) {dim = 1} : (memref<6x?xf32>) -> (index) return %1, %2 : index, index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @memref_alloca(%sz: index) -> (index, index) { %0 = memref.alloca(%sz) : memref<6x?xf32> %1 = ""test.reify_bound""(%0) {dim = 0} : (memref<6x?xf32>) -> (index) %2 = ""test.reify_bound""(%0) {dim = 1} : (memref<6x?xf32>) -> (index) return %1, %2 : index, index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @memref_cast(%m: memref<10xf32>) -> index { %0 = memref.cast %m : memref<10xf32> to memref %1 = ""test.reify_bound""(%0) {dim = 0} : (memref) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @memref_dim(%m: memref) -> index { %c0 = arith.constant 0 : index %0 = memref.dim %m, %c0 : memref %1 = ""test.reify_bound""(%0) : (index) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "memref.global ""private"" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]> func.func @memref_get_global() -> index { %0 = memref.get_global @gv0 : memref<4xf32> %1 = ""test.reify_bound""(%0) {dim = 0} : (memref<4xf32>) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @memref_rank(%m: memref<5xf32>) -> index { %0 = memref.rank %m : memref<5xf32> %1 = ""test.reify_bound""(%0) : (index) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @memref_subview(%m: memref, %sz: index) -> index { %0 = memref.subview %m[2][%sz][1] : memref to memref> %1 = ""test.reify_bound""(%0) {dim = 0} : (memref>) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @basic() -> i32 { %0 = arith.constant 5 : i32 %1 = memref.alloca() : memref memref.store %0, %1[] : memref %2 = memref.load %1[] : memref return %2 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @basic_default() -> i32 { %0 = arith.constant 5 : i32 %1 = memref.alloca() : memref %2 = memref.load %1[] : memref memref.store %0, %1[] : memref return %2 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @basic_float() -> f32 { %0 = arith.constant 5.2 : f32 %1 = memref.alloca() : memref memref.store %0, %1[] : memref %2 = memref.load %1[] : memref return %2 : f32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @basic_ranked() -> i32 { %0 = arith.constant 0 : index %1 = arith.constant 5 : i32 %2 = memref.alloca() : memref<1x1xi32> memref.store %1, %2[%0, %0] : memref<1x1xi32> %3 = memref.load %2[%0, %0] : memref<1x1xi32> return %3 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @reject_multiple_elements() -> i32 { %0 = arith.constant 0 : index %1 = arith.constant 5 : i32 %2 = memref.alloca() : memref<1x2xi32> memref.store %1, %2[%0, %0] : memref<1x2xi32> %3 = memref.load %2[%0, %0] : memref<1x2xi32> return %3 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @cycle(%arg0: i64, %arg1: i1, %arg2: i64) { %alloca = memref.alloca() : memref memref.store %arg2, %alloca[] : memref cf.cond_br %arg1, ^bb1, ^bb2 ^bb1: %use = memref.load %alloca[] : memref func.call @use(%use) : (i64) -> () memref.store %arg0, %alloca[] : memref cf.br ^bb2 ^bb2: cf.br ^bb1 } func.func @use(%arg: i64) { return }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @recursive(%arg: i64) -> i64 { %alloca0 = memref.alloca() : memref>> %alloca1 = memref.alloca() : memref> %alloca2 = memref.alloca() : memref memref.store %arg, %alloca2[] : memref memref.store %alloca2, %alloca1[] : memref> memref.store %alloca1, %alloca0[] : memref>> %load0 = memref.load %alloca0[] : memref>> %load1 = memref.load %load0[] : memref> %load2 = memref.load %load1[] : memref return %load2 : i64 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @deny_store_of_alloca(%arg: memref>) -> i32 { %0 = arith.constant 5 : i32 %1 = memref.alloca() : memref memref.store %0, %1[] : memref memref.store %1, %arg[] : memref> %2 = memref.load %1[] : memref return %2 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @promotable_nonpromotable_intertwined() -> i32 { %0 = memref.alloca() : memref %1 = memref.alloca() : memref> memref.store %0, %1[] : memref> %2 = memref.load %1[] : memref> call @use(%0) : (memref) -> () %3 = memref.load %0[] : memref return %3 : i32 } func.func @use(%arg: memref) { return }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg{region-simplify=false}))' --split-input-file ,1 "func.func @subview_of_size_memcast(%arg : memref<4x6x16x32xi8>) -> memref<16x32xi8, strided<[32, 1], offset: ?>>{ %0 = memref.cast %arg : memref<4x6x16x32xi8> to memref %1 = memref.subview %0[0, 1, 0, 0] [1, 1, 16, 32] [1, 1, 1, 1] : memref to memref<16x32xi8, strided<[32, 1], offset: ?>> return %1 : memref<16x32xi8, strided<[32, 1], offset: ?>> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @subview_of_strides_memcast(%arg : memref<1x1x?xf32, strided<[35, 7, 1], offset: ?>>) -> memref<1x4xf32, strided<[?, ?], offset: ?>> { %0 = memref.cast %arg : memref<1x1x?xf32, strided<[35, 7, 1], offset: ?>> to memref<1x1x?xf32, strided<[?, ?, ?], offset: ?>> %1 = memref.subview %0[0, 0, 0] [1, 1, 4] [1, 1, 1] : memref<1x1x?xf32, strided<[?, ?, ?], offset: ?>> to memref<1x4xf32, strided<[?, ?], offset: ?>> return %1 : memref<1x4xf32, strided<[?, ?], offset: ?>> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @subview_of_static_full_size(%arg0 : memref<4x6x16x32xi8>) -> memref<4x6x16x32xi8> { %0 = memref.subview %arg0[0, 0, 0, 0] [4, 6, 16, 32] [1, 1, 1, 1] : memref<4x6x16x32xi8> to memref<4x6x16x32xi8> return %0 : memref<4x6x16x32xi8> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @subview_canonicalize(%arg0 : memref, %arg1 : index, %arg2 : index) -> memref> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = memref.subview %arg0[%c0, %arg1, %c1] [%c4, %c1, %arg2] [%c1, %c1, %c1] : memref to memref> return %0 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @rank_reducing_subview_canonicalize(%arg0 : memref, %arg1 : index, %arg2 : index) -> memref> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = memref.subview %arg0[%c0, %arg1, %c1] [%c4, 1, %arg2] [%c1, %c1, %c1] : memref to memref> return %0 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @multiple_reducing_dims(%arg0 : memref<1x384x384xf32>, %arg1 : index, %arg2 : index, %arg3 : index) -> memref> { %c1 = arith.constant 1 : index %0 = memref.subview %arg0[0, %arg1, %arg2] [1, %c1, %arg3] [1, 1, 1] : memref<1x384x384xf32> to memref> %1 = memref.subview %0[0, 0] [1, %arg3] [1, 1] : memref> to memref> return %1 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @multiple_reducing_dims_dynamic(%arg0 : memref, %arg1 : index, %arg2 : index, %arg3 : index) -> memref> { %c1 = arith.constant 1 : index %0 = memref.subview %arg0[0, %arg1, %arg2] [1, %c1, %arg3] [1, 1, 1] : memref to memref> %1 = memref.subview %0[0, 0] [1, %arg3] [1, 1] : memref> to memref> return %1 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @multiple_reducing_dims_all_dynamic(%arg0 : memref>, %arg1 : index, %arg2 : index, %arg3 : index) -> memref> { %c1 = arith.constant 1 : index %0 = memref.subview %arg0[0, %arg1, %arg2] [1, %c1, %arg3] [1, 1, 1] : memref> to memref> %1 = memref.subview %0[0, 0] [1, %arg3] [1, 1] : memref> to memref> return %1 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @subview_negative_stride1(%arg0 : memref) -> memref> { %c0 = arith.constant 0 : index %c1 = arith.constant -1 : index %1 = memref.dim %arg0, %c0 : memref %2 = arith.addi %1, %c1 : index %3 = memref.subview %arg0[%2] [%1] [%c1] : memref to memref> return %3 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @subview_negative_stride2(%arg0 : memref<7xf32>) -> memref> { %c0 = arith.constant 0 : index %c1 = arith.constant -1 : index %1 = memref.dim %arg0, %c0 : memref<7xf32> %2 = arith.addi %1, %c1 : index %3 = memref.subview %arg0[%2] [%1] [%c1] : memref<7xf32> to memref> return %3 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @dim_of_sized_view(%arg : memref, %size: index) -> index { %c0 = arith.constant 0 : index %0 = memref.reinterpret_cast %arg to offset: [0], sizes: [%size], strides: [1] : memref to memref %1 = memref.dim %0, %c0 : memref return %1 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @no_fold_of_store(%arg : memref<32xi8>, %holder: memref>) { %0 = memref.cast %arg : memref<32xi8> to memref memref.store %0, %holder[] : memref> return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @dim_of_alloca(%size: index) -> index { %0 = memref.alloca(%size) : memref %c0 = arith.constant 0 : index %1 = memref.dim %0, %c0 : memref return %1 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @dim_of_alloca_with_dynamic_size(%arg0: memref<*xf32>) -> index { %0 = memref.rank %arg0 : memref<*xf32> %1 = memref.alloca(%0) : memref %c0 = arith.constant 0 : index %2 = memref.dim %1, %c0 : memref return %2 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @dim_of_memref_reshape(%arg0: memref<*xf32>, %arg1: memref) -> index { %c3 = arith.constant 3 : index %0 = memref.reshape %arg0(%arg1) : (memref<*xf32>, memref) -> memref<*xf32> memref.store %c3, %arg1[%c3] : memref %1 = memref.dim %0, %c3 : memref<*xf32> return %1 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @dim_of_memref_reshape_i32(%arg0: memref<*xf32>, %arg1: memref) -> index { %c3 = arith.constant 3 : index %0 = memref.reshape %arg0(%arg1) : (memref<*xf32>, memref) -> memref<*xf32> %1 = memref.dim %0, %c3 : memref<*xf32> return %1 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @alloc_const_fold() -> memref { %c4 = arith.constant 4 : index %a = memref.alloc(%c4) : memref return %a : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @alloc_alignment_const_fold() -> memref { %c4 = arith.constant 4 : index %a = memref.alloc(%c4) {alignment = 4096 : i64} : memref return %a : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @alloc_const_fold_with_symbols1(%arg0 : index) -> memref> { %c1 = arith.constant 1 : index %0 = memref.alloc(%arg0)[%c1, %c1] : memref> return %0 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @alloc_const_fold_with_symbols2() -> memref> { %c1 = arith.constant 1 : index %0 = memref.alloc(%c1)[%c1, %c1] : memref> return %0 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @allocator(%arg0 : memref>, %arg1 : index) { %0 = memref.alloc(%arg1) : memref memref.store %0, %arg0[] : memref> return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @compose_collapse_of_collapse_zero_dim(%arg0 : memref<1x1x1xf32>) -> memref { %0 = memref.collapse_shape %arg0 [[0, 1, 2]] : memref<1x1x1xf32> into memref<1xf32> %1 = memref.collapse_shape %0 [] : memref<1xf32> into memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @compose_collapse_of_collapse(%arg0 : memref) -> memref { %0 = memref.collapse_shape %arg0 [[0, 1], [2], [3, 4]] : memref into memref %1 = memref.collapse_shape %0 [[0, 1], [2]] : memref into memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @do_not_compose_collapse_of_expand_non_identity_layout( %arg0: memref>) -> memref> { %1 = memref.expand_shape %arg0 [[0, 1], [2]] : memref> into memref> %2 = memref.collapse_shape %1 [[0, 1, 2]] : memref> into memref> return %2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @compose_expand_of_expand(%arg0 : memref) -> memref { %0 = memref.expand_shape %arg0 [[0, 1], [2]] : memref into memref %1 = memref.expand_shape %0 [[0, 1], [2], [3, 4]] : memref into memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @compose_expand_of_expand_of_zero_dim(%arg0 : memref) -> memref<1x1x1xf32> { %0 = memref.expand_shape %arg0 [] : memref into memref<1xf32> %1 = memref.expand_shape %0 [[0, 1, 2]] : memref<1xf32> into memref<1x1x1xf32> return %1 : memref<1x1x1xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_collapse_of_expand(%arg0 : memref<12x4xf32>) -> memref<12x4xf32> { %0 = memref.expand_shape %arg0 [[0, 1], [2]] : memref<12x4xf32> into memref<3x4x4xf32> %1 = memref.collapse_shape %0 [[0, 1], [2]] : memref<3x4x4xf32> into memref<12x4xf32> return %1 : memref<12x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_collapse_collapse_of_expand(%arg0 : memref) -> memref { %0 = memref.expand_shape %arg0 [[0, 1], [2]] : memref into memref %1 = memref.collapse_shape %0 [[0, 1], [2]] : memref into memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_memref_expand_cast(%arg0 : memref) -> memref<2x4x4xf32> { %0 = memref.cast %arg0 : memref to memref<8x4xf32> %1 = memref.expand_shape %0 [[0, 1], [2]] : memref<8x4xf32> into memref<2x4x4xf32> return %1 : memref<2x4x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @collapse_after_memref_cast_type_change(%arg0 : memref) -> memref { %dynamic = memref.cast %arg0: memref to memref %collapsed = memref.collapse_shape %dynamic [[0], [1, 2, 3]] : memref into memref return %collapsed : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @collapse_after_memref_cast(%arg0 : memref) -> memref { %dynamic = memref.cast %arg0: memref to memref %collapsed = memref.collapse_shape %dynamic [[0], [1, 2, 3]] : memref into memref return %collapsed : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @collapse_after_memref_cast_type_change_dynamic(%arg0: memref<1x1x1x?xi64>) -> memref { %casted = memref.cast %arg0 : memref<1x1x1x?xi64> to memref<1x1x?x?xi64> %collapsed = memref.collapse_shape %casted [[0, 1, 2], [3]] : memref<1x1x?x?xi64> into memref return %collapsed : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reduced_memref(%arg0: memref<2x5x7x1xf32>, %arg1 :index) -> memref<1x4x1xf32, strided<[35, 7, 1], offset: ?>> { %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %c4 = arith.constant 4 : index %c2 = arith.constant 2 : index %c1 = arith.constant 1 : index %0 = memref.subview %arg0[%arg1, %arg1, %arg1, 0] [%c1, %c4, %c1, 1] [1, 1, 1, 1] : memref<2x5x7x1xf32> to memref> %1 = memref.cast %0 : memref> to memref<1x4x1xf32, strided<[35, 7, 1], offset: ?>> return %1 : memref<1x4x1xf32, strided<[35, 7, 1], offset: ?>> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_rank_memref(%arg0 : memref) -> (index) { %rank_0 = memref.rank %arg0 : memref return %rank_0 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_no_op_subview(%arg0 : memref<20x42xf32>) -> memref<20x42xf32, strided<[42, 1]>> { %0 = memref.subview %arg0[0, 0] [20, 42] [1, 1] : memref<20x42xf32> to memref<20x42xf32, strided<[42, 1]>> return %0 : memref<20x42xf32, strided<[42, 1]>> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @no_fold_subview_with_non_zero_offset(%arg0 : memref<20x42xf32>) -> memref<20x42xf32, strided<[42, 1], offset: 1>> { %0 = memref.subview %arg0[0, 1] [20, 42] [1, 1] : memref<20x42xf32> to memref<20x42xf32, strided<[42, 1], offset: 1>> return %0 : memref<20x42xf32, strided<[42, 1], offset: 1>> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @no_fold_subview_with_non_unit_stride(%arg0 : memref<20x42xf32>) -> memref<20x42xf32, strided<[42, 2]>> { %0 = memref.subview %arg0[0, 0] [20, 42] [1, 2] : memref<20x42xf32> to memref<20x42xf32, strided<[42, 2]>> return %0 : memref<20x42xf32, strided<[42, 2]>> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @no_fold_dynamic_no_op_subview(%arg0 : memref) -> memref> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = memref.dim %arg0, %c0 : memref %1 = memref.dim %arg0, %c1 : memref %2 = memref.subview %arg0[0, 0] [%0, %1] [1, 1] : memref to memref> return %2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @atomicrmw_cast_fold(%arg0 : f32, %arg1 : memref<4xf32>, %c : index) { %v = memref.cast %arg1 : memref<4xf32> to memref %a = memref.atomic_rmw addf %arg0, %v[%c] : (f32, memref) -> f32 return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @copy_of_cast(%m1: memref, %m2: memref<*xf32>) { %casted1 = memref.cast %m1 : memref to memref> %casted2 = memref.cast %m2 : memref<*xf32> to memref> memref.copy %casted1, %casted2 : memref> to memref> return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @self_copy(%m1: memref) { memref.copy %m1, %m1 : memref to memref return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @scopeMerge() { memref.alloca_scope { %cnt = ""test.count""() : () -> index %a = memref.alloca(%cnt) : memref ""test.use""(%a) : (memref) -> () } return } func.func @scopeMerge2() { ""test.region""() ({ memref.alloca_scope { %cnt = ""test.count""() : () -> index %a = memref.alloca(%cnt) : memref ""test.use""(%a) : (memref) -> () } ""test.terminator""() : () -> () }) : () -> () return } func.func @scopeMerge3() { %cnt = ""test.count""() : () -> index ""test.region""() ({ memref.alloca_scope { %a = memref.alloca(%cnt) : memref ""test.use""(%a) : (memref) -> () } ""test.terminator""() : () -> () }) : () -> () return } func.func @scopeMerge4() { %cnt = ""test.count""() : () -> index ""test.region""() ({ memref.alloca_scope { %a = memref.alloca(%cnt) : memref ""test.use""(%a) : (memref) -> () } ""test.op""() : () -> () ""test.terminator""() : () -> () }) : () -> () return } func.func @scopeMerge5() { ""test.region""() ({ memref.alloca_scope { affine.parallel (%arg) = (0) to (64) { %a = memref.alloca(%arg) : memref ""test.use""(%a) : (memref) -> () } } ""test.op""() : () -> () ""test.terminator""() : () -> () }) : () -> () return } func.func @scopeInline(%arg : memref) { %cnt = ""test.count""() : () -> index ""test.region""() ({ memref.alloca_scope { memref.store %cnt, %arg[] : memref } ""test.terminator""() : () -> () }) : () -> () return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_reinterpret(%arg : memref, %size1: index, %size2: index) -> memref { %0 = memref.reinterpret_cast %arg to offset: [0], sizes: [%size1], strides: [1] : memref to memref %1 = memref.reinterpret_cast %0 to offset: [0], sizes: [%size2], strides: [1] : memref to memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_cast(%arg : memref, %size: index) -> memref { %0 = memref.cast %arg : memref to memref<5xi8> %1 = memref.reinterpret_cast %0 to offset: [0], sizes: [%size], strides: [1] : memref<5xi8> to memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_subview(%arg : memref, %size1: index, %size2: index) -> memref { %0 = memref.subview %arg[0] [%size1] [1] : memref to memref %1 = memref.reinterpret_cast %0 to offset: [0], sizes: [%size2], strides: [1] : memref to memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_extract_strided_metadata_w_type_mistach(%arg0 : memref<8x2xf32>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %arg0 : memref<8x2xf32> -> memref, index, index, index, index, index %m2 = memref.reinterpret_cast %base to offset: [%offset], sizes: [%sizes#0, %sizes#1], strides: [%strides#0, %strides#1] : memref to memref> return %m2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_extract_strided_metadata_w_constants(%arg0 : memref<8x2xf32>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %arg0 : memref<8x2xf32> -> memref, index, index, index, index, index %c8 = arith.constant 8: index %m2 = memref.reinterpret_cast %base to offset: [0], sizes: [%c8, 2], strides: [2, %strides#1] : memref to memref> return %m2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_extract_strided_metadata_same_type(%arg0 : memref>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %arg0 : memref> -> memref, index, index, index, index, index %m2 = memref.reinterpret_cast %base to offset: [%offset], sizes: [%sizes#0, %sizes#1], strides: [%strides#0, %strides#1] : memref to memref> return %m2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_extract_strided_metadata_w_different_stride(%arg0 : memref<8x2xf32>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %arg0 : memref<8x2xf32> -> memref, index, index, index, index, index %m2 = memref.reinterpret_cast %base to offset: [%offset], sizes: [4, 2, 2], strides: [1, 1, %strides#1] : memref to memref> return %m2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @reinterpret_of_extract_strided_metadata_w_different_offset(%arg0 : memref<8x2xf32>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %arg0 : memref<8x2xf32> -> memref, index, index, index, index, index %m2 = memref.reinterpret_cast %base to offset: [1], sizes: [%sizes#0, %sizes#1], strides: [%strides#0, %strides#1] : memref to memref> return %m2 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @canonicalize_rank_reduced_subview(%arg0 : memref<8x?xf32>, %arg1 : index) -> memref> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = memref.subview %arg0[%c0, %c0] [1, %arg1] [%c1, %c1] : memref<8x?xf32> to memref> return %0 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @memref_realloc_dead(%src : memref<2xf32>, %v : f32) -> memref<2xf32>{ %0 = memref.realloc %src : memref<2xf32> to memref<4xf32> %i2 = arith.constant 2 : index memref.store %v, %0[%i2] : memref<4xf32> return %src : memref<2xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @collapse_expand_fold_to_cast(%m: memref, 3>) -> (memref) { %0 = memref.expand_shape %m [[0, 1]] : memref, 3> into memref<1x?xf32, 3> %1 = memref.collapse_shape %0 [[0, 1]] : memref<1x?xf32, 3> into memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_trivial_subviews(%m: memref>, %sz: index) -> memref> { %0 = memref.subview %m[5] [%sz] [1] : memref> to memref> %1 = memref.subview %0[0] [%sz] [1] : memref> to memref> return %1 : memref> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @load_store_nontemporal(%input : memref<32xf32, affine_map<(d0) -> (d0)>>, %output : memref<32xf32, affine_map<(d0) -> (d0)>>) { %1 = arith.constant 7 : index %2 = memref.load %input[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> memref.store %2, %output[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> func.return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_trivial_memory_space_cast(%arg : memref) -> memref { %0 = memref.memory_space_cast %arg : memref to memref return %0 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @fold_multiple_memory_space_cast(%arg : memref) -> memref { %0 = memref.memory_space_cast %arg : memref to memref %1 = memref.memory_space_cast %0 : memref to memref return %1 : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func private @ub_negative_alloc_size() -> memref { %idx1 = index.constant 1 %c-2 = arith.constant -2 : index %c15 = arith.constant 15 : index %alloc = memref.alloc(%c15, %c-2, %idx1) : memref return %alloc : memref }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @tensor_store(%t: tensor, %m: memref) { memref.tensor_store %t, %m : memref return }", mlir-opt -one-shot-bufferize ,1 "func.func @make_alloca_loop_independent(%lb: index, %ub: index, %step: index) { %cst = arith.constant 5.5 : f32 %c0 = arith.constant 0 : index scf.for %i = %lb to %ub step %step { %alloc = memref.alloca(%i) : memref %view = memref.subview %alloc[1][5][1] : memref to memref<5xf32, strided<[1], offset: 1>> ""test.some_use""(%view) : (memref<5xf32, strided<[1], offset: 1>>) -> () ""test.another_use""(%alloc) : (memref) -> (memref) memref.store %cst, %alloc[%c0] : memref } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloca""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.make_loop_independent %0 {num_loops = 1} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @make_alloca_loop_independent_static(%step: index) { %cst = arith.constant 5.5 : f32 %c0 = arith.constant 0 : index %ub = arith.constant 128 : index scf.for %i = %c0 to %ub step %step { %sz = affine.apply affine_map<(d0)[s0] -> (-d0 + s0)>(%i)[%ub] %alloc = memref.alloca(%sz) : memref memref.store %cst, %alloc[%c0] : memref %dim = memref.dim %alloc, %c0 : memref vector.print %dim : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloca""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.memref.make_loop_independent %0 {num_loops = 1} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @memref_reinterpret_cast(%in: memref) -> memref<10x?xf32, strided<[?, 1], offset: ?>> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %out = memref.reinterpret_cast %in to offset: [%c0], sizes: [10, %c10], strides: [%c10, 1] : memref to memref<10x?xf32, strided<[?, 1], offset: ?>> return %out : memref<10x?xf32, strided<[?, 1], offset: ?>> } func.func @memref_reinterpret_cast_static_to_dynamic_sizes(%in: memref) -> memref<10x?xf32, strided<[?, 1], offset: ?>> { %out = memref.reinterpret_cast %in to offset: [1], sizes: [10, 10], strides: [1, 1] : memref to memref<10x?xf32, strided<[?, 1], offset: ?>> return %out : memref<10x?xf32, strided<[?, 1], offset: ?>> } func.func @memref_reinterpret_cast_dynamic_offset(%in: memref, %offset: index) -> memref<10x?xf32, strided<[?, 1], offset: ?>> { %out = memref.reinterpret_cast %in to offset: [%offset], sizes: [10, 10], strides: [1, 1] : memref to memref<10x?xf32, strided<[?, 1], offset: ?>> return %out : memref<10x?xf32, strided<[?, 1], offset: ?>> } func.func @memref_reshape(%unranked: memref<*xf32>, %shape1: memref<1xi32>, %shape2: memref<2xi32>, %shape3: memref) -> memref<*xf32> { %dyn_vec = memref.reshape %unranked(%shape1) : (memref<*xf32>, memref<1xi32>) -> memref %dyn_mat = memref.reshape %dyn_vec(%shape2) : (memref, memref<2xi32>) -> memref %new_unranked = memref.reshape %dyn_mat(%shape3) : (memref, memref) -> memref<*xf32> return %new_unranked : memref<*xf32> } memref.global @memref0 : memref<2xf32> memref.global constant @memref1 : memref<2xf32> = dense<[0.0, 1.0]> memref.global @memref2 : memref<2xf32> = uninitialized memref.global ""private"" @memref3 : memref<2xf32> = uninitialized memref.global ""private"" constant @memref4 : memref<2xf32> = uninitialized func.func @write_global_memref() { %0 = memref.get_global @memref0 : memref<2xf32> %1 = arith.constant dense<[1.0, 2.0]> : tensor<2xf32> memref.tensor_store %1, %0 : memref<2xf32> return } func.func @read_global_memref() { %0 = memref.get_global @memref0 : memref<2xf32> return } func.func @memref_copy() { %0 = memref.alloc() : memref<2xf32> %1 = memref.cast %0 : memref<2xf32> to memref<*xf32> %2 = memref.alloc() : memref<2xf32> %3 = memref.cast %0 : memref<2xf32> to memref<*xf32> memref.copy %1, %3 : memref<*xf32> to memref<*xf32> return } func.func @memref_dealloc() { %0 = memref.alloc() : memref<2xf32> %1 = memref.cast %0 : memref<2xf32> to memref<*xf32> memref.dealloc %1 : memref<*xf32> return } func.func @memref_alloca_scope() { memref.alloca_scope { memref.alloca_scope.return } return } func.func @expand_collapse_shape_static( %arg0: memref<3x4x5xf32>, %arg1: tensor<3x4x5xf32>, %arg2: tensor<3x?x5xf32>, %arg3: memref<30x20xf32, strided<[4000, 2], offset: 100>>, %arg4: memref<1x5xf32, strided<[5, 1], offset: ?>>, %arg5: memref, %arg6: memref<3x4x5xf32, strided<[240, 60, 10], offset: 0>>, %arg7: memref<1x2049xi64, strided<[?, ?], offset: ?>>) { %0 = memref.collapse_shape %arg0 [[0, 1], [2]] : memref<3x4x5xf32> into memref<12x5xf32> %r0 = memref.expand_shape %0 [[0, 1], [2]] : memref<12x5xf32> into memref<3x4x5xf32> %1 = memref.collapse_shape %arg0 [[0], [1, 2]] : memref<3x4x5xf32> into memref<3x20xf32> %r1 = memref.expand_shape %1 [[0], [1, 2]] : memref<3x20xf32> into memref<3x4x5xf32> %2 = memref.collapse_shape %arg0 [[0, 1, 2]] : memref<3x4x5xf32> into memref<60xf32> %r2 = memref.expand_shape %2 [[0, 1, 2]] : memref<60xf32> into memref<3x4x5xf32> %r5 = memref.expand_shape %arg5 [] : memref into memref<1x1xf32> %l0 = memref.expand_shape %arg3 [[0], [1, 2]] : memref<30x20xf32, strided<[4000, 2], offset: 100>> into memref<30x4x5xf32, strided<[4000, 10, 2], offset: 100>> %l1 = memref.expand_shape %arg3 [[0, 1], [2]] : memref<30x20xf32, strided<[4000, 2], offset: 100>> into memref<2x15x20xf32, strided<[60000, 4000, 2], offset: 100>> %r4 = memref.expand_shape %arg4 [[0], [1, 2]] : memref<1x5xf32, strided<[5, 1], offset: ?>> into memref<1x1x5xf32, strided<[5, 5, 1], offset: ?>> %r6 = memref.collapse_shape %arg6 [[0, 1], [2]] : memref<3x4x5xf32, strided<[240, 60, 10], offset: 0>> into memref<12x5xf32, strided<[60, 10], offset: 0>> %r7 = memref.collapse_shape %arg7 [[0, 1]] : memref<1x2049xi64, strided<[?, ?], offset: ?>> into memref<2049xi64, strided<[?], offset: ?>> %3 = memref.expand_shape %arg0 [[0, 1], [2], [3, 4]] : memref<3x4x5xf32> into memref<1x3x4x1x5xf32> %r3 = memref.collapse_shape %3 [[0, 1], [2], [3, 4]] : memref<1x3x4x1x5xf32> into memref<3x4x5xf32> %t0 = tensor.expand_shape %arg1 [[0, 1], [2], [3, 4]] : tensor<3x4x5xf32> into tensor<1x3x4x1x5xf32> %rt0 = tensor.collapse_shape %t0 [[0, 1], [2], [3, 4]] : tensor<1x3x4x1x5xf32> into tensor<3x4x5xf32> %t1 = tensor.expand_shape %arg2 [[0, 1], [2], [3, 4]] : tensor<3x?x5xf32> into tensor<1x3x?x1x5xf32> %rt1 = tensor.collapse_shape %t1 [[0], [1, 2], [3, 4]] : tensor<1x3x?x1x5xf32> into tensor<1x?x5xf32> return } func.func @expand_collapse_shape_dynamic(%arg0: memref, %arg1: memref>, %arg2: memref>, %arg3: memref>) { %0 = memref.collapse_shape %arg0 [[0, 1], [2]] : memref into memref %r0 = memref.expand_shape %0 [[0, 1], [2]] : memref into memref %1 = memref.collapse_shape %arg1 [[0, 1], [2]] : memref> into memref> %r1 = memref.expand_shape %1 [[0, 1], [2]] : memref> into memref> %2 = memref.collapse_shape %arg2 [[0, 1], [2]] : memref> into memref> %r2 = memref.expand_shape %2 [[0, 1], [2]] : memref> into memref> %3 = memref.collapse_shape %arg3 [[0, 1]] : memref> into memref> %r3 = memref.expand_shape %3 [[0, 1]] : memref> into memref return } func.func @expand_collapse_shape_zero_dim(%arg0 : memref<1x1xf32>, %arg1 : memref) -> (memref, memref<1x1xf32>) { %0 = memref.collapse_shape %arg0 [] : memref<1x1xf32> into memref %1 = memref.expand_shape %0 [] : memref into memref<1x1xf32> return %0, %1 : memref, memref<1x1xf32> } func.func @collapse_shape_to_dynamic (%arg0: memref) -> memref { %0 = memref.collapse_shape %arg0 [[0], [1], [2, 3, 4]] : memref into memref return %0 : memref }", mlir-opt | mlir-opt ,1 "func.func @memref_reinterpret_cast(%in: memref) -> memref<10x?xf32, strided<[?, 1], offset: ?>> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %out = memref.reinterpret_cast %in to offset: [%c0], sizes: [10, %c10], strides: [%c10, 1] : memref to memref<10x?xf32, strided<[?, 1], offset: ?>> return %out : memref<10x?xf32, strided<[?, 1], offset: ?>> } func.func @memref_reinterpret_cast_static_to_dynamic_sizes(%in: memref) -> memref<10x?xf32, strided<[?, 1], offset: ?>> { %out = memref.reinterpret_cast %in to offset: [1], sizes: [10, 10], strides: [1, 1] : memref to memref<10x?xf32, strided<[?, 1], offset: ?>> return %out : memref<10x?xf32, strided<[?, 1], offset: ?>> } func.func @memref_reinterpret_cast_dynamic_offset(%in: memref, %offset: index) -> memref<10x?xf32, strided<[?, 1], offset: ?>> { %out = memref.reinterpret_cast %in to offset: [%offset], sizes: [10, 10], strides: [1, 1] : memref to memref<10x?xf32, strided<[?, 1], offset: ?>> return %out : memref<10x?xf32, strided<[?, 1], offset: ?>> } func.func @memref_reshape(%unranked: memref<*xf32>, %shape1: memref<1xi32>, %shape2: memref<2xi32>, %shape3: memref) -> memref<*xf32> { %dyn_vec = memref.reshape %unranked(%shape1) : (memref<*xf32>, memref<1xi32>) -> memref %dyn_mat = memref.reshape %dyn_vec(%shape2) : (memref, memref<2xi32>) -> memref %new_unranked = memref.reshape %dyn_mat(%shape3) : (memref, memref) -> memref<*xf32> return %new_unranked : memref<*xf32> } memref.global @memref0 : memref<2xf32> memref.global constant @memref1 : memref<2xf32> = dense<[0.0, 1.0]> memref.global @memref2 : memref<2xf32> = uninitialized memref.global ""private"" @memref3 : memref<2xf32> = uninitialized memref.global ""private"" constant @memref4 : memref<2xf32> = uninitialized func.func @write_global_memref() { %0 = memref.get_global @memref0 : memref<2xf32> %1 = arith.constant dense<[1.0, 2.0]> : tensor<2xf32> memref.tensor_store %1, %0 : memref<2xf32> return } func.func @read_global_memref() { %0 = memref.get_global @memref0 : memref<2xf32> return } func.func @memref_copy() { %0 = memref.alloc() : memref<2xf32> %1 = memref.cast %0 : memref<2xf32> to memref<*xf32> %2 = memref.alloc() : memref<2xf32> %3 = memref.cast %0 : memref<2xf32> to memref<*xf32> memref.copy %1, %3 : memref<*xf32> to memref<*xf32> return } func.func @memref_dealloc() { %0 = memref.alloc() : memref<2xf32> %1 = memref.cast %0 : memref<2xf32> to memref<*xf32> memref.dealloc %1 : memref<*xf32> return } func.func @memref_alloca_scope() { memref.alloca_scope { memref.alloca_scope.return } return } func.func @expand_collapse_shape_static( %arg0: memref<3x4x5xf32>, %arg1: tensor<3x4x5xf32>, %arg2: tensor<3x?x5xf32>, %arg3: memref<30x20xf32, strided<[4000, 2], offset: 100>>, %arg4: memref<1x5xf32, strided<[5, 1], offset: ?>>, %arg5: memref, %arg6: memref<3x4x5xf32, strided<[240, 60, 10], offset: 0>>, %arg7: memref<1x2049xi64, strided<[?, ?], offset: ?>>) { %0 = memref.collapse_shape %arg0 [[0, 1], [2]] : memref<3x4x5xf32> into memref<12x5xf32> %r0 = memref.expand_shape %0 [[0, 1], [2]] : memref<12x5xf32> into memref<3x4x5xf32> %1 = memref.collapse_shape %arg0 [[0], [1, 2]] : memref<3x4x5xf32> into memref<3x20xf32> %r1 = memref.expand_shape %1 [[0], [1, 2]] : memref<3x20xf32> into memref<3x4x5xf32> %2 = memref.collapse_shape %arg0 [[0, 1, 2]] : memref<3x4x5xf32> into memref<60xf32> %r2 = memref.expand_shape %2 [[0, 1, 2]] : memref<60xf32> into memref<3x4x5xf32> %r5 = memref.expand_shape %arg5 [] : memref into memref<1x1xf32> %l0 = memref.expand_shape %arg3 [[0], [1, 2]] : memref<30x20xf32, strided<[4000, 2], offset: 100>> into memref<30x4x5xf32, strided<[4000, 10, 2], offset: 100>> %l1 = memref.expand_shape %arg3 [[0, 1], [2]] : memref<30x20xf32, strided<[4000, 2], offset: 100>> into memref<2x15x20xf32, strided<[60000, 4000, 2], offset: 100>> %r4 = memref.expand_shape %arg4 [[0], [1, 2]] : memref<1x5xf32, strided<[5, 1], offset: ?>> into memref<1x1x5xf32, strided<[5, 5, 1], offset: ?>> %r6 = memref.collapse_shape %arg6 [[0, 1], [2]] : memref<3x4x5xf32, strided<[240, 60, 10], offset: 0>> into memref<12x5xf32, strided<[60, 10], offset: 0>> %r7 = memref.collapse_shape %arg7 [[0, 1]] : memref<1x2049xi64, strided<[?, ?], offset: ?>> into memref<2049xi64, strided<[?], offset: ?>> %3 = memref.expand_shape %arg0 [[0, 1], [2], [3, 4]] : memref<3x4x5xf32> into memref<1x3x4x1x5xf32> %r3 = memref.collapse_shape %3 [[0, 1], [2], [3, 4]] : memref<1x3x4x1x5xf32> into memref<3x4x5xf32> %t0 = tensor.expand_shape %arg1 [[0, 1], [2], [3, 4]] : tensor<3x4x5xf32> into tensor<1x3x4x1x5xf32> %rt0 = tensor.collapse_shape %t0 [[0, 1], [2], [3, 4]] : tensor<1x3x4x1x5xf32> into tensor<3x4x5xf32> %t1 = tensor.expand_shape %arg2 [[0, 1], [2], [3, 4]] : tensor<3x?x5xf32> into tensor<1x3x?x1x5xf32> %rt1 = tensor.collapse_shape %t1 [[0], [1, 2], [3, 4]] : tensor<1x3x?x1x5xf32> into tensor<1x?x5xf32> return } func.func @expand_collapse_shape_dynamic(%arg0: memref, %arg1: memref>, %arg2: memref>, %arg3: memref>) { %0 = memref.collapse_shape %arg0 [[0, 1], [2]] : memref into memref %r0 = memref.expand_shape %0 [[0, 1], [2]] : memref into memref %1 = memref.collapse_shape %arg1 [[0, 1], [2]] : memref> into memref> %r1 = memref.expand_shape %1 [[0, 1], [2]] : memref> into memref> %2 = memref.collapse_shape %arg2 [[0, 1], [2]] : memref> into memref> %r2 = memref.expand_shape %2 [[0, 1], [2]] : memref> into memref> %3 = memref.collapse_shape %arg3 [[0, 1]] : memref> into memref> %r3 = memref.expand_shape %3 [[0, 1]] : memref> into memref return } func.func @expand_collapse_shape_zero_dim(%arg0 : memref<1x1xf32>, %arg1 : memref) -> (memref, memref<1x1xf32>) { %0 = memref.collapse_shape %arg0 [] : memref<1x1xf32> into memref %1 = memref.expand_shape %0 [] : memref into memref<1x1xf32> return %0, %1 : memref, memref<1x1xf32> } func.func @collapse_shape_to_dynamic (%arg0: memref) -> memref { %0 = memref.collapse_shape %arg0 [[0], [1], [2, 3, 4]] : memref into memref return %0 : memref }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @expand_collapse_shape_transposed_layout( %m0: memref>, %m1: memref<4x5x6xf32, strided<[1, ?, 1000], offset: 0>>) { %r0 = memref.expand_shape %m0 [[0], [1, 2]] : memref> into memref> %rr0 = memref.collapse_shape %r0 [[0], [1, 2]] : memref> into memref> %r1 = memref.expand_shape %m1 [[0, 1], [2], [3, 4]] : memref<4x5x6xf32, strided<[1, ?, 1000], offset: 0>> into memref<2x2x5x2x3xf32, strided<[2, 1, ?, 3000, 1000], offset: 0>> %rr1 = memref.collapse_shape %r1 [[0, 1], [2], [3, 4]] : memref<2x2x5x2x3xf32, strided<[2, 1, ?, 3000, 1000], offset: 0>> into memref<4x5x6xf32, strided<[1, ?, 1000], offset: 0>> return }", mlir-opt | mlir-opt ,1 "func.func @expand_collapse_shape_transposed_layout( %m0: memref>, %m1: memref<4x5x6xf32, strided<[1, ?, 1000], offset: 0>>) { %r0 = memref.expand_shape %m0 [[0], [1, 2]] : memref> into memref> %rr0 = memref.collapse_shape %r0 [[0], [1, 2]] : memref> into memref> %r1 = memref.expand_shape %m1 [[0, 1], [2], [3, 4]] : memref<4x5x6xf32, strided<[1, ?, 1000], offset: 0>> into memref<2x2x5x2x3xf32, strided<[2, 1, ?, 3000, 1000], offset: 0>> %rr1 = memref.collapse_shape %r1 [[0, 1], [2], [3, 4]] : memref<2x2x5x2x3xf32, strided<[2, 1, ?, 3000, 1000], offset: 0>> into memref<4x5x6xf32, strided<[1, ?, 1000], offset: 0>> return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @rank(%t : memref<4x4x?xf32>) { %0 = ""memref.rank""(%t) : (memref<4x4x?xf32>) -> index %1 = memref.rank %t : memref<4x4x?xf32> return }", mlir-opt | mlir-opt ,1 "func.func @rank(%t : memref<4x4x?xf32>) { %0 = ""memref.rank""(%t) : (memref<4x4x?xf32>) -> index %1 = memref.rank %t : memref<4x4x?xf32> return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "- func.func @atomic_rmw(%I: memref<10xf32>, %val: f32, %i : index) { %x = memref.atomic_rmw addf %val, %I[%i] : (f32, memref<10xf32>) -> f32 return } func.func @generic_atomic_rmw(%I: memref<1x2xf32>, %i : index, %j : index) { %x = memref.generic_atomic_rmw %I[%i, %j] : memref<1x2xf32> { ^bb0(%old_value : f32): %c1 = arith.constant 1.0 : f32 %out = arith.addf %c1, %old_value : f32 memref.atomic_yield %out : f32 } { index_attr = 8 : index } return }", mlir-opt | mlir-opt ,1 "- func.func @atomic_rmw(%I: memref<10xf32>, %val: f32, %i : index) { %x = memref.atomic_rmw addf %val, %I[%i] : (f32, memref<10xf32>) -> f32 return } func.func @generic_atomic_rmw(%I: memref<1x2xf32>, %i : index, %j : index) { %x = memref.generic_atomic_rmw %I[%i, %j] : memref<1x2xf32> { ^bb0(%old_value : f32): %c1 = arith.constant 1.0 : f32 %out = arith.addf %c1, %old_value : f32 memref.atomic_yield %out : f32 } { index_attr = 8 : index } return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @extract_strided_metadata(%memref : memref<10x?xf32>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %memref : memref<10x?xf32> -> memref, index, index, index, index, index %m2 = memref.reinterpret_cast %base to offset: [%offset], sizes: [%sizes#0, %sizes#1], strides: [%strides#0, %strides#1] : memref to memref> return %m2: memref> }", mlir-opt | mlir-opt ,1 "func.func @extract_strided_metadata(%memref : memref<10x?xf32>) -> memref> { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %memref : memref<10x?xf32> -> memref, index, index, index, index, index %m2 = memref.reinterpret_cast %base to offset: [%offset], sizes: [%sizes#0, %sizes#1], strides: [%strides#0, %strides#1] : memref to memref> return %m2: memref> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @memref_realloc_ss(%src : memref<2xf32>) -> memref<4xf32>{ %0 = memref.realloc %src : memref<2xf32> to memref<4xf32> return %0 : memref<4xf32> } func.func @memref_realloc_sd(%src : memref<2xf32>, %d : index) -> memref{ %0 = memref.realloc %src(%d) : memref<2xf32> to memref return %0 : memref } func.func @memref_realloc_ds(%src : memref) -> memref<4xf32>{ %0 = memref.realloc %src: memref to memref<4xf32> return %0 : memref<4xf32> } func.func @memref_realloc_dd(%src : memref, %d: index) -> memref{ %0 = memref.realloc %src(%d) : memref to memref return %0 : memref } func.func @memref_extract_aligned_pointer(%src : memref) -> index { %0 = memref.extract_aligned_pointer_as_index %src : memref -> index return %0 : index } func.func @memref_memory_space_cast(%src : memref) -> memref { %dst = memref.memory_space_cast %src : memref to memref return %dst : memref }", mlir-opt | mlir-opt ,1 "func.func @memref_realloc_ss(%src : memref<2xf32>) -> memref<4xf32>{ %0 = memref.realloc %src : memref<2xf32> to memref<4xf32> return %0 : memref<4xf32> } func.func @memref_realloc_sd(%src : memref<2xf32>, %d : index) -> memref{ %0 = memref.realloc %src(%d) : memref<2xf32> to memref return %0 : memref } func.func @memref_realloc_ds(%src : memref) -> memref<4xf32>{ %0 = memref.realloc %src: memref to memref<4xf32> return %0 : memref<4xf32> } func.func @memref_realloc_dd(%src : memref, %d: index) -> memref{ %0 = memref.realloc %src(%d) : memref to memref return %0 : memref } func.func @memref_extract_aligned_pointer(%src : memref) -> index { %0 = memref.extract_aligned_pointer_as_index %src : memref -> index return %0 : index } func.func @memref_memory_space_cast(%src : memref) -> memref { %dst = memref.memory_space_cast %src : memref to memref return %dst : memref }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @multi_buffer(%in: memref<16xf32>) { %tmp = memref.alloc() : memref<4xf32> %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index scf.for %i0 = %c0 to %c16 step %c4 { %1 = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %1, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloc""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloc""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64} : (!transform.op<""memref.alloc"">) -> !transform.any_op transform.test_print_remark_at_operand %1, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @multi_buffer_on_affine_loop(%in: memref<16xf32>) { %tmp = memref.alloc() : memref<4xf32> %c0 = arith.constant 0 : index affine.for %i0 = 0 to 16 step 4 { %1 = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %1, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloc""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloc""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64} : (!transform.op<""memref.alloc"">) -> !transform.any_op transform.test_print_remark_at_operand %1, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @multi_buffer_uses_with_no_loop_dominator(%in: memref<16xf32>, %cond: i1) { %tmp = memref.alloc() : memref<4xf32> %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index scf.if %cond { scf.for %i0 = %c0 to %c16 step %c4 { %var = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %var, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } } scf.for %i0 = %c0 to %c16 step %c4 { %1 = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %1, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloc""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloc""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64} : (!transform.op<""memref.alloc"">) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @multi_buffer_reject_alloca(%in: memref<16xf32>, %cond: i1) { %tmp = memref.alloca() : memref<4xf32> %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index scf.if %cond { scf.for %i0 = %c0 to %c16 step %c4 { %var = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %var, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } } scf.for %i0 = %c0 to %c16 step %c4 { %1 = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %1, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloca""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloca""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64} : (!transform.op<""memref.alloca"">) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @multi_buffer_one_alloc_with_use_outside_of_loop(%in: memref<16xf32>) { %tmp = memref.alloc() : memref<4xf32> %tmp2 = memref.alloc() : memref<4xf32> ""some_use_outside_of_loop""(%tmp2) : (memref<4xf32>) -> () %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index scf.for %i0 = %c0 to %c16 step %c4 { %1 = memref.subview %in[%i0] [4] [1] : memref<16xf32> to memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> memref.copy %1, %tmp : memref<4xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref<4xf32> ""some_use""(%tmp) : (memref<4xf32>) ->() } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloc""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloc""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64} : (!transform.op<""memref.alloc"">) -> !transform.any_op transform.test_print_remark_at_operand %1, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @multi_buffer_no_analysis(%in: memref<16xf32>) { %tmp = memref.alloc() : memref<4xf32> %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index scf.for %i0 = %c0 to %c16 step %c4 { ""some_write_read""(%tmp) : (memref<4xf32>) ->() } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloc""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloc""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64, skip_analysis} : (!transform.op<""memref.alloc"">) -> !transform.any_op transform.test_print_remark_at_operand %1, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @multi_buffer_dealloc(%in: memref<16xf32>) { %tmp = memref.alloc() : memref<4xf32> %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index scf.for %i0 = %c0 to %c16 step %c4 { ""some_write_read""(%tmp) : (memref<4xf32>) ->() } memref.dealloc %tmp : memref<4xf32> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.alloc""]} in %arg1 : (!transform.any_op) -> !transform.op<""memref.alloc""> %1 = transform.memref.multibuffer %0 {factor = 2 : i64, skip_analysis} : (!transform.op<""memref.alloc"">) -> !transform.any_op transform.test_print_remark_at_operand %1, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -verify-diagnostics -allow-unregistered-dialect -split-input-file ,1 "func.func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = memref.alloc() : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> %1 = memref.subview %0[%c0, %c0, %c0][%arg0, %arg1, %arg2][%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> %2 = memref.alloc()[%arg2] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> %3 = memref.subview %2[%c1][%arg0][%c1] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref (d0 * s1 + s0)>> %4 = memref.alloc() : memref<64x22xf32, strided<[22, 1]>> %5 = memref.subview %4[%c0, %c1][%arg0, %arg1][%c1, %c0] : memref<64x22xf32, strided<[22, 1], offset: 0>> to memref> %6 = memref.subview %0[0, 2, 0][4, 4, 4][1, 1, 1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref<4x4x4xf32, strided<[64, 4, 1], offset: 8>> %7 = memref.alloc(%arg1, %arg2) : memref %8 = memref.subview %7[0, 0][4, 4][1, 1] : memref to memref<4x4xf32, strided<[?, 1], offset: ?>> %9 = memref.alloc() : memref<16x4xf32> %10 = memref.subview %9[%arg1, %arg1][4, 4][%arg2, %arg2] : memref<16x4xf32> to memref<4x4xf32, strided<[?, ?], offset: ?>> %11 = memref.subview %9[%arg1, %arg2][4, 4][2, 2] : memref<16x4xf32> to memref<4x4xf32, strided<[8, 2], offset: ?>> %12 = memref.alloc() : memref<1x9x1x4x1xf32, strided<[36, 36, 4, 4, 1]>> %13 = memref.subview %12[%arg1, %arg1, %arg1, %arg1, %arg1][1, 9, 1, 4, 1][%arg2, %arg2, %arg2, %arg2, %arg2] : memref<1x9x1x4x1xf32, strided<[36, 36, 4, 4, 1], offset: 0>> to memref<9x4xf32, strided<[?, ?], offset: ?>> %14 = memref.subview %12[%arg1, %arg1, %arg1, %arg1, %arg1][1, 9, 1, 4, 1][%arg2, %arg2, %arg2, %arg2, %arg2] : memref<1x9x1x4x1xf32, strided<[36, 36, 4, 4, 1], offset: 0>> to memref<1x9x4xf32, strided<[?, ?, ?], offset: ?>> %15 = memref.alloc(%arg1, %arg2)[%c0, %c1, %arg1, %arg0, %arg0, %arg2, %arg2] : memref<1x?x5x1x?x1xf32, strided<[?, ?, ?, ?, ?, ?], offset: ?>> %16 = memref.subview %15[0, 0, 0, 0, 0, 0][1, %arg1, 5, 1, %arg2, 1][1, 1, 1, 1, 1, 1] : memref<1x?x5x1x?x1xf32, strided<[?, ?, ?, ?, ?, ?], offset: ?>> to memref> %17 = memref.subview %15[%arg1, %arg1, %arg1, %arg1, %arg1, %arg1][1, %arg1, 5, 1, %arg2, 1][1, 1, 1, 1, 1, 1] : memref<1x?x5x1x?x1xf32, strided<[?, ?, ?, ?, ?, ?], offset: ?>> to memref> %18 = memref.alloc() : memref<1x8xf32> %19 = memref.subview %18[0, 0][1, 8][1, 1] : memref<1x8xf32> to memref<8xf32> %20 = memref.alloc() : memref<8x16x4xf32> %21 = memref.subview %20[0, 0, 0][1, 16, 4][1, 1, 1] : memref<8x16x4xf32> to memref<16x4xf32> %22 = memref.subview %20[3, 4, 2][1, 6, 3][1, 1, 1] : memref<8x16x4xf32> to memref<6x3xf32, strided<[4, 1], offset: 210>> %23 = memref.alloc() : memref %78 = memref.subview %23[] [] [] : memref to memref %24 = memref.alloc() : memref<5x3xf32> %25 = memref.subview %24[2, 0][3, 3][1, 1]: memref<5x3xf32> to memref<3x3xf32, strided<[3, 1], offset: 6>> %26 = memref.subview %24[1, 0][1, 3][1, 1]: memref<5x3xf32> to memref<3xf32, strided<[1], offset: 3>> %27 = memref.subview %24[1, 1] [1, 1] [1, 1] : memref<5x3xf32> to memref (4)>> %28 = memref.subview %24[%arg0, 1] [1, 1] [1, 1] : memref<5x3xf32> to memref (s0)>> %a30 = memref.alloc(%arg0, %arg0) : memref %30 = memref.subview %a30[0, %arg1][%arg2, 1][1, 1] : memref to memref (d0 * s1 + s0)>> %c8 = arith.constant 8 : index %a40 = memref.alloc() : memref<16x16xf32> %40 = memref.subview %a40[%c8, 8][8, 8][1, 1] : memref<16x16xf32> to memref<8x8xf32, affine_map<(d0, d1)[s0] -> (d0 * 16 + d1 + s0)>> return }", mlir-opt | mlir-opt ,1 "func.func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = memref.alloc() : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> %1 = memref.subview %0[%c0, %c0, %c0][%arg0, %arg1, %arg2][%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> %2 = memref.alloc()[%arg2] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> %3 = memref.subview %2[%c1][%arg0][%c1] : memref<64xf32, affine_map<(d0)[s0] -> (d0 + s0)>> to memref (d0 * s1 + s0)>> %4 = memref.alloc() : memref<64x22xf32, strided<[22, 1]>> %5 = memref.subview %4[%c0, %c1][%arg0, %arg1][%c1, %c0] : memref<64x22xf32, strided<[22, 1], offset: 0>> to memref> %6 = memref.subview %0[0, 2, 0][4, 4, 4][1, 1, 1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref<4x4x4xf32, strided<[64, 4, 1], offset: 8>> %7 = memref.alloc(%arg1, %arg2) : memref %8 = memref.subview %7[0, 0][4, 4][1, 1] : memref to memref<4x4xf32, strided<[?, 1], offset: ?>> %9 = memref.alloc() : memref<16x4xf32> %10 = memref.subview %9[%arg1, %arg1][4, 4][%arg2, %arg2] : memref<16x4xf32> to memref<4x4xf32, strided<[?, ?], offset: ?>> %11 = memref.subview %9[%arg1, %arg2][4, 4][2, 2] : memref<16x4xf32> to memref<4x4xf32, strided<[8, 2], offset: ?>> %12 = memref.alloc() : memref<1x9x1x4x1xf32, strided<[36, 36, 4, 4, 1]>> %13 = memref.subview %12[%arg1, %arg1, %arg1, %arg1, %arg1][1, 9, 1, 4, 1][%arg2, %arg2, %arg2, %arg2, %arg2] : memref<1x9x1x4x1xf32, strided<[36, 36, 4, 4, 1], offset: 0>> to memref<9x4xf32, strided<[?, ?], offset: ?>> %14 = memref.subview %12[%arg1, %arg1, %arg1, %arg1, %arg1][1, 9, 1, 4, 1][%arg2, %arg2, %arg2, %arg2, %arg2] : memref<1x9x1x4x1xf32, strided<[36, 36, 4, 4, 1], offset: 0>> to memref<1x9x4xf32, strided<[?, ?, ?], offset: ?>> %15 = memref.alloc(%arg1, %arg2)[%c0, %c1, %arg1, %arg0, %arg0, %arg2, %arg2] : memref<1x?x5x1x?x1xf32, strided<[?, ?, ?, ?, ?, ?], offset: ?>> %16 = memref.subview %15[0, 0, 0, 0, 0, 0][1, %arg1, 5, 1, %arg2, 1][1, 1, 1, 1, 1, 1] : memref<1x?x5x1x?x1xf32, strided<[?, ?, ?, ?, ?, ?], offset: ?>> to memref> %17 = memref.subview %15[%arg1, %arg1, %arg1, %arg1, %arg1, %arg1][1, %arg1, 5, 1, %arg2, 1][1, 1, 1, 1, 1, 1] : memref<1x?x5x1x?x1xf32, strided<[?, ?, ?, ?, ?, ?], offset: ?>> to memref> %18 = memref.alloc() : memref<1x8xf32> %19 = memref.subview %18[0, 0][1, 8][1, 1] : memref<1x8xf32> to memref<8xf32> %20 = memref.alloc() : memref<8x16x4xf32> %21 = memref.subview %20[0, 0, 0][1, 16, 4][1, 1, 1] : memref<8x16x4xf32> to memref<16x4xf32> %22 = memref.subview %20[3, 4, 2][1, 6, 3][1, 1, 1] : memref<8x16x4xf32> to memref<6x3xf32, strided<[4, 1], offset: 210>> %23 = memref.alloc() : memref %78 = memref.subview %23[] [] [] : memref to memref %24 = memref.alloc() : memref<5x3xf32> %25 = memref.subview %24[2, 0][3, 3][1, 1]: memref<5x3xf32> to memref<3x3xf32, strided<[3, 1], offset: 6>> %26 = memref.subview %24[1, 0][1, 3][1, 1]: memref<5x3xf32> to memref<3xf32, strided<[1], offset: 3>> %27 = memref.subview %24[1, 1] [1, 1] [1, 1] : memref<5x3xf32> to memref (4)>> %28 = memref.subview %24[%arg0, 1] [1, 1] [1, 1] : memref<5x3xf32> to memref (s0)>> %a30 = memref.alloc(%arg0, %arg0) : memref %30 = memref.subview %a30[0, %arg1][%arg2, 1][1, 1] : memref to memref (d0 * s1 + s0)>> %c8 = arith.constant 8 : index %a40 = memref.alloc() : memref<16x16xf32> %40 = memref.subview %a40[%c8, 8][8, 8][1, 1] : memref<16x16xf32> to memref<8x8xf32, affine_map<(d0, d1)[s0] -> (d0 * 16 + d1 + s0)>> return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @multi_buffer(%a: memref<1024x1024xf32>) { %0 = memref.alloc() {someAttribute} : memref<4x128xf32> %c1024 = arith.constant 1024 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index scf.for %arg2 = %c1 to %c1024 step %c3 { %1 = memref.subview %a[%arg2, 0] [4, 128] [1, 1] : memref<1024x1024xf32> to memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> memref.copy %1, %0 : memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> to memref<4x128xf32> ""some_use""(%0) : (memref<4x128xf32>) -> () ""some_use""(%0) : (memref<4x128xf32>) -> () } return }", mlir-opt -allow-unregistered-dialect -test-multi-buffering=multiplier=5 -cse -split-input-file ,1 "func.func @multi_buffer_affine(%a: memref<1024x1024xf32>) { %0 = memref.alloc() : memref<4x128xf32> %c1024 = arith.constant 1024 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index affine.for %arg2 = 1 to 1024 step 3 { %1 = memref.subview %a[%arg2, 0] [4, 128] [1, 1] : memref<1024x1024xf32> to memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> memref.copy %1, %0 : memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> to memref<4x128xf32> ""some_use""(%0) : (memref<4x128xf32>) -> () ""some_use""(%0) : (memref<4x128xf32>) -> () } return }", mlir-opt -allow-unregistered-dialect -test-multi-buffering=multiplier=5 -cse -split-input-file ,1 "func.func @multi_buffer_subview_use(%a: memref<1024x1024xf32>) { %0 = memref.alloc() : memref<4x128xf32> %c1024 = arith.constant 1024 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index scf.for %arg2 = %c1 to %c1024 step %c3 { %1 = memref.subview %a[%arg2, 0] [4, 128] [1, 1] : memref<1024x1024xf32> to memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> memref.copy %1, %0 : memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> to memref<4x128xf32> %s = memref.subview %0[0, 1] [4, 127] [1, 1] : memref<4x128xf32> to memref<4x127xf32, affine_map<(d0, d1) -> (d0 * 128 + d1 + 1)>> ""some_use""(%s) : (memref<4x127xf32, affine_map<(d0, d1) -> (d0 * 128 + d1 + 1)>>) -> () ""some_use""(%0) : (memref<4x128xf32>) -> () } return }", mlir-opt -allow-unregistered-dialect -test-multi-buffering=multiplier=5 -cse -split-input-file ,1 "func.func @multi_buffer_negative(%a: memref<1024x1024xf32>) { %0 = memref.alloc() : memref<4x128xf32> %c1024 = arith.constant 1024 : index %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index scf.for %arg2 = %c0 to %c1024 step %c3 { ""blocking_use""(%0) : (memref<4x128xf32>) -> () %1 = memref.subview %a[%arg2, 0] [4, 128] [1, 1] : memref<1024x1024xf32> to memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> memref.copy %1, %0 : memref<4x128xf32, affine_map<(d0, d1)[s0] -> (d0 * 1024 + s0 + d1)>> to memref<4x128xf32> ""some_use""(%0) : (memref<4x128xf32>) -> () } return }", mlir-opt -allow-unregistered-dialect -test-multi-buffering=multiplier=5 -cse -split-input-file ,1 "func.func @expand_shape(%m: memref) -> memref { %0 = memref.expand_shape %m [[0, 1]] : memref into memref return %0 : memref }", mlir-opt -generate-runtime-verification -cse ,1 "func.func @memref_i32() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : i32 %m = memref.alloc() : memref<4xi32, 1> %v = memref.load %m[%c0] : memref<4xi32, 1> memref.store %c1, %m[%c0] : memref<4xi32, 1> return } func.func @memref_f32() { %c0 = arith.constant 0 : index %c1 = arith.constant 1.0 : f32 %m = memref.alloc() : memref<4xf32, 1> %v = memref.load %m[%c0] : memref<4xf32, 1> memref.store %c1, %m[%c0] : memref<4xf32, 1> return } func.func @alloc_load_store_i64() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : i64 %m = memref.alloc() : memref<4xi64, 1> %v = memref.load %m[%c0] : memref<4xi64, 1> memref.store %c1, %m[%c0] : memref<4xi64, 1> return } func.func @alloc_load_store_i64_nontemporal() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : i64 %m = memref.alloc() : memref<4xi64, 1> %v = memref.load %m[%c0] {nontemporal = true} : memref<4xi64, 1> memref.store %c1, %m[%c0] {nontemporal = true} : memref<4xi64, 1> return }"," mlir-opt --memref-emulate-wide-int=""widest-int-supported=32"" ",1 "func.func @basic() -> i32 { %0 = arith.constant 5 : i32 %1 = memref.alloca() : memref memref.store %0, %1[] : memref %2 = memref.load %1[] : memref return %2 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg))' --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ,1 "func.func @no_alloca() -> i32 { %0 = arith.constant 5 : i32 return %0 : i32 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg))' --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ,1 "func.func @cycle(%arg0: i64, %arg1: i1, %arg2: i64) { %alloca = memref.alloca() : memref memref.store %arg2, %alloca[] : memref cf.cond_br %arg1, ^bb1, ^bb2 ^bb1: %use = memref.load %alloca[] : memref call @use(%use) : (i64) -> () memref.store %arg0, %alloca[] : memref cf.br ^bb2 ^bb2: cf.br ^bb1 } func.func @use(%arg: i64) { return }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg))' --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ,1 "func.func @recursive(%arg: i64) -> i64 { %alloca0 = memref.alloca() : memref>> %alloca1 = memref.alloca() : memref> %alloca2 = memref.alloca() : memref memref.store %arg, %alloca2[] : memref memref.store %alloca2, %alloca1[] : memref> memref.store %alloca1, %alloca0[] : memref>> %load0 = memref.load %alloca0[] : memref>> %load1 = memref.load %load0[] : memref> %load2 = memref.load %load1[] : memref return %load2 : i64 }", mlir-opt --pass-pipeline='builtin.module(func.func(mem2reg))' --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ,1 "func.func @extract_strided_metadata_constants(%base: memref<5x4xf32, strided<[4, 1], offset: 2>>) -> (memref, index, index, index, index, index) { %base_buffer, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %base : memref<5x4xf32, strided<[4,1], offset:2>> -> memref, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @simplify_subview_all_dynamic( %base: memref>, %offset0: index, %offset1: index, %offset2: index, %size0: index, %size1: index, %size2: index, %stride0: index, %stride1: index, %stride2: index) -> memref> { %subview = memref.subview %base[%offset0, %offset1, %offset2] [%size0, %size1, %size2] [%stride0, %stride1, %stride2] : memref> to memref> return %subview : memref> }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_subview(%base: memref<5x4xf32>) -> (memref, index, index, index, index, index) { %subview = memref.subview %base[0, 2][2, 2][1, 1] : memref<5x4xf32> to memref<2x2xf32, strided<[4, 1], offset: 2>> %base_buffer, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %subview : memref<2x2xf32, strided<[4,1], offset:2>> -> memref, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_subview_with_dynamic_size( %base: memref<8x16x4xf32>, %size: index) -> (memref, index, index, index, index, index, index, index) { %subview = memref.subview %base[3, 4, 2][%size, 6, 3][1, 1, 1] : memref<8x16x4xf32> to memref> %base_buffer, %offset, %sizes:3, %strides:3 = memref.extract_strided_metadata %subview : memref> -> memref, index, index, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %sizes#2, %strides#0, %strides#1, %strides#2 : memref, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_rank_reduced_subview(%base: memref<8x16x4xf32>) -> (memref, index, index, index, index, index) { %subview = memref.subview %base[3, 4, 2][1, 6, 3][1, 1, 1] : memref<8x16x4xf32> to memref<6x3xf32, strided<[4, 1], offset: 210>> %base_buffer, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %subview : memref<6x3xf32, strided<[4,1], offset: 210>> -> memref, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_rank_reduced_subview_w_variable_strides( %base: memref<8x16x4xf32>, %stride: index) -> (memref, index, index, index, index, index) { %subview = memref.subview %base[3, 4, 2][1, 6, 3][1, %stride, 1] : memref<8x16x4xf32> to memref<6x3xf32, strided<[?, 1], offset: 210>> %base_buffer, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %subview : memref<6x3xf32, strided<[?, 1], offset: 210>> -> memref, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_subview_w_variable_offset( %arg0: memref<384x128xf32>, %arg1 : index, %arg2 : index) -> (memref, index, index, index, index, index) { %subview = memref.subview %arg0[%arg1, %arg2] [64, 64] [1, 1] : memref<384x128xf32> to memref<64x64xf32, strided<[128, 1], offset: ?>> %base_buffer, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %subview : memref<64x64xf32, strided<[128, 1], offset: ?>> -> memref, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_subview_all_dynamic( %base: memref>, %offset0: index, %offset1: index, %offset2: index, %size0: index, %size1: index, %size2: index, %stride0: index, %stride1: index, %stride2: index) -> (memref, index, index, index, index, index, index, index) { %subview = memref.subview %base[%offset0, %offset1, %offset2] [%size0, %size1, %size2] [%stride0, %stride1, %stride2] : memref> to memref> %base_buffer, %offset, %sizes:3, %strides:3 = memref.extract_strided_metadata %subview : memref> -> memref, index, index, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %sizes#2, %strides#0, %strides#1, %strides#2 : memref, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @simplify_expand_shape( %base: memref>, %offset0: index, %offset1: index, %offset2: index, %size0: index, %size1: index, %size2: index, %stride0: index, %stride1: index, %stride2: index) -> memref> { %subview = memref.expand_shape %base[[0, 1, 2, 3],[4, 5, 6, 7]] : memref> into memref> return %subview : memref> }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_expand_shape_all_static( %arg : memref<30x4xi16>) -> (memref, index, index, index, index, index, index, index, index, index, index, index) { %expand_shape = memref.expand_shape %arg[[0, 1, 2], [3, 4]] : memref<30x4xi16> into memref<3x5x2x2x2xi16> %base, %offset, %sizes:5, %strides:5 = memref.extract_strided_metadata %expand_shape : memref<3x5x2x2x2xi16> -> memref, index, index, index, index, index, index, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %sizes#2, %sizes#3, %sizes#4, %strides#0, %strides#1, %strides#2, %strides#3, %strides#4 : memref, index, index, index, index, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_expand_shape_all_dynamic( %base: memref>, %offset0: index, %offset1: index, %offset2: index, %size0: index, %size1: index, %size2: index, %stride0: index, %stride1: index, %stride2: index) -> (memref, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index) { %subview = memref.expand_shape %base[[0, 1, 2, 3],[4, 5, 6, 7]] : memref> into memref> %base_buffer, %offset, %sizes:8, %strides:8 = memref.extract_strided_metadata %subview : memref> -> memref, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index return %base_buffer, %offset, %sizes#0, %sizes#1, %sizes#2, %sizes#3, %sizes#4, %sizes#5, %sizes#6, %sizes#7, %strides#0, %strides#1, %strides#2, %strides#3, %strides#4, %strides#5, %strides#6, %strides#7 : memref, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_expand_shape_all_static_0_rank( %arg : memref>) -> (memref, index, index, index, index, index, index, index, index, index, index, index) { %expand_shape = memref.expand_shape %arg[] : memref> into memref<1x1x1x1x1xi16, strided<[1,1,1,1,1], offset: ?>> %base, %offset, %sizes:5, %strides:5 = memref.extract_strided_metadata %expand_shape : memref<1x1x1x1x1xi16, strided<[1,1,1,1,1], offset: ?>> -> memref, index, index, index, index, index, index, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %sizes#2, %sizes#3, %sizes#4, %strides#0, %strides#1, %strides#2, %strides#3, %strides#4 : memref, index, index, index, index, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_alloc_all_static_0_rank() -> (memref, index) { %A = memref.alloc() : memref %base, %offset = memref.extract_strided_metadata %A : memref -> memref, index return %base, %offset : memref, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_alloc_dyn_size( %dyn_size0 : index, %dyn_size2 : index, %dyn_size3 : index) -> (memref, index, index, index, index, index, index, index, index, index) { %A = memref.alloc(%dyn_size0, %dyn_size2, %dyn_size3) : memref %base, %offset, %sizes:4, %strides:4 = memref.extract_strided_metadata %A : memref -> memref, index, index, index, index, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %sizes#2, %sizes#3, %strides#0, %strides#1, %strides#2, %strides#3 : memref, index, index, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_alloca_dyn_size( %dyn_size0 : index, %dyn_size1 : index, %dyn_size3 : index) -> (memref, index, index, index, index, index, index, index, index, index) { %A = memref.alloca(%dyn_size0, %dyn_size1, %dyn_size3) : memref %base, %offset, %sizes:4, %strides:4 = memref.extract_strided_metadata %A : memref -> memref, index, index, index, index, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %sizes#2, %sizes#3, %strides#0, %strides#1, %strides#2, %strides#3 : memref, index, index, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "#map0 = affine_map<(d0)[s0] -> (d0 + s0)> func.func @extract_strided_metadata_of_alloc_with_variable_offset(%arg : index) -> (memref, index, index, index) { %A = memref.alloc()[%arg] : memref<4xi16, #map0> %base, %offset, %size, %stride = memref.extract_strided_metadata %A : memref<4xi16, #map0> -> memref, index, index, index return %base, %offset, %size, %stride : memref, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "#map0 = affine_map<(d0) -> (d0 + 12)> func.func @extract_strided_metadata_of_alloc_with_cst_offset(%arg : index) -> (memref, index, index, index) { %A = memref.alloc() : memref<4xi16, #map0> %base, %offset, %size, %stride = memref.extract_strided_metadata %A : memref<4xi16, #map0> -> memref, index, index, index return %base, %offset, %size, %stride : memref, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_alloc_with_cst_offset_in_type(%arg : index) -> (memref, index, index, index) { %A = memref.alloc() : memref<4xi16, strided<[1], offset : 10>> %base, %offset, %size, %stride = memref.extract_strided_metadata %A : memref<4xi16, strided<[1], offset : 10>> -> memref, index, index, index return %base, %offset, %size, %stride : memref, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_alloc_with_strided(%arg : index) -> (memref, index, index, index) { %A = memref.alloc() : memref<4xi16, strided<[12]>> %base, %offset, %size, %stride = memref.extract_strided_metadata %A : memref<4xi16, strided<[12]>> -> memref, index, index, index return %base, %offset, %size, %stride : memref, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_aligned_pointer_as_index(%arg0: memref) -> index { %c = memref.subview %arg0[] [] [] : memref to memref %r = memref.extract_aligned_pointer_as_index %arg0: memref -> index return %r : index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @simplify_collapse(%arg : memref) -> memref { %collapsed_view = memref.collapse_shape %arg [[0], [1, 2, 3], [4, 5]] : memref into memref return %collapsed_view : memref }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @simplify_collapse_with_dim_of_size1(%arg0: memref<3x1xf32, strided<[2,1]>>, %arg1: memref<3xf32>) { %collapse_shape = memref.collapse_shape %arg0 [[0, 1]] : memref<3x1xf32, strided<[2, 1]>> into memref<3xf32, strided<[2]>> memref.copy %collapse_shape, %arg1 : memref<3xf32, strided<[2]>> to memref<3xf32> return }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @simplify_collapse_with_dim_of_size1_and_non_1_stride (%arg0: memref<1x1xi32, strided<[2, 1], offset: ?>>) -> memref<1xi32, strided<[2], offset: ?>> { %collapse_shape = memref.collapse_shape %arg0 [[0, 1]] : memref<1x1xi32, strided<[2, 1], offset: ?>> into memref<1xi32, strided<[2], offset: ?>> return %collapse_shape : memref<1xi32, strided<[2], offset: ?>> }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @simplify_collapse_with_dim_of_size1_and_resulting_dyn_stride (%arg0: memref<2x3x1x1x1xi32, strided<[?, ?, ?, ?, 2], offset: ?>>) -> memref<6x1xi32, strided<[?, ?], offset: ?>> { %collapse_shape = memref.collapse_shape %arg0 [[0, 1], [2, 3, 4]] : memref<2x3x1x1x1xi32, strided<[?, ?, ?, ?, 2], offset: ?>> into memref<6x1xi32, strided<[?, ?], offset: ?>> return %collapse_shape : memref<6x1xi32, strided<[?, ?], offset: ?>> }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_collapse(%arg : memref) -> (memref, index, index, index, index, index, index, index) { %collapsed_view = memref.collapse_shape %arg [[0], [1, 2, 3], [4, 5]] : memref into memref %base, %offset, %sizes:3, %strides:3 = memref.extract_strided_metadata %collapsed_view : memref -> memref, index, index, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %sizes#2, %strides#0, %strides#1, %strides#2 : memref, index, index, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_collapse_to_rank0(%arg : memref<1x1x1x1x1x1xi32>) -> (memref, index) { %collapsed_view = memref.collapse_shape %arg [] : memref<1x1x1x1x1x1xi32> into memref %base, %offset = memref.extract_strided_metadata %collapsed_view : memref -> memref, index return %base, %offset : memref, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_extract_strided_metadata(%arg : memref) -> (memref, index) { %base, %offset = memref.extract_strided_metadata %arg:memref -> memref, index %base2, %offset2 = memref.extract_strided_metadata %base:memref -> memref, index return %base2, %offset2 : memref, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_reinterpret_cast( %arg : memref>, %offset: index, %size0 : index, %size1 : index, %stride0 : index, %stride1 : index) -> (memref, index, index, index, index, index) { %cast = memref.reinterpret_cast %arg to offset: [%offset], sizes: [%size0, %size1], strides: [%stride0, %stride1] : memref> to memref> %base, %base_offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %cast:memref> -> memref, index, index, index, index, index return %base, %base_offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_reinterpret_cast_unranked( %arg : memref<*xi32>, %offset: index, %size0 : index, %size1 : index, %stride0 : index, %stride1 : index) -> (memref, index, index, index, index, index) { %cast = memref.reinterpret_cast %arg to offset: [%offset], sizes: [%size0, %size1], strides: [%stride0, %stride1] : memref<*xi32> to memref> %base, %base_offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %cast:memref> -> memref, index, index, index, index, index return %base, %base_offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @extract_strided_metadata_of_reinterpret_cast_rank0( %arg : memref>, %offset: index, %size0 : index, %size1 : index, %stride0 : index, %stride1 : index) -> (memref, index, index, index, index, index) { %cast = memref.reinterpret_cast %arg to offset: [%offset], sizes: [%size0, %size1], strides: [%stride0, %stride1] : memref> to memref> %base, %base_offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %cast:memref> -> memref, index, index, index, index, index return %base, %base_offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "memref.global ""private"" constant @const_i32 : memref<512x384xi32> = dense<42> func.func @extract_strided_metadata_of_get_global() -> (memref, index, index, index, index, index) { %A = memref.get_global @const_i32 : memref<512x384xi32> %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %A : memref<512x384xi32> -> memref, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "memref.global ""private"" constant @const_i32 : memref<512x384xi32, strided<[420, 1], offset: 0>> = dense<42> func.func @extract_strided_metadata_of_get_global_with_strides() -> (memref, index, index, index, index, index) { %A = memref.get_global @const_i32 : memref<512x384xi32, strided<[420, 1], offset: 0>> %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %A : memref<512x384xi32, strided<[420, 1], offset: 0>> -> memref, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "memref.global ""private"" constant @const_i32 : memref<512x384xi32, strided<[384, 1], offset: 20>> = dense<42> func.func @extract_strided_metadata_of_get_global_with_offset() -> (memref, index, index, index, index, index) { %A = memref.get_global @const_i32 : memref<512x384xi32, strided<[384, 1], offset: 20>> %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %A : memref<512x384xi32, strided<[384, 1], offset: 20>> -> memref, index, index, index, index, index return %base, %offset, %sizes#0, %sizes#1, %strides#0, %strides#1 : memref, index, index, index, index, index }", mlir-opt --expand-strided-metadata -split-input-file -o - ,1 "func.func @basic(%arg0: i32, %arg1: i32) -> i32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %alloca = memref.alloca() : memref<2xi32> memref.store %arg0, %alloca[%c0] : memref<2xi32> memref.store %arg1, %alloca[%c1] : memref<2xi32> %res = memref.load %alloca[%c0] : memref<2xi32> return %res : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @basic_high_dimensions(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %alloca = memref.alloca() : memref<2x2xi32> memref.store %arg0, %alloca[%c0, %c0] : memref<2x2xi32> memref.store %arg1, %alloca[%c0, %c1] : memref<2x2xi32> memref.store %arg2, %alloca[%c1, %c0] : memref<2x2xi32> %res = memref.load %alloca[%c0, %c1] : memref<2x2xi32> return %res : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @resolve_alias(%arg0: i32, %arg1: i32) -> i32 { %c0 = arith.constant 0 : index %alloca = memref.alloca() : memref<2xi32> memref.store %arg0, %alloca[%c0] : memref<2xi32> memref.store %arg1, %alloca[%c0] : memref<2xi32> %res = memref.load %alloca[%c0] : memref<2xi32> return %res : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @no_direct_use(%arg0: i32, %arg1: i32) -> i32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %alloca = memref.alloca() : memref<2xi32> memref.store %arg0, %alloca[%c0] : memref<2xi32> memref.store %arg1, %alloca[%c1] : memref<2xi32> %res = memref.load %alloca[%c0] : memref<2xi32> call @use(%alloca) : (memref<2xi32>) -> () return %res : i32 } func.func @use(%foo: memref<2xi32>) { return }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @no_dynamic_indexing(%arg0: i32, %arg1: i32, %index: index) -> i32 { %c0 = arith.constant 0 : index %alloca = memref.alloca() : memref<2xi32> memref.store %arg0, %alloca[%c0] : memref<2xi32> memref.store %arg1, %alloca[%index] : memref<2xi32> %res = memref.load %alloca[%c0] : memref<2xi32> return %res : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @no_dynamic_shape(%arg0: i32, %arg1: i32) -> i32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %alloca = memref.alloca(%c1) : memref memref.store %arg0, %alloca[%c0, %c0] : memref %res = memref.load %alloca[%c0, %c0] : memref return %res : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @no_out_of_bounds(%arg0: i32, %arg1: i32) -> i32 { %c0 = arith.constant 0 : index %c100 = arith.constant 100 : index %alloca = memref.alloca() : memref<2xi32> memref.store %arg0, %alloca[%c0] : memref<2xi32> memref.store %arg1, %alloca[%c100] : memref<2xi32> %res = memref.load %alloca[%c0] : memref<2xi32> return %res : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(sroa))"" --split-input-file ",1 "func.func @testenterdataop(%a: memref) -> () { %ifCond = arith.constant true %0 = acc.create varPtr(%a : memref) -> memref acc.enter_data if(%ifCond) dataOperands(%0 : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testenterdataop(%a: memref) -> () { %ifCond = arith.constant false %0 = acc.create varPtr(%a : memref) -> memref acc.enter_data if(%ifCond) dataOperands(%0 : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testexitdataop(%a: memref) -> () { %ifCond = arith.constant true %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.exit_data if(%ifCond) dataOperands(%0 : memref) acc.delete accPtr(%0 : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testexitdataop(%a: memref) -> () { %ifCond = arith.constant false %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.exit_data if(%ifCond) dataOperands(%0 : memref) acc.delete accPtr(%0 : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testupdateop(%a: memref) -> () { %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.update_host accPtr(%0 : memref) to varPtr(%a : memref) %ifCond = arith.constant true acc.update if(%ifCond) dataOperands(%0: memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testupdateop(%a: memref) -> () { %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.update_host accPtr(%0 : memref) to varPtr(%a : memref) %ifCond = arith.constant false acc.update if(%ifCond) dataOperands(%0: memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testenterdataop(%a: memref, %ifCond: i1) -> () { %0 = acc.create varPtr(%a : memref) -> memref acc.enter_data if(%ifCond) dataOperands(%0 : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testexitdataop(%a: memref, %ifCond: i1) -> () { %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.exit_data if(%ifCond) dataOperands(%0 : memref) acc.delete accPtr(%0 : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testupdateop(%a: memref, %ifCond: i1) -> () { %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.update_host accPtr(%0 : memref) to varPtr(%a : memref) acc.update if(%ifCond) dataOperands(%0: memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testhostdataop(%a: memref, %ifCond: i1) -> () { %0 = acc.use_device varPtr(%a : memref) -> memref %false = arith.constant false acc.host_data dataOperands(%0 : memref) if(%false) { acc.loop { acc.yield } acc.loop { acc.yield } acc.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @testhostdataop(%a: memref, %ifCond: i1) -> () { %0 = acc.use_device varPtr(%a : memref) -> memref %true = arith.constant true acc.host_data dataOperands(%0 : memref) if(%true) { } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index %async = arith.constant 1 : i64 acc.parallel async(%async: i64) { acc.loop gang vector { scf.for %arg3 = %c0 to %c10 step %c1 { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> %p = arith.mulf %a, %b : f32 %co = arith.addf %cij, %p : f32 memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32> } } } acc.yield } attributes { collapse = 3 } acc.yield } return %C : memref<10x10xf32> }", mlir-opt -split-input-file ,1 "func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index %async = arith.constant 1 : i64 acc.parallel async(%async: i64) { acc.loop gang vector { scf.for %arg3 = %c0 to %c10 step %c1 { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> %p = arith.mulf %a, %b : f32 %co = arith.addf %cij, %p : f32 memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32> } } } acc.yield } attributes { collapse = 3 } acc.yield } return %C : memref<10x10xf32> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index %async = arith.constant 1 : i64 acc.parallel async(%async: i64) { acc.loop gang vector { scf.for %arg3 = %c0 to %c10 step %c1 { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> %p = arith.mulf %a, %b : f32 %co = arith.addf %cij, %p : f32 memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32> } } } acc.yield } attributes { collapse = 3 } acc.yield } return %C : memref<10x10xf32> }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index acc.parallel { acc.loop { scf.for %arg3 = %c0 to %c10 step %c1 { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> %p = arith.mulf %a, %b : f32 %co = arith.addf %cij, %p : f32 memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32> } } } acc.yield } attributes {seq} acc.yield } return %C : memref<10x10xf32> }", mlir-opt -split-input-file ,1 "func.func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index acc.parallel { acc.loop { scf.for %arg3 = %c0 to %c10 step %c1 { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> %p = arith.mulf %a, %b : f32 %co = arith.addf %cij, %p : f32 memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32> } } } acc.yield } attributes {seq} acc.yield } return %C : memref<10x10xf32> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @compute2(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index acc.parallel { acc.loop { scf.for %arg3 = %c0 to %c10 step %c1 { scf.for %arg4 = %c0 to %c10 step %c1 { scf.for %arg5 = %c0 to %c10 step %c1 { %a = memref.load %A[%arg3, %arg5] : memref<10x10xf32> %b = memref.load %B[%arg5, %arg4] : memref<10x10xf32> %cij = memref.load %C[%arg3, %arg4] : memref<10x10xf32> %p = arith.mulf %a, %b : f32 %co = arith.addf %cij, %p : f32 memref.store %co, %C[%arg3, %arg4] : memref<10x10xf32> } } } acc.yield } attributes {seq} acc.yield } return %C : memref<10x10xf32> }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>, %d: memref<10xf32>) -> memref<10xf32> { %lb = arith.constant 0 : index %st = arith.constant 1 : index %c10 = arith.constant 10 : index %numGangs = arith.constant 10 : i64 %numWorkers = arith.constant 10 : i64 %pa = acc.present varPtr(%a : memref<10x10xf32>) -> memref<10x10xf32> %pb = acc.present varPtr(%b : memref<10x10xf32>) -> memref<10x10xf32> %pc = acc.present varPtr(%c : memref<10xf32>) -> memref<10xf32> %pd = acc.present varPtr(%d : memref<10xf32>) -> memref<10xf32> acc.data dataOperands(%pa, %pb, %pc, %pd: memref<10x10xf32>, memref<10x10xf32>, memref<10xf32>, memref<10xf32>) { acc.parallel num_gangs(%numGangs: i64) num_workers(%numWorkers: i64) private(@privatization_memref_10_f32 -> %c : memref<10xf32>) { acc.loop gang { scf.for %x = %lb to %c10 step %st { acc.loop worker { scf.for %y = %lb to %c10 step %st { %axy = memref.load %a[%x, %y] : memref<10x10xf32> %bxy = memref.load %b[%x, %y] : memref<10x10xf32> %tmp = arith.addf %axy, %bxy : f32 memref.store %tmp, %c[%y] : memref<10xf32> } acc.yield } acc.loop { scf.for %i = %lb to %c10 step %st { %ci = memref.load %c[%i] : memref<10xf32> %dx = memref.load %d[%x] : memref<10xf32> %z = arith.addf %ci, %dx : f32 memref.store %z, %d[%x] : memref<10xf32> } acc.yield } attributes {seq} } acc.yield } acc.yield } acc.terminator } return %d : memref<10xf32> }", mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>, %d: memref<10xf32>) -> memref<10xf32> { %lb = arith.constant 0 : index %st = arith.constant 1 : index %c10 = arith.constant 10 : index %numGangs = arith.constant 10 : i64 %numWorkers = arith.constant 10 : i64 %pa = acc.present varPtr(%a : memref<10x10xf32>) -> memref<10x10xf32> %pb = acc.present varPtr(%b : memref<10x10xf32>) -> memref<10x10xf32> %pc = acc.present varPtr(%c : memref<10xf32>) -> memref<10xf32> %pd = acc.present varPtr(%d : memref<10xf32>) -> memref<10xf32> acc.data dataOperands(%pa, %pb, %pc, %pd: memref<10x10xf32>, memref<10x10xf32>, memref<10xf32>, memref<10xf32>) { acc.parallel num_gangs(%numGangs: i64) num_workers(%numWorkers: i64) private(@privatization_memref_10_f32 -> %c : memref<10xf32>) { acc.loop gang { scf.for %x = %lb to %c10 step %st { acc.loop worker { scf.for %y = %lb to %c10 step %st { %axy = memref.load %a[%x, %y] : memref<10x10xf32> %bxy = memref.load %b[%x, %y] : memref<10x10xf32> %tmp = arith.addf %axy, %bxy : f32 memref.store %tmp, %c[%y] : memref<10xf32> } acc.yield } acc.loop { scf.for %i = %lb to %c10 step %st { %ci = memref.load %c[%i] : memref<10xf32> %dx = memref.load %d[%x] : memref<10xf32> %z = arith.addf %ci, %dx : f32 memref.store %z, %d[%x] : memref<10xf32> } acc.yield } attributes {seq} } acc.yield } acc.yield } acc.terminator } return %d : memref<10xf32> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } func.func @compute3(%a: memref<10x10xf32>, %b: memref<10x10xf32>, %c: memref<10xf32>, %d: memref<10xf32>) -> memref<10xf32> { %lb = arith.constant 0 : index %st = arith.constant 1 : index %c10 = arith.constant 10 : index %numGangs = arith.constant 10 : i64 %numWorkers = arith.constant 10 : i64 %pa = acc.present varPtr(%a : memref<10x10xf32>) -> memref<10x10xf32> %pb = acc.present varPtr(%b : memref<10x10xf32>) -> memref<10x10xf32> %pc = acc.present varPtr(%c : memref<10xf32>) -> memref<10xf32> %pd = acc.present varPtr(%d : memref<10xf32>) -> memref<10xf32> acc.data dataOperands(%pa, %pb, %pc, %pd: memref<10x10xf32>, memref<10x10xf32>, memref<10xf32>, memref<10xf32>) { acc.parallel num_gangs(%numGangs: i64) num_workers(%numWorkers: i64) private(@privatization_memref_10_f32 -> %c : memref<10xf32>) { acc.loop gang { scf.for %x = %lb to %c10 step %st { acc.loop worker { scf.for %y = %lb to %c10 step %st { %axy = memref.load %a[%x, %y] : memref<10x10xf32> %bxy = memref.load %b[%x, %y] : memref<10x10xf32> %tmp = arith.addf %axy, %bxy : f32 memref.store %tmp, %c[%y] : memref<10xf32> } acc.yield } acc.loop { scf.for %i = %lb to %c10 step %st { %ci = memref.load %c[%i] : memref<10xf32> %dx = memref.load %d[%x] : memref<10xf32> %z = arith.addf %ci, %dx : f32 memref.store %z, %d[%x] : memref<10xf32> } acc.yield } attributes {seq} } acc.yield } acc.yield } acc.terminator } return %d : memref<10xf32> }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testloopop() -> () { %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 128 : i32 %idxValue = arith.constant 8 : index acc.loop gang worker vector { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(static=%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%i32Value: i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%i32Value: i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64) worker vector { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64, static=%i64Value: i64) worker(%i64Value: i64) vector(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i32Value: i32, static=%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop tile(%i64Value, %i64Value : i64, i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop tile(%i32Value, %i32Value : i32, i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } return }", mlir-opt -split-input-file ,1 "func.func @testloopop() -> () { %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 128 : i32 %idxValue = arith.constant 8 : index acc.loop gang worker vector { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(static=%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%i32Value: i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%i32Value: i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64) worker vector { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64, static=%i64Value: i64) worker(%i64Value: i64) vector(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i32Value: i32, static=%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop tile(%i64Value, %i64Value : i64, i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop tile(%i32Value, %i32Value : i32, i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testloopop() -> () { %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 128 : i32 %idxValue = arith.constant 8 : index acc.loop gang worker vector { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(static=%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%i32Value: i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop worker(%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%i32Value: i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop vector(%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64) worker vector { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i64Value: i64, static=%i64Value: i64) worker(%i64Value: i64) vector(%i64Value: i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop gang(num=%i32Value: i32, static=%idxValue: index) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop tile(%i64Value, %i64Value : i64, i64) { ""test.openacc_dummy_op""() : () -> () acc.yield } acc.loop tile(%i32Value, %i32Value : i32, i32) { ""test.openacc_dummy_op""() : () -> () acc.yield } return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @acc_loop_multiple_block() { acc.parallel { acc.loop { %c1 = arith.constant 1 : index cf.br ^bb1(%c1 : index) ^bb1(%9: index): %c0 = arith.constant 0 : index %12 = arith.cmpi sgt, %9, %c0 : index cf.cond_br %12, ^bb2, ^bb3 ^bb2: %c1_0 = arith.constant 1 : index %c10 = arith.constant 10 : index %22 = arith.subi %c10, %c1_0 : index cf.br ^bb1(%22 : index) ^bb3: acc.yield } acc.yield } return }", mlir-opt -split-input-file ,1 "func.func @acc_loop_multiple_block() { acc.parallel { acc.loop { %c1 = arith.constant 1 : index cf.br ^bb1(%c1 : index) ^bb1(%9: index): %c0 = arith.constant 0 : index %12 = arith.cmpi sgt, %9, %c0 : index cf.cond_br %12, ^bb2, ^bb3 ^bb2: %c1_0 = arith.constant 1 : index %c10 = arith.constant 10 : index %22 = arith.subi %c10, %c1_0 : index cf.br ^bb1(%22 : index) ^bb3: acc.yield } acc.yield } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @acc_loop_multiple_block() { acc.parallel { acc.loop { %c1 = arith.constant 1 : index cf.br ^bb1(%c1 : index) ^bb1(%9: index): %c0 = arith.constant 0 : index %12 = arith.cmpi sgt, %9, %c0 : index cf.cond_br %12, ^bb2, ^bb3 ^bb2: %c1_0 = arith.constant 1 : index %c10 = arith.constant 10 : index %22 = arith.subi %c10, %c1_0 : index cf.br ^bb1(%22 : index) ^bb3: acc.yield } acc.yield } return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { ^bb0(%arg0: memref<10x10xf32>): %0 = memref.alloc() : memref<10x10xf32> acc.yield %0 : memref<10x10xf32> } destroy { ^bb0(%arg0: memref<10x10xf32>): memref.dealloc %arg0 : memref<10x10xf32> acc.terminator } func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.parallel async(%i64value: i64) { } acc.parallel async(%i32value: i32) { } acc.parallel async(%idxValue: index) { } acc.parallel wait(%i64value: i64) { } acc.parallel wait(%i32value: i32) { } acc.parallel wait(%idxValue: index) { } acc.parallel wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.parallel num_gangs(%i64value: i64) { } acc.parallel num_gangs(%i32value: i32) { } acc.parallel num_gangs(%idxValue: index) { } acc.parallel num_workers(%i64value: i64) { } acc.parallel num_workers(%i32value: i32) { } acc.parallel num_workers(%idxValue: index) { } acc.parallel vector_length(%i64value: i64) { } acc.parallel vector_length(%i32value: i32) { } acc.parallel vector_length(%idxValue: index) { } acc.parallel private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.parallel { } attributes {defaultAttr = #acc} acc.parallel { } attributes {defaultAttr = #acc} acc.parallel { } attributes {asyncAttr} acc.parallel { } attributes {waitAttr} acc.parallel { } attributes {selfAttr} return }", mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { ^bb0(%arg0: memref<10x10xf32>): %0 = memref.alloc() : memref<10x10xf32> acc.yield %0 : memref<10x10xf32> } destroy { ^bb0(%arg0: memref<10x10xf32>): memref.dealloc %arg0 : memref<10x10xf32> acc.terminator } func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.parallel async(%i64value: i64) { } acc.parallel async(%i32value: i32) { } acc.parallel async(%idxValue: index) { } acc.parallel wait(%i64value: i64) { } acc.parallel wait(%i32value: i32) { } acc.parallel wait(%idxValue: index) { } acc.parallel wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.parallel num_gangs(%i64value: i64) { } acc.parallel num_gangs(%i32value: i32) { } acc.parallel num_gangs(%idxValue: index) { } acc.parallel num_workers(%i64value: i64) { } acc.parallel num_workers(%i32value: i32) { } acc.parallel num_workers(%idxValue: index) { } acc.parallel vector_length(%i64value: i64) { } acc.parallel vector_length(%i32value: i32) { } acc.parallel vector_length(%idxValue: index) { } acc.parallel private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.parallel { } attributes {defaultAttr = #acc} acc.parallel { } attributes {defaultAttr = #acc} acc.parallel { } attributes {asyncAttr} acc.parallel { } attributes {waitAttr} acc.parallel { } attributes {selfAttr} return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { ^bb0(%arg0: memref<10x10xf32>): %0 = memref.alloc() : memref<10x10xf32> acc.yield %0 : memref<10x10xf32> } destroy { ^bb0(%arg0: memref<10x10xf32>): memref.dealloc %arg0 : memref<10x10xf32> acc.terminator } func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.parallel async(%i64value: i64) { } acc.parallel async(%i32value: i32) { } acc.parallel async(%idxValue: index) { } acc.parallel wait(%i64value: i64) { } acc.parallel wait(%i32value: i32) { } acc.parallel wait(%idxValue: index) { } acc.parallel wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.parallel num_gangs(%i64value: i64) { } acc.parallel num_gangs(%i32value: i32) { } acc.parallel num_gangs(%idxValue: index) { } acc.parallel num_workers(%i64value: i64) { } acc.parallel num_workers(%i32value: i32) { } acc.parallel num_workers(%idxValue: index) { } acc.parallel vector_length(%i64value: i64) { } acc.parallel vector_length(%i32value: i32) { } acc.parallel vector_length(%idxValue: index) { } acc.parallel private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.parallel { } attributes {defaultAttr = #acc} acc.parallel { } attributes {defaultAttr = #acc} acc.parallel { } attributes {asyncAttr} acc.parallel { } attributes {waitAttr} acc.parallel { } attributes {selfAttr} return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { ^bb0(%arg0: memref<10x10xf32>): %0 = memref.alloc() : memref<10x10xf32> acc.yield %0 : memref<10x10xf32> } destroy { ^bb0(%arg0: memref<10x10xf32>): memref.dealloc %arg0 : memref<10x10xf32> acc.terminator } acc.firstprivate.recipe @privatization_memref_10xf32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } copy { ^bb0(%arg0: memref<10xf32>, %arg1: memref<10xf32>): acc.terminator } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.firstprivate.recipe @privatization_memref_20xf32 : memref<20xf32> init { ^bb0(%arg0: memref<20xf32>): %0 = memref.alloc() : memref<20xf32> acc.yield %0 : memref<20xf32> } copy { ^bb0(%arg0: memref<20xf32>, %arg1: memref<20xf32>): acc.terminator } func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.serial async(%i64value: i64) { } acc.serial async(%i32value: i32) { } acc.serial async(%idxValue: index) { } acc.serial wait(%i64value: i64) { } acc.serial wait(%i32value: i32) { } acc.serial wait(%idxValue: index) { } acc.serial wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.serial private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.serial { } attributes {defaultAttr = #acc} acc.serial { } attributes {defaultAttr = #acc} acc.serial { } attributes {asyncAttr} acc.serial { } attributes {waitAttr} acc.serial { } attributes {selfAttr} acc.serial { acc.yield } attributes {selfAttr} return }", mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { ^bb0(%arg0: memref<10x10xf32>): %0 = memref.alloc() : memref<10x10xf32> acc.yield %0 : memref<10x10xf32> } destroy { ^bb0(%arg0: memref<10x10xf32>): memref.dealloc %arg0 : memref<10x10xf32> acc.terminator } acc.firstprivate.recipe @privatization_memref_10xf32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } copy { ^bb0(%arg0: memref<10xf32>, %arg1: memref<10xf32>): acc.terminator } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.firstprivate.recipe @privatization_memref_20xf32 : memref<20xf32> init { ^bb0(%arg0: memref<20xf32>): %0 = memref.alloc() : memref<20xf32> acc.yield %0 : memref<20xf32> } copy { ^bb0(%arg0: memref<20xf32>, %arg1: memref<20xf32>): acc.terminator } func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.serial async(%i64value: i64) { } acc.serial async(%i32value: i32) { } acc.serial async(%idxValue: index) { } acc.serial wait(%i64value: i64) { } acc.serial wait(%i32value: i32) { } acc.serial wait(%idxValue: index) { } acc.serial wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.serial private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.serial { } attributes {defaultAttr = #acc} acc.serial { } attributes {defaultAttr = #acc} acc.serial { } attributes {asyncAttr} acc.serial { } attributes {waitAttr} acc.serial { } attributes {selfAttr} acc.serial { acc.yield } attributes {selfAttr} return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { ^bb0(%arg0: memref<10x10xf32>): %0 = memref.alloc() : memref<10x10xf32> acc.yield %0 : memref<10x10xf32> } destroy { ^bb0(%arg0: memref<10x10xf32>): memref.dealloc %arg0 : memref<10x10xf32> acc.terminator } acc.firstprivate.recipe @privatization_memref_10xf32 : memref<10xf32> init { ^bb0(%arg0: memref<10xf32>): %0 = memref.alloc() : memref<10xf32> acc.yield %0 : memref<10xf32> } copy { ^bb0(%arg0: memref<10xf32>, %arg1: memref<10xf32>): acc.terminator } destroy { ^bb0(%arg0: memref<10xf32>): memref.dealloc %arg0 : memref<10xf32> acc.terminator } acc.firstprivate.recipe @privatization_memref_20xf32 : memref<20xf32> init { ^bb0(%arg0: memref<20xf32>): %0 = memref.alloc() : memref<20xf32> acc.yield %0 : memref<20xf32> } copy { ^bb0(%arg0: memref<20xf32>, %arg1: memref<20xf32>): acc.terminator } func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.serial async(%i64value: i64) { } acc.serial async(%i32value: i32) { } acc.serial async(%idxValue: index) { } acc.serial wait(%i64value: i64) { } acc.serial wait(%i32value: i32) { } acc.serial wait(%idxValue: index) { } acc.serial wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.serial private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.serial { } attributes {defaultAttr = #acc} acc.serial { } attributes {defaultAttr = #acc} acc.serial { } attributes {asyncAttr} acc.serial { } attributes {waitAttr} acc.serial { } attributes {selfAttr} acc.serial { acc.yield } attributes {selfAttr} return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.kernels async(%i64value: i64) { } acc.kernels async(%i32value: i32) { } acc.kernels async(%idxValue: index) { } acc.kernels wait(%i64value: i64) { } acc.kernels wait(%i32value: i32) { } acc.kernels wait(%idxValue: index) { } acc.kernels wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.kernels { } attributes {defaultAttr = #acc} acc.kernels { } attributes {defaultAttr = #acc} acc.kernels { } attributes {asyncAttr} acc.kernels { } attributes {waitAttr} acc.kernels { } attributes {selfAttr} acc.kernels { acc.terminator } attributes {selfAttr} return }", mlir-opt -split-input-file ,1 "func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.kernels async(%i64value: i64) { } acc.kernels async(%i32value: i32) { } acc.kernels async(%idxValue: index) { } acc.kernels wait(%i64value: i64) { } acc.kernels wait(%i32value: i32) { } acc.kernels wait(%idxValue: index) { } acc.kernels wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.kernels { } attributes {defaultAttr = #acc} acc.kernels { } attributes {defaultAttr = #acc} acc.kernels { } attributes {asyncAttr} acc.kernels { } attributes {waitAttr} acc.kernels { } attributes {selfAttr} acc.kernels { acc.terminator } attributes {selfAttr} return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 %i32value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index acc.kernels async(%i64value: i64) { } acc.kernels async(%i32value: i32) { } acc.kernels async(%idxValue: index) { } acc.kernels wait(%i64value: i64) { } acc.kernels wait(%i32value: i32) { } acc.kernels wait(%idxValue: index) { } acc.kernels wait(%i64value, %i32value, %idxValue : i64, i32, index) { } acc.kernels { } attributes {defaultAttr = #acc} acc.kernels { } attributes {defaultAttr = #acc} acc.kernels { } attributes {asyncAttr} acc.kernels { } attributes {waitAttr} acc.kernels { } attributes {selfAttr} acc.kernels { acc.terminator } attributes {selfAttr} return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testdataop(%a: memref, %b: memref, %c: memref) -> () { %ifCond = arith.constant true %0 = acc.present varPtr(%a : memref) -> memref acc.data if(%ifCond) dataOperands(%0 : memref) { } %1 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%1 : memref) if(%ifCond) { } %2 = acc.present varPtr(%a : memref) -> memref %3 = acc.present varPtr(%b : memref) -> memref %4 = acc.present varPtr(%c : memref) -> memref acc.data dataOperands(%2, %3, %4 : memref, memref, memref) { } %5 = acc.copyin varPtr(%a : memref) -> memref %6 = acc.copyin varPtr(%b : memref) -> memref %7 = acc.copyin varPtr(%c : memref) -> memref acc.data dataOperands(%5, %6, %7 : memref, memref, memref) { } %8 = acc.copyin varPtr(%a : memref) -> memref {dataClause = 2 : i64} %9 = acc.copyin varPtr(%b : memref) -> memref {dataClause = 2 : i64} %10 = acc.copyin varPtr(%c : memref) -> memref {dataClause = 2 : i64} acc.data dataOperands(%8, %9, %10 : memref, memref, memref) { } %11 = acc.create varPtr(%a : memref) -> memref {dataClause = 4 : i64} %12 = acc.create varPtr(%b : memref) -> memref {dataClause = 4 : i64} %13 = acc.create varPtr(%c : memref) -> memref {dataClause = 4 : i64} acc.data dataOperands(%11, %12, %13 : memref, memref, memref) { } acc.copyout accPtr(%11 : memref) to varPtr(%a : memref) acc.copyout accPtr(%12 : memref) to varPtr(%b : memref) acc.copyout accPtr(%13 : memref) to varPtr(%c : memref) %14 = acc.create varPtr(%a : memref) -> memref {dataClause = 5 : i64} %15 = acc.create varPtr(%b : memref) -> memref {dataClause = 5 : i64} %16 = acc.create varPtr(%c : memref) -> memref {dataClause = 5 : i64} acc.data dataOperands(%14, %15, %16 : memref, memref, memref) { } acc.copyout accPtr(%14 : memref) to varPtr(%a : memref) {dataClause = 5 : i64} acc.copyout accPtr(%15 : memref) to varPtr(%b : memref) {dataClause = 5 : i64} acc.copyout accPtr(%16 : memref) to varPtr(%c : memref) {dataClause = 5 : i64} %17 = acc.create varPtr(%a : memref) -> memref %18 = acc.create varPtr(%b : memref) -> memref %19 = acc.create varPtr(%c : memref) -> memref acc.data dataOperands(%17, %18, %19 : memref, memref, memref) { } acc.delete accPtr(%17 : memref) {dataClause = 7 : i64} acc.delete accPtr(%18 : memref) {dataClause = 7 : i64} acc.delete accPtr(%19 : memref) {dataClause = 7 : i64} %20 = acc.create varPtr(%a : memref) -> memref {dataClause = 8 : i64} %21 = acc.create varPtr(%b : memref) -> memref {dataClause = 8 : i64} %22 = acc.create varPtr(%c : memref) -> memref {dataClause = 8 : i64} acc.data dataOperands(%20, %21, %22 : memref, memref, memref) { } acc.delete accPtr(%20 : memref) {dataClause = 8 : i64} acc.delete accPtr(%21 : memref) {dataClause = 8 : i64} acc.delete accPtr(%22 : memref) {dataClause = 8 : i64} %23 = acc.nocreate varPtr(%a : memref) -> memref %24 = acc.nocreate varPtr(%b : memref) -> memref %25 = acc.nocreate varPtr(%c : memref) -> memref acc.data dataOperands(%23, %24, %25 : memref, memref, memref) { } %26 = acc.deviceptr varPtr(%a : memref) -> memref %27 = acc.deviceptr varPtr(%b : memref) -> memref %28 = acc.deviceptr varPtr(%c : memref) -> memref acc.data dataOperands(%26, %27, %28 : memref, memref, memref) { } %29 = acc.attach varPtr(%a : memref) -> memref %30 = acc.attach varPtr(%b : memref) -> memref %31 = acc.attach varPtr(%c : memref) -> memref acc.data dataOperands(%29, %30, %31 : memref, memref, memref) { } %32 = acc.copyin varPtr(%a : memref) -> memref %33 = acc.create varPtr(%b : memref) -> memref {dataClause = 4 : i64} %34 = acc.present varPtr(%c : memref) -> memref acc.data dataOperands(%32, %33, %34 : memref, memref, memref) { } acc.copyout accPtr(%33 : memref) to varPtr(%b : memref) %35 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%35 : memref) { } attributes { defaultAttr = #acc } %36 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%36 : memref) { } attributes { defaultAttr = #acc } acc.data { } attributes { defaultAttr = #acc } return }", mlir-opt -split-input-file ,1 "func.func @testdataop(%a: memref, %b: memref, %c: memref) -> () { %ifCond = arith.constant true %0 = acc.present varPtr(%a : memref) -> memref acc.data if(%ifCond) dataOperands(%0 : memref) { } %1 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%1 : memref) if(%ifCond) { } %2 = acc.present varPtr(%a : memref) -> memref %3 = acc.present varPtr(%b : memref) -> memref %4 = acc.present varPtr(%c : memref) -> memref acc.data dataOperands(%2, %3, %4 : memref, memref, memref) { } %5 = acc.copyin varPtr(%a : memref) -> memref %6 = acc.copyin varPtr(%b : memref) -> memref %7 = acc.copyin varPtr(%c : memref) -> memref acc.data dataOperands(%5, %6, %7 : memref, memref, memref) { } %8 = acc.copyin varPtr(%a : memref) -> memref {dataClause = 2 : i64} %9 = acc.copyin varPtr(%b : memref) -> memref {dataClause = 2 : i64} %10 = acc.copyin varPtr(%c : memref) -> memref {dataClause = 2 : i64} acc.data dataOperands(%8, %9, %10 : memref, memref, memref) { } %11 = acc.create varPtr(%a : memref) -> memref {dataClause = 4 : i64} %12 = acc.create varPtr(%b : memref) -> memref {dataClause = 4 : i64} %13 = acc.create varPtr(%c : memref) -> memref {dataClause = 4 : i64} acc.data dataOperands(%11, %12, %13 : memref, memref, memref) { } acc.copyout accPtr(%11 : memref) to varPtr(%a : memref) acc.copyout accPtr(%12 : memref) to varPtr(%b : memref) acc.copyout accPtr(%13 : memref) to varPtr(%c : memref) %14 = acc.create varPtr(%a : memref) -> memref {dataClause = 5 : i64} %15 = acc.create varPtr(%b : memref) -> memref {dataClause = 5 : i64} %16 = acc.create varPtr(%c : memref) -> memref {dataClause = 5 : i64} acc.data dataOperands(%14, %15, %16 : memref, memref, memref) { } acc.copyout accPtr(%14 : memref) to varPtr(%a : memref) {dataClause = 5 : i64} acc.copyout accPtr(%15 : memref) to varPtr(%b : memref) {dataClause = 5 : i64} acc.copyout accPtr(%16 : memref) to varPtr(%c : memref) {dataClause = 5 : i64} %17 = acc.create varPtr(%a : memref) -> memref %18 = acc.create varPtr(%b : memref) -> memref %19 = acc.create varPtr(%c : memref) -> memref acc.data dataOperands(%17, %18, %19 : memref, memref, memref) { } acc.delete accPtr(%17 : memref) {dataClause = 7 : i64} acc.delete accPtr(%18 : memref) {dataClause = 7 : i64} acc.delete accPtr(%19 : memref) {dataClause = 7 : i64} %20 = acc.create varPtr(%a : memref) -> memref {dataClause = 8 : i64} %21 = acc.create varPtr(%b : memref) -> memref {dataClause = 8 : i64} %22 = acc.create varPtr(%c : memref) -> memref {dataClause = 8 : i64} acc.data dataOperands(%20, %21, %22 : memref, memref, memref) { } acc.delete accPtr(%20 : memref) {dataClause = 8 : i64} acc.delete accPtr(%21 : memref) {dataClause = 8 : i64} acc.delete accPtr(%22 : memref) {dataClause = 8 : i64} %23 = acc.nocreate varPtr(%a : memref) -> memref %24 = acc.nocreate varPtr(%b : memref) -> memref %25 = acc.nocreate varPtr(%c : memref) -> memref acc.data dataOperands(%23, %24, %25 : memref, memref, memref) { } %26 = acc.deviceptr varPtr(%a : memref) -> memref %27 = acc.deviceptr varPtr(%b : memref) -> memref %28 = acc.deviceptr varPtr(%c : memref) -> memref acc.data dataOperands(%26, %27, %28 : memref, memref, memref) { } %29 = acc.attach varPtr(%a : memref) -> memref %30 = acc.attach varPtr(%b : memref) -> memref %31 = acc.attach varPtr(%c : memref) -> memref acc.data dataOperands(%29, %30, %31 : memref, memref, memref) { } %32 = acc.copyin varPtr(%a : memref) -> memref %33 = acc.create varPtr(%b : memref) -> memref {dataClause = 4 : i64} %34 = acc.present varPtr(%c : memref) -> memref acc.data dataOperands(%32, %33, %34 : memref, memref, memref) { } acc.copyout accPtr(%33 : memref) to varPtr(%b : memref) %35 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%35 : memref) { } attributes { defaultAttr = #acc } %36 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%36 : memref) { } attributes { defaultAttr = #acc } acc.data { } attributes { defaultAttr = #acc } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testdataop(%a: memref, %b: memref, %c: memref) -> () { %ifCond = arith.constant true %0 = acc.present varPtr(%a : memref) -> memref acc.data if(%ifCond) dataOperands(%0 : memref) { } %1 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%1 : memref) if(%ifCond) { } %2 = acc.present varPtr(%a : memref) -> memref %3 = acc.present varPtr(%b : memref) -> memref %4 = acc.present varPtr(%c : memref) -> memref acc.data dataOperands(%2, %3, %4 : memref, memref, memref) { } %5 = acc.copyin varPtr(%a : memref) -> memref %6 = acc.copyin varPtr(%b : memref) -> memref %7 = acc.copyin varPtr(%c : memref) -> memref acc.data dataOperands(%5, %6, %7 : memref, memref, memref) { } %8 = acc.copyin varPtr(%a : memref) -> memref {dataClause = 2 : i64} %9 = acc.copyin varPtr(%b : memref) -> memref {dataClause = 2 : i64} %10 = acc.copyin varPtr(%c : memref) -> memref {dataClause = 2 : i64} acc.data dataOperands(%8, %9, %10 : memref, memref, memref) { } %11 = acc.create varPtr(%a : memref) -> memref {dataClause = 4 : i64} %12 = acc.create varPtr(%b : memref) -> memref {dataClause = 4 : i64} %13 = acc.create varPtr(%c : memref) -> memref {dataClause = 4 : i64} acc.data dataOperands(%11, %12, %13 : memref, memref, memref) { } acc.copyout accPtr(%11 : memref) to varPtr(%a : memref) acc.copyout accPtr(%12 : memref) to varPtr(%b : memref) acc.copyout accPtr(%13 : memref) to varPtr(%c : memref) %14 = acc.create varPtr(%a : memref) -> memref {dataClause = 5 : i64} %15 = acc.create varPtr(%b : memref) -> memref {dataClause = 5 : i64} %16 = acc.create varPtr(%c : memref) -> memref {dataClause = 5 : i64} acc.data dataOperands(%14, %15, %16 : memref, memref, memref) { } acc.copyout accPtr(%14 : memref) to varPtr(%a : memref) {dataClause = 5 : i64} acc.copyout accPtr(%15 : memref) to varPtr(%b : memref) {dataClause = 5 : i64} acc.copyout accPtr(%16 : memref) to varPtr(%c : memref) {dataClause = 5 : i64} %17 = acc.create varPtr(%a : memref) -> memref %18 = acc.create varPtr(%b : memref) -> memref %19 = acc.create varPtr(%c : memref) -> memref acc.data dataOperands(%17, %18, %19 : memref, memref, memref) { } acc.delete accPtr(%17 : memref) {dataClause = 7 : i64} acc.delete accPtr(%18 : memref) {dataClause = 7 : i64} acc.delete accPtr(%19 : memref) {dataClause = 7 : i64} %20 = acc.create varPtr(%a : memref) -> memref {dataClause = 8 : i64} %21 = acc.create varPtr(%b : memref) -> memref {dataClause = 8 : i64} %22 = acc.create varPtr(%c : memref) -> memref {dataClause = 8 : i64} acc.data dataOperands(%20, %21, %22 : memref, memref, memref) { } acc.delete accPtr(%20 : memref) {dataClause = 8 : i64} acc.delete accPtr(%21 : memref) {dataClause = 8 : i64} acc.delete accPtr(%22 : memref) {dataClause = 8 : i64} %23 = acc.nocreate varPtr(%a : memref) -> memref %24 = acc.nocreate varPtr(%b : memref) -> memref %25 = acc.nocreate varPtr(%c : memref) -> memref acc.data dataOperands(%23, %24, %25 : memref, memref, memref) { } %26 = acc.deviceptr varPtr(%a : memref) -> memref %27 = acc.deviceptr varPtr(%b : memref) -> memref %28 = acc.deviceptr varPtr(%c : memref) -> memref acc.data dataOperands(%26, %27, %28 : memref, memref, memref) { } %29 = acc.attach varPtr(%a : memref) -> memref %30 = acc.attach varPtr(%b : memref) -> memref %31 = acc.attach varPtr(%c : memref) -> memref acc.data dataOperands(%29, %30, %31 : memref, memref, memref) { } %32 = acc.copyin varPtr(%a : memref) -> memref %33 = acc.create varPtr(%b : memref) -> memref {dataClause = 4 : i64} %34 = acc.present varPtr(%c : memref) -> memref acc.data dataOperands(%32, %33, %34 : memref, memref, memref) { } acc.copyout accPtr(%33 : memref) to varPtr(%b : memref) %35 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%35 : memref) { } attributes { defaultAttr = #acc } %36 = acc.present varPtr(%a : memref) -> memref acc.data dataOperands(%36 : memref) { } attributes { defaultAttr = #acc } acc.data { } attributes { defaultAttr = #acc } return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testupdateop(%a: memref, %b: memref, %c: memref) -> () { %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true %0 = acc.update_device varPtr(%a : memref) -> memref %1 = acc.update_device varPtr(%b : memref) -> memref %2 = acc.update_device varPtr(%c : memref) -> memref acc.update async(%i64Value: i64) dataOperands(%0: memref) acc.update async(%i32Value: i32) dataOperands(%0: memref) acc.update async(%i32Value: i32) dataOperands(%0: memref) acc.update async(%idxValue: index) dataOperands(%0: memref) acc.update wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%0: memref) acc.update if(%ifCond) dataOperands(%0: memref) acc.update device_type(%i32Value : i32) dataOperands(%0: memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {async} acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {wait} acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {ifPresent} return }", mlir-opt -split-input-file ,1 "func.func @testupdateop(%a: memref, %b: memref, %c: memref) -> () { %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true %0 = acc.update_device varPtr(%a : memref) -> memref %1 = acc.update_device varPtr(%b : memref) -> memref %2 = acc.update_device varPtr(%c : memref) -> memref acc.update async(%i64Value: i64) dataOperands(%0: memref) acc.update async(%i32Value: i32) dataOperands(%0: memref) acc.update async(%i32Value: i32) dataOperands(%0: memref) acc.update async(%idxValue: index) dataOperands(%0: memref) acc.update wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%0: memref) acc.update if(%ifCond) dataOperands(%0: memref) acc.update device_type(%i32Value : i32) dataOperands(%0: memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {async} acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {wait} acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {ifPresent} return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testupdateop(%a: memref, %b: memref, %c: memref) -> () { %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true %0 = acc.update_device varPtr(%a : memref) -> memref %1 = acc.update_device varPtr(%b : memref) -> memref %2 = acc.update_device varPtr(%c : memref) -> memref acc.update async(%i64Value: i64) dataOperands(%0: memref) acc.update async(%i32Value: i32) dataOperands(%0: memref) acc.update async(%i32Value: i32) dataOperands(%0: memref) acc.update async(%idxValue: index) dataOperands(%0: memref) acc.update wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%0: memref) acc.update if(%ifCond) dataOperands(%0: memref) acc.update device_type(%i32Value : i32) dataOperands(%0: memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {async} acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {wait} acc.update dataOperands(%0, %1, %2 : memref, memref, memref) attributes {ifPresent} return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.wait acc.wait(%i64Value: i64) acc.wait(%i32Value: i32) acc.wait(%idxValue: index) acc.wait(%i32Value, %idxValue : i32, index) acc.wait async(%i64Value: i64) acc.wait async(%i32Value: i32) acc.wait async(%idxValue: index) acc.wait(%i32Value: i32) async(%idxValue: index) acc.wait(%i64Value: i64) wait_devnum(%i32Value: i32) acc.wait attributes {async} acc.wait(%i64Value: i64) async(%idxValue: index) wait_devnum(%i32Value: i32) acc.wait(%i64Value: i64) wait_devnum(%i32Value: i32) async(%idxValue: index) acc.wait if(%ifCond)", mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.wait acc.wait(%i64Value: i64) acc.wait(%i32Value: i32) acc.wait(%idxValue: index) acc.wait(%i32Value, %idxValue : i32, index) acc.wait async(%i64Value: i64) acc.wait async(%i32Value: i32) acc.wait async(%idxValue: index) acc.wait(%i32Value: i32) async(%idxValue: index) acc.wait(%i64Value: i64) wait_devnum(%i32Value: i32) acc.wait attributes {async} acc.wait(%i64Value: i64) async(%idxValue: index) wait_devnum(%i32Value: i32) acc.wait(%i64Value: i64) wait_devnum(%i32Value: i32) async(%idxValue: index) acc.wait if(%ifCond)", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.wait acc.wait(%i64Value: i64) acc.wait(%i32Value: i32) acc.wait(%idxValue: index) acc.wait(%i32Value, %idxValue : i32, index) acc.wait async(%i64Value: i64) acc.wait async(%i32Value: i32) acc.wait async(%idxValue: index) acc.wait(%i32Value: i32) async(%idxValue: index) acc.wait(%i64Value: i64) wait_devnum(%i32Value: i32) acc.wait attributes {async} acc.wait(%i64Value: i64) async(%idxValue: index) wait_devnum(%i32Value: i32) acc.wait(%i64Value: i64) wait_devnum(%i32Value: i32) async(%idxValue: index) acc.wait if(%ifCond)", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %i32Value2 = arith.constant 2 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.init acc.init device_type(%i32Value : i32) acc.init device_type(%i32Value, %i32Value2 : i32, i32) acc.init device_num(%i64Value : i64) acc.init device_num(%i32Value : i32) acc.init device_num(%idxValue : index) acc.init if(%ifCond) acc.init if(%ifCond) device_num(%idxValue : index) acc.init device_num(%idxValue : index) if(%ifCond)", mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %i32Value2 = arith.constant 2 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.init acc.init device_type(%i32Value : i32) acc.init device_type(%i32Value, %i32Value2 : i32, i32) acc.init device_num(%i64Value : i64) acc.init device_num(%i32Value : i32) acc.init device_num(%idxValue : index) acc.init if(%ifCond) acc.init if(%ifCond) device_num(%idxValue : index) acc.init device_num(%idxValue : index) if(%ifCond)", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %i32Value2 = arith.constant 2 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.init acc.init device_type(%i32Value : i32) acc.init device_type(%i32Value, %i32Value2 : i32, i32) acc.init device_num(%i64Value : i64) acc.init device_num(%i32Value : i32) acc.init device_num(%idxValue : index) acc.init if(%ifCond) acc.init if(%ifCond) device_num(%idxValue : index) acc.init device_num(%idxValue : index) if(%ifCond)", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %i32Value2 = arith.constant 2 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.shutdown acc.shutdown device_type(%i32Value : i32) acc.shutdown device_type(%i32Value, %i32Value2 : i32, i32) acc.shutdown device_num(%i64Value : i64) acc.shutdown device_num(%i32Value : i32) acc.shutdown device_num(%idxValue : index) acc.shutdown if(%ifCond) acc.shutdown if(%ifCond) device_num(%idxValue : index) acc.shutdown device_num(%idxValue : index) if(%ifCond)", mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %i32Value2 = arith.constant 2 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.shutdown acc.shutdown device_type(%i32Value : i32) acc.shutdown device_type(%i32Value, %i32Value2 : i32, i32) acc.shutdown device_num(%i64Value : i64) acc.shutdown device_num(%i32Value : i32) acc.shutdown device_num(%idxValue : index) acc.shutdown if(%ifCond) acc.shutdown if(%ifCond) device_num(%idxValue : index) acc.shutdown device_num(%idxValue : index) if(%ifCond)", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "%i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %i32Value2 = arith.constant 2 : i32 %idxValue = arith.constant 1 : index %ifCond = arith.constant true acc.shutdown acc.shutdown device_type(%i32Value : i32) acc.shutdown device_type(%i32Value, %i32Value2 : i32, i32) acc.shutdown device_num(%i64Value : i64) acc.shutdown device_num(%i32Value : i32) acc.shutdown device_num(%idxValue : index) acc.shutdown if(%ifCond) acc.shutdown if(%ifCond) device_num(%idxValue : index) acc.shutdown device_num(%idxValue : index) if(%ifCond)", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testexitdataop(%a: !llvm.ptr) -> () { %ifCond = arith.constant true %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%0 : !llvm.ptr) acc.copyout accPtr(%0 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %1 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%1 : !llvm.ptr) acc.delete accPtr(%1 : !llvm.ptr) %2 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%2 : !llvm.ptr) attributes {async,finalize} acc.delete accPtr(%2 : !llvm.ptr) %3 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%3 : !llvm.ptr) acc.detach accPtr(%3 : !llvm.ptr) %4 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%4 : !llvm.ptr) attributes {async} acc.copyout accPtr(%4 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %5 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%5 : !llvm.ptr) attributes {wait} acc.delete accPtr(%5 : !llvm.ptr) %6 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data async(%i64Value : i64) dataOperands(%6 : !llvm.ptr) acc.copyout accPtr(%6 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %7 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%7 : !llvm.ptr) async(%i64Value : i64) acc.copyout accPtr(%7 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %8 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data if(%ifCond) dataOperands(%8 : !llvm.ptr) acc.copyout accPtr(%8 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %9 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%9 : !llvm.ptr) acc.copyout accPtr(%9 : !llvm.ptr) to varPtr(%a : !llvm.ptr) return }", mlir-opt -split-input-file ,1 "func.func @testexitdataop(%a: !llvm.ptr) -> () { %ifCond = arith.constant true %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%0 : !llvm.ptr) acc.copyout accPtr(%0 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %1 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%1 : !llvm.ptr) acc.delete accPtr(%1 : !llvm.ptr) %2 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%2 : !llvm.ptr) attributes {async,finalize} acc.delete accPtr(%2 : !llvm.ptr) %3 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%3 : !llvm.ptr) acc.detach accPtr(%3 : !llvm.ptr) %4 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%4 : !llvm.ptr) attributes {async} acc.copyout accPtr(%4 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %5 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%5 : !llvm.ptr) attributes {wait} acc.delete accPtr(%5 : !llvm.ptr) %6 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data async(%i64Value : i64) dataOperands(%6 : !llvm.ptr) acc.copyout accPtr(%6 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %7 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%7 : !llvm.ptr) async(%i64Value : i64) acc.copyout accPtr(%7 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %8 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data if(%ifCond) dataOperands(%8 : !llvm.ptr) acc.copyout accPtr(%8 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %9 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%9 : !llvm.ptr) acc.copyout accPtr(%9 : !llvm.ptr) to varPtr(%a : !llvm.ptr) return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testexitdataop(%a: !llvm.ptr) -> () { %ifCond = arith.constant true %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%0 : !llvm.ptr) acc.copyout accPtr(%0 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %1 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%1 : !llvm.ptr) acc.delete accPtr(%1 : !llvm.ptr) %2 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%2 : !llvm.ptr) attributes {async,finalize} acc.delete accPtr(%2 : !llvm.ptr) %3 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%3 : !llvm.ptr) acc.detach accPtr(%3 : !llvm.ptr) %4 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%4 : !llvm.ptr) attributes {async} acc.copyout accPtr(%4 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %5 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%5 : !llvm.ptr) attributes {wait} acc.delete accPtr(%5 : !llvm.ptr) %6 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data async(%i64Value : i64) dataOperands(%6 : !llvm.ptr) acc.copyout accPtr(%6 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %7 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data dataOperands(%7 : !llvm.ptr) async(%i64Value : i64) acc.copyout accPtr(%7 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %8 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data if(%ifCond) dataOperands(%8 : !llvm.ptr) acc.copyout accPtr(%8 : !llvm.ptr) to varPtr(%a : !llvm.ptr) %9 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.exit_data wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%9 : !llvm.ptr) acc.copyout accPtr(%9 : !llvm.ptr) to varPtr(%a : !llvm.ptr) return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testenterdataop(%a: !llvm.ptr, %b: !llvm.ptr, %c: !llvm.ptr) -> () { %ifCond = arith.constant true %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %0 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%0 : !llvm.ptr) %1 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr %2 = acc.create varPtr(%b : !llvm.ptr) -> !llvm.ptr {dataClause = 8 : i64} %3 = acc.create varPtr(%c : !llvm.ptr) -> !llvm.ptr {dataClause = 8 : i64} acc.enter_data dataOperands(%1, %2, %3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) %4 = acc.attach varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%4 : !llvm.ptr) %5 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%5 : !llvm.ptr) attributes {async} %6 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%6 : !llvm.ptr) attributes {wait} %7 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data async(%i64Value : i64) dataOperands(%7 : !llvm.ptr) %8 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%8 : !llvm.ptr) async(%i64Value : i64) %9 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data if(%ifCond) dataOperands(%9 : !llvm.ptr) %10 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%10 : !llvm.ptr) return }", mlir-opt -split-input-file ,1 "func.func @testenterdataop(%a: !llvm.ptr, %b: !llvm.ptr, %c: !llvm.ptr) -> () { %ifCond = arith.constant true %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %0 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%0 : !llvm.ptr) %1 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr %2 = acc.create varPtr(%b : !llvm.ptr) -> !llvm.ptr {dataClause = 8 : i64} %3 = acc.create varPtr(%c : !llvm.ptr) -> !llvm.ptr {dataClause = 8 : i64} acc.enter_data dataOperands(%1, %2, %3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) %4 = acc.attach varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%4 : !llvm.ptr) %5 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%5 : !llvm.ptr) attributes {async} %6 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%6 : !llvm.ptr) attributes {wait} %7 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data async(%i64Value : i64) dataOperands(%7 : !llvm.ptr) %8 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%8 : !llvm.ptr) async(%i64Value : i64) %9 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data if(%ifCond) dataOperands(%9 : !llvm.ptr) %10 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%10 : !llvm.ptr) return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testenterdataop(%a: !llvm.ptr, %b: !llvm.ptr, %c: !llvm.ptr) -> () { %ifCond = arith.constant true %i64Value = arith.constant 1 : i64 %i32Value = arith.constant 1 : i32 %idxValue = arith.constant 1 : index %0 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%0 : !llvm.ptr) %1 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr %2 = acc.create varPtr(%b : !llvm.ptr) -> !llvm.ptr {dataClause = 8 : i64} %3 = acc.create varPtr(%c : !llvm.ptr) -> !llvm.ptr {dataClause = 8 : i64} acc.enter_data dataOperands(%1, %2, %3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) %4 = acc.attach varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%4 : !llvm.ptr) %5 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%5 : !llvm.ptr) attributes {async} %6 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%6 : !llvm.ptr) attributes {wait} %7 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data async(%i64Value : i64) dataOperands(%7 : !llvm.ptr) %8 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data dataOperands(%8 : !llvm.ptr) async(%i64Value : i64) %9 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data if(%ifCond) dataOperands(%9 : !llvm.ptr) %10 = acc.copyin varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.enter_data wait_devnum(%i64Value: i64) wait(%i32Value, %idxValue : i32, index) dataOperands(%10 : !llvm.ptr) return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @teststructureddataclauseops(%a: memref<10xf32>, %b: memref>, %c: memref<10x20xf32>) -> () { %deviceptr = acc.deviceptr varPtr(%a : memref<10xf32>) -> memref<10xf32> {name = ""arrayA""} acc.parallel dataOperands(%deviceptr : memref<10xf32>) { } %present = acc.present varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.data dataOperands(%present : memref<10xf32>) { } %copyin = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.parallel dataOperands(%copyin : memref<10xf32>) { } %copyinreadonly = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 2} acc.kernels dataOperands(%copyinreadonly : memref<10xf32>) { } %copyinfromcopy = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 3} acc.serial dataOperands(%copyinfromcopy : memref<10xf32>) { } acc.copyout accPtr(%copyinfromcopy : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 3} %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> %createimplicit = acc.create varPtr(%c : memref<10x20xf32>) -> memref<10x20xf32> {implicit = true} acc.parallel dataOperands(%create, %createimplicit : memref<10xf32>, memref<10x20xf32>) { } acc.delete accPtr(%create : memref<10xf32>) {dataClause = 7} acc.delete accPtr(%createimplicit : memref<10x20xf32>) {dataClause = 7, implicit = true} %copyoutzero = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 5} acc.parallel dataOperands(%copyoutzero: memref<10xf32>) { } acc.copyout accPtr(%copyoutzero : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 5} %attach = acc.attach varPtr(%b : memref>) -> memref> acc.parallel dataOperands(%attach : memref>) { } acc.detach accPtr(%attach : memref>) {dataClause = 10} %copyinparent = acc.copyin varPtr(%a : memref<10xf32>) varPtrPtr(%b : memref>) -> memref<10xf32> {dataClause = 3} acc.parallel dataOperands(%copyinparent : memref<10xf32>) { } acc.copyout accPtr(%copyinparent : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 3} %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c9 = arith.constant 9 : index %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %bounds1full = acc.bounds lowerbound(%c0 : index) upperbound(%c9 : index) stride(%c1 : index) %copyinfullslice1 = acc.copyin varPtr(%a : memref<10xf32>) bounds(%bounds1full) -> memref<10xf32> {name = ""arrayA[0:9]""} %bounds2full = acc.bounds lowerbound(%c1 : index) upperbound(%c20 : index) extent(%c20 : index) stride(%c4 : index) startIdx(%c1 : index) {strideInBytes = true} %copyinfullslice2 = acc.copyin varPtr(%c : memref<10x20xf32>) bounds(%bounds1full, %bounds2full) -> memref<10x20xf32> acc.parallel dataOperands(%copyinfullslice1, %copyinfullslice2 : memref<10xf32>, memref<10x20xf32>) { } %bounds1partial = acc.bounds lowerbound(%c4 : index) upperbound(%c9 : index) stride(%c1 : index) %copyinpartial = acc.copyin varPtr(%a : memref<10xf32>) bounds(%bounds1partial) -> memref<10xf32> {dataClause = 3} acc.parallel dataOperands(%copyinpartial : memref<10xf32>) { } acc.copyout accPtr(%copyinpartial : memref<10xf32>) bounds(%bounds1partial) to varPtr(%a : memref<10xf32>) {dataClause = 3} return }", mlir-opt -split-input-file ,1 "func.func @teststructureddataclauseops(%a: memref<10xf32>, %b: memref>, %c: memref<10x20xf32>) -> () { %deviceptr = acc.deviceptr varPtr(%a : memref<10xf32>) -> memref<10xf32> {name = ""arrayA""} acc.parallel dataOperands(%deviceptr : memref<10xf32>) { } %present = acc.present varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.data dataOperands(%present : memref<10xf32>) { } %copyin = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.parallel dataOperands(%copyin : memref<10xf32>) { } %copyinreadonly = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 2} acc.kernels dataOperands(%copyinreadonly : memref<10xf32>) { } %copyinfromcopy = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 3} acc.serial dataOperands(%copyinfromcopy : memref<10xf32>) { } acc.copyout accPtr(%copyinfromcopy : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 3} %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> %createimplicit = acc.create varPtr(%c : memref<10x20xf32>) -> memref<10x20xf32> {implicit = true} acc.parallel dataOperands(%create, %createimplicit : memref<10xf32>, memref<10x20xf32>) { } acc.delete accPtr(%create : memref<10xf32>) {dataClause = 7} acc.delete accPtr(%createimplicit : memref<10x20xf32>) {dataClause = 7, implicit = true} %copyoutzero = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 5} acc.parallel dataOperands(%copyoutzero: memref<10xf32>) { } acc.copyout accPtr(%copyoutzero : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 5} %attach = acc.attach varPtr(%b : memref>) -> memref> acc.parallel dataOperands(%attach : memref>) { } acc.detach accPtr(%attach : memref>) {dataClause = 10} %copyinparent = acc.copyin varPtr(%a : memref<10xf32>) varPtrPtr(%b : memref>) -> memref<10xf32> {dataClause = 3} acc.parallel dataOperands(%copyinparent : memref<10xf32>) { } acc.copyout accPtr(%copyinparent : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 3} %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c9 = arith.constant 9 : index %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %bounds1full = acc.bounds lowerbound(%c0 : index) upperbound(%c9 : index) stride(%c1 : index) %copyinfullslice1 = acc.copyin varPtr(%a : memref<10xf32>) bounds(%bounds1full) -> memref<10xf32> {name = ""arrayA[0:9]""} %bounds2full = acc.bounds lowerbound(%c1 : index) upperbound(%c20 : index) extent(%c20 : index) stride(%c4 : index) startIdx(%c1 : index) {strideInBytes = true} %copyinfullslice2 = acc.copyin varPtr(%c : memref<10x20xf32>) bounds(%bounds1full, %bounds2full) -> memref<10x20xf32> acc.parallel dataOperands(%copyinfullslice1, %copyinfullslice2 : memref<10xf32>, memref<10x20xf32>) { } %bounds1partial = acc.bounds lowerbound(%c4 : index) upperbound(%c9 : index) stride(%c1 : index) %copyinpartial = acc.copyin varPtr(%a : memref<10xf32>) bounds(%bounds1partial) -> memref<10xf32> {dataClause = 3} acc.parallel dataOperands(%copyinpartial : memref<10xf32>) { } acc.copyout accPtr(%copyinpartial : memref<10xf32>) bounds(%bounds1partial) to varPtr(%a : memref<10xf32>) {dataClause = 3} return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @teststructureddataclauseops(%a: memref<10xf32>, %b: memref>, %c: memref<10x20xf32>) -> () { %deviceptr = acc.deviceptr varPtr(%a : memref<10xf32>) -> memref<10xf32> {name = ""arrayA""} acc.parallel dataOperands(%deviceptr : memref<10xf32>) { } %present = acc.present varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.data dataOperands(%present : memref<10xf32>) { } %copyin = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> acc.parallel dataOperands(%copyin : memref<10xf32>) { } %copyinreadonly = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 2} acc.kernels dataOperands(%copyinreadonly : memref<10xf32>) { } %copyinfromcopy = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 3} acc.serial dataOperands(%copyinfromcopy : memref<10xf32>) { } acc.copyout accPtr(%copyinfromcopy : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 3} %create = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> %createimplicit = acc.create varPtr(%c : memref<10x20xf32>) -> memref<10x20xf32> {implicit = true} acc.parallel dataOperands(%create, %createimplicit : memref<10xf32>, memref<10x20xf32>) { } acc.delete accPtr(%create : memref<10xf32>) {dataClause = 7} acc.delete accPtr(%createimplicit : memref<10x20xf32>) {dataClause = 7, implicit = true} %copyoutzero = acc.create varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 5} acc.parallel dataOperands(%copyoutzero: memref<10xf32>) { } acc.copyout accPtr(%copyoutzero : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 5} %attach = acc.attach varPtr(%b : memref>) -> memref> acc.parallel dataOperands(%attach : memref>) { } acc.detach accPtr(%attach : memref>) {dataClause = 10} %copyinparent = acc.copyin varPtr(%a : memref<10xf32>) varPtrPtr(%b : memref>) -> memref<10xf32> {dataClause = 3} acc.parallel dataOperands(%copyinparent : memref<10xf32>) { } acc.copyout accPtr(%copyinparent : memref<10xf32>) to varPtr(%a : memref<10xf32>) {dataClause = 3} %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c9 = arith.constant 9 : index %c10 = arith.constant 10 : index %c20 = arith.constant 20 : index %bounds1full = acc.bounds lowerbound(%c0 : index) upperbound(%c9 : index) stride(%c1 : index) %copyinfullslice1 = acc.copyin varPtr(%a : memref<10xf32>) bounds(%bounds1full) -> memref<10xf32> {name = ""arrayA[0:9]""} %bounds2full = acc.bounds lowerbound(%c1 : index) upperbound(%c20 : index) extent(%c20 : index) stride(%c4 : index) startIdx(%c1 : index) {strideInBytes = true} %copyinfullslice2 = acc.copyin varPtr(%c : memref<10x20xf32>) bounds(%bounds1full, %bounds2full) -> memref<10x20xf32> acc.parallel dataOperands(%copyinfullslice1, %copyinfullslice2 : memref<10xf32>, memref<10x20xf32>) { } %bounds1partial = acc.bounds lowerbound(%c4 : index) upperbound(%c9 : index) stride(%c1 : index) %copyinpartial = acc.copyin varPtr(%a : memref<10xf32>) bounds(%bounds1partial) -> memref<10xf32> {dataClause = 3} acc.parallel dataOperands(%copyinpartial : memref<10xf32>) { } acc.copyout accPtr(%copyinpartial : memref<10xf32>) bounds(%bounds1partial) to varPtr(%a : memref<10xf32>) {dataClause = 3} return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @testunstructuredclauseops(%a: memref<10xf32>) -> () { %copyin = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {structured = false} acc.enter_data dataOperands(%copyin : memref<10xf32>) %devptr = acc.getdeviceptr varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 4} acc.exit_data dataOperands(%devptr : memref<10xf32>) acc.copyout accPtr(%devptr : memref<10xf32>) to varPtr(%a : memref<10xf32>) {structured = false} return }", mlir-opt -split-input-file ,1 "func.func @testunstructuredclauseops(%a: memref<10xf32>) -> () { %copyin = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {structured = false} acc.enter_data dataOperands(%copyin : memref<10xf32>) %devptr = acc.getdeviceptr varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 4} acc.exit_data dataOperands(%devptr : memref<10xf32>) acc.copyout accPtr(%devptr : memref<10xf32>) to varPtr(%a : memref<10xf32>) {structured = false} return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @testunstructuredclauseops(%a: memref<10xf32>) -> () { %copyin = acc.copyin varPtr(%a : memref<10xf32>) -> memref<10xf32> {structured = false} acc.enter_data dataOperands(%copyin : memref<10xf32>) %devptr = acc.getdeviceptr varPtr(%a : memref<10xf32>) -> memref<10xf32> {dataClause = 4} acc.exit_data dataOperands(%devptr : memref<10xf32>) acc.copyout accPtr(%devptr : memref<10xf32>) to varPtr(%a : memref<10xf32>) {structured = false} return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @host_device_ops(%a: memref) -> () { %devptr = acc.getdeviceptr varPtr(%a : memref) -> memref {dataClause = 16} acc.update_host accPtr(%devptr : memref) to varPtr(%a : memref) {structured = false} acc.update dataOperands(%devptr : memref) %accPtr = acc.update_device varPtr(%a : memref) -> memref acc.update dataOperands(%accPtr : memref) return }", mlir-opt -split-input-file ,1 "func.func @host_device_ops(%a: memref) -> () { %devptr = acc.getdeviceptr varPtr(%a : memref) -> memref {dataClause = 16} acc.update_host accPtr(%devptr : memref) to varPtr(%a : memref) {structured = false} acc.update dataOperands(%devptr : memref) %accPtr = acc.update_device varPtr(%a : memref) -> memref acc.update dataOperands(%accPtr : memref) return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @host_device_ops(%a: memref) -> () { %devptr = acc.getdeviceptr varPtr(%a : memref) -> memref {dataClause = 16} acc.update_host accPtr(%devptr : memref) to varPtr(%a : memref) {structured = false} acc.update dataOperands(%devptr : memref) %accPtr = acc.update_device varPtr(%a : memref) -> memref acc.update dataOperands(%accPtr : memref) return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @host_data_ops(%a: !llvm.ptr, %ifCond: i1) -> () { %0 = acc.use_device varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.host_data dataOperands(%0: !llvm.ptr) { } acc.host_data dataOperands(%0: !llvm.ptr) { } attributes {if_present} acc.host_data if(%ifCond) dataOperands(%0: !llvm.ptr) { } return }", mlir-opt -split-input-file ,1 "func.func @host_data_ops(%a: !llvm.ptr, %ifCond: i1) -> () { %0 = acc.use_device varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.host_data dataOperands(%0: !llvm.ptr) { } acc.host_data dataOperands(%0: !llvm.ptr) { } attributes {if_present} acc.host_data if(%ifCond) dataOperands(%0: !llvm.ptr) { } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @host_data_ops(%a: !llvm.ptr, %ifCond: i1) -> () { %0 = acc.use_device varPtr(%a : !llvm.ptr) -> !llvm.ptr acc.host_data dataOperands(%0: !llvm.ptr) { } acc.host_data dataOperands(%0: !llvm.ptr) { } attributes {if_present} acc.host_data if(%ifCond) dataOperands(%0: !llvm.ptr) { } return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_i32 : !llvm.ptr init { ^bb0(%arg0: !llvm.ptr): %c1 = arith.constant 1 : i32 %c0 = arith.constant 0 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr llvm.store %c0, %0 : !llvm.ptr acc.yield %0 : !llvm.ptr }", mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_i32 : !llvm.ptr init { ^bb0(%arg0: !llvm.ptr): %c1 = arith.constant 1 : i32 %c0 = arith.constant 0 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr llvm.store %c0, %0 : !llvm.ptr acc.yield %0 : !llvm.ptr }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "acc.private.recipe @privatization_i32 : !llvm.ptr init { ^bb0(%arg0: !llvm.ptr): %c1 = arith.constant 1 : i32 %c0 = arith.constant 0 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr llvm.store %c0, %0 : !llvm.ptr acc.yield %0 : !llvm.ptr }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func private @destroy_struct(!llvm.struct<(i32, i32)>) -> () acc.private.recipe @privatization_struct_i32_i64 : !llvm.struct<(i32, i32)> init { ^bb0(%arg0 : !llvm.struct<(i32, i32)>): %c1 = arith.constant 1 : i32 %0 = llvm.mlir.undef : !llvm.struct<(i32, i32)> %1 = llvm.insertvalue %c1, %0[0] : !llvm.struct<(i32, i32)> %2 = llvm.insertvalue %c1, %1[1] : !llvm.struct<(i32, i32)> acc.yield %2 : !llvm.struct<(i32, i32)> } destroy { ^bb0(%arg0: !llvm.struct<(i32, i32)>): func.call @destroy_struct(%arg0) : (!llvm.struct<(i32, i32)>) -> () acc.terminator }", mlir-opt -split-input-file ,1 "func.func private @destroy_struct(!llvm.struct<(i32, i32)>) -> () acc.private.recipe @privatization_struct_i32_i64 : !llvm.struct<(i32, i32)> init { ^bb0(%arg0 : !llvm.struct<(i32, i32)>): %c1 = arith.constant 1 : i32 %0 = llvm.mlir.undef : !llvm.struct<(i32, i32)> %1 = llvm.insertvalue %c1, %0[0] : !llvm.struct<(i32, i32)> %2 = llvm.insertvalue %c1, %1[1] : !llvm.struct<(i32, i32)> acc.yield %2 : !llvm.struct<(i32, i32)> } destroy { ^bb0(%arg0: !llvm.struct<(i32, i32)>): func.call @destroy_struct(%arg0) : (!llvm.struct<(i32, i32)>) -> () acc.terminator }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func private @destroy_struct(!llvm.struct<(i32, i32)>) -> () acc.private.recipe @privatization_struct_i32_i64 : !llvm.struct<(i32, i32)> init { ^bb0(%arg0 : !llvm.struct<(i32, i32)>): %c1 = arith.constant 1 : i32 %0 = llvm.mlir.undef : !llvm.struct<(i32, i32)> %1 = llvm.insertvalue %c1, %0[0] : !llvm.struct<(i32, i32)> %2 = llvm.insertvalue %c1, %1[1] : !llvm.struct<(i32, i32)> acc.yield %2 : !llvm.struct<(i32, i32)> } destroy { ^bb0(%arg0: !llvm.struct<(i32, i32)>): func.call @destroy_struct(%arg0) : (!llvm.struct<(i32, i32)>) -> () acc.terminator }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator init { ^bb0(%arg0: i64): %0 = arith.constant 0 : i64 acc.yield %0 : i64 } combiner { ^bb0(%arg0: i64, %arg1: i64): %0 = arith.addi %arg0, %arg1 : i64 acc.yield %0 : i64 } func.func @acc_reduc_test(%a : i64) -> () { acc.parallel reduction(@reduction_add_i64 -> %a : i64) { acc.loop reduction(@reduction_add_i64 -> %a : i64) { acc.yield } acc.yield } return }", mlir-opt -split-input-file ,1 "acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator init { ^bb0(%arg0: i64): %0 = arith.constant 0 : i64 acc.yield %0 : i64 } combiner { ^bb0(%arg0: i64, %arg1: i64): %0 = arith.addi %arg0, %arg1 : i64 acc.yield %0 : i64 } func.func @acc_reduc_test(%a : i64) -> () { acc.parallel reduction(@reduction_add_i64 -> %a : i64) { acc.loop reduction(@reduction_add_i64 -> %a : i64) { acc.yield } acc.yield } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator init { ^bb0(%arg0: i64): %0 = arith.constant 0 : i64 acc.yield %0 : i64 } combiner { ^bb0(%arg0: i64, %arg1: i64): %0 = arith.addi %arg0, %arg1 : i64 acc.yield %0 : i64 } func.func @acc_reduc_test(%a : i64) -> () { acc.parallel reduction(@reduction_add_i64 -> %a : i64) { acc.loop reduction(@reduction_add_i64 -> %a : i64) { acc.yield } acc.yield } return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator init { ^bb0(%0: i64): %1 = arith.constant 0 : i64 acc.yield %1 : i64 } combiner { ^bb0(%0: i64, %1: i64): %2 = arith.addi %0, %1 : i64 acc.yield %2 : i64 } func.func @acc_reduc_test(%a : i64) -> () { acc.serial reduction(@reduction_add_i64 -> %a : i64) { } return }", mlir-opt -split-input-file ,1 "acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator init { ^bb0(%0: i64): %1 = arith.constant 0 : i64 acc.yield %1 : i64 } combiner { ^bb0(%0: i64, %1: i64): %2 = arith.addi %0, %1 : i64 acc.yield %2 : i64 } func.func @acc_reduc_test(%a : i64) -> () { acc.serial reduction(@reduction_add_i64 -> %a : i64) { } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "acc.reduction.recipe @reduction_add_i64 : i64 reduction_operator init { ^bb0(%0: i64): %1 = arith.constant 0 : i64 acc.yield %1 : i64 } combiner { ^bb0(%0: i64, %1: i64): %2 = arith.addi %0, %1 : i64 acc.yield %2 : i64 } func.func @acc_reduc_test(%a : i64) -> () { acc.serial reduction(@reduction_add_i64 -> %a : i64) { } return }", mlir-opt -split-input-file -mlir-print-op-generic | mlir-opt -split-input-file ,1 "func.func @multiple_conversion_casts(%arg0: i32, %arg1: i32) -> (i32, i32) { %inputs:2 = builtin.unrealized_conversion_cast %arg0, %arg1 : i32, i32 to i64, i64 %outputs:2 = builtin.unrealized_conversion_cast %inputs#0, %inputs#1 : i64, i64 to i32, i32 return %outputs#0, %outputs#1 : i32, i32 } func.func @multiple_conversion_casts_failure(%arg0: i32, %arg1: i32, %arg2: i64) -> (i32, i32) { %inputs:2 = builtin.unrealized_conversion_cast %arg0, %arg1 : i32, i32 to i64, i64 %outputs:2 = builtin.unrealized_conversion_cast %arg2, %inputs#1 : i64, i64 to i32, i32 return %outputs#0, %outputs#1 : i32, i32 }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func private @f1() -> memref> func.func private @f2() -> memref> func.func private @f3() -> memref> func.func private @f4() -> memref> func.func private @f5() -> memref> func.func private @f6() -> memref> func.func private @f7() -> memref> func.func private @f8() -> memref> func.func private @f9() -> memref> func.func private @f10() -> memref>", mlir-opt | mlir-opt ,1 "module @TestComplex attributes { bytecode.test = complex } {} module @TestFloat attributes { bytecode.test = bf16, bytecode.test1 = f16, bytecode.test2 = f32, bytecode.test3 = f64, bytecode.test4 = f80, bytecode.test5 = f128 } {} module @TestInteger attributes { bytecode.int = i1024, bytecode.int1 = si32, bytecode.int2 = ui512 } {} module @TestIndex attributes { bytecode.index = index } {} module @TestFunc attributes { bytecode.func = () -> (), bytecode.func1 = (i1) -> (i32) } {} module @TestMemRef attributes { bytecode.test = memref<2xi8>, bytecode.test1 = memref<2xi8, 1> } {} module @TestNone attributes { bytecode.test = none } {} module @TestRankedTensor attributes { bytecode.test = tensor<16x32x?xf64>, bytecode.test1 = tensor<16xf64, ""sparse""> } {} module @TestTuple attributes { bytecode.test = tuple<>, bytecode.test1 = tuple } {} module @TestUnrankedMemRef attributes { bytecode.test = memref<*xi8>, bytecode.test1 = memref<*xi8, 1> } {} module @TestUnrankedTensor attributes { bytecode.test = tensor<*xi8> } {} module @TestVector attributes { bytecode.test = vector<8x8x128xi8>, bytecode.test1 = vector<8x[8]xf32> } {}", mlir-opt -emit-bytecode | mlir-opt ,1 "module @TestArray attributes { bytecode.array = [unit] } {} module @TestDenseArray attributes { bytecode.test1 = array, bytecode.test2 = array, bytecode.test3 = array } {} module @TestDenseIntOrFPElements attributes { bytecode.test1 = dense : tensor<256xi1>, bytecode.test2 = dense<[10, 32, 255]> : tensor<3xi8>, bytecode.test3 = dense<[10.0, 32.0, 1809.0]> : tensor<3xf64> } {} module @TestDenseStringElementsAttr attributes { bytecode.test1 = dense<""splat""> : tensor<256x!bytecode.string>, bytecode.test2 = dense<[""foo"", ""bar"", ""baz""]> : tensor<3x!bytecode.string> } {} module @TestFloat attributes { bytecode.float = 10.0 : f64, bytecode.float1 = 0.1 : f80, bytecode.float2 = 0.1 : f128, bytecode.float3 = -0.5 : bf16 } {} module @TestInt attributes { bytecode.int = false, bytecode.int1 = -1 : i8, bytecode.int2 = 800 : ui64, bytecode.int3 = 90000000000000000300000000000000000001 : i128 } {} module @TestSparseElements attributes { bytecode.sparse = sparse<[[0, 0], [1, 2]], [1, 5]> : tensor<3x4xi32> } {} module @TestString attributes { bytecode.string = ""hello"", bytecode.string2 = ""hello"" : i32 } {} module @TestSymbolRef attributes { bytecode.ref = @foo, bytecode.ref2 = @foo::@bar::@foo } {} module @TestType attributes { bytecode.type = i178 } {} module @TestLocCallSite attributes { bytecode.loc = loc(callsite(""foo"" at ""mysource.cc"":10:8)) } {} module @TestLocFileLineCol attributes { bytecode.loc = loc(""mysource.cc"":10:8) } {} module @TestLocFused attributes { bytecode.loc = loc(fused[""foo"", ""mysource.cc"":10:8]), bytecode.loc2 = loc(fused<""myPass"">[""foo"", ""foo2""]) } {} module @TestLocName attributes { bytecode.loc = loc(""foo""), bytecode.loc2 = loc(""foo""(""mysource.cc"":10:8)) } {} module @TestLocUnknown attributes { bytecode.loc = loc(unknown) } {}", mlir-opt -emit-bytecode -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect -mlir-print-local-scope ,1 "func.func @ceil_fold() -> f32 { %c = arith.constant 0.3 : f32 %r = math.ceil %c : f32 return %r : f32 } func.func @ceil_fold2() -> f32 { %c = arith.constant 2.0 : f32 %r = math.ceil %c : f32 return %r : f32 } func.func @log2_fold() -> f32 { %c = arith.constant 4.0 : f32 %r = math.log2 %c : f32 return %r : f32 } func.func @log2_fold2() -> f32 { %c = arith.constant 0.0 : f32 %r = math.log2 %c : f32 return %r : f32 } func.func @log2_nofold2() -> f32 { %c = arith.constant -1.0 : f32 %r = math.log2 %c : f32 return %r : f32 } func.func @log2_fold_64() -> f64 { %c = arith.constant 4.0 : f64 %r = math.log2 %c : f64 return %r : f64 } func.func @log2_fold2_64() -> f64 { %c = arith.constant 0.0 : f64 %r = math.log2 %c : f64 return %r : f64 } func.func @log2_nofold2_64() -> f64 { %c = arith.constant -1.0 : f64 %r = math.log2 %c : f64 return %r : f64 } func.func @log2_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %0 = math.log2 %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @powf_fold() -> f32 { %c = arith.constant 2.0 : f32 %r = math.powf %c, %c : f32 return %r : f32 } func.func @powf_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %v2 = arith.constant dense<[2.0, 2.0, 2.0, 2.0]> : vector<4xf32> %0 = math.powf %v1, %v2 : vector<4xf32> return %0 : vector<4xf32> } func.func @sqrt_fold() -> f32 { %c = arith.constant 4.0 : f32 %r = math.sqrt %c : f32 return %r : f32 } func.func @sqrt_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %0 = math.sqrt %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @abs_fold() -> f32 { %c = arith.constant -4.0 : f32 %r = math.absf %c : f32 return %r : f32 } func.func @copysign_fold() -> f32 { %c1 = arith.constant 4.0 : f32 %c2 = arith.constant -9.0 : f32 %r = math.copysign %c1, %c2 : f32 return %r : f32 } func.func @ctlz_fold1() -> i32 { %c = arith.constant 1 : i32 %r = math.ctlz %c : i32 return %r : i32 } func.func @ctlz_fold2() -> i8 { %c = arith.constant 1 : i8 %r = math.ctlz %c : i8 return %r : i8 } func.func @cttz_fold() -> i32 { %c = arith.constant 256 : i32 %r = math.cttz %c : i32 return %r : i32 } func.func @ctpop_fold() -> i32 { %c = arith.constant 0xFF0000FF : i32 %r = math.ctpop %c : i32 return %r : i32 } func.func @log10_fold() -> f32 { %c = arith.constant 100.0 : f32 %r = math.log10 %c : f32 return %r : f32 } func.func @log10_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 10.0, 100.0, 200.0]> : vector<4xf32> %0 = math.log10 %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @log1p_fold() -> f32 { %c = arith.constant 17.0 : f32 %r = math.log1p %c : f32 return %r : f32 } func.func @log1p_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[3.0, 5.0, 7.0, 11.0]> : vector<4xf32> %0 = math.log1p %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @log_fold() -> f32 { %c = arith.constant 2.0 : f32 %r = math.log %c : f32 return %r : f32 } func.func @log_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %0 = math.log %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @exp_fold() -> f32 { %c = arith.constant 2.0 : f32 %r = math.exp %c : f32 return %r : f32 } func.func @exp_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %0 = math.exp %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @exp2_fold() -> f32 { %c = arith.constant 2.0 : f32 %r = math.exp2 %c : f32 return %r : f32 } func.func @exp2_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %0 = math.exp2 %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @expm1_fold() -> f32 { %c = arith.constant 2.0 : f32 %r = math.expm1 %c : f32 return %r : f32 } func.func @expm1_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.expm1 %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @tan_fold() -> f32 { %c = arith.constant 1.0 : f32 %r = math.tan %c : f32 return %r : f32 } func.func @tan_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.tan %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @tanh_fold() -> f32 { %c = arith.constant 1.0 : f32 %r = math.tanh %c : f32 return %r : f32 } func.func @tanh_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.tanh %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @atan_fold() -> f32 { %c = arith.constant 1.0 : f32 %r = math.atan %c : f32 return %r : f32 } func.func @atan_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.atan %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @atan2_fold() -> f32 { %c1 = arith.constant 0.0 : f32 %c2 = arith.constant 1.0 : f32 %r = math.atan2 %c1, %c2 : f32 return %r : f32 } func.func @atan2_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 0.0, 1.0, 1.0]> : vector<4xf32> %v2 = arith.constant dense<[1.0, 1.0, 2.0, 2.0]> : vector<4xf32> %0 = math.atan2 %v1, %v2 : vector<4xf32> return %0 : vector<4xf32> } func.func @cos_fold() -> f32 { %c = arith.constant 1.0 : f32 %r = math.cos %c : f32 return %r : f32 } func.func @cos_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.cos %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @roundeven_fold() -> f32 { %c = arith.constant 1.5 : f32 %r = math.roundeven %c : f32 return %r : f32 } func.func @roundeven_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.5, -0.5, 1.5, -1.5]> : vector<4xf32> %0 = math.roundeven %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @round_fold() -> f32 { %c = arith.constant 1.5 : f32 %r = math.round %c : f32 return %r : f32 } func.func @round_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.5, -0.5, 1.5, -1.5]> : vector<4xf32> %0 = math.round %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @floor_fold() -> f32 { %c = arith.constant 0.3 : f32 %r = math.floor %c : f32 return %r : f32 } func.func @floor_fold2() -> f32 { %c = arith.constant 2.0 : f32 %r = math.floor %c : f32 return %r : f32 } func.func @trunc_fold() -> f32 { %c = arith.constant 1.1 : f32 %r = math.trunc %c : f32 return %r : f32 } func.func @trunc_fold_vec() -> (vector<4xf32>) { %v = arith.constant dense<[0.5, -0.5, 1.5, -1.5]> : vector<4xf32> %0 = math.trunc %v : vector<4xf32> return %0 : vector<4xf32> } func.func @sin_fold() -> f32 { %c = arith.constant 1.0 : f32 %r = math.sin %c : f32 return %r : f32 } func.func @sin_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.sin %v1 : vector<4xf32> return %0 : vector<4xf32> } func.func @erf_fold() -> f32 { %c = arith.constant 1.0 : f32 %r = math.erf %c : f32 return %r : f32 } func.func @erf_fold_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32> %0 = math.erf %v1 : vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @atan(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.atan %f : f32 %1 = math.atan %v : vector<4xf32> %2 = math.atan %t : tensor<4x4x?xf32> return } func.func @atan2(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.atan2 %f, %f : f32 %1 = math.atan2 %v, %v : vector<4xf32> %2 = math.atan2 %t, %t : tensor<4x4x?xf32> return } func.func @cbrt(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.cbrt %f : f32 %1 = math.cbrt %v : vector<4xf32> %2 = math.cbrt %t : tensor<4x4x?xf32> return } func.func @cos(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.cos %f : f32 %1 = math.cos %v : vector<4xf32> %2 = math.cos %t : tensor<4x4x?xf32> return } func.func @sin(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.sin %f : f32 %1 = math.sin %v : vector<4xf32> %2 = math.sin %t : tensor<4x4x?xf32> return } func.func @erf(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.erf %f : f32 %1 = math.erf %v : vector<4xf32> %2 = math.erf %t : tensor<4x4x?xf32> return } func.func @exp(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.exp %f : f32 %1 = math.exp %v : vector<4xf32> %2 = math.exp %t : tensor<4x4x?xf32> return } func.func @exp2(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.exp2 %f : f32 %1 = math.exp2 %v : vector<4xf32> %2 = math.exp2 %t : tensor<4x4x?xf32> return } func.func @expm1(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.expm1 %f : f32 %1 = math.expm1 %v : vector<4xf32> %2 = math.expm1 %t : tensor<4x4x?xf32> return } func.func @log(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log %f : f32 %1 = math.log %v : vector<4xf32> %2 = math.log %t : tensor<4x4x?xf32> return } func.func @log10(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log10 %f : f32 %1 = math.log10 %v : vector<4xf32> %2 = math.log10 %t : tensor<4x4x?xf32> return } func.func @log1p(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log1p %f : f32 %1 = math.log1p %v : vector<4xf32> %2 = math.log1p %t : tensor<4x4x?xf32> return } func.func @log2(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log2 %f : f32 %1 = math.log2 %v : vector<4xf32> %2 = math.log2 %t : tensor<4x4x?xf32> return } func.func @powf(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.powf %f, %f : f32 %1 = math.powf %v, %v : vector<4xf32> %2 = math.powf %t, %t : tensor<4x4x?xf32> return } func.func @fpowi(%b: f32, %p: i32, %vb: vector<4xf64>, %vp: vector<4xi16>, %tb: tensor<4x3x?xf16>, %tp: tensor<4x3x?xi64>) { %0 = math.fpowi %b, %p : f32, i32 %1 = math.fpowi %vb, %vp : vector<4xf64>, vector<4xi16> %2 = math.fpowi %tb, %tp : tensor<4x3x?xf16>, tensor<4x3x?xi64> return } func.func @rsqrt(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.rsqrt %f : f32 %1 = math.rsqrt %v : vector<4xf32> %2 = math.rsqrt %t : tensor<4x4x?xf32> return } func.func @sqrt(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.sqrt %f : f32 %1 = math.sqrt %v : vector<4xf32> %2 = math.sqrt %t : tensor<4x4x?xf32> return } func.func @tan(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.tan %f : f32 %1 = math.tan %v : vector<4xf32> %2 = math.tan %t : tensor<4x4x?xf32> return } func.func @tanh(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.tanh %f : f32 %1 = math.tanh %v : vector<4xf32> %2 = math.tanh %t : tensor<4x4x?xf32> return } func.func @round(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.round %f : f32 %1 = math.round %v : vector<4xf32> %2 = math.round %t : tensor<4x4x?xf32> return } func.func @roundeven(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.roundeven %f : f32 %1 = math.roundeven %v : vector<4xf32> %2 = math.roundeven %t : tensor<4x4x?xf32> return } func.func @ipowi(%i: i32, %v: vector<4xi32>, %t: tensor<4x4x?xi32>) { %0 = math.ipowi %i, %i : i32 %1 = math.ipowi %v, %v : vector<4xi32> %2 = math.ipowi %t, %t : tensor<4x4x?xi32> return } func.func @trunc(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.trunc %f : f32 %1 = math.trunc %v : vector<4xf32> %2 = math.trunc %t : tensor<4x4x?xf32> return } func.func @fastmath(%f: f32, %i: i32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.trunc %f fastmath : f32 %1 = math.powf %v, %v fastmath : vector<4xf32> %2 = math.fma %t, %t, %t fastmath : tensor<4x4x?xf32> %3 = math.absf %f fastmath : f32 %4 = math.fpowi %f, %i fastmath : f32, i32 return }", mlir-opt | mlir-opt ,1 "func.func @atan(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.atan %f : f32 %1 = math.atan %v : vector<4xf32> %2 = math.atan %t : tensor<4x4x?xf32> return } func.func @atan2(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.atan2 %f, %f : f32 %1 = math.atan2 %v, %v : vector<4xf32> %2 = math.atan2 %t, %t : tensor<4x4x?xf32> return } func.func @cbrt(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.cbrt %f : f32 %1 = math.cbrt %v : vector<4xf32> %2 = math.cbrt %t : tensor<4x4x?xf32> return } func.func @cos(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.cos %f : f32 %1 = math.cos %v : vector<4xf32> %2 = math.cos %t : tensor<4x4x?xf32> return } func.func @sin(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.sin %f : f32 %1 = math.sin %v : vector<4xf32> %2 = math.sin %t : tensor<4x4x?xf32> return } func.func @erf(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.erf %f : f32 %1 = math.erf %v : vector<4xf32> %2 = math.erf %t : tensor<4x4x?xf32> return } func.func @exp(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.exp %f : f32 %1 = math.exp %v : vector<4xf32> %2 = math.exp %t : tensor<4x4x?xf32> return } func.func @exp2(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.exp2 %f : f32 %1 = math.exp2 %v : vector<4xf32> %2 = math.exp2 %t : tensor<4x4x?xf32> return } func.func @expm1(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.expm1 %f : f32 %1 = math.expm1 %v : vector<4xf32> %2 = math.expm1 %t : tensor<4x4x?xf32> return } func.func @log(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log %f : f32 %1 = math.log %v : vector<4xf32> %2 = math.log %t : tensor<4x4x?xf32> return } func.func @log10(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log10 %f : f32 %1 = math.log10 %v : vector<4xf32> %2 = math.log10 %t : tensor<4x4x?xf32> return } func.func @log1p(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log1p %f : f32 %1 = math.log1p %v : vector<4xf32> %2 = math.log1p %t : tensor<4x4x?xf32> return } func.func @log2(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.log2 %f : f32 %1 = math.log2 %v : vector<4xf32> %2 = math.log2 %t : tensor<4x4x?xf32> return } func.func @powf(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.powf %f, %f : f32 %1 = math.powf %v, %v : vector<4xf32> %2 = math.powf %t, %t : tensor<4x4x?xf32> return } func.func @fpowi(%b: f32, %p: i32, %vb: vector<4xf64>, %vp: vector<4xi16>, %tb: tensor<4x3x?xf16>, %tp: tensor<4x3x?xi64>) { %0 = math.fpowi %b, %p : f32, i32 %1 = math.fpowi %vb, %vp : vector<4xf64>, vector<4xi16> %2 = math.fpowi %tb, %tp : tensor<4x3x?xf16>, tensor<4x3x?xi64> return } func.func @rsqrt(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.rsqrt %f : f32 %1 = math.rsqrt %v : vector<4xf32> %2 = math.rsqrt %t : tensor<4x4x?xf32> return } func.func @sqrt(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.sqrt %f : f32 %1 = math.sqrt %v : vector<4xf32> %2 = math.sqrt %t : tensor<4x4x?xf32> return } func.func @tan(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.tan %f : f32 %1 = math.tan %v : vector<4xf32> %2 = math.tan %t : tensor<4x4x?xf32> return } func.func @tanh(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.tanh %f : f32 %1 = math.tanh %v : vector<4xf32> %2 = math.tanh %t : tensor<4x4x?xf32> return } func.func @round(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.round %f : f32 %1 = math.round %v : vector<4xf32> %2 = math.round %t : tensor<4x4x?xf32> return } func.func @roundeven(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.roundeven %f : f32 %1 = math.roundeven %v : vector<4xf32> %2 = math.roundeven %t : tensor<4x4x?xf32> return } func.func @ipowi(%i: i32, %v: vector<4xi32>, %t: tensor<4x4x?xi32>) { %0 = math.ipowi %i, %i : i32 %1 = math.ipowi %v, %v : vector<4xi32> %2 = math.ipowi %t, %t : tensor<4x4x?xi32> return } func.func @trunc(%f: f32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.trunc %f : f32 %1 = math.trunc %v : vector<4xf32> %2 = math.trunc %t : tensor<4x4x?xf32> return } func.func @fastmath(%f: f32, %i: i32, %v: vector<4xf32>, %t: tensor<4x4x?xf32>) { %0 = math.trunc %f fastmath : f32 %1 = math.powf %v, %v fastmath : vector<4xf32> %2 = math.fma %t, %t, %t fastmath : tensor<4x4x?xf32> %3 = math.absf %f fastmath : f32 %4 = math.fpowi %f, %i fastmath : f32, i32 return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @erf_scalar(%arg0: f32) -> f32 { %0 = math.erf %arg0 : f32 return %0 : f32 } func.func @erf_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.erf %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @exp_scalar(%arg0: f32) -> f32 { %0 = math.exp %arg0 : f32 return %0 : f32 } func.func @exp_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.exp %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @expm1_scalar(%arg0: f32) -> f32 { %0 = math.expm1 %arg0 : f32 return %0 : f32 } func.func @expm1_vector(%arg0: vector<8x8xf32>) -> vector<8x8xf32> { %0 = math.expm1 %arg0 : vector<8x8xf32> return %0 : vector<8x8xf32> } func.func @log_scalar(%arg0: f32) -> f32 { %0 = math.log %arg0 : f32 return %0 : f32 } func.func @log_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.log %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @log2_scalar(%arg0: f32) -> f32 { %0 = math.log2 %arg0 : f32 return %0 : f32 } func.func @log2_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.log2 %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @log1p_scalar(%arg0: f32) -> f32 { %0 = math.log1p %arg0 : f32 return %0 : f32 } func.func @log1p_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.log1p %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @tanh_scalar(%arg0: f32) -> f32 { %0 = math.tanh %arg0 : f32 return %0 : f32 } func.func @tanh_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.tanh %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @rsqrt_scalar(%arg0: f32) -> f32 { %0 = math.rsqrt %arg0 : f32 return %0 : f32 } func.func @rsqrt_vector_8xf32(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.rsqrt %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @rsqrt_vector_5xf32(%arg0: vector<5xf32>) -> vector<5xf32> { %0 = math.rsqrt %arg0 : vector<5xf32> return %0 : vector<5xf32> } func.func @rsqrt_vector_16xf32(%arg0: vector<16xf32>) -> vector<16xf32> { %0 = math.rsqrt %arg0 : vector<16xf32> return %0 : vector<16xf32> } func.func @rsqrt_vector_2x8xf32(%arg0: vector<2x8xf32>) -> vector<2x8xf32> { %0 = math.rsqrt %arg0 : vector<2x8xf32> return %0 : vector<2x8xf32> } func.func @rsqrt_vector_2x16xf32(%arg0: vector<2x16xf32>) -> vector<2x16xf32> { %0 = math.rsqrt %arg0 : vector<2x16xf32> return %0 : vector<2x16xf32> } func.func @atan_scalar(%arg0: f32) -> f32 { %0 = math.atan %arg0 : f32 return %0 : f32 } func.func @atan2_scalar(%arg0: f16, %arg1: f16) -> f16 { %0 = math.atan2 %arg0, %arg1 : f16 return %0 : f16 } func.func @cbrt_vector(%arg0: vector<4xf32>) -> vector<4xf32> { %0 = ""math.cbrt""(%arg0) : (vector<4xf32>) -> vector<4xf32> func.return %0 : vector<4xf32> } func.func @math_f16(%arg0 : vector<4xf16>) -> vector<4xf16> { %0 = ""math.atan""(%arg0) : (vector<4xf16>) -> vector<4xf16> %1 = ""math.atan2""(%0, %arg0) : (vector<4xf16>, vector<4xf16>) -> vector<4xf16> %2 = ""math.tanh""(%1) : (vector<4xf16>) -> vector<4xf16> %3 = ""math.log""(%2) : (vector<4xf16>) -> vector<4xf16> %4 = ""math.log2""(%3) : (vector<4xf16>) -> vector<4xf16> %5 = ""math.log1p""(%4) : (vector<4xf16>) -> vector<4xf16> %6 = ""math.erf""(%5) : (vector<4xf16>) -> vector<4xf16> %7 = ""math.exp""(%6) : (vector<4xf16>) -> vector<4xf16> %8 = ""math.expm1""(%7) : (vector<4xf16>) -> vector<4xf16> %9 = ""math.cbrt""(%8) : (vector<4xf16>) -> vector<4xf16> %10 = ""math.sin""(%9) : (vector<4xf16>) -> vector<4xf16> %11 = ""math.cos""(%10) : (vector<4xf16>) -> vector<4xf16> return %11 : vector<4xf16> } func.func @rsqrt_f16(%arg0 : vector<2x8xf16>) -> vector<2x8xf16> { %0 = ""math.rsqrt""(%arg0) : (vector<2x8xf16>) -> vector<2x8xf16> return %0 : vector<2x8xf16> }", mlir-opt -test-math-polynomial-approximation ,1 "func.func @erf_scalar(%arg0: f32) -> f32 { %0 = math.erf %arg0 : f32 return %0 : f32 } func.func @erf_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.erf %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @exp_scalar(%arg0: f32) -> f32 { %0 = math.exp %arg0 : f32 return %0 : f32 } func.func @exp_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.exp %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @expm1_scalar(%arg0: f32) -> f32 { %0 = math.expm1 %arg0 : f32 return %0 : f32 } func.func @expm1_vector(%arg0: vector<8x8xf32>) -> vector<8x8xf32> { %0 = math.expm1 %arg0 : vector<8x8xf32> return %0 : vector<8x8xf32> } func.func @log_scalar(%arg0: f32) -> f32 { %0 = math.log %arg0 : f32 return %0 : f32 } func.func @log_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.log %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @log2_scalar(%arg0: f32) -> f32 { %0 = math.log2 %arg0 : f32 return %0 : f32 } func.func @log2_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.log2 %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @log1p_scalar(%arg0: f32) -> f32 { %0 = math.log1p %arg0 : f32 return %0 : f32 } func.func @log1p_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.log1p %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @tanh_scalar(%arg0: f32) -> f32 { %0 = math.tanh %arg0 : f32 return %0 : f32 } func.func @tanh_vector(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.tanh %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @rsqrt_scalar(%arg0: f32) -> f32 { %0 = math.rsqrt %arg0 : f32 return %0 : f32 } func.func @rsqrt_vector_8xf32(%arg0: vector<8xf32>) -> vector<8xf32> { %0 = math.rsqrt %arg0 : vector<8xf32> return %0 : vector<8xf32> } func.func @rsqrt_vector_5xf32(%arg0: vector<5xf32>) -> vector<5xf32> { %0 = math.rsqrt %arg0 : vector<5xf32> return %0 : vector<5xf32> } func.func @rsqrt_vector_16xf32(%arg0: vector<16xf32>) -> vector<16xf32> { %0 = math.rsqrt %arg0 : vector<16xf32> return %0 : vector<16xf32> } func.func @rsqrt_vector_2x8xf32(%arg0: vector<2x8xf32>) -> vector<2x8xf32> { %0 = math.rsqrt %arg0 : vector<2x8xf32> return %0 : vector<2x8xf32> } func.func @rsqrt_vector_2x16xf32(%arg0: vector<2x16xf32>) -> vector<2x16xf32> { %0 = math.rsqrt %arg0 : vector<2x16xf32> return %0 : vector<2x16xf32> } func.func @atan_scalar(%arg0: f32) -> f32 { %0 = math.atan %arg0 : f32 return %0 : f32 } func.func @atan2_scalar(%arg0: f16, %arg1: f16) -> f16 { %0 = math.atan2 %arg0, %arg1 : f16 return %0 : f16 } func.func @cbrt_vector(%arg0: vector<4xf32>) -> vector<4xf32> { %0 = ""math.cbrt""(%arg0) : (vector<4xf32>) -> vector<4xf32> func.return %0 : vector<4xf32> } func.func @math_f16(%arg0 : vector<4xf16>) -> vector<4xf16> { %0 = ""math.atan""(%arg0) : (vector<4xf16>) -> vector<4xf16> %1 = ""math.atan2""(%0, %arg0) : (vector<4xf16>, vector<4xf16>) -> vector<4xf16> %2 = ""math.tanh""(%1) : (vector<4xf16>) -> vector<4xf16> %3 = ""math.log""(%2) : (vector<4xf16>) -> vector<4xf16> %4 = ""math.log2""(%3) : (vector<4xf16>) -> vector<4xf16> %5 = ""math.log1p""(%4) : (vector<4xf16>) -> vector<4xf16> %6 = ""math.erf""(%5) : (vector<4xf16>) -> vector<4xf16> %7 = ""math.exp""(%6) : (vector<4xf16>) -> vector<4xf16> %8 = ""math.expm1""(%7) : (vector<4xf16>) -> vector<4xf16> %9 = ""math.cbrt""(%8) : (vector<4xf16>) -> vector<4xf16> %10 = ""math.sin""(%9) : (vector<4xf16>) -> vector<4xf16> %11 = ""math.cos""(%10) : (vector<4xf16>) -> vector<4xf16> return %11 : vector<4xf16> } func.func @rsqrt_f16(%arg0 : vector<2x8xf16>) -> vector<2x8xf16> { %0 = ""math.rsqrt""(%arg0) : (vector<2x8xf16>) -> vector<2x8xf16> return %0 : vector<2x8xf16> }", mlir-opt -test-math-polynomial-approximation=enable-avx2 ,1 "func.func @tanh(%arg: f32) -> f32 { %res = math.tanh %arg : f32 return %res : f32 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @vector_tanh(%arg: vector<4xf32>) -> vector<4xf32> { %res = math.tanh %arg : vector<4xf32> return %res : vector<4xf32> }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @tan(%arg: f32) -> f32 { %res = math.tan %arg : f32 return %res : f32 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @vector_tan(%arg: vector<4xf32>) -> vector<4xf32> { %res = math.tan %arg : vector<4xf32> return %res : vector<4xf32> }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @ctlz(%arg: i32) -> i32 { %res = math.ctlz %arg : i32 return %res : i32 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @ctlz_vector(%arg: vector<4xi32>) -> vector<4xi32> { %res = math.ctlz %arg : vector<4xi32> return %res : vector<4xi32> }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @fmaf_func(%a: f64, %b: f64, %c: f64) -> f64 { %ret = math.fma %a, %b, %c : f64 return %ret : f64 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @floorf_func(%a: f64) -> f64 { %ret = math.floor %a : f64 return %ret : f64 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @ceilf_func(%a: f64) -> f64 { %ret = math.ceil %a : f64 return %ret : f64 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @exp2f_func(%a: f64) -> f64 { %ret = math.exp2 %a : f64 return %ret : f64 } func.func @exp2f_func_tensor(%a: tensor<1xf32>) -> tensor<1xf32> { %ret = math.exp2 %a : tensor<1xf32> return %ret : tensor<1xf32> }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @roundf_func(%a: f32) -> f32 { %ret = math.round %a : f32 return %ret : f32 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @powf_func(%a: f64, %b: f64) ->f64 { %ret = math.powf %a, %b : f64 return %ret : f64 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @roundeven(%arg: f32) -> f32 { %res = math.roundeven %arg : f32 return %res : f32 }", mlir-opt --split-input-file -test-expand-math ,1 "func.func @pow_noop(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant 1.0 : f32 %v = arith.constant dense <1.0> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @pow_square(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant 2.0 : f32 %v = arith.constant dense <2.0> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @pow_cube(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant 3.0 : f32 %v = arith.constant dense <3.0> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @pow_recip(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant -1.0 : f32 %v = arith.constant dense <-1.0> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @pow_sqrt(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant 0.5 : f32 %v = arith.constant dense <0.5> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @pow_rsqrt(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant -0.5 : f32 %v = arith.constant dense <-0.5> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @pow_0_75(%arg0: f32, %arg1 : vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant 0.75 : f32 %v = arith.constant dense <0.75> : vector<4xf32> %0 = math.powf %arg0, %c : f32 %1 = math.powf %arg1, %v : vector<4xf32> return %0, %1 : f32, vector<4xf32> } func.func @ipowi_zero_exp(%arg0: i32, %arg1: vector<4xi32>) -> (i32, vector<4xi32>) { %c = arith.constant 0 : i32 %v = arith.constant dense <0> : vector<4xi32> %0 = math.ipowi %arg0, %c : i32 %1 = math.ipowi %arg1, %v : vector<4xi32> return %0, %1 : i32, vector<4xi32> } func.func @ipowi_exp_one(%arg0: i32, %arg1: vector<4xi32>) -> (i32, vector<4xi32>, i32, vector<4xi32>) { %c1 = arith.constant 1 : i32 %v1 = arith.constant dense <1> : vector<4xi32> %0 = math.ipowi %arg0, %c1 : i32 %1 = math.ipowi %arg1, %v1 : vector<4xi32> %cm1 = arith.constant -1 : i32 %vm1 = arith.constant dense <-1> : vector<4xi32> %2 = math.ipowi %arg0, %cm1 : i32 %3 = math.ipowi %arg1, %vm1 : vector<4xi32> return %0, %1, %2, %3 : i32, vector<4xi32>, i32, vector<4xi32> } func.func @ipowi_exp_two(%arg0: i32, %arg1: vector<4xi32>) -> (i32, vector<4xi32>, i32, vector<4xi32>) { %c1 = arith.constant 2 : i32 %v1 = arith.constant dense <2> : vector<4xi32> %0 = math.ipowi %arg0, %c1 : i32 %1 = math.ipowi %arg1, %v1 : vector<4xi32> %cm1 = arith.constant -2 : i32 %vm1 = arith.constant dense <-2> : vector<4xi32> %2 = math.ipowi %arg0, %cm1 : i32 %3 = math.ipowi %arg1, %vm1 : vector<4xi32> return %0, %1, %2, %3 : i32, vector<4xi32>, i32, vector<4xi32> } func.func @ipowi_exp_three(%arg0: i32, %arg1: vector<4xi32>) -> (i32, vector<4xi32>, i32, vector<4xi32>) { %c1 = arith.constant 3 : i32 %v1 = arith.constant dense <3> : vector<4xi32> %0 = math.ipowi %arg0, %c1 : i32 %1 = math.ipowi %arg1, %v1 : vector<4xi32> %cm1 = arith.constant -3 : i32 %vm1 = arith.constant dense <-3> : vector<4xi32> %2 = math.ipowi %arg0, %cm1 : i32 %3 = math.ipowi %arg1, %vm1 : vector<4xi32> return %0, %1, %2, %3 : i32, vector<4xi32>, i32, vector<4xi32> } func.func @fpowi_zero_exp(%arg0: f32, %arg1: vector<4xf32>) -> (f32, vector<4xf32>) { %c = arith.constant 0 : i32 %v = arith.constant dense <0> : vector<4xi32> %0 = math.fpowi %arg0, %c : f32, i32 %1 = math.fpowi %arg1, %v : vector<4xf32>, vector<4xi32> return %0, %1 : f32, vector<4xf32> } func.func @fpowi_exp_one(%arg0: f32, %arg1: vector<4xf32>) -> (f32, vector<4xf32>, f32, vector<4xf32>) { %c1 = arith.constant 1 : i32 %v1 = arith.constant dense <1> : vector<4xi32> %0 = math.fpowi %arg0, %c1 : f32, i32 %1 = math.fpowi %arg1, %v1 : vector<4xf32>, vector<4xi32> %cm1 = arith.constant -1 : i32 %vm1 = arith.constant dense <-1> : vector<4xi32> %2 = math.fpowi %arg0, %cm1 : f32, i32 %3 = math.fpowi %arg1, %vm1 : vector<4xf32>, vector<4xi32> return %0, %1, %2, %3 : f32, vector<4xf32>, f32, vector<4xf32> } func.func @fpowi_exp_two(%arg0: f32, %arg1: vector<4xf32>) -> (f32, vector<4xf32>, f32, vector<4xf32>) { %c1 = arith.constant 2 : i32 %v1 = arith.constant dense <2> : vector<4xi32> %0 = math.fpowi %arg0, %c1 : f32, i32 %1 = math.fpowi %arg1, %v1 : vector<4xf32>, vector<4xi32> %cm1 = arith.constant -2 : i32 %vm1 = arith.constant dense <-2> : vector<4xi32> %2 = math.fpowi %arg0, %cm1 : f32, i32 %3 = math.fpowi %arg1, %vm1 : vector<4xf32>, vector<4xi32> return %0, %1, %2, %3 : f32, vector<4xf32>, f32, vector<4xf32> } func.func @fpowi_exp_three(%arg0: f32, %arg1: vector<4xf32>) -> (f32, vector<4xf32>, f32, vector<4xf32>) { %c1 = arith.constant 3 : i32 %v1 = arith.constant dense <3> : vector<4xi32> %0 = math.fpowi %arg0, %c1 : f32, i32 %1 = math.fpowi %arg1, %v1 : vector<4xf32>, vector<4xi32> %cm1 = arith.constant -3 : i32 %vm1 = arith.constant dense <-3> : vector<4xi32> %2 = math.fpowi %arg0, %cm1 : f32, i32 %3 = math.fpowi %arg1, %vm1 : vector<4xf32>, vector<4xi32> return %0, %1, %2, %3 : f32, vector<4xf32>, f32, vector<4xf32> }", mlir-opt -test-math-algebraic-simplification ,1 "func.func @ipowi32_fold(%result : memref) { %arg0_base = arith.constant 0 : i32 %arg0_power = arith.constant 0 : i32 %res0 = math.ipowi %arg0_base, %arg0_power : i32 %i0 = arith.constant 0 : index memref.store %res0, %result[%i0] : memref %arg1_base = arith.constant 10 : i32 %arg1_power = arith.constant 0 : i32 %res1 = math.ipowi %arg1_base, %arg1_power : i32 %i1 = arith.constant 1 : index memref.store %res1, %result[%i1] : memref %arg2_base = arith.constant -10 : i32 %arg2_power = arith.constant 0 : i32 %res2 = math.ipowi %arg2_base, %arg2_power : i32 %i2 = arith.constant 2 : index memref.store %res2, %result[%i2] : memref %arg3_base = arith.constant 0 : i32 %arg3_power = arith.constant -1 : i32 %res3 = math.ipowi %arg3_base, %arg3_power : i32 %i3 = arith.constant 3 : index memref.store %res3, %result[%i3] : memref %arg4_base = arith.constant 1 : i32 %arg4_power = arith.constant -10 : i32 %res4 = math.ipowi %arg4_base, %arg4_power : i32 %i4 = arith.constant 4 : index memref.store %res4, %result[%i4] : memref %arg5_base = arith.constant 2 : i32 %arg5_power = arith.constant -1 : i32 %res5 = math.ipowi %arg5_base, %arg5_power : i32 %i5 = arith.constant 5 : index memref.store %res5, %result[%i5] : memref %arg6_base = arith.constant -2 : i32 %arg6_power = arith.constant -1 : i32 %res6 = math.ipowi %arg6_base, %arg6_power : i32 %i6 = arith.constant 6 : index memref.store %res6, %result[%i6] : memref %arg7_base = arith.constant -1 : i32 %arg7_power = arith.constant -10 : i32 %res7 = math.ipowi %arg7_base, %arg7_power : i32 %i7 = arith.constant 7 : index memref.store %res7, %result[%i7] : memref %arg8_base = arith.constant -1 : i32 %arg8_power = arith.constant -11 : i32 %res8 = math.ipowi %arg8_base, %arg8_power : i32 %i8 = arith.constant 8 : index memref.store %res8, %result[%i8] : memref %arg9_base = arith.constant -3 : i32 %arg9_power = arith.constant 3 : i32 %res9 = math.ipowi %arg9_base, %arg9_power : i32 %i9 = arith.constant 9 : index memref.store %res9, %result[%i9] : memref %arg10_base = arith.constant 2 : i32 %arg10_power = arith.constant 30 : i32 %res10 = math.ipowi %arg10_base, %arg10_power : i32 %i10 = arith.constant 10 : index memref.store %res10, %result[%i10] : memref %arg11_base = arith.constant 2 : i32 %arg11_base_vec = vector.splat %arg11_base : vector<2x2xi32> %arg11_power = arith.constant 30 : i32 %arg11_power_vec = vector.splat %arg11_power : vector<2x2xi32> %res11_vec = math.ipowi %arg11_base_vec, %arg11_power_vec : vector<2x2xi32> %i11 = arith.constant 11 : index %res11 = vector.extract %res11_vec[1, 1] : vector<2x2xi32> memref.store %res11, %result[%i11] : memref return } func.func @ipowi64_fold(%result : memref) { %arg0_base = arith.constant 0 : i64 %arg0_power = arith.constant 0 : i64 %res0 = math.ipowi %arg0_base, %arg0_power : i64 %i0 = arith.constant 0 : index memref.store %res0, %result[%i0] : memref %arg1_base = arith.constant 10 : i64 %arg1_power = arith.constant 0 : i64 %res1 = math.ipowi %arg1_base, %arg1_power : i64 %i1 = arith.constant 1 : index memref.store %res1, %result[%i1] : memref %arg2_base = arith.constant -10 : i64 %arg2_power = arith.constant 0 : i64 %res2 = math.ipowi %arg2_base, %arg2_power : i64 %i2 = arith.constant 2 : index memref.store %res2, %result[%i2] : memref %arg3_base = arith.constant 0 : i64 %arg3_power = arith.constant -1 : i64 %res3 = math.ipowi %arg3_base, %arg3_power : i64 %i3 = arith.constant 3 : index memref.store %res3, %result[%i3] : memref %arg4_base = arith.constant 1 : i64 %arg4_power = arith.constant -10 : i64 %res4 = math.ipowi %arg4_base, %arg4_power : i64 %i4 = arith.constant 4 : index memref.store %res4, %result[%i4] : memref %arg5_base = arith.constant 2 : i64 %arg5_power = arith.constant -1 : i64 %res5 = math.ipowi %arg5_base, %arg5_power : i64 %i5 = arith.constant 5 : index memref.store %res5, %result[%i5] : memref %arg6_base = arith.constant -2 : i64 %arg6_power = arith.constant -1 : i64 %res6 = math.ipowi %arg6_base, %arg6_power : i64 %i6 = arith.constant 6 : index memref.store %res6, %result[%i6] : memref %arg7_base = arith.constant -1 : i64 %arg7_power = arith.constant -10 : i64 %res7 = math.ipowi %arg7_base, %arg7_power : i64 %i7 = arith.constant 7 : index memref.store %res7, %result[%i7] : memref %arg8_base = arith.constant -1 : i64 %arg8_power = arith.constant -11 : i64 %res8 = math.ipowi %arg8_base, %arg8_power : i64 %i8 = arith.constant 8 : index memref.store %res8, %result[%i8] : memref %arg9_base = arith.constant -3 : i64 %arg9_power = arith.constant 3 : i64 %res9 = math.ipowi %arg9_base, %arg9_power : i64 %i9 = arith.constant 9 : index memref.store %res9, %result[%i9] : memref %arg10_base = arith.constant 2 : i64 %arg10_power = arith.constant 30 : i64 %res10 = math.ipowi %arg10_base, %arg10_power : i64 %i10 = arith.constant 10 : index memref.store %res10, %result[%i10] : memref %arg11_base = arith.constant 2 : i64 %arg11_power = arith.constant 48 : i64 %res11 = math.ipowi %arg11_base, %arg11_power : i64 %i11 = arith.constant 11 : index memref.store %res11, %result[%i11] : memref return } func.func @ipowi16_fold(%result : memref) { %arg0_base = arith.constant 0 : i16 %arg0_power = arith.constant 0 : i16 %res0 = math.ipowi %arg0_base, %arg0_power : i16 %i0 = arith.constant 0 : index memref.store %res0, %result[%i0] : memref %arg1_base = arith.constant 10 : i16 %arg1_power = arith.constant 0 : i16 %res1 = math.ipowi %arg1_base, %arg1_power : i16 %i1 = arith.constant 1 : index memref.store %res1, %result[%i1] : memref %arg2_base = arith.constant -10 : i16 %arg2_power = arith.constant 0 : i16 %res2 = math.ipowi %arg2_base, %arg2_power : i16 %i2 = arith.constant 2 : index memref.store %res2, %result[%i2] : memref %arg3_base = arith.constant 0 : i16 %arg3_power = arith.constant -1 : i16 %res3 = math.ipowi %arg3_base, %arg3_power : i16 %i3 = arith.constant 3 : index memref.store %res3, %result[%i3] : memref %arg4_base = arith.constant 1 : i16 %arg4_power = arith.constant -10 : i16 %res4 = math.ipowi %arg4_base, %arg4_power : i16 %i4 = arith.constant 4 : index memref.store %res4, %result[%i4] : memref %arg5_base = arith.constant 2 : i16 %arg5_power = arith.constant -1 : i16 %res5 = math.ipowi %arg5_base, %arg5_power : i16 %i5 = arith.constant 5 : index memref.store %res5, %result[%i5] : memref %arg6_base = arith.constant -2 : i16 %arg6_power = arith.constant -1 : i16 %res6 = math.ipowi %arg6_base, %arg6_power : i16 %i6 = arith.constant 6 : index memref.store %res6, %result[%i6] : memref %arg7_base = arith.constant -1 : i16 %arg7_power = arith.constant -10 : i16 %res7 = math.ipowi %arg7_base, %arg7_power : i16 %i7 = arith.constant 7 : index memref.store %res7, %result[%i7] : memref %arg8_base = arith.constant -1 : i16 %arg8_power = arith.constant -11 : i16 %res8 = math.ipowi %arg8_base, %arg8_power : i16 %i8 = arith.constant 8 : index memref.store %res8, %result[%i8] : memref %arg9_base = arith.constant -3 : i16 %arg9_power = arith.constant 3 : i16 %res9 = math.ipowi %arg9_base, %arg9_power : i16 %i9 = arith.constant 9 : index memref.store %res9, %result[%i9] : memref %arg10_base = arith.constant 2 : i16 %arg10_power = arith.constant 14 : i16 %res10 = math.ipowi %arg10_base, %arg10_power : i16 %i10 = arith.constant 10 : index memref.store %res10, %result[%i10] : memref return } func.func @ipowi8_fold(%result : memref) { %arg0_base = arith.constant 0 : i8 %arg0_power = arith.constant 0 : i8 %res0 = math.ipowi %arg0_base, %arg0_power : i8 %i0 = arith.constant 0 : index memref.store %res0, %result[%i0] : memref %arg1_base = arith.constant 10 : i8 %arg1_power = arith.constant 0 : i8 %res1 = math.ipowi %arg1_base, %arg1_power : i8 %i1 = arith.constant 1 : index memref.store %res1, %result[%i1] : memref %arg2_base = arith.constant -10 : i8 %arg2_power = arith.constant 0 : i8 %res2 = math.ipowi %arg2_base, %arg2_power : i8 %i2 = arith.constant 2 : index memref.store %res2, %result[%i2] : memref %arg3_base = arith.constant 0 : i8 %arg3_power = arith.constant -1 : i8 %res3 = math.ipowi %arg3_base, %arg3_power : i8 %i3 = arith.constant 3 : index memref.store %res3, %result[%i3] : memref %arg4_base = arith.constant 1 : i8 %arg4_power = arith.constant -10 : i8 %res4 = math.ipowi %arg4_base, %arg4_power : i8 %i4 = arith.constant 4 : index memref.store %res4, %result[%i4] : memref %arg5_base = arith.constant 2 : i8 %arg5_power = arith.constant -1 : i8 %res5 = math.ipowi %arg5_base, %arg5_power : i8 %i5 = arith.constant 5 : index memref.store %res5, %result[%i5] : memref %arg6_base = arith.constant -2 : i8 %arg6_power = arith.constant -1 : i8 %res6 = math.ipowi %arg6_base, %arg6_power : i8 %i6 = arith.constant 6 : index memref.store %res6, %result[%i6] : memref %arg7_base = arith.constant -1 : i8 %arg7_power = arith.constant -10 : i8 %res7 = math.ipowi %arg7_base, %arg7_power : i8 %i7 = arith.constant 7 : index memref.store %res7, %result[%i7] : memref %arg8_base = arith.constant -1 : i8 %arg8_power = arith.constant -11 : i8 %res8 = math.ipowi %arg8_base, %arg8_power : i8 %i8 = arith.constant 8 : index memref.store %res8, %result[%i8] : memref %arg9_base = arith.constant -3 : i8 %arg9_power = arith.constant 3 : i8 %res9 = math.ipowi %arg9_base, %arg9_power : i8 %i9 = arith.constant 9 : index memref.store %res9, %result[%i9] : memref %arg10_base = arith.constant 2 : i8 %arg10_power = arith.constant 6 : i8 %res10 = math.ipowi %arg10_base, %arg10_power : i8 %i10 = arith.constant 10 : index memref.store %res10, %result[%i10] : memref return }", mlir-opt -canonicalize ,1 """test.some_op_with_region""() ({ ^bb0(%arg0: f64): math.atan %arg0 : f64 ""test.possible_terminator""() : () -> () }) : () -> ()", mlir-opt --mlir-print-op-generic ,1 "func.func @avx512_mask_rndscale(%a: vector<16xf32>, %b: vector<8xf64>, %i32: i32, %i16: i16, %i8: i8) -> (vector<16xf32>, vector<8xf64>, vector<16xf32>, vector<8xf64>) { %0 = x86vector.avx512.mask.rndscale %a, %i32, %a, %i16, %i32: vector<16xf32> %1 = x86vector.avx512.mask.rndscale %b, %i32, %b, %i8, %i32: vector<8xf64> %2 = x86vector.avx512.mask.scalef %a, %a, %a, %i16, %i32: vector<16xf32> %3 = x86vector.avx512.mask.scalef %b, %b, %b, %i8, %i32: vector<8xf64> return %0, %1, %2, %3 : vector<16xf32>, vector<8xf64>, vector<16xf32>, vector<8xf64> } func.func @avx512_mask_compress(%k1: vector<16xi1>, %a1: vector<16xf32>, %k2: vector<8xi1>, %a2: vector<8xi64>) -> (vector<16xf32>, vector<16xf32>, vector<8xi64>) { %0 = x86vector.avx512.mask.compress %k1, %a1 : vector<16xf32> %1 = x86vector.avx512.mask.compress %k1, %a1 {constant_src = dense<5.0> : vector<16xf32>} : vector<16xf32> %2 = x86vector.avx512.mask.compress %k2, %a2, %a2 : vector<8xi64>, vector<8xi64> return %0, %1, %2 : vector<16xf32>, vector<16xf32>, vector<8xi64> } func.func @avx512_vp2intersect(%a: vector<16xi32>, %b: vector<8xi64>) -> (vector<16xi1>, vector<16xi1>, vector<8xi1>, vector<8xi1>) { %0, %1 = x86vector.avx512.vp2intersect %a, %a : vector<16xi32> %2, %3 = x86vector.avx512.vp2intersect %b, %b : vector<8xi64> return %0, %1, %2, %3 : vector<16xi1>, vector<16xi1>, vector<8xi1>, vector<8xi1> } func.func @avx_rsqrt(%a: vector<8xf32>) -> (vector<8xf32>) { %0 = x86vector.avx.rsqrt %a : vector<8xf32> return %0 : vector<8xf32> } func.func @avx_dot(%a: vector<8xf32>, %b: vector<8xf32>) -> (vector<8xf32>) { %0 = x86vector.avx.intr.dot %a, %b : vector<8xf32> return %0 : vector<8xf32> }"," mlir-opt -convert-vector-to-llvm=""enable-x86vector"" | mlir-opt ",1 "func.func @avx512_mask_rndscale(%a: vector<16xf32>, %b: vector<8xf64>, %i32: i32, %i16: i16, %i8: i8) -> (vector<16xf32>, vector<8xf64>) { %0 = x86vector.avx512.mask.rndscale %a, %i32, %a, %i16, %i32 : vector<16xf32> %1 = x86vector.avx512.mask.rndscale %b, %i32, %b, %i8, %i32 : vector<8xf64> return %0, %1: vector<16xf32>, vector<8xf64> } func.func @avx512_scalef(%a: vector<16xf32>, %b: vector<8xf64>, %i32: i32, %i16: i16, %i8: i8) -> (vector<16xf32>, vector<8xf64>) { %0 = x86vector.avx512.mask.scalef %a, %a, %a, %i16, %i32: vector<16xf32> %1 = x86vector.avx512.mask.scalef %b, %b, %b, %i8, %i32 : vector<8xf64> return %0, %1: vector<16xf32>, vector<8xf64> } func.func @avx512_vp2intersect(%a: vector<16xi32>, %b: vector<8xi64>) -> (vector<16xi1>, vector<16xi1>, vector<8xi1>, vector<8xi1>) { %0, %1 = x86vector.avx512.vp2intersect %a, %a : vector<16xi32> %2, %3 = x86vector.avx512.vp2intersect %b, %b : vector<8xi64> return %0, %1, %2, %3 : vector<16xi1>, vector<16xi1>, vector<8xi1>, vector<8xi1> } func.func @avx512_mask_compress(%k1: vector<16xi1>, %a1: vector<16xf32>, %k2: vector<8xi1>, %a2: vector<8xi64>) -> (vector<16xf32>, vector<16xf32>, vector<8xi64>) { %0 = x86vector.avx512.mask.compress %k1, %a1 : vector<16xf32> %1 = x86vector.avx512.mask.compress %k1, %a1 {constant_src = dense<5.0> : vector<16xf32>} : vector<16xf32> %2 = x86vector.avx512.mask.compress %k2, %a2, %a2 : vector<8xi64>, vector<8xi64> return %0, %1, %2 : vector<16xf32>, vector<16xf32>, vector<8xi64> } func.func @avx_rsqrt(%a: vector<8xf32>) -> (vector<8xf32>) { %0 = x86vector.avx.rsqrt %a : vector<8xf32> return %0 : vector<8xf32> } func.func @avx_dot(%a: vector<8xf32>, %b: vector<8xf32>) -> (vector<8xf32>) { %0 = x86vector.avx.intr.dot %a, %b : vector<8xf32> return %0 : vector<8xf32> }", mlir-opt -verify-diagnostics | mlir-opt ,1 "func.func @arm_neon_smull(%a: vector<8xi8>, %b: vector<8xi8>) -> (vector<8xi16>, vector<4xi32>, vector<2xi64>) { %0 = arm_neon.intr.smull %a, %b : vector<8xi8> to vector<8xi16> %00 = vector.extract_strided_slice %0 {offsets = [3], sizes = [4], strides = [1]}: vector<8xi16> to vector<4xi16> %1 = arm_neon.intr.smull %00, %00 : vector<4xi16> to vector<4xi32> %11 = vector.extract_strided_slice %1 {offsets = [1], sizes = [2], strides = [1]}: vector<4xi32> to vector<2xi32> %2 = arm_neon.intr.smull %11, %11 : vector<2xi32> to vector<2xi64> return %0, %1, %2 : vector<8xi16>, vector<4xi32>, vector<2xi64> } func.func @arm_neon_sdot(%a: vector<2xi32>, %b: vector<8xi8>, %c: vector<8xi8>) -> vector<2xi32> { %0 = arm_neon.intr.sdot %a, %b, %c : vector<8xi8>, vector<8xi8> to vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -verify-diagnostics | mlir-opt ,1 "func.func @redundant_scast() -> tensor<4xi8> { %cst = arith.constant dense<5> : tensor<4xi8> %1 = ""quant.scast""(%cst) : (tensor<4xi8>) -> tensor<4x!quant.uniform> %2 = ""quant.scast""(%1) : (tensor<4x!quant.uniform>) -> tensor<4xi8> %3 = arith.addi %2, %2 : tensor<4xi8> return %3 : tensor<4xi8> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "func.func @non_redundant_scast() -> tensor<4x!quant.uniform> { %cst = arith.constant dense<5> : tensor<4xi8> %1 = ""quant.scast""(%cst) : (tensor<4xi8>) -> tensor<4x!quant.uniform> return %1 : tensor<4x!quant.uniform> }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' ,1 "!qalias = !quant.uniform:f32, 0.99872:127> func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform:f32, 0.99872:127 > func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.uniform func.func @parse() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.any:f32> func.func @parseFullySpecified() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.any> func.func @parseNoExpressedType() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.any func.func @parseOnlyStorageType() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "!qalias = !quant.calibrated> func.func @parseCalibrated() -> !qalias { %0 = ""foo""() : () -> !qalias return %0 : !qalias }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "module @parseAnyFullySpecified attributes { bytecode.test = !quant.any:f32> } {} module @parseAnyNoExpressedType attributes { bytecode.test = !quant.any> } {} module @parseAnyOnlyStorageType attributes { bytecode.test = !quant.any> } {} module @parseCalibrated attributes { bytecode.test = !quant.calibrated> } {} module @parseUniformPerLayer attributes { bytecode.test = !quant.uniform:f32, 9.987200e-01:127> } {} module @parseUniformPerAxisScaleZero attributes { bytecode.test = !quant.uniform } {} module @parseUniformPerAxisScaleNoZero attributes { bytecode.test = !quant.uniform } {} module @parseUniformPerAxisMixed attributes { bytecode.test = !quant.uniform } {}", mlir-opt -emit-bytecode | mlir-opt ,1 "pdl.pattern @operation_op : benefit(1) { %root = operation ""foo.op"" rewrite %root { %unused_rewrite = operation ""bar.unused"" erase %root } }"," mlir-opt -canonicalize=""test-convergence"" ",1 "pdl.pattern @operations : benefit(1) { %attribute = attribute %type = type %op0 = operation {""attr"" = %attribute} -> (%type : !pdl.type) %op0_result = pdl.result 0 of %op0 %input = operand %root = operation(%op0_result, %input : !pdl.value, !pdl.value) rewrite %root with ""rewriter"" }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @rewrite_with_args : benefit(1) { %input = operand %root = operation(%input : !pdl.value) rewrite %root with ""rewriter""(%input : !pdl.value) }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @rewrite_multi_root_optimal : benefit(2) { %input1 = operand %input2 = operand %type = type %op1 = operation(%input1 : !pdl.value) -> (%type : !pdl.type) %val1 = result 0 of %op1 %root1 = operation(%val1 : !pdl.value) %op2 = operation(%input2 : !pdl.value) -> (%type : !pdl.type) %val2 = result 0 of %op2 %root2 = operation(%val1, %val2 : !pdl.value, !pdl.value) rewrite with ""rewriter""(%root1, %root2 : !pdl.operation, !pdl.operation) }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @rewrite_multi_root_forced : benefit(2) { %input1 = operand %input2 = operand %type = type %op1 = operation(%input1 : !pdl.value) -> (%type : !pdl.type) %val1 = result 0 of %op1 %root1 = operation(%val1 : !pdl.value) %op2 = operation(%input2 : !pdl.value) -> (%type : !pdl.type) %val2 = result 0 of %op2 %root2 = operation(%val1, %val2 : !pdl.value, !pdl.value) rewrite %root1 with ""rewriter""(%root2 : !pdl.operation) }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @infer_type_from_operation_replace : benefit(1) { %type1 = type : i32 %type2 = type %root = operation -> (%type1, %type2 : !pdl.type, !pdl.type) rewrite %root { %type3 = type %newOp = operation ""foo.op"" -> (%type1, %type3 : !pdl.type, !pdl.type) replace %root with %newOp } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @infer_type_from_type_used_in_match : benefit(1) { %type1 = type : i32 %type2 = type %root = operation -> (%type1, %type2 : !pdl.type, !pdl.type) rewrite %root { %newOp = operation ""foo.op"" -> (%type1, %type2 : !pdl.type, !pdl.type) } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @infer_type_from_type_used_in_match : benefit(1) { %types = types %root = operation -> (%types : !pdl.range) rewrite %root { %otherTypes = types : [i32, i64] %newOp = operation ""foo.op"" -> (%types, %otherTypes : !pdl.range, !pdl.range) } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @infer_type_from_type_used_in_match : benefit(1) { %type1 = type %type2 = type %operand1 = operand : %type1 %operand2 = operand : %type2 %root = operation (%operand1, %operand2 : !pdl.value, !pdl.value) rewrite %root { %newOp = operation ""foo.op"" -> (%type1, %type2 : !pdl.type, !pdl.type) } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @infer_type_from_type_used_in_match : benefit(1) { %types = types %operands = operands : %types %root = operation (%operands : !pdl.range) rewrite %root { %newOp = operation ""foo.op"" -> (%types : !pdl.range) } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @apply_rewrite_with_no_results : benefit(1) { %root = operation rewrite %root { apply_native_rewrite ""NativeRewrite""(%root : !pdl.operation) } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @attribute_with_dict : benefit(1) { %root = operation rewrite %root { %attr = attribute = {some_unit_attr} attributes {pdl.special_attribute} apply_native_rewrite ""NativeRewrite""(%attr : !pdl.attribute) } }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "pdl.pattern @attribute_with_loc : benefit(1) { %attr = attribute loc(""bar"") %root = operation {""attribute"" = %attr} rewrite %root with ""rewriter"" }"," mlir-opt -split-input-file | mlir-opt // RUN: mlir-opt -split-input-file -mlir-print-op-generic -mlir-print-local-scope ",1 "func.func @known_oob_load(%arg0: memref<4xf32>) -> f32 { %c4_i32 = arith.constant 4 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c4_i32] : memref<4xf32>, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @known_oob_load_2d(%arg0: memref<4x4xf32>) -> f32 { %c0_i32 = arith.constant 0 : i32 %c4_i32 = arith.constant 4 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c4_i32, %c0_i32] : memref<4x4xf32>, i32, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @known_oob_load_2d_on_last(%arg0: memref<4x4xf32>) -> f32 { %c0_i32 = arith.constant 0 : i32 %c16_i32 = arith.constant 16 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c0_i32, %c16_i32] : memref<4x4xf32>, i32, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @known_oob_load_index(%arg0: memref<4xf32>) -> f32 { %c0_i32 = arith.constant 0 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 4 : i32} %arg0[%c0_i32] : memref<4xf32>, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @known_oob_load_sgproffset(%arg0: memref<4xf32>) -> f32 { %c2_i32 = arith.constant 2 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c2_i32] sgprOffset %c2_i32 : memref<4xf32>, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unknown_load(%arg0: memref<4xf32>, %arg1: i32) -> f32 { %c4_i32 = arith.constant 4 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%arg1] sgprOffset %c4_i32 : memref<4xf32>, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unknown_load_sgproffset(%arg0: memref<4xf32>, %arg1: i32) -> f32 { %c4_i32 = arith.constant 4 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c4_i32] sgprOffset %arg1 : memref<4xf32>, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unranked(%arg0: memref) -> f32 { %c4_i32 = arith.constant 4 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c4_i32] : memref, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @no_oob_check(%arg0: memref<4xf32>) -> f32 { %c4_i32 = arith.constant 4 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = false} %arg0[%c4_i32] : memref<4xf32>, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @in_bounds_overall(%arg0: memref<4x4xf32>) -> f32 { %c0_i32 = arith.constant 0 : i32 %c15_i32 = arith.constant 15 : i32 %0 = amdgpu.raw_buffer_load {boundsCheck = true} %arg0[%c0_i32, %c15_i32] : memref<4x4xf32>, i32, i32 -> f32 func.return %0 : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dead_store(%arg0: memref<4xf32>, %arg1: f32) { %c4_i32 = arith.constant 4 : i32 amdgpu.raw_buffer_store {boundsCheck = true} %arg1 -> %arg0[%c4_i32] : f32 -> memref<4xf32>, i32 func.return }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dead_atomic_add(%arg0: memref<4xf32>, %arg1: f32) { %c4_i32 = arith.constant 4 : i32 amdgpu.raw_buffer_atomic_fadd {boundsCheck = true} %arg1 -> %arg0[%c4_i32] : f32 -> memref<4xf32>, i32 func.return }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @atomic_fmax(%val: f32, %buffer: memref, %idx: i32) { gpu.printf ""Begin\n"" amdgpu.raw_buffer_atomic_fmax {foo, indexOffset = 4 : i32} %val -> %buffer[%idx] : f32 -> memref, i32 gpu.printf ""End\n"" func.return }", mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx90a ,1 "func.func @atomic_fmax(%val: f32, %buffer: memref, %idx: i32) { gpu.printf ""Begin\n"" amdgpu.raw_buffer_atomic_fmax {foo, indexOffset = 4 : i32} %val -> %buffer[%idx] : f32 -> memref, i32 gpu.printf ""End\n"" func.return }", mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx1030 ,1 "func.func @atomic_fmax_f64(%val: f64, %buffer: memref, %idx: i32) { gpu.printf ""Begin\n"" amdgpu.raw_buffer_atomic_fmax %val -> %buffer[%idx] : f64 -> memref, i32 gpu.printf ""End\n"" func.return }", mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx90a ,1 "func.func @atomic_fmax_f64(%val: f64, %buffer: memref, %idx: i32) { gpu.printf ""Begin\n"" amdgpu.raw_buffer_atomic_fmax %val -> %buffer[%idx] : f64 -> memref, i32 gpu.printf ""End\n"" func.return }", mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx1030 ,1 "func.func @atomic_fadd(%val: f32, %buffer: memref, %idx: i32) { amdgpu.raw_buffer_atomic_fadd %val -> %buffer[%idx] : f32 -> memref, i32 func.return }", mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx90a ,1 "func.func @atomic_fadd(%val: f32, %buffer: memref, %idx: i32) { amdgpu.raw_buffer_atomic_fadd %val -> %buffer[%idx] : f32 -> memref, i32 func.return }", mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx1030 ,1 "func.func @raw_buffer_load_f32_from_rank_1(%src : memref<128xf32>, %offset : i32, %idx0 : i32) -> f32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0] sgprOffset %offset : memref<128xf32>, i32 -> f32 func.return %0 : f32 } func.func @raw_buffer_load_f32_from_rank_4(%src : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) -> f32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : memref<128x64x32x16xf32>, i32, i32, i32, i32 -> f32 func.return %0 : f32 } func.func @raw_buffer_load_scalar(%src : memref) -> f32 { %0 = amdgpu.raw_buffer_load {indexOffset = 1 : i32} %src[] : memref -> f32 func.return %0 : f32 } func.func @raw_buffer_load_4xf32_from_rank_4(%src : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) -> vector<4xf32> { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : memref<128x64x32x16xf32>, i32, i32, i32, i32 -> vector<4xf32> func.return %0 : vector<4xf32> } func.func @raw_buffer_store_f32_to_rank_1(%value : f32, %dst : memref<128xf32>, %offset : i32, %idx0 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0] sgprOffset %offset : f32 -> memref<128xf32>, i32 func.return } func.func @raw_buffer_store_f32_to_rank_4(%value : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_store_4xf32_to_rank_4(%value : vector<4xf32>, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : vector<4xf32> -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_store_scalar(%value : f32, %dst : memref) { amdgpu.raw_buffer_store {indexOffset = 1 : i32} %value -> %dst[] : f32 -> memref func.return } func.func @raw_buffer_atomic_fadd_f32_to_rank_1(%value : f32, %dst : memref<128xf32>, %offset : i32, %idx0 : i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0] sgprOffset %offset : f32 -> memref<128xf32>, i32 func.return } func.func @raw_buffer_atomic_fadd_f32_to_rank_4(%value : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_atomic_cmpswap_f32(%src : f32, %cmp : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true, indexOffset = 1 : i32} %src, %cmp -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @lds_barrier() { amdgpu.lds_barrier func.return } func.func @mfma(%arg0 : f32, %arg1 : vector<32xf32>) -> vector<32xf32> { %0 = amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 1 : i32, cbsz = 1 : i32, k = 1 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32> func.return %0 : vector<32xf32> }", mlir-opt -allow-unregistered-dialect ,1 "func.func @raw_buffer_load_f32_from_rank_1(%src : memref<128xf32>, %offset : i32, %idx0 : i32) -> f32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0] sgprOffset %offset : memref<128xf32>, i32 -> f32 func.return %0 : f32 } func.func @raw_buffer_load_f32_from_rank_4(%src : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) -> f32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : memref<128x64x32x16xf32>, i32, i32, i32, i32 -> f32 func.return %0 : f32 } func.func @raw_buffer_load_scalar(%src : memref) -> f32 { %0 = amdgpu.raw_buffer_load {indexOffset = 1 : i32} %src[] : memref -> f32 func.return %0 : f32 } func.func @raw_buffer_load_4xf32_from_rank_4(%src : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) -> vector<4xf32> { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : memref<128x64x32x16xf32>, i32, i32, i32, i32 -> vector<4xf32> func.return %0 : vector<4xf32> } func.func @raw_buffer_store_f32_to_rank_1(%value : f32, %dst : memref<128xf32>, %offset : i32, %idx0 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0] sgprOffset %offset : f32 -> memref<128xf32>, i32 func.return } func.func @raw_buffer_store_f32_to_rank_4(%value : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_store_4xf32_to_rank_4(%value : vector<4xf32>, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : vector<4xf32> -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_store_scalar(%value : f32, %dst : memref) { amdgpu.raw_buffer_store {indexOffset = 1 : i32} %value -> %dst[] : f32 -> memref func.return } func.func @raw_buffer_atomic_fadd_f32_to_rank_1(%value : f32, %dst : memref<128xf32>, %offset : i32, %idx0 : i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0] sgprOffset %offset : f32 -> memref<128xf32>, i32 func.return } func.func @raw_buffer_atomic_fadd_f32_to_rank_4(%value : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_atomic_cmpswap_f32(%src : f32, %cmp : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true, indexOffset = 1 : i32} %src, %cmp -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @lds_barrier() { amdgpu.lds_barrier func.return } func.func @mfma(%arg0 : f32, %arg1 : vector<32xf32>) -> vector<32xf32> { %0 = amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 1 : i32, cbsz = 1 : i32, k = 1 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32> func.return %0 : vector<32xf32> }", mlir-opt -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect ,1 "func.func @raw_buffer_load_f32_from_rank_1(%src : memref<128xf32>, %offset : i32, %idx0 : i32) -> f32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0] sgprOffset %offset : memref<128xf32>, i32 -> f32 func.return %0 : f32 } func.func @raw_buffer_load_f32_from_rank_4(%src : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) -> f32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : memref<128x64x32x16xf32>, i32, i32, i32, i32 -> f32 func.return %0 : f32 } func.func @raw_buffer_load_scalar(%src : memref) -> f32 { %0 = amdgpu.raw_buffer_load {indexOffset = 1 : i32} %src[] : memref -> f32 func.return %0 : f32 } func.func @raw_buffer_load_4xf32_from_rank_4(%src : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) -> vector<4xf32> { %0 = amdgpu.raw_buffer_load {boundsCheck = true, indexOffset = 1 : i32} %src[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : memref<128x64x32x16xf32>, i32, i32, i32, i32 -> vector<4xf32> func.return %0 : vector<4xf32> } func.func @raw_buffer_store_f32_to_rank_1(%value : f32, %dst : memref<128xf32>, %offset : i32, %idx0 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0] sgprOffset %offset : f32 -> memref<128xf32>, i32 func.return } func.func @raw_buffer_store_f32_to_rank_4(%value : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_store_4xf32_to_rank_4(%value : vector<4xf32>, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_store {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : vector<4xf32> -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_store_scalar(%value : f32, %dst : memref) { amdgpu.raw_buffer_store {indexOffset = 1 : i32} %value -> %dst[] : f32 -> memref func.return } func.func @raw_buffer_atomic_fadd_f32_to_rank_1(%value : f32, %dst : memref<128xf32>, %offset : i32, %idx0 : i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0] sgprOffset %offset : f32 -> memref<128xf32>, i32 func.return } func.func @raw_buffer_atomic_fadd_f32_to_rank_4(%value : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true, indexOffset = 1 : i32} %value -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @raw_buffer_atomic_cmpswap_f32(%src : f32, %cmp : f32, %dst : memref<128x64x32x16xf32>, %offset : i32, %idx0 : i32, %idx1 : i32, %idx2 : i32, %idx3 : i32) { amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true, indexOffset = 1 : i32} %src, %cmp -> %dst[%idx0, %idx1, %idx2, %idx3] sgprOffset %offset : f32 -> memref<128x64x32x16xf32>, i32, i32, i32, i32 func.return } func.func @lds_barrier() { amdgpu.lds_barrier func.return } func.func @mfma(%arg0 : f32, %arg1 : vector<32xf32>) -> vector<32xf32> { %0 = amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 1 : i32, cbsz = 1 : i32, k = 1 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32> func.return %0 : vector<32xf32> }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic | mlir-opt -allow-unregistered-dialect ,1 "func.func @num_worker_threads(%arg0: memref) { %lb = arith.constant 0 : index %ub = arith.constant 100 : index %st = arith.constant 1 : index scf.parallel (%i) = (%lb) to (%ub) step (%st) { %one = arith.constant 1.0 : f32 memref.store %one, %arg0[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=num-workers=-1 ,1 "func.func @token_await(%arg0: !async.token) { async.runtime.await %arg0 : !async.token return } func.func @group_await(%arg0: !async.group) { async.runtime.await %arg0 : !async.group return } func.func @add_token_to_group(%arg0: !async.group, %arg1: !async.token) { async.runtime.add_to_group %arg1, %arg0 : !async.token return } func.func @value_load(%arg0: !async.value) { %0 = async.runtime.load %arg0 : !async.value return } func.func @error_check(%arg0: !async.token) { %0 = async.runtime.is_error %arg0 : !async.token return }", mlir-opt -async-runtime-policy-based-ref-counting ,1 "func.func private @token() -> !async.token func.func private @cond() -> i1 func.func private @take_token(%arg0: !async.token) func.func @token_arg_no_uses(%arg0: !async.token) { return } func.func @token_value_no_uses() { %0 = async.runtime.create : !async.token return } func.func @token_returned_no_uses() { %0 = call @token() : () -> !async.token return } func.func @token_arg_to_func(%arg0: !async.token) { call @take_token(%arg0): (!async.token) -> () return } func.func @token_value_to_func() { %0 = async.runtime.create : !async.token call @take_token(%0): (!async.token) -> () return } func.func @token_arg_cond_br_await_with_fallthough(%arg0: !async.token, %arg1: i1) { cf.cond_br %arg1, ^bb1, ^bb2 ^bb1: cf.br ^bb2 ^bb2: async.runtime.await %arg0 : !async.token return } func.func @token_simple_return() -> !async.token { %token = async.runtime.create : !async.token return %token : !async.token } func.func @token_coro_return() -> !async.token { %token = async.runtime.create : !async.token %id = async.coro.id %hdl = async.coro.begin %id %saved = async.coro.save %hdl async.runtime.resume %hdl async.coro.suspend %saved, ^suspend, ^resume, ^cleanup ^resume: cf.br ^cleanup ^cleanup: async.coro.free %id, %hdl cf.br ^suspend ^suspend: async.coro.end %hdl return %token : !async.token } func.func @token_coro_await_and_resume(%arg0: !async.token) -> !async.token { %token = async.runtime.create : !async.token %id = async.coro.id %hdl = async.coro.begin %id %saved = async.coro.save %hdl async.runtime.await_and_resume %arg0, %hdl : !async.token async.coro.suspend %saved, ^suspend, ^resume, ^cleanup ^resume: cf.br ^cleanup ^cleanup: async.coro.free %id, %hdl cf.br ^suspend ^suspend: async.coro.end %hdl return %token : !async.token } func.func @value_coro_await_and_resume(%arg0: !async.value) -> !async.token { %token = async.runtime.create : !async.token %id = async.coro.id %hdl = async.coro.begin %id %saved = async.coro.save %hdl async.runtime.await_and_resume %arg0, %hdl : !async.value async.coro.suspend %saved, ^suspend, ^resume, ^cleanup ^resume: %0 = async.runtime.load %arg0 : !async.value %1 = arith.addf %0, %0 : f32 cf.br ^cleanup ^cleanup: async.coro.free %id, %hdl cf.br ^suspend ^suspend: async.coro.end %hdl return %token : !async.token } func.func private @outlined_async_execute(%arg0: !async.token) -> !async.token { %0 = async.runtime.create : !async.token %1 = async.coro.id %2 = async.coro.begin %1 %3 = async.coro.save %2 async.runtime.resume %2 async.coro.suspend %3, ^suspend, ^resume, ^cleanup ^resume: %4 = async.coro.save %2 async.runtime.await_and_resume %arg0, %2 : !async.token async.coro.suspend %4, ^suspend, ^resume_1, ^cleanup ^resume_1: async.runtime.set_available %0 : !async.token cf.br ^cleanup ^cleanup: async.coro.free %1, %2 cf.br ^suspend ^suspend: async.coro.end %2 return %0 : !async.token } func.func @token_await_inside_nested_region(%arg0: i1) { %token = call @token() : () -> !async.token scf.if %arg0 { async.runtime.await %token : !async.token } return } func.func @token_defined_in_the_loop() { cf.br ^bb1 ^bb1: %token = call @token() : () -> !async.token async.runtime.await %token : !async.token %0 = call @cond(): () -> (i1) cf.cond_br %0, ^bb1, ^bb2 ^bb2: return } func.func @divergent_liveness_one_token(%arg0 : i1) { %token = call @token() : () -> !async.token cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: async.runtime.await %token : !async.token cf.br ^bb2 ^bb2: return } func.func @divergent_liveness_unique_predecessor(%arg0 : i1) { %token = call @token() : () -> !async.token cf.cond_br %arg0, ^bb2, ^bb1 ^bb1: cf.br ^bb3 ^bb2: async.runtime.await %token : !async.token cf.br ^bb3 ^bb3: return } func.func @divergent_liveness_two_tokens(%arg0 : i1) { %token0 = call @token() : () -> !async.token %token1 = call @token() : () -> !async.token cf.cond_br %arg0, ^await0, ^await1 ^await0: async.runtime.await %token0 : !async.token cf.br ^ret ^await1: async.runtime.await %token1 : !async.token cf.br ^ret ^ret: return }", mlir-opt -async-runtime-ref-counting ,1 "func.func @identity_token(%arg0: !async.token) -> !async.token { return %arg0 : !async.token } func.func @identity_value(%arg0 : !async.value) -> !async.value { return %arg0 : !async.value } func.func @empty_async_execute() -> !async.token { %token = async.execute { async.yield } return %token : !async.token } func.func @return_async_value() -> !async.value { %token, %bodyResults = async.execute -> !async.value { %cst = arith.constant 1.000000e+00 : f32 async.yield %cst : f32 } return %bodyResults : !async.value } func.func @return_captured_value() -> !async.token { %cst = arith.constant 1.000000e+00 : f32 %token, %results = async.execute -> !async.value { async.yield %cst : f32 } return %token : !async.token } func.func @return_async_values() -> (!async.value, !async.value) { %token, %bodyResults:2 = async.execute -> (!async.value, !async.value) { %cst1 = arith.constant 1.000000e+00 : f32 %cst2 = arith.constant 2.000000e+00 : f32 async.yield %cst1, %cst2 : f32, f32 } return %bodyResults#0, %bodyResults#1 : !async.value, !async.value } func.func @async_token_dependencies(%arg0: !async.token) -> !async.token { %token = async.execute [%arg0] { async.yield } return %token : !async.token } func.func @async_value_operands(%arg0: !async.value) -> !async.token { %token, %results = async.execute (%arg0 as %arg1: !async.value) -> !async.value { async.yield %arg1 : f32 } return %token : !async.token } func.func @async_token_and_value_operands(%arg0: !async.token, %arg1: !async.value) -> !async.token { %token, %results = async.execute [%arg0] (%arg1 as %arg2: !async.value) -> !async.value { async.yield %arg2 : f32 } return %token : !async.token } func.func @empty_tokens_or_values_operands() { %token0 = async.execute [] () -> () { async.yield } %token1 = async.execute () -> () { async.yield } %token2 = async.execute -> () { async.yield } %token3 = async.execute () { async.yield } %token4 = async.execute [] { async.yield } return } func.func @await_token(%arg0: !async.token) { async.await %arg0 : !async.token return } func.func @await_value(%arg0: !async.value) -> f32 { %0 = async.await %arg0 : !async.value return %0 : f32 } func.func @create_group_and_await_all(%arg0: !async.token, %arg1: !async.value) -> index { %c = arith.constant 2 : index %0 = async.create_group %c : !async.group %1 = async.add_to_group %arg0, %0 : !async.token %2 = async.add_to_group %arg1, %0 : !async.value async.await_all %0 %3 = arith.addi %1, %2 : index return %3 : index } async.func @async_func_return_token() -> !async.token { return } async.func @async_func_return_value() -> !async.value { %0 = arith.constant 42 : i32 return %0 : i32 } async.func @async_func_return_optional_token() -> (!async.token, !async.value) { %0 = arith.constant 42 : i32 return %0 : i32 } func.func @async_call() { %0 = async.call @async_func_return_token() : () -> !async.token %1 = async.call @async_func_return_value() : () -> !async.value %2, %3 = async.call @async_func_return_optional_token() : () -> (!async.token, !async.value) return }", mlir-opt ,1 "func.func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref) { scf.parallel (%i) = (%arg0) to (%arg1) step (%arg2) { %one = arith.constant 1.0 : f32 memref.store %one, %arg3[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=false ,1 "func.func @loop_2d(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index, %arg6: memref) { scf.parallel (%i0, %i1) = (%arg0, %arg3) to (%arg1, %arg4) step (%arg2, %arg5) { %one = arith.constant 1.0 : f32 memref.store %one, %arg6[%i0, %i1] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=false ,1 "func.func @loop_1d(%arg0: index, %arg1: index, %arg2: index, %arg3: memref) { scf.parallel (%i) = (%arg0) to (%arg1) step (%arg2) { %one = arith.constant 1.0 : f32 memref.store %one, %arg3[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=true ,1 "func.func @loop_2d(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index, %arg6: memref) { scf.parallel (%i0, %i1) = (%arg0, %arg3) to (%arg1, %arg4) step (%arg2, %arg5) { %one = arith.constant 1.0 : f32 memref.store %one, %arg6[%i0, %i1] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=true ,1 "func.func @create_token() -> !async.token { %0 = async.runtime.create : !async.token return %0 : !async.token } func.func @create_value() -> !async.value { %0 = async.runtime.create : !async.value return %0 : !async.value } func.func @create_group() -> !async.group { %c = arith.constant 10 : index %0 = async.runtime.create_group %c : !async.group return %0 : !async.group } func.func @set_token_available(%arg0: !async.token) { async.runtime.set_available %arg0 : !async.token return } func.func @set_value_available(%arg0: !async.value) { async.runtime.set_available %arg0 : !async.value return } func.func @set_token_error(%arg0: !async.token) { async.runtime.set_error %arg0 : !async.token return } func.func @set_value_error(%arg0: !async.value) { async.runtime.set_error %arg0 : !async.value return } func.func @is_token_error(%arg0: !async.token) -> i1 { %0 = async.runtime.is_error %arg0 : !async.token return %0 : i1 } func.func @is_value_error(%arg0: !async.value) -> i1 { %0 = async.runtime.is_error %arg0 : !async.value return %0 : i1 } func.func @is_group_error(%arg0: !async.group) -> i1 { %0 = async.runtime.is_error %arg0 : !async.group return %0 : i1 } func.func @await_token(%arg0: !async.token) { async.runtime.await %arg0 : !async.token return } func.func @await_value(%arg0: !async.value) { async.runtime.await %arg0 : !async.value return } func.func @await_group(%arg0: !async.group) { async.runtime.await %arg0 : !async.group return } func.func @await_and_resume_token(%arg0: !async.token, %arg1: !async.coro.handle) { async.runtime.await_and_resume %arg0, %arg1 : !async.token return } func.func @await_and_resume_value(%arg0: !async.value, %arg1: !async.coro.handle) { async.runtime.await_and_resume %arg0, %arg1 : !async.value return } func.func @await_and_resume_group(%arg0: !async.group, %arg1: !async.coro.handle) { async.runtime.await_and_resume %arg0, %arg1 : !async.group return } func.func @resume(%arg0: !async.coro.handle) { async.runtime.resume %arg0 return } func.func @store(%arg0: f32, %arg1: !async.value) { async.runtime.store %arg0, %arg1 : return } func.func @load(%arg0: !async.value) -> f32 { %0 = async.runtime.load %arg0 : return %0 : f32 } func.func @add_to_group(%arg0: !async.token, %arg1: !async.value, %arg2: !async.group) { async.runtime.add_to_group %arg0, %arg2 : !async.token async.runtime.add_to_group %arg1, %arg2 : !async.value return } func.func @add_ref(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token return } func.func @drop_ref(%arg0: !async.token) { async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token return }", mlir-opt ,1 "func.func @coro_id() -> !async.coro.id { %0 = async.coro.id return %0 : !async.coro.id } func.func @coro_handle(%arg0: !async.coro.id) -> !async.coro.handle { %0 = async.coro.begin %arg0 return %0 : !async.coro.handle } func.func @coro_free(%arg0: !async.coro.id, %arg1: !async.coro.handle) { async.coro.free %arg0, %arg1 return } func.func @coro_end(%arg0: !async.coro.handle) { async.coro.end %arg0 return } func.func @coro_save(%arg0: !async.coro.handle) -> !async.coro.state { %0 = async.coro.save %arg0 return %0 : !async.coro.state } func.func @coro_suspend(%arg0: !async.coro.state) { async.coro.suspend %arg0, ^suspend, ^resume, ^cleanup ^resume: return { coro.resume } ^cleanup: return { coro.cleanup } ^suspend: return { coro.suspend } }", mlir-opt ,1 "func.func @clone_constant(%arg0: memref, %lb: index, %ub: index, %st: index) { %one = arith.constant 1.0 : f32 scf.parallel (%i) = (%lb) to (%ub) step (%st) { memref.store %one, %arg0[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=true ,1 "func.func @clone_constant(%arg0: memref, %lb: index, %ub: index, %st: index) { %one = arith.constant 1.0 : f32 scf.parallel (%i) = (%lb) to (%ub) step (%st) { memref.store %one, %arg0[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=false -canonicalize -inline -symbol-dce ,1 "func.func @sink_constant_step(%arg0: memref, %lb: index, %ub: index) { %one = arith.constant 1.0 : f32 %st = arith.constant 123 : index scf.parallel (%i) = (%lb) to (%ub) step (%st) { memref.store %one, %arg0[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=true ,1 "func.func @sink_constant_step(%arg0: memref, %lb: index, %ub: index) { %one = arith.constant 1.0 : f32 %st = arith.constant 123 : index scf.parallel (%i) = (%lb) to (%ub) step (%st) { memref.store %one, %arg0[%i] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=false -canonicalize -inline -symbol-dce ,1 "func.func @sink_constant_step(%arg0: memref, %lb: index, %ub: index) { %one = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.parallel (%i, %j) = (%lb, %c0) to (%ub, %c10) step (%c1, %c1) { memref.store %one, %arg0[%i, %j] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=true ,1 "func.func @sink_constant_step(%arg0: memref, %lb: index, %ub: index) { %one = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.parallel (%i, %j) = (%lb, %c0) to (%ub, %c10) step (%c1, %c1) { memref.store %one, %arg0[%i, %j] : memref } return }", mlir-opt -split-input-file -async-parallel-for=async-dispatch=false -canonicalize -inline -symbol-dce ,1 "func.func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) { %token = async.execute { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } async.await %token : !async.token return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) { %token0 = async.execute { %c0 = arith.constant 0 : index %token1 = async.execute { %c1 = arith.constant 1: index memref.store %arg0, %arg2[%c0] : memref<1xf32> async.yield } async.await %token1 : !async.token memref.store %arg1, %arg2[%c0] : memref<1xf32> async.yield } async.await %token0 : !async.token return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) { %token = async.execute { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } %token_0 = async.execute [%token] { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @async_group_await_all(%arg0: f32, %arg1: memref<1xf32>) { %c = arith.constant 1 : index %0 = async.create_group %c : !async.group %token = async.execute { async.yield } async.add_to_group %token, %0 : !async.token async.execute { async.await_all %0 async.yield } async.await_all %0 return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @execute_and_return_f32() -> f32 { %token, %result = async.execute -> !async.value { %c0 = arith.constant 123.0 : f32 async.yield %c0 : f32 } %0 = async.await %result : !async.value return %0 : f32 }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @async_value_operands() { %token, %result = async.execute -> !async.value { %c0 = arith.constant 123.0 : f32 async.yield %c0 : f32 } %token0 = async.execute(%result as %value: !async.value) { %0 = arith.addf %value, %value : f32 async.yield } async.await %token0 : !async.token return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @execute_assertion(%arg0: i1) { %token = async.execute { cf.assert %arg0, ""error"" async.yield } async.await %token : !async.token return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @lower_scf_to_cfg(%arg0: f32, %arg1: memref<1xf32>, %arg2: i1) { %token0 = async.execute { async.yield } %token1 = async.execute { scf.if %arg2 { async.await %token0 : !async.token } else { async.await %token0 : !async.token } async.yield } return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func @clone_constants(%arg0: f32, %arg1: memref<1xf32>) { %c0 = arith.constant 0 : index %token = async.execute { memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } async.await %token : !async.token return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "async.func @async_func_await(%arg0: f32, %arg1: !async.value) -> !async.token { %0 = async.await %arg1 : !async.value return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "async.func @execute_in_async_func(%arg0: f32, %arg1: memref<1xf32>) -> !async.token { %token = async.execute { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } async.await %token : !async.token return }", mlir-opt -split-input-file -async-func-to-async-runtime -async-to-async-runtime ,1 "func.func private @consume_token(%arg0: !async.token) func.func @cancellable_operations_0(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token return } func.func @cancellable_operations_1(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token call @consume_token(%arg0): (!async.token) -> () async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token return } func.func @cancellable_operations_2(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token async.runtime.await %arg0 : !async.token async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token async.runtime.await %arg0 : !async.token async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token async.runtime.await %arg0 : !async.token async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token return } func.func @cancellable_operations_3(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token call @consume_token(%arg0): (!async.token) -> () async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token async.runtime.await %arg0 : !async.token return } func.func @not_cancellable_operations_0(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token call @consume_token(%arg0): (!async.token) -> () async.runtime.await %arg0 : !async.token async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token return }", mlir-opt -async-runtime-ref-counting-opt ,1 "func.func @loop_1d(%arg0: memref) { %lb = arith.constant 0 : index %ub = arith.constant 100 : index %st = arith.constant 1 : index scf.parallel (%i) = (%lb) to (%ub) step (%st) { %one = arith.constant 1.0 : f32 memref.store %one, %arg0[%i] : memref } return }", mlir-opt -async-parallel-for=async-dispatch=true -canonicalize -inline -symbol-dce ,1 "func.func @loop_1d(%arg0: memref) { %lb = arith.constant 0 : index %ub = arith.constant 100 : index %st = arith.constant 1 : index scf.parallel (%i) = (%lb) to (%ub) step (%st) { %one = arith.constant 1.0 : f32 memref.store %one, %arg0[%i] : memref } return }", mlir-opt -async-parallel-for=async-dispatch=false -canonicalize -inline -symbol-dce ,1 "func.func @no_op(%arg0: !async.token) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @wrong_async_await_arg_type(%arg0: f32) { async.await %arg0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @wrong_async_await_result_type(%arg0: !async.value) { %0 = ""async.await""(%arg0): (!async.value) -> f64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "async.func @wrong_async_func_void_result_type(%arg0: f32) { return }", mlir-opt -split-input-file -verify-diagnostics ,1 "async.func @wrong_async_func_result_type(%arg0: f32) -> f32 { return %arg0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "async.func @wrong_async_func_token_type_placement(%arg0: f32) -> (!async.value, !async.token) { return %arg0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "async.func @wrong_async_func_return_type(%arg0: f32) -> (!async.token, !async.value) { return %arg0 : f32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @transpose_fold(%arg0: tensor<3x4xf32>) -> tensor<3x4xf32> { %0 = arith.constant dense<[0, 1]> : tensor<2xi32> %1 = ""tosa.transpose""(%arg0, %0) { perms = [1, 0] }: (tensor<3x4xf32>, tensor<2xi32>) -> tensor<3x4xf32> return %1 : tensor<3x4xf32> } func.func @transpose_nofold(%arg0: tensor<3x3xf32>) -> tensor<3x3xf32> { %0 = arith.constant dense<[1, 0]> : tensor<2xi32> %1 = ""tosa.transpose""(%arg0, %0) { perms = [1, 0] }: (tensor<3x3xf32>, tensor<2xi32>) -> tensor<3x3xf32> return %1 : tensor<3x3xf32> } func.func @transpose_nofold_shape(%arg0: tensor<3x4xf32>) -> tensor { %0 = arith.constant dense<[1, 0]> : tensor<2xi32> %1 = ""tosa.transpose""(%arg0, %0) { perms = [1, 0] }: (tensor<3x4xf32>, tensor<2xi32>) -> tensor return %1 : tensor } func.func @transpose_fold_splat() -> tensor<3x2xf32> { %input = ""tosa.const""() {value = dense<4.0> : tensor<2x3xf32>} : () -> tensor<2x3xf32> %perms = ""tosa.const""() {value = dense<[1, 0]> : tensor<2xi32>} : () -> tensor<2xi32> %1 = ""tosa.transpose""(%input, %perms) : (tensor<2x3xf32>, tensor<2xi32>) -> tensor<3x2xf32> return %1 : tensor<3x2xf32> } func.func @transpose_fold_2d_float() -> tensor<3x2xf32> { %input = ""tosa.const""() {value = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf32>} : () -> tensor<2x3xf32> %perms = ""tosa.const""() {value = dense<[1, 0]> : tensor<2xi32>} : () -> tensor<2xi32> %1 = ""tosa.transpose""(%input, %perms) : (tensor<2x3xf32>, tensor<2xi32>) -> tensor<3x2xf32> return %1 : tensor<3x2xf32> } func.func @transpose_fold_2d_bool() -> tensor<3x2xi1> { %input = ""tosa.const""() {value = dense<[[true, false, false], [false, false, true]]> : tensor<2x3xi1>} : () -> tensor<2x3xi1> %perms = ""tosa.const""() {value = dense<[1, 0]> : tensor<2xi32>} : () -> tensor<2xi32> %1 = ""tosa.transpose""(%input, %perms) : (tensor<2x3xi1>, tensor<2xi32>) -> tensor<3x2xi1> return %1 : tensor<3x2xi1> } func.func @transpose_fold_4d_int() -> tensor<3x1x4x2xi32> { %input = ""tosa.const""() {value = dense<[[ [[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]], [[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]] ]]> : tensor<1x2x3x4xi32>} : () -> tensor<1x2x3x4xi32> %perms = ""tosa.const""() {value = dense<[2, 0, 3, 1]> : tensor<4xi64>} : () -> tensor<4xi64> %1 = ""tosa.transpose""(%input, %perms) : (tensor<1x2x3x4xi32>, tensor<4xi64>) -> tensor<3x1x4x2xi32> return %1 : tensor<3x1x4x2xi32> } func.func @transpose_nofold_non_cst_input(%input: tensor<2x3xf32>) -> tensor<3x2xf32> { %perms = ""tosa.const""() {value = dense<[1, 0]> : tensor<2xi32>} : () -> tensor<2xi32> %1 = ""tosa.transpose""(%input, %perms) : (tensor<2x3xf32>, tensor<2xi32>) -> tensor<3x2xf32> return %1 : tensor<3x2xf32> } func.func @transpose_nofold_non_cst_perms(%perms: tensor<2xi32>) -> tensor<3x2xf32> { %input = ""tosa.const""() {value = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf32>} : () -> tensor<2x3xf32> %1 = ""tosa.transpose""(%input, %perms) : (tensor<2x3xf32>, tensor<2xi32>) -> tensor<3x2xf32> return %1 : tensor<3x2xf32> } func.func @transpose_nofold_multi_users() -> (tensor<3x2xf32>, tensor<2x3xf32>) { %input = ""tosa.const""() {value = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf32>} : () -> tensor<2x3xf32> %perms = ""tosa.const""() {value = dense<[1, 0]> : tensor<2xi32>} : () -> tensor<2xi32> %1 = ""tosa.transpose""(%input, %perms) : (tensor<2x3xf32>, tensor<2xi32>) -> tensor<3x2xf32> return %1, %input : tensor<3x2xf32>, tensor<2x3xf32> } func.func @transpose_nofold_quantized_types() -> tensor<1x1x2x2x!quant.uniform:f32:3, {1.000000e-01,1.000000e-01}>> { %perms = ""tosa.const""() {value = dense<[1, 2, 3, 0]> : tensor<4xi32>} : () -> tensor<4xi32> %input = ""tosa.const""() {value = dense<-127> : tensor<2x1x1x2xi8>} : () -> tensor<2x1x1x2xi8> %0 = ""tosa.transpose""(%input, %perms) : (tensor<2x1x1x2xi8>, tensor<4xi32>) -> tensor<1x1x2x2x!quant.uniform:f32:3, {1.000000e-01,1.000000e-01}>> return %0: tensor<1x1x2x2x!quant.uniform:f32:3, {1.000000e-01,1.000000e-01}>> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_add_zero_rhs_f32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0.0> : tensor} : () -> tensor %add = ""tosa.add""(%arg0, %zero) : (tensor, tensor) -> tensor return %add : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_add_zero_lhs_f32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0.0> : tensor} : () -> tensor %add = ""tosa.add""(%zero, %arg0) : (tensor, tensor) -> tensor return %add : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_add_zero_rhs_i32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %add = ""tosa.add""(%arg0, %zero) : (tensor, tensor) -> tensor return %add : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_add_zero_lhs_i32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %add = ""tosa.add""(%zero, %arg0) : (tensor, tensor) -> tensor return %add : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_add_splat_i32() -> tensor<10xi32> { %one = ""tosa.const""() {value = dense<1> : tensor<10xi32>} : () -> tensor<10xi32> %two = ""tosa.const""() {value = dense<2> : tensor<10xi32>} : () -> tensor<10xi32> %add = ""tosa.add""(%one, %two) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi32> return %add : tensor<10xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_add_splat_f32() -> tensor<10xf32> { %one = ""tosa.const""() {value = dense<1.0> : tensor<10xf32>} : () -> tensor<10xf32> %two = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %add = ""tosa.add""(%one, %two) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xf32> return %add : tensor<10xf32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_div_zero_lhs_i32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %div = ""tosa.div""(%zero, %arg0) : (tensor, tensor) -> tensor return %div : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_div_one_rhs_i32(%arg0: tensor) -> tensor { %one = ""tosa.const""() {value = dense<1> : tensor} : () -> tensor %div = ""tosa.div""(%arg0, %one) : (tensor, tensor) -> tensor return %div : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_div_splat_i32() -> tensor { %lhs = ""tosa.const""() {value = dense<10> : tensor} : () -> tensor %rhs = ""tosa.const""() {value = dense<-3> : tensor} : () -> tensor %div = ""tosa.div""(%lhs, %rhs) : (tensor, tensor) -> tensor return %div : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_zero_rhs_f32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0.0> : tensor} : () -> tensor %mul = ""tosa.mul""(%arg0, %zero) {shift = 0 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_zero_lhs_f32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0.0> : tensor} : () -> tensor %mul = ""tosa.mul""(%zero, %arg0) {shift = 0 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_zero_rhs_i32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %mul = ""tosa.mul""(%arg0, %zero) {shift = 0 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_zero_lhs_i32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %mul = ""tosa.mul""(%zero, %arg0) {shift = 0 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_one_rhs_f32(%arg0: tensor) -> tensor { %one = ""tosa.const""() {value = dense<1.0> : tensor} : () -> tensor %mul = ""tosa.mul""(%arg0, %one) {shift = 0 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_one_lhs_f32(%arg0: tensor) -> tensor { %one = ""tosa.const""() {value = dense<1.0> : tensor} : () -> tensor %mul = ""tosa.mul""(%one, %arg0) {shift = 0 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_one_rhs_i32(%arg0: tensor) -> tensor { %one = ""tosa.const""() {value = dense<64> : tensor} : () -> tensor %mul = ""tosa.mul""(%arg0, %one) {shift = 6 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_one_lhs_i32(%arg0: tensor) -> tensor { %one = ""tosa.const""() {value = dense<64> : tensor} : () -> tensor %mul = ""tosa.mul""(%one, %arg0) {shift = 6 : i32} : (tensor, tensor) -> tensor return %mul : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_splat_i8() -> tensor<10xi8> { %one = ""tosa.const""() {value = dense<17> : tensor<10xi8>} : () -> tensor<10xi8> %two = ""tosa.const""() {value = dense<32> : tensor<10xi8>} : () -> tensor<10xi8> %mul = ""tosa.mul""(%one, %two) {shift = 3 : i32} : (tensor<10xi8>, tensor<10xi8>) -> tensor<10xi8> return %mul : tensor<10xi8> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_mul_splat_f32() -> tensor<10xf32> { %one = ""tosa.const""() {value = dense<3.0> : tensor<10xf32>} : () -> tensor<10xf32> %two = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %mul = ""tosa.mul""(%one, %two) {shift = 0 : i32} : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xf32> return %mul : tensor<10xf32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_sub_zero_rhs_f32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0.0> : tensor} : () -> tensor %sub = ""tosa.sub""(%arg0, %zero) : (tensor, tensor) -> tensor return %sub : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_sub_zero_rhs_i32(%arg0: tensor) -> tensor { %zero = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %sub = ""tosa.sub""(%arg0, %zero) : (tensor, tensor) -> tensor return %sub : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_sub_splat_i32() -> tensor<10xi32> { %one = ""tosa.const""() {value = dense<1> : tensor<10xi32>} : () -> tensor<10xi32> %two = ""tosa.const""() {value = dense<2> : tensor<10xi32>} : () -> tensor<10xi32> %sub = ""tosa.sub""(%one, %two) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi32> return %sub : tensor<10xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_sub_splat_f32() -> tensor<10xf32> { %one = ""tosa.const""() {value = dense<1.0> : tensor<10xf32>} : () -> tensor<10xf32> %two = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %sub = ""tosa.sub""(%one, %two) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xf32> return %sub : tensor<10xf32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_greater_splat_f32() -> (tensor<10xi1>, tensor<10xi1>) { %0 = ""tosa.const""() {value = dense<4.0> : tensor<10xf32>} : () -> tensor<10xf32> %1 = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %2 = ""tosa.const""() {value = dense<1.0> : tensor<10xf32>} : () -> tensor<10xf32> %3 = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %true = ""tosa.greater""(%0, %1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xi1> %false = ""tosa.greater""(%2, %3) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xi1> return %true, %false : tensor<10xi1>, tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_greater_splat_i32() -> (tensor<10xi1>, tensor<10xi1>) { %0 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %1 = ""tosa.const""() {value = dense<8> : tensor<10xi32>} : () -> tensor<10xi32> %2 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %3 = ""tosa.const""() {value = dense<-12> : tensor<10xi32>} : () -> tensor<10xi32> %false = ""tosa.greater""(%0, %1) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> %true = ""tosa.greater""(%2, %3) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> return %false, %true : tensor<10xi1>, tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_greater_eq_splat_f32() -> (tensor<10xi1>, tensor<10xi1>) { %0 = ""tosa.const""() {value = dense<4.0> : tensor<10xf32>} : () -> tensor<10xf32> %1 = ""tosa.const""() {value = dense<4.0> : tensor<10xf32>} : () -> tensor<10xf32> %2 = ""tosa.const""() {value = dense<1.0> : tensor<10xf32>} : () -> tensor<10xf32> %3 = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %true = ""tosa.greater_equal""(%0, %1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xi1> %false = ""tosa.greater_equal""(%2, %3) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xi1> return %true, %false : tensor<10xi1>, tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_greater_eq_splat_i32() -> (tensor<10xi1>, tensor<10xi1>) { %0 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %1 = ""tosa.const""() {value = dense<8> : tensor<10xi32>} : () -> tensor<10xi32> %2 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %3 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %true = ""tosa.greater_equal""(%2, %3) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> %false = ""tosa.greater_equal""(%0, %1) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> return %true, %false : tensor<10xi1>, tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_eq_splat_f32() -> (tensor<10xi1>, tensor<10xi1>) { %0 = ""tosa.const""() {value = dense<4.0> : tensor<10xf32>} : () -> tensor<10xf32> %1 = ""tosa.const""() {value = dense<4.0> : tensor<10xf32>} : () -> tensor<10xf32> %2 = ""tosa.const""() {value = dense<1.0> : tensor<10xf32>} : () -> tensor<10xf32> %3 = ""tosa.const""() {value = dense<2.0> : tensor<10xf32>} : () -> tensor<10xf32> %true = ""tosa.equal""(%0, %1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xi1> %false = ""tosa.equal""(%2, %3) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xi1> return %true, %false : tensor<10xi1>, tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_eq_splat_i32() -> (tensor<10xi1>, tensor<10xi1>) { %0 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %1 = ""tosa.const""() {value = dense<8> : tensor<10xi32>} : () -> tensor<10xi32> %2 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %3 = ""tosa.const""() {value = dense<-10> : tensor<10xi32>} : () -> tensor<10xi32> %true = ""tosa.equal""(%2, %3) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> %false = ""tosa.equal""(%0, %1) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> return %true, %false : tensor<10xi1>, tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @fold_eq_i32(%arg0 : tensor<10xi32>) -> (tensor<10xi1>) { %0 = ""tosa.equal""(%arg0, %arg0) : (tensor<10xi32>, tensor<10xi32>) -> tensor<10xi1> return %0 : tensor<10xi1> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @reshape_splat() -> tensor<6x5x4xi32> { %splat = ""tosa.const""() {value = dense<42> : tensor<4x5x6xi32>} : () -> tensor<4x5x6xi32> %reshape = ""tosa.reshape""(%splat) { new_shape = array } : (tensor<4x5x6xi32>) -> tensor<6x5x4xi32> return %reshape : tensor<6x5x4xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @slice_splat() -> tensor<1x1x1xi32> { %splat = ""tosa.const""() {value = dense<42> : tensor<4x5x6xi32>} : () -> tensor<4x5x6xi32> %slice = ""tosa.slice""(%splat) { size = array, start = array } : (tensor<4x5x6xi32>) -> tensor<1x1x1xi32> return %slice : tensor<1x1x1xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @slice_singleton() -> tensor<1x1xi32> { %splat = ""tosa.const""() {value = dense<[[0, 1, 2], [3, 4, 5], [6, 7 ,8]]> : tensor<3x3xi32>} : () -> tensor<3x3xi32> %slice = ""tosa.slice""(%splat) { size = array, start = array } : (tensor<3x3xi32>) -> tensor<1x1xi32> return %slice : tensor<1x1xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @cast_float_to_float() -> tensor { %splat = ""tosa.const""() {value = dense<42.0> : tensor} : () -> tensor %cast = ""tosa.cast""(%splat) : (tensor) -> tensor return %cast : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @cast_int_to_float() -> tensor { %splat = ""tosa.const""() {value = dense<4> : tensor} : () -> tensor %cast = ""tosa.cast""(%splat) : (tensor) -> tensor return %cast : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @cast_float_to_int() -> tensor { %splat = ""tosa.const""() {value = dense<-4.0> : tensor} : () -> tensor %cast = ""tosa.cast""(%splat) : (tensor) -> tensor return %cast : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @cast_int_to_int_trunc() -> tensor { %splat = ""tosa.const""() {value = dense<-1> : tensor} : () -> tensor %cast = ""tosa.cast""(%splat) : (tensor) -> tensor return %cast : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @cast_int_to_int_sign() -> tensor { %splat = ""tosa.const""() {value = dense<-1> : tensor} : () -> tensor %cast = ""tosa.cast""(%splat) : (tensor) -> tensor return %cast : tensor }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @reverse_splat() -> tensor<10xi32> { %splat = ""tosa.const""() {value = dense<42> : tensor<10xi32>} : () -> tensor<10xi32> %reverse = ""tosa.reverse""(%splat) { axis = 0 : i64 } : (tensor<10xi32>) -> tensor<10xi32> return %reverse : tensor<10xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @reverse_length_one(%arg0 : tensor<10x1xi32>) -> (tensor<10x1xi32>, tensor<10x1xi32>) { %nofold = ""tosa.reverse""(%arg0) { axis = 0 : i64 } : (tensor<10x1xi32>) -> tensor<10x1xi32> %fold = ""tosa.reverse""(%arg0) { axis = 1 : i64 } : (tensor<10x1xi32>) -> tensor<10x1xi32> return %nofold, %fold : tensor<10x1xi32>, tensor<10x1xi32> }", mlir-opt --split-input-file --tosa-layerwise-constant-fold ,1 "func.func @test_cancel_transpose_transpose(%arg0: tensor<1x2x3xi32>) -> (tensor<1x2x3xi32>) { %0 = arith.constant dense<[1, 2, 0]> : tensor<3xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<1x2x3xi32>, tensor<3xi32>) -> (tensor<2x3x1xi32>) %2 = arith.constant dense<[2, 0, 1]> : tensor<3xi32> %3 = ""tosa.transpose""(%1, %2) : (tensor<2x3x1xi32>, tensor<3xi32>) -> tensor<1x2x3xi32> return %3 : tensor<1x2x3xi32> }", mlir-opt --canonicalize -split-input-file ,1 "func.func @test_remove_identity_transpose(%arg0: tensor<1x2x3xi32>) -> (tensor<1x2x3xi32>) { %0 = arith.constant dense<[0, 1, 2]> : tensor<3xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<1x2x3xi32>, tensor<3xi32>) -> (tensor<1x2x3xi32>) return %1 : tensor<1x2x3xi32> }", mlir-opt --canonicalize -split-input-file ,1 "func.func @test_do_not_cancel_different_transpose(%arg0: tensor<2x3x4x5xi32>) -> (tensor<5x4x3x2xi32>) { %0 = arith.constant dense<[1, 2, 0, 3]> : tensor<4xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<2x3x4x5xi32>, tensor<4xi32>) -> (tensor<3x4x2x5xi32>) %2 = arith.constant dense<[3, 1, 0, 2]> : tensor<4xi32> %3 = ""tosa.transpose""(%1, %2) : (tensor<3x4x2x5xi32>, tensor<4xi32>) -> tensor<5x4x3x2xi32> return %3 : tensor<5x4x3x2xi32> }", mlir-opt --canonicalize -split-input-file ,1 "func.func @test_prefer_compose_transpose(%arg0: tensor<1x2x3x4xi32>) -> (tensor<4x3x2x1xi32>) { %0 = arith.constant dense<[1, 2, 0, 3]> : tensor<4xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<1x2x3x4xi32>, tensor<4xi32>) -> (tensor<2x3x1x4xi32>) %2 = arith.constant dense<[3, 1, 0, 2]> : tensor<4xi32> %3 = ""tosa.transpose""(%1, %2) : (tensor<2x3x1x4xi32>, tensor<4xi32>) -> tensor<4x3x2x1xi32> return %3 : tensor<4x3x2x1xi32> }", mlir-opt --canonicalize -split-input-file ,1 "func.func @transpose_conv2d(%arg0: tensor<2x16x14x3xf32>, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor<5xf32>) -> tensor<2x18x19x5xf32> { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x16x14x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> tensor<2x18x19x5xf32> return %0 : tensor<2x18x19x5xf32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @transpose_conv2d_quantized(%arg0: tensor<2x16x14x3xi8>, %arg1: tensor<5x3x6x3xi8>, %arg2: tensor<5xi32>) -> (tensor<2x18x19x5xi32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, quantization_info = #tosa.conv_quant, out_shape = array, stride = array} : (tensor<2x16x14x3xi8>, tensor<5x3x6x3xi8>, tensor<5xi32>) -> tensor<2x18x19x5xi32> return %0 : tensor<2x18x19x5xi32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @transpose_conv2d_quantized_padded(%arg0: tensor<2x16x14x3xi8>, %arg1: tensor<5x3x6x3xi8>, %arg2: tensor<5xi32>) -> (tensor<2x21x26x5xi32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) { out_pad = array, quantization_info = #tosa.conv_quant, out_shape = array, stride = array} : (tensor<2x16x14x3xi8>, tensor<5x3x6x3xi8>, tensor<5xi32>) -> tensor<2x21x26x5xi32> return %0 : tensor<2x21x26x5xi32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @transpose_conv2d_strided(%arg0: tensor<2x17x15x3xf32>, %arg1: tensor<5x3x5x3xf32>, %arg2: tensor<5xf32>) -> tensor<2x?x?x5xf32> { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x17x15x3xf32>, tensor<5x3x5x3xf32>, tensor<5xf32>) -> tensor<2x35x47x5xf32> %1 = tensor.cast %0 : tensor<2x35x47x5xf32> to tensor<2x?x?x5xf32> return %1 : tensor<2x?x?x5xf32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @transpose_conv2d_strided_quantized(%arg0: tensor<2x17x15x3xi8>, %arg1: tensor<5x3x5x3xi8>, %arg2: tensor<5xi32>) -> (tensor<2x35x47x5xi32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, quantization_info = #tosa.conv_quant, out_shape = array, stride = array} : (tensor<2x17x15x3xi8>, tensor<5x3x5x3xi8>, tensor<5xi32>) -> tensor<2x35x47x5xi32> return %0 : tensor<2x35x47x5xi32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @transpose_conv2d_strided_overpad(%arg0 : tensor<1x16x1x1xi8>, %arg1 : tensor<1x2x1x1xi8>, %arg2 : tensor<1xi32>) -> (tensor<1x19x2x1xi32>) { %2 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) { out_pad = array, out_shape = array, stride = array, quantization_info = #tosa.conv_quant} : (tensor<1x16x1x1xi8>, tensor<1x2x1x1xi8>, tensor<1xi32>) -> (tensor<1x19x2x1xi32>) ""func.return"" (%2) : (tensor<1x19x2x1xi32>) -> () }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @test_broadcast0(%arg0: tensor<1xf32>, %arg1: tensor<1xf32>) -> tensor<1xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> return %0 : tensor<1xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast1(%arg0: tensor<1xf32>, %arg1: tensor<2x1xf32>) -> tensor<2x1xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1xf32>, tensor<2x1xf32>) -> tensor<2x1xf32> return %0 : tensor<2x1xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast2(%arg0: tensor<2x1xf32>, %arg1: tensor<1xf32>) -> tensor<2x1xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<2x1xf32>, tensor<1xf32>) -> tensor<2x1xf32> return %0 : tensor<2x1xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast3(%arg0: tensor<2x1x1x1xf32>, %arg1: tensor<1xf32>) -> tensor<2x1x1x1xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<2x1x1x1xf32>, tensor<1xf32>) -> tensor<2x1x1x1xf32> return %0 : tensor<2x1x1x1xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast4(%arg0: tensor<1x1x1x2xf32>, %arg1: tensor<1xf32>) -> tensor<1x1x1x2xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1x1x1x2xf32>, tensor<1xf32>) -> tensor<1x1x1x2xf32> return %0 : tensor<1x1x1x2xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast5(%arg0: tensor<1x1x2x1xf32>, %arg1: tensor<1xf32>) -> tensor<1x1x2x1xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1x1x2x1xf32>, tensor<1xf32>) -> tensor<1x1x2x1xf32> return %0 : tensor<1x1x2x1xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast6(%arg0: tensor<17x16x15x14xf32>, %arg1: tensor<1xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<17x16x15x14xf32>, tensor<1xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast7(%arg0: tensor<17x16x1x14xf32>, %arg1: tensor<1x1xf32>) -> tensor<17x16x1x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<17x16x1x14xf32>, tensor<1x1xf32>) -> tensor<17x16x1x14xf32> return %0 : tensor<17x16x1x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast8(%arg0: tensor<17x16x15x14xf32>, %arg1: tensor<1x1xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<17x16x15x14xf32>, tensor<1x1xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast9(%arg0: tensor<17x16x15x14xf32>, %arg1: tensor<15x1xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<17x16x15x14xf32>, tensor<15x1xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast10(%arg0: tensor<17x16x15x14xf32>, %arg1: tensor<15x14xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<17x16x15x14xf32>, tensor<15x14xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast13(%arg0: tensor<1xf32>, %arg1: tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1xf32>, tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast14(%arg0: tensor<1x1xf32>, %arg1: tensor<17x16x1x14xf32>) -> tensor<17x16x1x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1x1xf32>, tensor<17x16x1x14xf32>) -> tensor<17x16x1x14xf32> return %0 : tensor<17x16x1x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast15(%arg0: tensor<1x1xf32>, %arg1: tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1x1xf32>, tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast16(%arg0: tensor<15x1xf32>, %arg1: tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<15x1xf32>, tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast17(%arg0: tensor<15x14xf32>, %arg1: tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<15x14xf32>, tensor<17x16x15x14xf32>) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast18(%arg0: tensor<14x1xf32>, %arg1: tensor<1x15xf32>) -> tensor<14x15xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<14x1xf32>, tensor<1x15xf32>) -> tensor<14x15xf32> return %0 : tensor<14x15xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast19(%arg0: tensor<64x64x1xf32>, %arg1: tensor<1x17xf32>) -> (tensor<64x64x17xf32> ) { %0 = ""tosa.sub""(%arg0, %arg1) : (tensor<64x64x1xf32>, tensor<1x17xf32>) -> tensor<64x64x17xf32> return %0 : tensor<64x64x17xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast20(%arg0: tensor<3x3x4x1xf32>, %arg1: tensor<4x5xf32>) -> (tensor<3x3x4x5xf32> ) { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<3x3x4x1xf32>, tensor<4x5xf32>) -> tensor<3x3x4x5xf32> return %0 : tensor<3x3x4x5xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_mul(%arg0: tensor<15x14xi32>, %arg1: tensor<17x16x15x14xi32>) -> tensor<17x16x15x14xi32> { %0 = ""tosa.mul""(%arg0, %arg1) <{shift = 1 : i32 }> : (tensor<15x14xi32>, tensor<17x16x15x14xi32>) -> tensor<17x16x15x14xi32> return %0 : tensor<17x16x15x14xi32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_arithmetic_right_shift(%arg0: tensor<15x14xi32>, %arg1: tensor<17x16x15x14xi32>) -> tensor<17x16x15x14xi32> { %0 = ""tosa.arithmetic_right_shift""(%arg0, %arg1) <{ round = true }> : (tensor<15x14xi32>, tensor<17x16x15x14xi32>) -> tensor<17x16x15x14xi32> return %0 : tensor<17x16x15x14xi32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_scalar(%arg0: tensor, %arg1: tensor<17x16x15x14xi32>) -> tensor<17x16x15x14xi32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor, tensor<17x16x15x14xi32>) -> tensor<17x16x15x14xi32> return %0 : tensor<17x16x15x14xi32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_both_input(%arg0: tensor<1x16x16xi1>, %arg1: tensor, %arg2: tensor) -> tensor<1x16x16xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<1x16x16xi1>, tensor, tensor) -> tensor<1x16x16xf32> return %0 : tensor<1x16x16xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_one_input(%arg0: tensor<17x16x15x14xi1>, %arg1: tensor<17x16x15x14xf32>, %arg2: tensor) -> tensor<17x16x15x14xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<17x16x15x14xi1>, tensor<17x16x15x14xf32>, tensor) -> tensor<17x16x15x14xf32> return %0 : tensor<17x16x15x14xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_predicate(%arg0: tensor, %arg1: tensor<1x32x32x8xf32>, %arg2: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor, tensor<1x32x32x8xf32>, tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_abc(%arg0: tensor, %arg1: tensor<32x8xf32>, %arg2: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor, tensor<32x8xf32>, tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_acb(%arg0: tensor, %arg1: tensor<1x32x32x8xf32>, %arg2: tensor<32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor, tensor<1x32x32x8xf32>, tensor<32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_bac(%arg0: tensor<32x8xi1>, %arg1: tensor, %arg2: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<32x8xi1>, tensor, tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_bca(%arg0: tensor<32x8xi1>, %arg1: tensor<1x32x32x8xf32>, %arg2: tensor) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<32x8xi1>, tensor<1x32x32x8xf32>, tensor) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_cab(%arg0: tensor<1x32x32x8xi1>, %arg1: tensor, %arg2: tensor<32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<1x32x32x8xi1>, tensor, tensor<32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_broadcast_select_cba(%arg0: tensor<1x32x32x8xi1>, %arg1: tensor<32x8xf32>, %arg2: tensor) -> tensor<1x32x32x8xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<1x32x32x8xi1>, tensor<32x8xf32>, tensor) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --tosa-make-broadcastable ,1 "func.func @test_argmax(%arg0: tensor) -> tensor { %0 = ""tosa.argmax""(%arg0) {axis = 1 : i64} : (tensor) -> tensor return %0 : tensor }", mlir-opt | mlir-opt ,1 "func.func @test_argmax(%arg0: tensor) -> tensor { %0 = ""tosa.argmax""(%arg0) {axis = 1 : i64} : (tensor) -> tensor return %0 : tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @single_concat(%arg0: tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> { %0 = ""tosa.concat""(%arg0, %arg0) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> return %0 : tensor<1x2x7x7xf32> }", mlir-opt --split-input-file --canonicalize ,1 "func.func @concat_different_axis(%arg0: tensor<1x1x7x7xf32>) -> tensor<2x2x7x7xf32> { %0 = ""tosa.concat""(%arg0, %arg0) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> %1 = ""tosa.concat""(%0, %0) {axis = 0} : (tensor<1x2x7x7xf32>, tensor<1x2x7x7xf32>) -> tensor<2x2x7x7xf32> return %1 : tensor<2x2x7x7xf32> }", mlir-opt --split-input-file --canonicalize ,1 "func.func @fold_concats(%arg0: tensor<1x1x7x7xf32>) -> tensor<1x4x7x7xf32> { %tmp = tensor.empty() : tensor<1x1x7x7xf32> %0 = ""tosa.concat""(%arg0, %arg0) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> %1 = ""tosa.concat""(%tmp, %0, %tmp) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x2x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x4x7x7xf32> return %1 : tensor<1x4x7x7xf32> }", mlir-opt --split-input-file --canonicalize ,1 "func.func @nested_fold(%arg0: tensor<1x1x7x7xf32>) -> tensor<1x8x7x7xf32> { %tmp = tensor.empty() : tensor<1x1x7x7xf32> %0 = ""tosa.concat""(%arg0, %arg0) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> %1 = ""tosa.concat""(%tmp, %0, %tmp) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x2x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x4x7x7xf32> %2 = ""tosa.concat""(%1, %1) {axis = 1} : (tensor<1x4x7x7xf32>, tensor<1x4x7x7xf32>) -> tensor<1x8x7x7xf32> return %2 : tensor<1x8x7x7xf32> }", mlir-opt --split-input-file --canonicalize ,1 "func.func @wide_fold(%arg0: tensor<1x1x7x7xf32>, %arg1: tensor<1x1x7x7xf32>) -> tensor<1x4x7x7xf32> { %0 = ""tosa.concat""(%arg0, %arg0) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> %1 = ""tosa.concat""(%arg1, %arg1) {axis = 1} : (tensor<1x1x7x7xf32>, tensor<1x1x7x7xf32>) -> tensor<1x2x7x7xf32> %2 = ""tosa.concat""(%0, %1) {axis = 1} : (tensor<1x2x7x7xf32>, tensor<1x2x7x7xf32>) -> tensor<1x4x7x7xf32> return %2 : tensor<1x4x7x7xf32> }", mlir-opt --split-input-file --canonicalize ,1 "func.func @partially_foldable(%arg0: tensor<1x1x8x8xf32>, %arg1: tensor<1x2x4x8xf32>) -> tensor<1x4x8x8xf32> { %0 = ""tosa.concat""(%arg0, %arg0) {axis = 1} : (tensor<1x1x8x8xf32>, tensor<1x1x8x8xf32>) -> tensor<1x2x8x8xf32> %1 = ""tosa.concat""(%arg1, %arg1) {axis = 2} : (tensor<1x2x4x8xf32>, tensor<1x2x4x8xf32>) -> tensor<1x2x8x8xf32> %2 = ""tosa.concat""(%0, %1) {axis = 1} : (tensor<1x2x8x8xf32>, tensor<1x2x8x8xf32>) -> tensor<1x4x8x8xf32> return %2 : tensor<1x4x8x8xf32> }", mlir-opt --split-input-file --canonicalize ,1 "func.func @test_return(%arg0 : tensor<4xf32>) -> tensor<*xf32> { %0 = ""tosa.log""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> return %0 : tensor<*xf32> }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_multiple(%arg0 : tensor<4xf32>, %arg1 : tensor<1xf32>, %arg2 : tensor) -> tensor<*xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %1 = ""tosa.log""(%0) : (tensor<*xf32>) -> tensor<*xf32> %2 = ""tosa.sub""(%0, %arg2) : (tensor<*xf32>, tensor) -> tensor<*xf32> return %0 : tensor<*xf32> }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_unary_f32(%arg0 : tensor<4xf32>) -> () { %0 = ""tosa.abs""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %1 = ""tosa.ceil""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %2 = ""tosa.clamp""(%arg0) { max_int = 10 : i64, min_int = 0 : i64, min_fp = 0.0 : f32, max_fp = 10.0 : f32 } : (tensor<4xf32>) -> tensor<*xf32> %3 = ""tosa.exp""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %4 = ""tosa.floor""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %5 = ""tosa.log""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %6 = ""tosa.negate""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %7 = ""tosa.reciprocal""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %8 = ""tosa.reverse""(%arg0) { axis = 0 : i64 } : (tensor<4xf32>) -> tensor %9 = ""tosa.rsqrt""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %10 = ""tosa.tanh""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %11 = ""tosa.sigmoid""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> %12 = ""tosa.cast""(%arg0) : (tensor<4xf32>) -> tensor<*xi32> %13 = ""tosa.erf""(%arg0) : (tensor<4xf32>) -> tensor<*xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_unary_i32(%arg0 : tensor<4xi32>) -> () { %0 = ""tosa.abs""(%arg0) : (tensor<4xi32>) -> tensor<*xi32> %1 = ""tosa.bitwise_not""(%arg0) : (tensor<4xi32>) -> tensor<*xi32> %2 = ""tosa.clamp""(%arg0) { max_int = 10 : i64, min_int = 0 : i64, min_fp = 0.0 : f32, max_fp = 10.0 : f32 } : (tensor<4xi32>) -> tensor<*xi32> %3 = ""tosa.clz""(%arg0) : (tensor<4xi32>) -> tensor<*xi32> %4 = ""tosa.negate""(%arg0) : (tensor<4xi32>) -> tensor<*xi32> %5 = ""tosa.reverse""(%arg0) { axis = 0 : i64 } : (tensor<4xi32>) -> tensor %6 = ""tosa.rescale""(%arg0) {input_zp = 243 : i32, output_zp = 252 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor<4xi32>) -> (tensor<*xi16>) %7 = ""tosa.identity""(%arg0) : (tensor<4xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_binary_scalar_f32(%arg0 : tensor<4xf32>, %arg1 : tensor) -> () { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xf32> %1 = ""tosa.maximum""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xf32> %2 = ""tosa.minimum""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xf32> %3 = ""tosa.mul""(%arg0, %arg1) { shift = 0 : i32 }: (tensor<4xf32>, tensor) -> tensor<*xf32> %4 = ""tosa.pow""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xf32> %5 = ""tosa.sub""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xf32> %6 = ""tosa.equal""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xi1> %7 = ""tosa.greater""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xi1> %8 = ""tosa.greater_equal""(%arg0, %arg1) : (tensor<4xf32>, tensor) -> tensor<*xi1> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_binary_broadcast_f32(%arg0 : tensor<4xf32>, %arg1 : tensor<1xf32>) -> () { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %1 = ""tosa.maximum""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %2 = ""tosa.minimum""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %3 = ""tosa.mul""(%arg0, %arg1) { shift = 0 : i32 } : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %4 = ""tosa.pow""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %5 = ""tosa.sub""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xf32> %6 = ""tosa.equal""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xi1> %7 = ""tosa.greater""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xi1> %8 = ""tosa.greater_equal""(%arg0, %arg1) : (tensor<4xf32>, tensor<1xf32>) -> tensor<*xi1> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_binary_i32(%arg0 : tensor<4xi32>, %arg1 : tensor) -> () { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi32> %1 = ""tosa.bitwise_and""(%arg0, %arg1): (tensor<4xi32>, tensor) -> tensor<*xi32> %2 = ""tosa.bitwise_or""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi32> %3 = ""tosa.bitwise_xor""(%arg0, %arg1): (tensor<4xi32>, tensor) -> tensor<*xi32> %4 = ""tosa.equal""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi1> %5 = ""tosa.greater""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi1> %6 = ""tosa.greater_equal""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi1> %7 = ""tosa.logical_left_shift""(%arg0, %arg1) { shift = 0 : i32 }: (tensor<4xi32>, tensor) -> tensor<*xi32> %8 = ""tosa.logical_right_shift""(%arg0, %arg1) { shift = 0 : i32 }: (tensor<4xi32>, tensor) -> tensor<*xi32> %9 = ""tosa.maximum""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi32> %10 = ""tosa.minimum""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi32> %11 = ""tosa.mul""(%arg0, %arg1) { shift = 0 : i32 }: (tensor<4xi32>, tensor) -> tensor<*xi32> %12 = ""tosa.pow""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi32> %13 = ""tosa.sub""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_binary_i1(%arg0 : tensor<4xi1>, %arg1 : tensor) -> () { %0 = ""tosa.logical_and""(%arg0, %arg1): (tensor<4xi1>, tensor) -> tensor<*xi1> %1 = ""tosa.logical_or""(%arg0, %arg1): (tensor<4xi1>, tensor) -> tensor<*xi1> %2 = ""tosa.logical_xor""(%arg0, %arg1): (tensor<4xi1>, tensor) -> tensor<*xi1> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_select_i32(%arg0 : tensor<4xi1>, %arg1 : tensor, %arg2 : tensor<4xi32>) -> () { %0 = ""tosa.select""(%arg0, %arg1, %arg2): (tensor<4xi1>, tensor, tensor<4xi32>) -> tensor<*xi32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_argmax(%arg0 : tensor<2x3xi32>) -> () { %0 = ""tosa.argmax""(%arg0) {axis = 0 : i64} : (tensor<2x3xi32>) -> tensor %1 = ""tosa.argmax""(%arg0) {axis = 1 : i64} : (tensor<2x3xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_argmax(%arg0 : tensor<2x?xi32>) -> () { %0 = ""tosa.argmax""(%arg0) {axis = 0 : i64} : (tensor<2x?xi32>) -> tensor %1 = ""tosa.argmax""(%arg0) {axis = 1 : i64} : (tensor<2x?xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_fully_connected(%arg0 : tensor<3x4xf32>, %arg1 : tensor<5x4xf32>, %arg2 : tensor<5xf32>) -> () { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor<3x4xf32>, tensor<5x4xf32>, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_input_fully_connected(%arg0 : tensor<3x4xf32>, %arg1 : tensor, %arg2 : tensor) -> () { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor<3x4xf32>, tensor, tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_weight_fully_connected(%arg0 : tensor, %arg1 : tensor<5x4xf32>, %arg2 : tensor) -> () { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor, tensor<5x4xf32>, tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_bias_fully_connected(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor<5xf32>) -> () { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor, tensor, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_out_fully_connected(%arg0 : tensor<3x?xf32>, %arg1 : tensor, %arg2 : tensor<5xf32>) -> () { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor<3x?xf32>, tensor, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_matmul(%arg0 : tensor<2x3x4xi32>, %arg1 : tensor<2x4x5xi32>) -> () { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<2x3x4xi32>, tensor<2x4x5xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_lhs_matmul(%arg0 : tensor, %arg1 : tensor<2x4x5xi32>) -> () { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor, tensor<2x4x5xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_rhs_matmul(%arg0 : tensor<2x3x4xi32>, %arg1 : tensor) -> () { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<2x3x4xi32>, tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_mixed_matmul(%arg0 : tensor, %arg1 : tensor) -> () { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor, tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_table_static(%arg0 : tensor<4x5xi16>, %arg1 : tensor<513xi16>) -> () { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<4x5xi16>, tensor<513xi16>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_table_dynamic(%arg0 : tensor<4x?xi16>, %arg1 : tensor<513xi16>) -> () { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<4x?xi16>, tensor<513xi16>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_reshape(%arg0 : tensor<4x4xi32>) -> () { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<4x4xi32>) -> tensor %1 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<4x4xi32>) -> tensor %2 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<4x4xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_reshape(%arg0 : tensor<4x?xi32>) -> () { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<4x?xi32>) -> tensor %1 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<4x?xi32>) -> tensor %2 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<4x?xi32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_reduce_binary(%arg0 : tensor<2x3x?x?xi1>) -> () { %0 = ""tosa.reduce_all""(%arg0) {axis = 0 : i64} : (tensor<2x3x?x?xi1>) -> tensor %1 = ""tosa.reduce_all""(%arg0) {axis = 1 : i64} : (tensor<2x3x?x?xi1>) -> tensor %2 = ""tosa.reduce_all""(%arg0) {axis = 2 : i64} : (tensor<2x3x?x?xi1>) -> tensor %3 = ""tosa.reduce_all""(%arg0) {axis = 3 : i64} : (tensor<2x3x?x?xi1>) -> tensor %4 = ""tosa.reduce_any""(%arg0) {axis = 0 : i64} : (tensor<2x3x?x?xi1>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_reduce_float(%arg0 : tensor<2x3x?x?xf32>) -> () { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64} : (tensor<2x3x?x?xf32>) -> tensor %1 = ""tosa.reduce_sum""(%arg0) {axis = 1 : i64} : (tensor<2x3x?x?xf32>) -> tensor %2 = ""tosa.reduce_sum""(%arg0) {axis = 2 : i64} : (tensor<2x3x?x?xf32>) -> tensor %3 = ""tosa.reduce_sum""(%arg0) {axis = 3 : i64} : (tensor<2x3x?x?xf32>) -> tensor %4 = ""tosa.reduce_max""(%arg0) {axis = 3 : i64} : (tensor<2x3x?x?xf32>) -> tensor %5 = ""tosa.reduce_min""(%arg0) {axis = 3 : i64} : (tensor<2x3x?x?xf32>) -> tensor %6 = ""tosa.reduce_prod""(%arg0) {axis = 3 : i64} : (tensor<2x3x?x?xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_concat(%arg0 : tensor<1x2xf32>, %arg1 : tensor<2x2xf32>) -> () { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor<1x2xf32>, tensor<2x2xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_concat_dynamic(%arg0 : tensor<1x2xf32>, %arg1 : tensor<2x?xf32>) -> () { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor<1x2xf32>, tensor<2x?xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_concat_dynamic_axis(%arg0 : tensor, %arg1 : tensor<2x2xf32>) -> () { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor<2x2xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_concat_axis_1(%arg0 : tensor<2x1xf32>, %arg1 : tensor<2x2xf32>) -> () { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 1 : i64} : (tensor<2x1xf32>, tensor<2x2xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_padding_no_const(%arg0 : tensor<1x2xf32>, %arg1 : tensor<2x2xi32>) -> () { %0 = ""tosa.pad""(%arg0, %arg1) : (tensor<1x2xf32>, tensor<2x2xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_padding_dynamic_input(%arg0 : tensor<1x?xf32>) -> () { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor<1x?xf32>, tensor<2x2xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_padding_simple(%arg0 : tensor<1x2xf32>) -> () { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor<1x2xf32>, tensor<2x2xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_slice(%arg0 : tensor) -> () { %0 = ""tosa.slice""(%arg0) { size = array, start = array } : (tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_slice_dynamic(%arg0 : tensor<10x?x2xf32>) -> () { %0 = ""tosa.slice""(%arg0) {size = array, start = array} : (tensor<10x?x2xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_tile(%arg0 : tensor<2x3x?xi32>) -> () { %0 = ""tosa.tile""(%arg0) <{multiples = array}> : (tensor<2x3x?xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_transpose_same(%arg0 : tensor<4x4x4xi32>, %arg1 : tensor<3xi32>) -> () { %0 = ""tosa.transpose""(%arg0, %arg1) : (tensor<4x4x4xi32>, tensor<3xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_transpose_perm_unknown(%arg0 : tensor<4x4x5xi32>, %arg1 : tensor<3xi32>) -> () { %0 = ""tosa.transpose""(%arg0, %arg1) : (tensor<4x4x5xi32>, tensor<3xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_transpose_static(%arg0 : tensor<3x4x5xi32>) -> () { %0 = arith.constant dense<[2, 1, 0]> : tensor<3xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<3x4x5xi32>, tensor<3xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @gather_static(%arg0 : tensor<3x4x5xi32>, %arg1 : tensor<3x6xi32>) { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<3x4x5xi32>, tensor<3x6xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @gather_dynamic_values(%arg0 : tensor, %arg1 : tensor<3x6xi32>) { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor, tensor<3x6xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @gather_dynamic_indices(%arg0 : tensor<3x4x5xi32>, %arg1 : tensor) { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<3x4x5xi32>, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @gather_minimum_info(%arg0 : tensor<3x?x5xi32>, %arg1 : tensor) { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<3x?x5xi32>, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @scatter_static(%arg0 : tensor<3x4x5xi32>, %arg1 : tensor<3x6xi32>, %arg2 : tensor<3x6x5xi32>) { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor<3x4x5xi32>, tensor<3x6xi32>, tensor<3x6x5xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @scatter_static_values(%arg0 : tensor<3x4x5xi32>, %arg1 : tensor, %arg2 : tensor) { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor<3x4x5xi32>, tensor, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @scatter_static_indices(%arg0 : tensor, %arg1 : tensor<3x6xi32>, %arg2 : tensor) { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor, tensor<3x6xi32>, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @scatter_static_input(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor<3x6x5xi32>) { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor, tensor, tensor<3x6x5xi32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @scatter_minimum_static(%arg0 : tensor, %arg1 : tensor<3x?xi32>, %arg2 : tensor) { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor, tensor<3x?xi32>, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_pool_static(%arg0: tensor<3x5x6x7xf32>) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, kernel = array, pad = array, stride = array} : (tensor<3x5x6x7xf32>) -> tensor %1 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array} : (tensor<3x5x6x7xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_static(%input: tensor<2x8x9x3xf32>, %weights: tensor<5x3x6x3xf32>, %bias: tensor<5xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<2x8x9x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_dynamic_input(%input: tensor, %weights: tensor<5x3x6x3xf32>, %bias: tensor<5xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor, tensor<5x3x6x3xf32>, tensor<5xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_pool_dynamic_input(%arg0: tensor) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, kernel = array, pad = array, stride = array} : (tensor) -> tensor %1 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array} : (tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_pool_padded(%arg0: tensor<3x5x6x7xf32>) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, kernel = array, pad = array, stride = array} : (tensor<3x5x6x7xf32>) -> tensor %1 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array} : (tensor<3x5x6x7xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_dynamic_weight(%input: tensor<2x8x9x3xf32>, %weights: tensor, %bias: tensor<5xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<2x8x9x3xf32>, tensor, tensor<5xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_dynamic_bias(%input: tensor<2x8x9x3xf32>, %weights: tensor<5x3x6x3xf32>, %bias: tensor) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<2x8x9x3xf32>, tensor<5x3x6x3xf32>, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_pool_stride(%arg0: tensor<3x11x12x7xf32>) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, kernel = array, pad = array, stride = array} : (tensor<3x11x12x7xf32>) -> tensor %1 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array} : (tensor<3x11x12x7xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_padded(%input: tensor<2x8x9x3xf32>, %weights: tensor<5x3x6x3xf32>, %bias: tensor<5xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<2x8x9x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_dilated(%input: tensor<2x12x14x3xf32>, %weights: tensor<5x3x6x3xf32>, %bias: tensor<5xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<2x12x14x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv2d_strided(%input: tensor<1x13x14x1xf32>, %weights: tensor<1x1x1x1xf32>, %bias: tensor<1xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<1x13x14x1xf32>, tensor<1x1x1x1xf32>, tensor<1xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_static(%input: tensor<2x8x9x10x3xf32>, %weights: tensor<5x3x6x4x3xf32>, %bias: tensor<5xf32>) -> () { %0 = ""tosa.conv3d""(%input, %weights, %bias) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x10x3xf32>, tensor<5x3x6x4x3xf32>, tensor<5xf32>) -> (tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_dynamic_input(%arg0: tensor, %arg1: tensor<5x3x6x4x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.conv3d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor, tensor<5x3x6x4x3xf32>, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_dynamic_weight(%arg0: tensor<2x8x9x10x3xf32>, %arg1: tensor, %arg2: tensor<5xf32>) { %0 = ""tosa.conv3d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x10x3xf32>, tensor, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_dynamic_bias(%arg0: tensor<2x8x9x10x3xf32>, %arg1: tensor<5x3x6x4x3xf32>, %arg2: tensor) { %0 = ""tosa.conv3d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x10x3xf32>, tensor<5x3x6x4x3xf32>, tensor) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_padded(%arg0: tensor<2x8x9x10x3xf32>, %arg1: tensor<5x3x6x4x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.conv3d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x10x3xf32>, tensor<5x3x6x4x3xf32>, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_dilated(%arg0: tensor<2x12x14x16x3xf32>, %arg1: tensor<5x3x6x2x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.conv3d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x12x14x16x3xf32>, tensor<5x3x6x2x3xf32>, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @conv3d_strided(%arg0: tensor<1x13x14x15x1xf32>, %arg1: tensor<1x1x1x1x1xf32>, %arg2: tensor<1xf32>) { %0 = ""tosa.conv3d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<1x13x14x15x1xf32>, tensor<1x1x1x1x1xf32>, tensor<1xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_static(%arg0: tensor<2x8x9x3xf32>, %arg1: tensor<3x6x3x5xf32>, %arg2: tensor<15xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x3xf32>, tensor<3x6x3x5xf32>, tensor<15xf32>) -> tensor<2x6x4x15xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_dynamic_input(%arg0: tensor, %arg1: tensor<3x6x3x5xf32>, %arg2: tensor<15xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor, tensor<3x6x3x5xf32>, tensor<15xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_dynamic_weight(%arg0: tensor<2x8x9x3xf32>, %arg1: tensor, %arg2: tensor<15xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x3xf32>, tensor, tensor<15xf32>) -> tensor<2x?x?x15xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_dynamic_bias(%arg0: tensor<2x8x9x3xf32>, %arg1: tensor<3x6x3x5xf32>, %arg2: tensor) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x3xf32>, tensor<3x6x3x5xf32>, tensor) -> tensor<2x6x4x15xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_padded(%arg0: tensor<2x8x9x3xf32>, %arg1: tensor<3x6x3x5xf32>, %arg2: tensor<15xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x8x9x3xf32>, tensor<3x6x3x5xf32>, tensor<15xf32>) -> tensor<2x9x11x15xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_dilated(%arg0: tensor<2x12x14x3xf32>, %arg1: tensor<3x6x3x5xf32>, %arg2: tensor<15xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<2x12x14x3xf32>, tensor<3x6x3x5xf32>, tensor<15xf32>) -> tensor<2x6x4x15xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_strided(%arg0: tensor<1x13x14x1xf32>, %arg1: tensor<1x1x1x1xf32>, %arg2: tensor<1xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<1x13x14x1xf32>, tensor<1x1x1x1xf32>, tensor<1xf32>) -> tensor<1x5x7x1xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_out_shape(%arg0: tensor<2x?x?x3xf32>, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x?x?x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> tensor<2x8x9x5xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_static(%arg0: tensor<2x16x14x3xf32>, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x16x14x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> tensor<2x?x?x5xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_static_strided(%arg0: tensor<2x16x14x3xf32>, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x16x14x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> tensor<2x?x?x5xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_dynamic_input(%arg0: tensor, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor, tensor<5x3x6x3xf32>, tensor<5xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_dynamic_weights(%arg0: tensor<2x6x4x3xf32>, %arg1: tensor, %arg2: tensor<5xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x6x4x3xf32>, tensor, tensor<5xf32>) -> tensor<2x?x?x5xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_dynamic_bias(%arg0: tensor<2x6x4x3xf32>, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x6x4x3xf32>, tensor<5x3x6x3xf32>, tensor) -> tensor<2x8x9x5xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @transpose_conv2d_padded(%arg0: tensor<2x9x11x3xf32>, %arg1: tensor<5x3x6x3xf32>, %arg2: tensor<5xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<2x9x11x3xf32>, tensor<5x3x6x3xf32>, tensor<5xf32>) -> tensor<2x10x13x5xf32> return } func.func @transpose_conv2d_strided(%arg0: tensor<1x5x7x1xf32>, %arg1: tensor<1x1x1x1xf32>, %arg2: tensor<1xf32>) { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<1x5x7x1xf32>, tensor<1x1x1x1xf32>, tensor<1xf32>) -> tensor<1x13x13x1xf32> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_int_horizontal(%arg0: tensor<1x15x13x1xi8>) { %0 = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<1x15x13x1xi8>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_int_vertical(%arg0: tensor<1x49x42x1xi16>) { %0 = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<1x49x42x1xi16>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_int_power_of_two_upscale(%arg0: tensor<1x23x19x1xi8>) { %0 = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x23x19x1xi8>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_int_power_of_two_upscale_offsetted(%arg0: tensor<1x41x26x1xi16>) { %0 = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x41x26x1xi16>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_fp_horizontal(%arg0: tensor<1x50x48x1xf32>) { %0 = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x50x48x1xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_fp_vertical(%arg0: tensor<1x50x48x1xf32>) { %0 = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<1x50x48x1xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_fp_power_of_two_upscale(%arg0: tensor<1x23x23x1xf32>) { %0 = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x23x23x1xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @resize_fp_power_of_two_upscale_offsetted(%arg0: tensor<1x50x48x1xf32>) { %0 = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<1x50x48x1xf32>) -> tensor return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @if_test_simple(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> () { %a = ""tosa.log""(%arg0) : (tensor) -> tensor<*xf32> %b = ""tosa.log""(%arg1) : (tensor) -> tensor<*xf32> %0 = ""tosa.cond_if""(%arg2, %a, %b) ({ ^bb1(%arg3 : tensor<*xf32>, %arg4 : tensor<*xf32>): ""tosa.yield""(%arg3) : (tensor<*xf32>) -> () }, { ^bb1(%arg5 : tensor<*xf32>, %arg6 : tensor<*xf32>): ""tosa.yield""(%arg6) : (tensor<*xf32>) -> () }) : (tensor, tensor<*xf32>, tensor<*xf32>) -> (tensor<*xf32>) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @if_test_dynamic(%arg0 : tensor<2xf32>, %arg1 : tensor<3xf32>, %arg2 : tensor) -> () { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb1(%arg3 : tensor<2xf32>, %arg4 : tensor<3xf32>): ""tosa.yield""(%arg3) : (tensor<2xf32>) -> () }, { ^bb1(%arg5 : tensor<2xf32>, %arg6 : tensor<3xf32>): ""tosa.yield""(%arg6) : (tensor<3xf32>) -> () }) : (tensor, tensor<2xf32>, tensor<3xf32>) -> (tensor<*xf32>) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @if_test_unranked(%arg0 : tensor, %arg1 : tensor<3xf32>, %arg2 : tensor) -> () { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb1(%arg3 : tensor, %arg4 : tensor<3xf32>): ""tosa.yield""(%arg3) : (tensor) -> () }, { ^bb1(%arg5 : tensor, %arg6 : tensor<3xf32>): ""tosa.yield""(%arg6) : (tensor<3xf32>) -> () }) : (tensor, tensor, tensor<3xf32>) -> (tensor<*xf32>) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @if_test_propagate(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> () { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb1(%arg3 : tensor<*xf32>, %arg4 : tensor<*xf32>): %1 = ""tosa.add""(%arg3, %arg4) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32> ""tosa.yield""(%1) : (tensor<*xf32>) -> () }, { ^bb1(%arg5 : tensor<*xf32>, %arg6 : tensor<*xf32>): %1 = ""tosa.sub""(%arg5, %arg6) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32> ""tosa.yield""(%1) : (tensor<*xf32>) -> () }) : (tensor, tensor, tensor) -> (tensor<*xf32>) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @while_test(%arg0 : tensor) -> (tensor<*xi32>) { %0 = ""tosa.add""(%arg0, %arg0) : (tensor, tensor) -> tensor<*xi32> %1 = ""tosa.while_loop""(%0) ({ ^bb0(%arg2: tensor<*xi32>): %2 = ""tosa.const""() {value = dense<3> : tensor} : () -> tensor %3 = ""tosa.greater_equal""(%2, %arg2) : (tensor, tensor<*xi32>) -> tensor<*xi1> ""tosa.yield""(%3) : (tensor<*xi1>) -> () }, { ^bb0(%arg2: tensor<*xi32>): %2 = ""tosa.const""() {value = dense<1> : tensor} : () -> tensor %3 = ""tosa.add""(%arg2, %2) : (tensor<*xi32>, tensor) -> tensor<*xi32> ""tosa.yield""(%3) : (tensor<*xi32>) -> () }) : (tensor<*xi32>) -> (tensor<*xi32>) return %1 : tensor<*xi32> }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @while_test(%arg0 : tensor, %arg1 : tensor<1xi32>) -> () { %1:2 = ""tosa.while_loop""(%arg0, %arg1) ({ ^bb0(%arg2: tensor<*xi32>, %arg3: tensor<*xi32>): %2 = ""tosa.const""() {value = dense<3> : tensor} : () -> tensor %3 = ""tosa.greater_equal""(%2, %arg2) : (tensor, tensor<*xi32>) -> tensor<*xi1> ""tosa.yield""(%3) : (tensor<*xi1>) -> () }, { ^bb0(%arg2: tensor<*xi32>, %arg3: tensor<*xi32>): %2 = ""tosa.const""() {value = dense<1> : tensor} : () -> tensor %3 = ""tosa.add""(%arg2, %2) : (tensor<*xi32>, tensor) -> tensor<*xi32> %4 = ""tosa.concat""(%arg3, %arg3) { axis = 0 : i64 } : (tensor<*xi32>, tensor<*xi32>) -> (tensor<*xi32>) ""tosa.yield""(%3, %4) : (tensor<*xi32>, tensor<*xi32>) -> () }) : (tensor, tensor<1xi32>) -> (tensor<*xi32>, tensor<*xi32>) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_rfft2d(%arg0: tensor<5x2x8xf32>) -> () { %output_real, %output_imag = ""tosa.rfft2d""(%arg0) {} : (tensor<5x2x8xf32>) -> (tensor, tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_batch_rfft2d(%arg0 : tensor) -> () { %output_real, %output_imag = ""tosa.rfft2d""(%arg0) {} : (tensor) -> (tensor, tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_width_rfft2d(%arg0 : tensor<5x2x?xf32>) -> () { %output_real, %output_imag = ""tosa.rfft2d""(%arg0) {} : (tensor<5x2x?xf32>) -> (tensor, tensor) return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_static_fft2d(%arg0: tensor<1x4x8xf32>, %arg1: tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) { %output_real, %output_imag = ""tosa.fft2d""(%arg0, %arg1) {inverse = false} : (tensor<1x4x8xf32>, tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) return %output_real, %output_imag : tensor<1x4x8xf32>, tensor<1x4x8xf32> }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_dynamic_batch_fft2d(%arg0: tensor, %arg1: tensor) -> (tensor, tensor) { %output_real, %output_imag = ""tosa.fft2d""(%arg0, %arg1) {inverse = false} : (tensor, tensor) -> (tensor, tensor) return %output_real, %output_imag : tensor, tensor }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_unranked_equal(%arg0 : tensor<*xf32>, %arg1 : tensor) -> () { %0 = ""tosa.equal""(%arg0, %arg1) : (tensor<*xf32>, tensor) -> tensor<*xi1> return }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_non_tosa_consumer_shape(%arg0: tensor<4x4xf32>) -> !shape.shape { %0 = ""tosa.log""(%arg0) : (tensor<4x4xf32>) -> tensor<*xf32> %1 = shape.shape_of %0 : tensor<*xf32> -> !shape.shape return %1 : !shape.shape }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_non_tosa_consumer_shape2(%arg0: tensor<4x4xf32>) -> tensor { %0 = ""tosa.log""(%arg0) : (tensor<4x4xf32>) -> tensor<*xf32> %1 = shape.shape_of %0 : tensor<*xf32> -> tensor return %1 : tensor }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @test_non_tosa_consumer_extract(%arg0: tensor<4x4xf32>, %arg1: index) -> f32 { %0 = ""tosa.log""(%arg0) : (tensor<4x4xf32>) -> tensor %1 = tensor.extract %0[%arg1, %arg1] : tensor return %1 : f32 }", mlir-opt --split-input-file --tosa-infer-shapes ,1 "func.func @depthwise_conv2d_as_mul(%arg0: tensor<4x10x10x2xf32>, %arg1: tensor<1x1x2x3xf32>, %arg2: tensor<6xf32>) -> tensor<4x10x10x6xf32> { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x2xf32>, tensor<1x1x2x3xf32>, tensor<6xf32>) -> tensor<4x10x10x6xf32> return %0 : tensor<4x10x10x6xf32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @depthwise_conv2d_as_mul_q(%arg0: tensor<4x10x10x2xi8>, %arg1: tensor<1x1x2x3xi8>, %arg2: tensor<6xi32>) -> tensor<4x10x10x6xi32> { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array, quantization_info = #tosa.conv_quant} : (tensor<4x10x10x2xi8>, tensor<1x1x2x3xi8>, tensor<6xi32>) -> tensor<4x10x10x6xi32> return %0 : tensor<4x10x10x6xi32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @depthwise_conv2d_as_mul_padded(%arg0: tensor<4x10x10x2xf32>, %arg1: tensor<1x1x2x3xf32>, %arg2: tensor<6xf32>) -> tensor<4x12x12x6xf32> { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x2xf32>, tensor<1x1x2x3xf32>, tensor<6xf32>) -> tensor<4x12x12x6xf32> return %0 : tensor<4x12x12x6xf32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @argmax_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.argmax""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @add_bcast_zero_int(%arg0: tensor<4x2x3xi32>) -> tensor<4x2x3xi32> { %zeros = ""tosa.const""() {value = dense<0> : tensor<1x1x1xi32>} : () -> tensor<1x1x1xi32> %1 = ""tosa.add""(%arg0, %zeros) : (tensor<4x2x3xi32>, tensor<1x1x1xi32>) -> tensor<4x2x3xi32> return %1 : tensor<4x2x3xi32> } func.func @add_zero_int(%arg0: tensor<2x3xi32>) -> tensor<2x3xi32> { %zeros = ""tosa.const""() {value = dense<0> : tensor<2x3xi32>} : () -> tensor<2x3xi32> %1 = ""tosa.add""(%arg0, %zeros) : (tensor<2x3xi32>, tensor<2x3xi32>) -> tensor<2x3xi32> return %1 : tensor<2x3xi32> } func.func @cast_fold(%arg0: tensor) -> tensor { %0 = ""tosa.cast""(%arg0) : (tensor) -> tensor return %0 : tensor } func.func @cast_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.cast""(%arg0) : (tensor) -> tensor return %0 : tensor } func.func @clamp_not_noop(%arg0: tensor<4xi32>) -> tensor<4xi32> { %0 = ""tosa.clamp""(%arg0) {min_int = 1 : i64, max_int = 4 : i64, min_fp = 1.0 : f32, max_fp = 4.0 : f32} : (tensor<4xi32>) -> tensor<4xi32> return %0 : tensor<4xi32> } func.func @clamp_float_is_noop(%arg0: tensor<4xf32>) -> tensor<4xf32> { %0 = ""tosa.clamp""(%arg0) {min_int = -128 : i64, max_int = 127 : i64, min_fp = -3.40282347E+38 : f32, max_fp = 3.40282347E+38 : f32} : (tensor<4xf32>) -> tensor<4xf32> return %0 : tensor<4xf32> } func.func @clamp_int8_is_noop(%arg0: tensor<4xi8>) -> tensor<4xi8> { %0 = ""tosa.clamp""(%arg0) {min_int = -128 : i64, max_int = 127 : i64, min_fp = -3.40282347E+38 : f32, max_fp = 3.40282347E+38 : f32} : (tensor<4xi8>) -> tensor<4xi8> return %0 : tensor<4xi8> } func.func @clamp_int16_is_noop(%arg0: tensor<4xi16>) -> tensor<4xi16> { %0 = ""tosa.clamp""(%arg0) {min_int = -32768 : i64, max_int = 32767 : i64, min_fp = -3.40282347E+38 : f32, max_fp = 3.40282347E+38 : f32} : (tensor<4xi16>) -> tensor<4xi16> return %0 : tensor<4xi16> } func.func @clamp_uint8_is_noop(%arg0: tensor<4xui8>) -> tensor<4xui8> { %0 = ""tosa.clamp""(%arg0) {min_int = 0 : i64, max_int = 255 : i64, min_fp = -3.40282347E+38 : f32, max_fp = 3.40282347E+38 : f32} : (tensor<4xui8>) -> tensor<4xui8> return %0 : tensor<4xui8> } func.func @clamp_twice_is_single_clamp(%arg0: tensor<4xi8>) -> tensor<4xi8> { %0 = ""tosa.clamp""(%arg0) {max_fp = 3.0 : f32, max_int = 4 : i64, min_fp = -5.0 : f32, min_int = -2 : i64} : (tensor<4xi8>) -> tensor<4xi8> %1 = ""tosa.clamp""(%0) {max_fp = 5.0 : f32, max_int = 2 : i64, min_fp = -3.0 : f32, min_int = -4 : i64} : (tensor<4xi8>) -> tensor<4xi8> return %1 : tensor<4xi8> } func.func @concat_fold(%arg0: tensor) -> tensor { %0 = ""tosa.concat""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @concat_fold_cast(%arg0: tensor) -> tensor { %0 = ""tosa.concat""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @conv2d_stride_2(%arg0: tensor<4x10x10x2xf32>) -> tensor<4x10x10x3xf32> { %weight = ""tosa.const""() {value = dense<[[[[1.0, 1.0]]], [[[1.0, 1.0]]], [[[1.0, 1.0]]]]> : tensor<3x1x1x2xf32>} : ()-> tensor<3x1x1x2xf32> %bias = ""tosa.const""() {value = dense<0.0> : tensor<3xf32>} : ()-> tensor<3xf32> %0 = ""tosa.conv2d""(%arg0, %weight, %bias) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x2xf32>, tensor<3x1x1x2xf32>, tensor<3xf32>) -> tensor<4x10x10x3xf32> return %0 : tensor<4x10x10x3xf32> } func.func @conv2d_weight_2x2(%arg0: tensor<4x10x10x1xf32>) -> tensor<4x10x10x1xf32> { %weight = ""tosa.const""() {value = dense<[[[[1.0], [1.0]], [[1.0], [1.0]]]]> : tensor<1x2x2x1xf32>} : ()-> tensor<1x2x2x1xf32> %bias = ""tosa.const""() {value = dense<0.0> : tensor<1xf32>} : ()-> tensor<1xf32> %0 = ""tosa.conv2d""(%arg0, %weight, %bias) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x1xf32>, tensor<1x2x2x1xf32>, tensor<1xf32>) -> tensor<4x10x10x1xf32> return %0 : tensor<4x10x10x1xf32> } func.func @depthwise_conv2d_stride_2(%arg0: tensor<4x10x10x2xf32>, %arg1: tensor<1x1x2x3xf32>, %arg2: tensor<6xf32>) -> tensor<4x10x10x6xf32> { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x2xf32>, tensor<1x1x2x3xf32>, tensor<6xf32>) -> tensor<4x10x10x6xf32> return %0 : tensor<4x10x10x6xf32> } func.func @depthwise_conv2d_weight_2x2(%arg0: tensor<4x10x10x2xf32>, %arg1: tensor<2x2x2x3xf32>, %arg2: tensor<6xf32>) -> tensor<4x10x10x6xf32> { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x2xf32>, tensor<2x2x2x3xf32>, tensor<6xf32>) -> tensor<4x10x10x6xf32> return %0 : tensor<4x10x10x6xf32> } func.func @max_pool2d_is_noop(%arg0: tensor<10x1x1x3xf32>) -> tensor<10x1x1x3xf32> { %0 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array, dilation = array} : (tensor<10x1x1x3xf32>) -> tensor<10x1x1x3xf32> return %0 : tensor<10x1x1x3xf32> } func.func @pad_noop(%arg0: tensor) -> tensor { %0 = ""tosa.const""() { value = dense<0> : tensor<2x2xi32>} : () -> tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor, tensor<2x2xi32>) -> tensor return %1 : tensor } func.func @pad_determine_val_i32(%arg0: tensor, %arg1 : tensor<2x2xi32>) -> tensor { %0 = ""tosa.const""() { value = dense<[[1, 0], [0, 1]]> : tensor<2x2xi32>} : () -> tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %arg1) : (tensor, tensor<2x2xi32>) -> tensor return %1 : tensor } func.func @pad_determine_val_f32(%arg0: tensor, %arg1 : tensor<2x2xi32>) -> tensor { %0 = ""tosa.const""() { value = dense<[[1, 0], [0, 1]]> : tensor<2x2xi32>} : () -> tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %arg1) : (tensor, tensor<2x2xi32>) -> tensor return %1 : tensor } func.func @pad_determine_val_quant(%arg0: tensor, %arg1 : tensor<2x2xi32>) -> tensor { %0 = ""tosa.const""() { value = dense<[[1, 0], [0, 1]]> : tensor<2x2xi32>} : () -> tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %arg1) {quantization_info = #tosa.pad_quant} : (tensor, tensor<2x2xi32>) -> tensor return %1 : tensor } func.func @mul_one_float(%arg0: tensor<2x3xf32>) -> tensor<2x3xf32> { %ones = ""tosa.const""() {value = dense<1.0> : tensor<2x3xf32>} : () -> tensor<2x3xf32> %1 = ""tosa.mul""(%arg0, %ones) {shift = 0 : i32} : (tensor<2x3xf32>, tensor<2x3xf32>) -> tensor<2x3xf32> return %1 : tensor<2x3xf32> } func.func @mul_bcast_one_float(%arg0: tensor<2x3xf32>) -> tensor<2x3xf32> { %ones = ""tosa.const""() {value = dense<1.0> : tensor<1x1xf32>} : () -> tensor<1x1xf32> %1 = ""tosa.mul""(%ones, %arg0) {shift = 0 : i32} : (tensor<1x1xf32>, tensor<2x3xf32>) -> tensor<2x3xf32> return %1 : tensor<2x3xf32> } func.func @mul_one_int(%arg0: tensor<2x3xi32>) -> tensor<2x3xi32> { %ones = ""tosa.const""() {value = dense<1> : tensor<2x3xi32>} : () -> tensor<2x3xi32> %1 = ""tosa.mul""(%arg0, %ones) {shift = 0 : i32} : (tensor<2x3xi32>, tensor<2x3xi32>) -> tensor<2x3xi32> return %1 : tensor<2x3xi32> } func.func @mul_zero_broadcast(%arg0: tensor<2x3xf32>) -> (tensor<2x3xf32>, tensor<2x3xf32>) { %zeros = ""tosa.const""() {value = dense<0.0> : tensor<1x1xf32>} : () -> tensor<1x1xf32> %1 = ""tosa.mul""(%arg0, %zeros) {shift = 0 : i32} : (tensor<2x3xf32>, tensor<1x1xf32>) -> tensor<2x3xf32> %2 = ""tosa.mul""(%zeros, %arg0) {shift = 0 : i32} : (tensor<1x1xf32>, tensor<2x3xf32>) -> tensor<2x3xf32> return %1, %2 : tensor<2x3xf32>, tensor<2x3xf32> } func.func @select_same_value(%arg0: tensor<2x3xi1>, %arg1: tensor<2x3xi32>) -> tensor<2x3xi32> { %0 = ""tosa.select""(%arg0, %arg1, %arg1) : (tensor<2x3xi1>, tensor<2x3xi32>, tensor<2x3xi32>) -> tensor<2x3xi32> return %0 : tensor<2x3xi32> } func.func @select_true_value(%arg0: tensor<2x3xi32>, %arg1: tensor<2x3xi32>) -> tensor<2x3xi32> { %c1 = ""tosa.const""() {value = dense<1> : tensor<2x3xi1>} : () -> tensor<2x3xi1> %0 = ""tosa.select""(%c1, %arg0, %arg1) : (tensor<2x3xi1>, tensor<2x3xi32>, tensor<2x3xi32>) -> tensor<2x3xi32> return %0 : tensor<2x3xi32> } func.func @select_false_value(%arg0: tensor<2x3xi32>, %arg1: tensor<2x3xi32>) -> tensor<2x3xi32> { %c0 = ""tosa.const""() {value = dense<0> : tensor<2x3xi1>} : () -> tensor<2x3xi1> %0 = ""tosa.select""(%c0, %arg0, %arg1) : (tensor<2x3xi1>, tensor<2x3xi32>, tensor<2x3xi32>) -> tensor<2x3xi32> return %0 : tensor<2x3xi32> } func.func @select_not_pred(%arg0: tensor<2x3xi1>, %arg1: tensor<2x3xi32>, %arg2: tensor<2x3xi32>) -> tensor<2x3xi32> { %0 = ""tosa.logical_not""(%arg0) : (tensor<2x3xi1>) -> tensor<2x3xi1> %1 = ""tosa.select""(%0, %arg1, %arg2) : (tensor<2x3xi1>, tensor<2x3xi32>, tensor<2x3xi32>) -> tensor<2x3xi32> return %1 : tensor<2x3xi32> } func.func @reduce_all_fold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_all""(%arg0) {axis = 1 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_all_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_all""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_any_fold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_any""(%arg0) {axis = 1 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_any_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_any""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_max_fold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_max""(%arg0) {axis = 1 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_max_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_max""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_min_fold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_min""(%arg0) {axis = 1 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_min_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_min""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_prod_fold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_prod""(%arg0) {axis = 1 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_prod_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_prod""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_sum_fold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_sum""(%arg0) {axis = 1 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reduce_sum_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64}: (tensor) -> tensor return %0 : tensor } func.func @reshape_canonicalize(%arg0: tensor) -> tensor { %0 = ""tosa.reshape""(%arg0) {new_shape = array}: (tensor) -> tensor return %0 : tensor } func.func @reshape_canonicalize_double(%arg0: tensor) -> tensor { %0 = ""tosa.reshape""(%arg0) {new_shape = array}: (tensor) -> tensor<5x?xf32> %1 = ""tosa.reshape""(%0) {new_shape = array}: (tensor<5x?xf32>) -> tensor return %1 : tensor } func.func @reshape_canonicalize_const() -> tensor<1x10xi32> { %0 = ""tosa.const""() {value = dense<0> : tensor<10xi32>} : () -> tensor<10xi32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<10xi32>) -> tensor<1x10xi32> return %1 : tensor<1x10xi32> } func.func @reshape_canonicalize_const_spat() -> (tensor<10xi32>, tensor<1x10xi32>) { %0 = ""tosa.const""() {value = dense<0> : tensor<10xi32>} : () -> tensor<10xi32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<10xi32>) -> tensor<1x10xi32> return %0 , %1 : tensor<10xi32>, tensor<1x10xi32> } func.func @reshape_canonicalize_const_sparse() -> (tensor<3xi32>, tensor<1x3xi32>) { %0 = ""tosa.const""() {value = dense<[1, 2, 3]> : tensor<3xi32>} : ()-> tensor<3xi32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<3xi32>) -> tensor<1x3xi32> return %0 , %1 : tensor<3xi32>, tensor<1x3xi32> } func.func @reshape_canonicalize_quant() -> (tensor<1x3x!quant.uniform>) { %0 = ""tosa.const""() {value = dense<[1, 2, 3]> : tensor<3xi8>} : ()-> tensor<3x!quant.uniform> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<3x!quant.uniform>) -> tensor<1x3x!quant.uniform> return %1 : tensor<1x3x!quant.uniform> } func.func @transpose_canonicalize_strip_quant() -> (tensor<2x1x3xi8>) { %perms = ""tosa.const""() {value = dense<[1, 0, 2]> : tensor<3xi32>} : () -> tensor<3xi32> %0 = ""tosa.const""() {value = dense<0> : tensor<1x2x3xi8>} : ()-> tensor<1x2x3x!quant.uniform> %1 = ""tosa.transpose""(%0, %perms) : (tensor<1x2x3x!quant.uniform>, tensor<3xi32>) -> tensor<2x1x3xi8> return %1 : tensor<2x1x3xi8> } func.func @slice_fold(%arg0: tensor<3x4xf32>) -> tensor<3x4xf32> { %0 = ""tosa.slice""(%arg0) { size = array, start = array}: (tensor<3x4xf32>) -> tensor<3x4xf32> return %0 : tensor<3x4xf32> } func.func @slice_nofold(%arg0: tensor) -> tensor { %0 = ""tosa.slice""(%arg0) { size = array, start = array}: (tensor) -> tensor return %0 : tensor } func.func @tile_fold(%arg0: tensor<3x4xf32>) -> tensor<3x4xf32> { %0 = ""tosa.tile""(%arg0) { multiples = array }: (tensor<3x4xf32>) -> tensor<3x4xf32> return %0 : tensor<3x4xf32> } func.func @tile_nofold(%arg0: tensor<3x4xf32>) -> tensor<3x8xf32> { %0 = ""tosa.tile""(%arg0) { multiples = array }: (tensor<3x4xf32>) -> tensor<3x8xf32> return %0 : tensor<3x8xf32> } func.func @transpose_no_op(%arg0: tensor<3x4x5x6xf32>) -> tensor<3x4x5x6xf32> { %perms = ""tosa.const""() {value = dense<[0, 1, 2, 3]> : tensor<4xi32>} : () -> tensor<4xi32> %1 = ""tosa.transpose""(%arg0, %perms) : (tensor<3x4x5x6xf32>, tensor<4xi32>) -> tensor<3x4x5x6xf32> return %1 : tensor<3x4x5x6xf32> } func.func @transpose_is_reshape(%arg0: tensor<1x4x5x1xf32>) -> tensor<1x4x1x5xf32> { %perms = ""tosa.const""() <{value = dense<[3, 1, 0, 2]> : tensor<4xi32>}> : () -> tensor<4xi32> %0 = ""tosa.transpose""(%arg0, %perms) : (tensor<1x4x5x1xf32>, tensor<4xi32>) -> tensor<1x4x1x5xf32> return %0 : tensor<1x4x1x5xf32> } func.func @single_bit_reshape() -> tensor<1xi1> { %0 = arith.constant dense : tensor<1x1xi1> %1 = ""tosa.reshape""(%0) <{new_shape = array}> : (tensor<1x1xi1>) -> tensor<1xi1> return %1 : tensor<1xi1> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @fold_resize_nearest(%arg0 : tensor<1x15x13x1xi8>) -> tensor<1x15x13x1xi8> { %resize = ""tosa.resize""(%arg0) <{mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array}> : (tensor<1x15x13x1xi8>) -> tensor<1x15x13x1xi8> return %resize : tensor<1x15x13x1xi8> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @fold_resize_bilinear(%arg0 : tensor<1x15x13x1xi8>) -> tensor<1x15x13x1xi8> { %resize = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x15x13x1xi8>) -> tensor<1x15x13x1xi8> return %resize : tensor<1x15x13x1xi8> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_concat_slice_final_axis(%arg0 : tensor<1x12x12x1xf32>, %arg1 : tensor<1x12x12x1xf32>) -> (tensor<1x12x12x1xf32>, tensor<1x12x12x1xf32>) { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 3 : i64} : (tensor<1x12x12x1xf32>, tensor<1x12x12x1xf32>) -> tensor<1x12x12x2xf32> %1 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x12x12x2xf32>) -> tensor<1x12x12x1xf32> %2 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x12x12x2xf32>) -> tensor<1x12x12x1xf32> return %1, %2 : tensor<1x12x12x1xf32>, tensor<1x12x12x1xf32> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_concat_slice_middle_axis(%arg0 : tensor<1x12x12xf32>, %arg1 : tensor<1x12x12xf32>) -> (tensor<1x12x12xf32>, tensor<1x12x12xf32>) { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 1 : i64} : (tensor<1x12x12xf32>, tensor<1x12x12xf32>) -> tensor<1x24x12xf32> %1 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x24x12xf32>) -> tensor<1x12x12xf32> %2 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x24x12xf32>) -> tensor<1x12x12xf32> return %1, %2 : tensor<1x12x12xf32>, tensor<1x12x12xf32> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_cross_concat_inputs(%arg0 : tensor<1x12x12xf32>, %arg1 : tensor<1x12x12xf32>) -> (tensor<1x12x15xf32>, tensor<1x12x20xf32>) { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 2 : i64} : (tensor<1x12x12xf32>, tensor<1x12x12xf32>) -> tensor<1x12x24xf32> %1 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x12x24xf32>) -> tensor<1x12x15xf32> %2 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x12x24xf32>) -> tensor<1x12x20xf32> return %1, %2 : tensor<1x12x15xf32>, tensor<1x12x20xf32> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_concat_slice_on_non_concat_axis(%arg0 : tensor<1x12x12xf32>, %arg1 : tensor<1x12x12xf32>) -> (tensor<1x6x12xf32>, tensor<1x3x12xf32>) { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 2 : i64} : (tensor<1x12x12xf32>, tensor<1x12x12xf32>) -> tensor<1x12x24xf32> %1 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x12x24xf32>) -> tensor<1x6x12xf32> %2 = ""tosa.slice""(%0) {size = array, start = array} : (tensor<1x12x24xf32>) -> tensor<1x3x12xf32> return %1, %2 : tensor<1x6x12xf32>, tensor<1x3x12xf32> }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @fold_log_exp(%arg0: tensor) -> tensor { %0 = ""tosa.exp""(%arg0) : (tensor) -> tensor %1 = ""tosa.log""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @fold_exp_log(%arg0: tensor) -> tensor { %0 = ""tosa.log""(%arg0) : (tensor) -> tensor %1 = ""tosa.exp""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @fold_negate_negate(%arg0: tensor) -> tensor { %0 = ""tosa.negate""(%arg0) : (tensor) -> tensor %1 = ""tosa.negate""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @fold_abs_abs(%arg0: tensor) -> tensor { %0 = ""tosa.abs""(%arg0) : (tensor) -> tensor %1 = ""tosa.abs""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @test_argmax(%arg0: tensor<14x19xf32>) -> tensor<14xi32> { %0 = ""tosa.argmax""(%arg0) {axis = 1 : i64} : (tensor<14x19xf32>) -> tensor<14xi32> return %0 : tensor<14xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_argmax(%arg0: tensor<14x19xf32>) -> tensor<14xi32> { %0 = ""tosa.argmax""(%arg0) {axis = 1 : i64} : (tensor<14x19xf32>) -> tensor<14xi32> return %0 : tensor<14xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_avg_pool2d_f32(%arg0: tensor<1x7x7x9xf32>) -> tensor<1x7x7x9xf32> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9xf32>) -> tensor<1x7x7x9xf32> return %0 : tensor<1x7x7x9xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_avg_pool2d_f32(%arg0: tensor<1x7x7x9xf32>) -> tensor<1x7x7x9xf32> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9xf32>) -> tensor<1x7x7x9xf32> return %0 : tensor<1x7x7x9xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_avg_pool2d_i8(%arg0: tensor<1x7x7x9xi8>) -> tensor<1x7x7x9xi8> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9xi8>) -> tensor<1x7x7x9xi8> return %0 : tensor<1x7x7x9xi8> }", mlir-opt | mlir-opt ,1 "func.func @test_avg_pool2d_i8(%arg0: tensor<1x7x7x9xi8>) -> tensor<1x7x7x9xi8> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9xi8>) -> tensor<1x7x7x9xi8> return %0 : tensor<1x7x7x9xi8> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_avg_pool2d_i16(%arg0: tensor<1x7x7x9xi16>) -> tensor<1x7x7x9xi16> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9xi16>) -> tensor<1x7x7x9xi16> return %0 : tensor<1x7x7x9xi16> }", mlir-opt | mlir-opt ,1 "func.func @test_avg_pool2d_i16(%arg0: tensor<1x7x7x9xi16>) -> tensor<1x7x7x9xi16> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9xi16>) -> tensor<1x7x7x9xi16> return %0 : tensor<1x7x7x9xi16> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_avg_pool2d_q8(%arg0: tensor<1x7x7x9x!quant.uniform>) -> tensor<1x7x7x9x!quant.uniform> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9x!quant.uniform>) -> tensor<1x7x7x9x!quant.uniform> return %0 : tensor<1x7x7x9x!quant.uniform> }", mlir-opt | mlir-opt ,1 "func.func @test_avg_pool2d_q8(%arg0: tensor<1x7x7x9x!quant.uniform>) -> tensor<1x7x7x9x!quant.uniform> { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, kernel = array, pad = array, stride = array} : (tensor<1x7x7x9x!quant.uniform>) -> tensor<1x7x7x9x!quant.uniform> return %0 : tensor<1x7x7x9x!quant.uniform> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_conv2d(%arg0: tensor<1x4x4x4xf32>, %arg1: tensor<8x1x1x4xf32>, %arg2: tensor<8xf32>) -> tensor<1x4x4x8xf32> { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<1x4x4x4xf32>, tensor<8x1x1x4xf32>, tensor<8xf32>) -> tensor<1x4x4x8xf32> return %0 : tensor<1x4x4x8xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_conv2d(%arg0: tensor<1x4x4x4xf32>, %arg1: tensor<8x1x1x4xf32>, %arg2: tensor<8xf32>) -> tensor<1x4x4x8xf32> { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<1x4x4x4xf32>, tensor<8x1x1x4xf32>, tensor<8xf32>) -> tensor<1x4x4x8xf32> return %0 : tensor<1x4x4x8xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_depthwise_conv2d(%arg0: tensor<1x4x4x4xf32>, %arg1: tensor<1x1x4x2xf32>, %arg2: tensor<8xf32>) -> tensor<1x4x4x8xf32> { %2 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<1x4x4x4xf32>, tensor<1x1x4x2xf32>, tensor<8xf32>) -> tensor<1x4x4x8xf32> return %2 : tensor<1x4x4x8xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_depthwise_conv2d(%arg0: tensor<1x4x4x4xf32>, %arg1: tensor<1x1x4x2xf32>, %arg2: tensor<8xf32>) -> tensor<1x4x4x8xf32> { %2 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, stride = array} : (tensor<1x4x4x4xf32>, tensor<1x1x4x2xf32>, tensor<8xf32>) -> tensor<1x4x4x8xf32> return %2 : tensor<1x4x4x8xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_fft2d(%arg0: tensor<1x4x8xf32>, %arg1: tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) { %0, %1 = ""tosa.fft2d""(%arg0, %arg1) {inverse = false} : (tensor<1x4x8xf32>, tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) return %0, %1 : tensor<1x4x8xf32>, tensor<1x4x8xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_fft2d(%arg0: tensor<1x4x8xf32>, %arg1: tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) { %0, %1 = ""tosa.fft2d""(%arg0, %arg1) {inverse = false} : (tensor<1x4x8xf32>, tensor<1x4x8xf32>) -> (tensor<1x4x8xf32>, tensor<1x4x8xf32>) return %0, %1 : tensor<1x4x8xf32>, tensor<1x4x8xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_fully_connected(%arg0: tensor<14x19xf32>, %arg1: tensor<19x28xf32>, %arg2: tensor<28xf32>) -> tensor<14x28xf32> { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor<14x19xf32>, tensor<19x28xf32>, tensor<28xf32>) -> tensor<14x28xf32> return %0 : tensor<14x28xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_fully_connected(%arg0: tensor<14x19xf32>, %arg1: tensor<19x28xf32>, %arg2: tensor<28xf32>) -> tensor<14x28xf32> { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor<14x19xf32>, tensor<19x28xf32>, tensor<28xf32>) -> tensor<14x28xf32> return %0 : tensor<14x28xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_matmul(%arg0: tensor<1x14x19xf32>, %arg1: tensor<1x19x28xf32>) -> tensor<1x14x28xf32> { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<1x14x19xf32>, tensor<1x19x28xf32>) -> tensor<1x14x28xf32> return %0 : tensor<1x14x28xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_matmul(%arg0: tensor<1x14x19xf32>, %arg1: tensor<1x19x28xf32>) -> tensor<1x14x28xf32> { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<1x14x19xf32>, tensor<1x19x28xf32>) -> tensor<1x14x28xf32> return %0 : tensor<1x14x28xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_max_pool2d(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array} : (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_max_pool2d(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> { %0 = ""tosa.max_pool2d""(%arg0) {kernel = array, pad = array, stride = array} : (tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> return %0 : tensor<1x32x32x8xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_rfft2d(%arg0: tensor<13x8x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) { %0, %1 = ""tosa.rfft2d""(%arg0) {} : (tensor<13x8x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) return %0, %1 : tensor<13x8x9xf32>, tensor<13x8x9xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_rfft2d(%arg0: tensor<13x8x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) { %0, %1 = ""tosa.rfft2d""(%arg0) {} : (tensor<13x8x16xf32>) -> (tensor<13x8x9xf32>, tensor<13x8x9xf32>) return %0, %1 : tensor<13x8x9xf32>, tensor<13x8x9xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_transpose_conv2d(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> return %0 : tensor<1x32x32x16xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_transpose_conv2d(%arg0: tensor<1x32x32x8xf32>, %arg1: tensor<16x1x1x8xf32>, %arg2: tensor<16xf32>) -> tensor<1x32x32x16xf32> { %0 = ""tosa.transpose_conv2d""(%arg0, %arg1, %arg2) {out_pad = array, out_shape = array, stride = array} : (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32> return %0 : tensor<1x32x32x16xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_clamp(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.clamp""(%arg0) {min_fp = 0.0 : f32, max_fp = 1.0: f32, min_int = 0 : i64, max_int = 1 : i64} : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_clamp(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.clamp""(%arg0) {min_fp = 0.0 : f32, max_fp = 1.0: f32, min_int = 0 : i64, max_int = 1 : i64} : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_sigmoid(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.sigmoid""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_sigmoid(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.sigmoid""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_tanh(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.tanh""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_tanh(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.tanh""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_erf(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.erf""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_erf(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.erf""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_add(%arg0: tensor<13x21x1xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<13x21x1xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_add(%arg0: tensor<13x21x1xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<13x21x1xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_arithmetic_right_shift(%arg0: tensor<13x21x1xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.arithmetic_right_shift""(%arg0, %arg1) { round = false } : (tensor<13x21x1xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_arithmetic_right_shift(%arg0: tensor<13x21x1xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.arithmetic_right_shift""(%arg0, %arg1) { round = false } : (tensor<13x21x1xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_bitwise_and(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x21x1xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.bitwise_and""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x21x1xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_bitwise_and(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x21x1xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.bitwise_and""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x21x1xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_bitwise_or(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x1x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.bitwise_or""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x1x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_bitwise_or(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x1x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.bitwise_or""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x1x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_bitwise_xor(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.bitwise_xor""(%arg0, %arg1) : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_bitwise_xor(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.bitwise_xor""(%arg0, %arg1) : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_div(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.div""(%arg0, %arg1) : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_div(%arg0: tensor<13x21x1xi32>, %arg1: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.div""(%arg0, %arg1) : (tensor<13x21x1xi32>, tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_logical_and(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x1xi1>) -> tensor<13x21x3xi1> { %0 = ""tosa.logical_and""(%arg0, %arg1) : (tensor<13x21x3xi1>, tensor<13x21x1xi1>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_logical_and(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x1xi1>) -> tensor<13x21x3xi1> { %0 = ""tosa.logical_and""(%arg0, %arg1) : (tensor<13x21x3xi1>, tensor<13x21x1xi1>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_logical_left_shift(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x21x1xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.logical_left_shift""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x21x1xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_logical_left_shift(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x21x1xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.logical_left_shift""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x21x1xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_logical_right_shift(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x21x1xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.logical_right_shift""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x21x1xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_logical_right_shift(%arg0: tensor<13x21x3xi32>, %arg1: tensor<13x21x1xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.logical_right_shift""(%arg0, %arg1) : (tensor<13x21x3xi32>, tensor<13x21x1xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_logical_or(%arg0: tensor<13x1x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = ""tosa.logical_or""(%arg0, %arg1) : (tensor<13x1x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_logical_or(%arg0: tensor<13x1x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = ""tosa.logical_or""(%arg0, %arg1) : (tensor<13x1x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_logical_xor(%arg0: tensor<13x1x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = ""tosa.logical_xor""(%arg0, %arg1) : (tensor<13x1x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_logical_xor(%arg0: tensor<13x1x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = ""tosa.logical_xor""(%arg0, %arg1) : (tensor<13x1x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_max(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x1xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.maximum""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x21x1xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_max(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x1xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.maximum""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x21x1xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_min(%arg0: tensor<13x21x3xf32>, %arg1: tensor<1x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.minimum""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<1x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_min(%arg0: tensor<13x21x3xf32>, %arg1: tensor<1x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.minimum""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<1x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.mul""(%arg0, %arg1) { shift = 1 : i32 } : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.mul""(%arg0, %arg1) { shift = 1 : i32 } : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_pow(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x1xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.pow""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x21x1xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_pow(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x1xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.pow""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x21x1xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_sub(%arg0: tensor<1x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.sub""(%arg0, %arg1) : (tensor<1x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_sub(%arg0: tensor<1x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.sub""(%arg0, %arg1) : (tensor<1x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @main(%arg0: tensor<64xi32>, %arg1: tensor<513x!quant.uniform>) -> tensor<64x!quant.uniform> { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<64xi32>, tensor<513x!quant.uniform>) -> tensor<64x!quant.uniform> return %0 : tensor<64x!quant.uniform> }", mlir-opt | mlir-opt ,1 "func.func @main(%arg0: tensor<64xi32>, %arg1: tensor<513x!quant.uniform>) -> tensor<64x!quant.uniform> { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<64xi32>, tensor<513x!quant.uniform>) -> tensor<64x!quant.uniform> return %0 : tensor<64x!quant.uniform> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_abs(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.abs""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_abs(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.abs""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_bitwise_not(%arg0: tensor<13x21x1xi32>) -> tensor<13x21x1xi32> { %0 = ""tosa.bitwise_not""(%arg0) : (tensor<13x21x1xi32>) -> tensor<13x21x1xi32> return %0 : tensor<13x21x1xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_bitwise_not(%arg0: tensor<13x21x1xi32>) -> tensor<13x21x1xi32> { %0 = ""tosa.bitwise_not""(%arg0) : (tensor<13x21x1xi32>) -> tensor<13x21x1xi32> return %0 : tensor<13x21x1xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_ceil(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.ceil""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_ceil(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.ceil""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_clz(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.clz""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_clz(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.clz""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_exp(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.exp""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_exp(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.exp""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_floor(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.floor""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_floor(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.floor""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_log(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.log""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_log(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.log""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_logical_not(%arg0: tensor<1x21x3xi1>) -> tensor<1x21x3xi1> { %0 = ""tosa.logical_not""(%arg0) : (tensor<1x21x3xi1>) -> tensor<1x21x3xi1> return %0 : tensor<1x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_logical_not(%arg0: tensor<1x21x3xi1>) -> tensor<1x21x3xi1> { %0 = ""tosa.logical_not""(%arg0) : (tensor<1x21x3xi1>) -> tensor<1x21x3xi1> return %0 : tensor<1x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_negate(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.negate""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_negate(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.negate""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reciprocal(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.reciprocal""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reciprocal(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.reciprocal""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_rsqrt(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.rsqrt""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_rsqrt(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.rsqrt""(%arg0) : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_select(%arg0: tensor<1x1x1xi1>, %arg1: tensor<13x21x3xf32>, %arg2: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_select(%arg0: tensor<1x1x1xi1>, %arg1: tensor<13x21x3xf32>, %arg2: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<1x1x1xi1>, tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_equal(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xi1> { %0 = ""tosa.equal""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_equal(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x1x3xf32>) -> tensor<13x21x3xi1> { %0 = ""tosa.equal""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x1x3xf32>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_greater(%arg0: tensor<13x21x1xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = ""tosa.greater""(%arg0, %arg1) : (tensor<13x21x1xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_greater(%arg0: tensor<13x21x1xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = ""tosa.greater""(%arg0, %arg1) : (tensor<13x21x1xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_greater_equal(%arg0: tensor<13x1x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = ""tosa.greater_equal""(%arg0, %arg1) : (tensor<13x1x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_greater_equal(%arg0: tensor<13x1x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = ""tosa.greater_equal""(%arg0, %arg1) : (tensor<13x1x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> return %0 : tensor<13x21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reduce_all(%arg0: tensor<13x21x3xi1>) -> tensor<21x3xi1> { %0 = ""tosa.reduce_all""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xi1>) -> tensor<1x21x3xi1> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xi1>) -> tensor<21x3xi1> return %1 : tensor<21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_reduce_all(%arg0: tensor<13x21x3xi1>) -> tensor<21x3xi1> { %0 = ""tosa.reduce_all""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xi1>) -> tensor<1x21x3xi1> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xi1>) -> tensor<21x3xi1> return %1 : tensor<21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reduce_any(%arg0: tensor<13x21x3xi1>) -> tensor<21x3xi1> { %0 = ""tosa.reduce_any""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xi1>) -> tensor<1x21x3xi1> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xi1>) -> tensor<21x3xi1> return %1 : tensor<21x3xi1> }", mlir-opt | mlir-opt ,1 "func.func @test_reduce_any(%arg0: tensor<13x21x3xi1>) -> tensor<21x3xi1> { %0 = ""tosa.reduce_any""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xi1>) -> tensor<1x21x3xi1> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xi1>) -> tensor<21x3xi1> return %1 : tensor<21x3xi1> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reduce_max(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_max""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reduce_max(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_max""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reduce_min(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_min""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reduce_min(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_min""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reduce_product(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_prod""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reduce_product(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_prod""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reduce_sum(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reduce_sum(%arg0: tensor<13x21x3xf32>) -> tensor<21x3xf32> { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<1x21x3xf32> %1 = ""tosa.reshape""(%0) {new_shape = array} : (tensor<1x21x3xf32>) -> tensor<21x3xf32> return %1 : tensor<21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_concat(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<26x21x3xf32> { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<26x21x3xf32> return %0 : tensor<26x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_concat(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<26x21x3xf32> { %0 = ""tosa.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<26x21x3xf32> return %0 : tensor<26x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_pad(%arg0: tensor<13x21x3xf32>, %arg1: tensor<3x2xi32>) -> tensor<13x21x3xf32> { %0 = ""tosa.pad""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<3x2xi32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_pad(%arg0: tensor<13x21x3xf32>, %arg1: tensor<3x2xi32>) -> tensor<13x21x3xf32> { %0 = ""tosa.pad""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<3x2xi32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_pad_explicit_value(%arg0: tensor<13x21x3xf32>, %arg1: tensor<3x2xi32>) -> tensor<13x21x3xf32> { %0 = ""tosa.const""() {value = dense<3.14> : tensor} : () -> tensor %1 = ""tosa.pad""(%arg0, %arg1, %0) : (tensor<13x21x3xf32>, tensor<3x2xi32>, tensor) -> tensor<13x21x3xf32> return %1 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_pad_explicit_value(%arg0: tensor<13x21x3xf32>, %arg1: tensor<3x2xi32>) -> tensor<13x21x3xf32> { %0 = ""tosa.const""() {value = dense<3.14> : tensor} : () -> tensor %1 = ""tosa.pad""(%arg0, %arg1, %0) : (tensor<13x21x3xf32>, tensor<3x2xi32>, tensor) -> tensor<13x21x3xf32> return %1 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reshape(%arg0: tensor<13x21x3xf32>) -> tensor<1x819xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<13x21x3xf32>) -> tensor<1x819xf32> return %0 : tensor<1x819xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reshape(%arg0: tensor<13x21x3xf32>) -> tensor<1x819xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<13x21x3xf32>) -> tensor<1x819xf32> return %0 : tensor<1x819xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_reverse(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.reverse""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_reverse(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.reverse""(%arg0) {axis = 0 : i64} : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_slice(%arg0: tensor<13x21x3xf32>) -> tensor<4x11x1xf32> { %0 = ""tosa.slice""(%arg0) {start = array, size = array} : (tensor<13x21x3xf32>) -> tensor<4x11x1xf32> return %0 : tensor<4x11x1xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_slice(%arg0: tensor<13x21x3xf32>) -> tensor<4x11x1xf32> { %0 = ""tosa.slice""(%arg0) {start = array, size = array} : (tensor<13x21x3xf32>) -> tensor<4x11x1xf32> return %0 : tensor<4x11x1xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_tile(%arg0: tensor<13x21x3xf32>) -> tensor<39x21x6xf32> { %0 = ""tosa.tile""(%arg0) {multiples = array} : (tensor<13x21x3xf32>) -> tensor<39x21x6xf32> return %0 : tensor<39x21x6xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_tile(%arg0: tensor<13x21x3xf32>) -> tensor<39x21x6xf32> { %0 = ""tosa.tile""(%arg0) {multiples = array} : (tensor<13x21x3xf32>) -> tensor<39x21x6xf32> return %0 : tensor<39x21x6xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_transpose(%arg0: tensor<13x21x3xf32>) -> tensor<3x13x21xf32> { %0 = ""tosa.const""() {value = dense<[2, 0, 1]> : tensor<3xi32>} : () -> tensor<3xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<13x21x3xf32>, tensor<3xi32>) -> tensor<3x13x21xf32> return %1 : tensor<3x13x21xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_transpose(%arg0: tensor<13x21x3xf32>) -> tensor<3x13x21xf32> { %0 = ""tosa.const""() {value = dense<[2, 0, 1]> : tensor<3xi32>} : () -> tensor<3xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<13x21x3xf32>, tensor<3xi32>) -> tensor<3x13x21xf32> return %1 : tensor<3x13x21xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_gather(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x26xi32>) -> tensor<13x26x3xf32> { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x26xi32>) -> tensor<13x26x3xf32> return %0 : tensor<13x26x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_gather(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x26xi32>) -> tensor<13x26x3xf32> { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<13x21x3xf32>, tensor<13x26xi32>) -> tensor<13x26x3xf32> return %0 : tensor<13x26x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_scatter(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x26xi32>, %arg2: tensor<13x26x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor<13x21x3xf32>, tensor<13x26xi32>, tensor<13x26x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_scatter(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x26xi32>, %arg2: tensor<13x26x3xf32>) -> tensor<13x21x3xf32> { %0 = ""tosa.scatter""(%arg0, %arg1, %arg2) : (tensor<13x21x3xf32>, tensor<13x26xi32>, tensor<13x26x3xf32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_resize(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> { %1 = ""tosa.resize""(%arg0) { scale = array, offset = array, border = array, mode = ""BILINEAR""} : (tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> return %1 : tensor<1x64x64x8xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_resize(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> { %1 = ""tosa.resize""(%arg0) { scale = array, offset = array, border = array, mode = ""BILINEAR""} : (tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> return %1 : tensor<1x64x64x8xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_cast1(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xf32> { %0 = ""tosa.cast""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt | mlir-opt ,1 "func.func @test_cast1(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xf32> { %0 = ""tosa.cast""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_cast2(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> { %0 = ""tosa.cast""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> return %0 : tensor<13x21x3x!quant.uniform> }", mlir-opt | mlir-opt ,1 "func.func @test_cast2(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> { %0 = ""tosa.cast""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> return %0 : tensor<13x21x3x!quant.uniform> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_cast3(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> { %0 = ""tosa.cast""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> return %0 : tensor<13x21x3x!quant.uniform> }", mlir-opt | mlir-opt ,1 "func.func @test_cast3(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> { %0 = ""tosa.cast""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3x!quant.uniform> return %0 : tensor<13x21x3x!quant.uniform> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_rescale(%arg0: tensor<13x21x3x!quant.uniform>) -> tensor<13x21x3x!quant.uniform> { %0 = ""tosa.rescale""(%arg0) {double_round = false, input_zp = 127 : i32, multiplier = array, output_zp = -1 : i32, per_channel = false, scale32 = true, shift = array} : (tensor<13x21x3x!quant.uniform>) -> tensor<13x21x3x!quant.uniform> return %0 : tensor<13x21x3x!quant.uniform> }", mlir-opt | mlir-opt ,1 "func.func @test_rescale(%arg0: tensor<13x21x3x!quant.uniform>) -> tensor<13x21x3x!quant.uniform> { %0 = ""tosa.rescale""(%arg0) {double_round = false, input_zp = 127 : i32, multiplier = array, output_zp = -1 : i32, per_channel = false, scale32 = true, shift = array} : (tensor<13x21x3x!quant.uniform>) -> tensor<13x21x3x!quant.uniform> return %0 : tensor<13x21x3x!quant.uniform> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_const(%arg0 : index) -> tensor<4xi32> { %0 = ""tosa.const""() {value = dense<[3, 0, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32> return %0 : tensor<4xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_const(%arg0 : index) -> tensor<4xi32> { %0 = ""tosa.const""() {value = dense<[3, 0, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32> return %0 : tensor<4xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_identity(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.identity""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_identity(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xi32> { %0 = ""tosa.identity""(%arg0) : (tensor<13x21x3xi32>) -> tensor<13x21x3xi32> return %0 : tensor<13x21x3xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_cond_if(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb0(%arg3: tensor, %arg4: tensor): %1 = ""tosa.add""(%arg3, %arg4) : (tensor, tensor) -> tensor ""tosa.yield""(%1) : (tensor) -> () }, { ^bb0(%arg3: tensor, %arg4: tensor): %1 = ""tosa.sub""(%arg3, %arg4) : (tensor, tensor) -> tensor ""tosa.yield""(%1) : (tensor) -> () }) : (tensor, tensor, tensor) -> tensor return %0 : tensor }", mlir-opt | mlir-opt ,1 "func.func @test_cond_if(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb0(%arg3: tensor, %arg4: tensor): %1 = ""tosa.add""(%arg3, %arg4) : (tensor, tensor) -> tensor ""tosa.yield""(%1) : (tensor) -> () }, { ^bb0(%arg3: tensor, %arg4: tensor): %1 = ""tosa.sub""(%arg3, %arg4) : (tensor, tensor) -> tensor ""tosa.yield""(%1) : (tensor) -> () }) : (tensor, tensor, tensor) -> tensor return %0 : tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_while_loop(%arg0: tensor<10xi32>, %arg1: tensor) { %0 = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %1:3 = ""tosa.while_loop""(%0, %0, %arg0) ({ ^bb0(%arg2: tensor, %arg3: tensor, %arg4: tensor<10xi32>): %2 = ""tosa.greater_equal""(%arg3, %arg1) : (tensor, tensor) -> tensor %3 = ""tosa.logical_not""(%2) : (tensor) -> tensor ""tosa.yield""(%3) : (tensor) -> () }, { ^bb0(%arg2: tensor, %arg3: tensor, %arg4: tensor<10xi32>): %2 = ""tosa.const""() {value = dense<1> : tensor} : () -> tensor %3 = ""tosa.add""(%arg3, %2) : (tensor, tensor) -> tensor %4 = ""tosa.reshape""(%2) {new_shape = array} : (tensor) -> tensor<1xi32> %5 = ""tosa.add""(%arg4, %4) : (tensor<10xi32>, tensor<1xi32>) -> tensor<10xi32> %6 = ""tosa.add""(%arg2, %2) : (tensor, tensor) -> tensor ""tosa.yield""(%6, %3, %5) : (tensor, tensor, tensor<10xi32>) -> () }) : (tensor, tensor, tensor<10xi32>) -> (tensor, tensor, tensor<10xi32>) return }", mlir-opt | mlir-opt ,1 "func.func @test_while_loop(%arg0: tensor<10xi32>, %arg1: tensor) { %0 = ""tosa.const""() {value = dense<0> : tensor} : () -> tensor %1:3 = ""tosa.while_loop""(%0, %0, %arg0) ({ ^bb0(%arg2: tensor, %arg3: tensor, %arg4: tensor<10xi32>): %2 = ""tosa.greater_equal""(%arg3, %arg1) : (tensor, tensor) -> tensor %3 = ""tosa.logical_not""(%2) : (tensor) -> tensor ""tosa.yield""(%3) : (tensor) -> () }, { ^bb0(%arg2: tensor, %arg3: tensor, %arg4: tensor<10xi32>): %2 = ""tosa.const""() {value = dense<1> : tensor} : () -> tensor %3 = ""tosa.add""(%arg3, %2) : (tensor, tensor) -> tensor %4 = ""tosa.reshape""(%2) {new_shape = array} : (tensor) -> tensor<1xi32> %5 = ""tosa.add""(%arg4, %4) : (tensor<10xi32>, tensor<1xi32>) -> tensor<10xi32> %6 = ""tosa.add""(%arg2, %2) : (tensor, tensor) -> tensor ""tosa.yield""(%6, %3, %5) : (tensor, tensor, tensor<10xi32>) -> () }) : (tensor, tensor, tensor<10xi32>) -> (tensor, tensor, tensor<10xi32>) return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_custom(%arg0: tensor<10xi32>) -> tensor<10xi32> { %0 = ""tosa.custom""(%arg0) {identifier=""custom_test"", config=""tosa_mlir_test"", implementation_attrs=""""} : (tensor<10xi32>) -> (tensor<10xi32>) return %0 : tensor<10xi32> }", mlir-opt | mlir-opt ,1 "func.func @test_custom(%arg0: tensor<10xi32>) -> tensor<10xi32> { %0 = ""tosa.custom""(%arg0) {identifier=""custom_test"", config=""tosa_mlir_test"", implementation_attrs=""""} : (tensor<10xi32>) -> (tensor<10xi32>) return %0 : tensor<10xi32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @inlined_if_fn(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb0(%arg3: tensor, %arg4: tensor): %1 = call @add(%arg3, %arg4) : (tensor, tensor) -> tensor ""tosa.yield""(%1) : (tensor) -> () }, { ^bb0(%arg3: tensor, %arg4: tensor): %1 = call @sub(%arg3, %arg4) : (tensor, tensor) -> tensor ""tosa.yield""(%1) : (tensor) -> () }) : (tensor, tensor, tensor) -> tensor return %0 : tensor } func.func private @add(%arg0: tensor, %arg1: tensor) -> tensor { %0 = ""tosa.add""(%arg0, %arg1) : (tensor, tensor) -> tensor return %0 : tensor } func.func private @sub(%arg0: tensor, %arg1: tensor) -> tensor { %0 = ""tosa.sub""(%arg0, %arg1) : (tensor, tensor) -> tensor return %0 : tensor }", mlir-opt -inline ,1 "func.func @inlined_while_fn(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor<10xi32>) -> tensor<10xi32> { %1:4 = ""tosa.while_loop""(%arg0, %arg1, %arg2, %arg3) ({ ^bb0(%arg4: tensor, %arg5: tensor, %arg6: tensor, %arg7: tensor<10xi32>): %2 = call @while_cond_40(%arg4, %arg5, %arg6, %arg7) : (tensor, tensor, tensor, tensor<10xi32>) -> tensor ""tosa.yield""(%2) : (tensor) -> () }, { ^bb0(%arg4: tensor, %arg5: tensor, %arg6: tensor, %arg7: tensor<10xi32>): %2:4 = call @while_body_50(%arg4, %arg5, %arg6, %arg7) : (tensor, tensor, tensor, tensor<10xi32>) -> (tensor, tensor, tensor, tensor<10xi32>) ""tosa.yield""(%2#0, %2#1, %2#2, %2#3) : (tensor, tensor, tensor, tensor<10xi32>) -> () }) : (tensor, tensor, tensor, tensor<10xi32>) -> (tensor, tensor, tensor, tensor<10xi32>) return %1#3 : tensor<10xi32> } func.func private @while_body_50(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor<10xi32>) -> (tensor, tensor, tensor, tensor<10xi32>) { %1 = ""tosa.add""(%arg0, %arg1) : (tensor, tensor) -> tensor %2 = ""tosa.add""(%arg3, %1) : (tensor<10xi32>, tensor) -> tensor<10xi32> return %1, %arg1, %arg2, %2: tensor, tensor, tensor, tensor<10xi32> } func.func private @while_cond_40(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor<10xi32>) -> tensor { %0 = ""tosa.greater_equal""(%arg0, %arg1) : (tensor, tensor) -> tensor %1 = ""tosa.logical_not""(%0) : (tensor) -> tensor return %1 : tensor }", mlir-opt -inline ,1 "func.func @conv2d_as_fully_connected(%arg0: tensor<4x10x10x2xf32>, %arg1: tensor<3x1x1x2xf32>, %arg2: tensor<3xf32>) -> tensor<4x10x10x3xf32> { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array} : (tensor<4x10x10x2xf32>, tensor<3x1x1x2xf32>, tensor<3xf32>) -> tensor<4x10x10x3xf32> return %0 : tensor<4x10x10x3xf32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @conv2d_as_fully_connected_quant(%arg0: tensor<4x10x10x2xi8>, %arg1: tensor<3x1x1x2xi8>, %arg2: tensor<3xi32>) -> tensor<4x10x10x3xi32> { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array, quantization_info = #tosa.conv_quant} : (tensor<4x10x10x2xi8>, tensor<3x1x1x2xi8>, tensor<3xi32>) -> tensor<4x10x10x3xi32> return %0 : tensor<4x10x10x3xi32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @conv_with_dynamic_dim(%arg0: tensor, %arg1: tensor<384x1x1x64xi8>, %arg2: tensor<384xi32>) -> tensor { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, quantization_info = #tosa.conv_quant, stride = array} : (tensor, tensor<384x1x1x64xi8>, tensor<384xi32>) -> tensor return %0 : tensor }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @conv2d_as_fully_connected_padded(%arg0: tensor<4x10x10x2xi8>, %arg1: tensor<3x1x1x2xi8>, %arg2: tensor<3xi32>) -> tensor<4x12x12x3xi32> { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {pad = array, stride = array, dilation = array, quantization_info = #tosa.conv_quant} : (tensor<4x10x10x2xi8>, tensor<3x1x1x2xi8>, tensor<3xi32>) -> tensor<4x12x12x3xi32> return %0 : tensor<4x12x12x3xi32> }", mlir-opt --split-input-file --tosa-optional-decompositions ,1 "func.func @test_const(%arg0 : index) -> tensor<4xi32> { %0 = ""tosa.const""() {value = dense<[3, 0, 1, 2]> : tensor<4xi32>} : () -> tensor<4xi32> return %0 : tensor<4xi32> } func.func @test_const_i64(%arg0 : index) -> tensor<4xi64> { %0 = ""tosa.const""() {value = dense<[3, 0, 1, 2]> : tensor<4xi64>} : () -> tensor<4xi64> return %0 : tensor<4xi64> } func.func @try_fold_equal_with_unranked_tensor(%arg0: tensor<4xi32>, %arg1: tensor) { %0 = ""tosa.equal""(%arg0, %arg1) : (tensor<4xi32>, tensor) -> tensor<*xi1> return }", mlir-opt --test-constant-fold ,1 "func.func @test_build_qtype(%arg0 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>>) -> tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> { %0 = ""tosa.negate""(%arg0) : (tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>>) -> tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> return %0 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489:128>> }", mlir-opt --tosa-test-quant-utils ,1 "func.func @test_build_mult_and_shift(%arg0: tensor<1x32x32x8x!quant.uniform>, %arg1 : tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489>>, %arg2 : tensor<16xi32>) -> tensor<1x32x32x16x!quant.uniform> { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {pad = array, dilation = array, stride = array, quantization_info = #tosa.conv_quant} : (tensor<1x32x32x8x!quant.uniform>, tensor<16x1x1x8x!quant.uniform:f32, 0.015680249780416489>>, tensor<16xi32>) -> tensor<1x32x32x16x!quant.uniform> return %0 : tensor<1x32x32x16x!quant.uniform> }", mlir-opt --tosa-test-quant-utils ,1 "func.func @f(%arg0: tensor<2x3x4xf32>) -> tensor<3xindex> { %0 = shape.shape_of %arg0 : tensor<2x3x4xf32> -> tensor<3xindex> return %0 : tensor<3xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> (!shape.shape, !shape.shape) { %c2 = arith.constant 2 : index %0 = shape.const_shape [2, 3, 4, 5] : !shape.shape %head, %tail = ""shape.split_at""(%0, %c2) : (!shape.shape, index) -> (!shape.shape, !shape.shape) return %head, %tail : !shape.shape, !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> (!shape.shape, !shape.shape) { %c-1 = arith.constant -1 : index %0 = shape.const_shape [2, 3, 4, 5] : !shape.shape %head, %tail = ""shape.split_at""(%0, %c-1) : (!shape.shape, index) -> (!shape.shape, !shape.shape) return %head, %tail : !shape.shape, !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> (!shape.shape, !shape.shape) { %c5 = arith.constant 5 : index %0 = shape.const_shape [2, 3, 4, 5] : !shape.shape %head, %tail = ""shape.split_at""(%0, %c5) : (!shape.shape, index) -> (!shape.shape, !shape.shape) return %head, %tail : !shape.shape, !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> !shape.shape { %0 = shape.const_shape [1, 2] : !shape.shape %1 = shape.const_shape [7, 1] : !shape.shape %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast() -> tensor<2xindex> { %0 = shape.const_shape [1, 2] : tensor<2xindex> %1 = shape.const_shape [7, 1] : tensor<2xindex> %2 = shape.broadcast %0, %1 : tensor<2xindex>, tensor<2xindex> -> tensor<2xindex> return %2 : tensor<2xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast() -> !shape.shape { %0 = shape.const_shape [1, 2] : tensor<2xindex> %1 = shape.const_shape [7, 1] : tensor<2xindex> %2 = shape.broadcast %0, %1 : tensor<2xindex>, tensor<2xindex> -> !shape.shape return %2 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) -> !shape.shape { %0 = shape.const_shape [] : !shape.shape %1 = shape.broadcast %arg0, %0 : !shape.shape, !shape.shape -> !shape.shape return %1 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) -> !shape.shape { %0 = shape.const_shape [] : !shape.shape %1 = shape.broadcast %0, %arg0 : !shape.shape, !shape.shape -> !shape.shape return %1 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> !shape.shape { %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [1, 2, 3] : !shape.shape %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @all_but_one_empty(%arg0 : !shape.shape) -> !shape.shape { %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [] : tensor<0xindex> %2 = shape.broadcast %0, %arg0, %1, %0 : !shape.shape, !shape.shape, tensor<0xindex>, !shape.shape -> !shape.shape return %2 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @partial_folding(%arg0 : !shape.shape) -> !shape.shape { %0 = shape.const_shape [2, 1] : !shape.shape %1 = shape.const_shape [1, 2, 3] : tensor<3xindex> %2 = shape.broadcast %0, %arg0, %1, %0 : !shape.shape, !shape.shape, tensor<3xindex>, !shape.shape -> !shape.shape return %2 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> !shape.shape { %0 = shape.const_shape [2] : !shape.shape %1 = shape.const_shape [7] : !shape.shape %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast(%arg0 : !shape.shape, %arg1 : !shape.shape) { %0 = shape.broadcast %arg0, %arg1 : !shape.shape, !shape.shape -> !shape.shape return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> !shape.shape { %lhs = shape.const_shape [0, 1] : !shape.shape %rhs = shape.const_shape [2, 3] : !shape.shape %0 = shape.concat %lhs, %rhs : !shape.shape , !shape.shape -> !shape.shape return %0 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> tensor<4xindex> { %lhs = shape.const_shape [0, 1] : tensor<2xindex> %rhs = shape.const_shape [2, 3] : tensor<2xindex> %0 = shape.concat %lhs, %rhs : tensor<2xindex>, tensor<2xindex> -> tensor<4xindex> return %0 : tensor<4xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> tensor<2xindex> { %cs = shape.const_shape [0, 1] : !shape.shape %0 = shape.to_extent_tensor %cs : !shape.shape -> tensor<2xindex> return %0 : tensor<2xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() -> !shape.shape { %e0 = arith.constant 3 : index %e1 = arith.constant 5 : index %e2 = arith.constant 11 : index %ret = shape.from_extents %e0, %e1, %e2 : index, index, index return %ret : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_const_size() -> !shape.shape { %e0 = shape.const_size 3 %e1 = shape.const_size 5 %ret = shape.from_extents %e0, %e1 : !shape.size, !shape.size return %ret : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @no_fold(%arg0: index) -> !shape.shape { %e0 = arith.constant 3 : index %ret = shape.from_extents %e0, %arg0 : index, index return %ret : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @const_size_to_index() -> index { %cs = shape.const_size 123 %ci = shape.size_to_index %cs : !shape.size return %ci : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @const_index_to_size() -> !shape.size { %ci = arith.constant 123 : index %cs = shape.index_to_size %ci return %cs : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @const_index_to_size_to_index() -> index { %ci0 = arith.constant 123 : index %cs0 = shape.index_to_size %ci0 %ci1 = shape.size_to_index %cs0 : !shape.size return %ci1 : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @nonfoldable_size_to_index(%cs : !shape.size) -> index { %ci = shape.size_to_index %cs : !shape.size return %ci : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @nonfoldable_index_to_size(%ci : index) -> !shape.size { %cs = shape.index_to_size %ci return %cs : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @num_elements() -> !shape.size { %shape = shape.const_shape [4, 5, 6] : !shape.shape %num_elements = shape.num_elements %shape : !shape.shape -> !shape.size return %num_elements : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @nonfoldable_num_elements(%shape : !shape.shape) -> !shape.size { %num_elements = shape.num_elements %shape : !shape.shape -> !shape.size return %num_elements : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @basic() -> index { %0 = shape.const_shape [0, 1, 2] : tensor<3xindex> %c2 = arith.constant 2 : index %1 = shape.get_extent %0, %c2 : tensor<3xindex>, index -> index return %1 : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @out_of_bounds() -> index { %0 = shape.const_shape [0, 1, 2] : tensor<3xindex> %c3 = arith.constant 3 : index %1 = shape.get_extent %0, %c3 : tensor<3xindex>, index -> index return %1 : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @not_const(%arg0: tensor) -> index { %c3 = arith.constant 3 : index %0 = shape.get_extent %arg0, %c3 : tensor, index -> index return %0 : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @basic() -> !shape.size { %0 = shape.const_shape [0, 1, 2] : !shape.shape %c2 = shape.const_size 2 %1 = shape.get_extent %0, %c2 : !shape.shape, !shape.size -> !shape.size return %1 : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @out_of_bounds() -> !shape.size { %0 = shape.const_shape [0, 1, 2] : !shape.shape %c3 = shape.const_size 3 %1 = shape.get_extent %0, %c3 : !shape.shape, !shape.size -> !shape.size return %1 : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @not_const(%arg0 : !shape.shape) -> !shape.size { %c3 = shape.const_size 3 %0 = shape.get_extent %arg0, %c3 : !shape.shape, !shape.size -> !shape.size return %0 : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) { %0 = shape.cstr_eq %arg0, %arg0, %arg0 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [0, 1] : !shape.shape %cs1 = shape.const_shape [0, 1] : !shape.shape %cs2 = shape.const_shape [0, 1] : !shape.shape %0 = shape.cstr_eq %cs0, %cs1, %cs2 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [0, 1] : !shape.shape %cs1 = shape.const_shape [3, 1] : !shape.shape %0 = shape.cstr_eq %cs0, %cs1 : !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0: !shape.shape, %arg1: !shape.shape) { %0 = shape.cstr_eq %arg0, %arg1 : !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_require_fold() { %true = arith.constant true %0 = shape.cstr_require %true, ""msg"" ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_require_no_fold(%arg0: i1) { %0 = shape.cstr_require %arg0, ""msg"" ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %0 = ""test.source""() : () -> !shape.witness %1 = ""test.source""() : () -> !shape.witness %2 = ""test.source""() : () -> !shape.witness %3 = shape.assuming_all %0, %1 %4 = shape.assuming_all %3, %2 ""consume.witness""(%4) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @assuming_all_to_cstr_eq(%a : !shape.shape, %b : tensor, %c : tensor<3xindex>) -> !shape.witness { %0 = shape.cstr_eq %a, %b : !shape.shape, tensor %1 = shape.cstr_eq %b, %c : tensor, tensor<3xindex> %2 = shape.assuming_all %0, %1 return %2 : !shape.witness }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @assuming_all_duplicate_operands(%arg0 : tensor, %arg1 : tensor) -> !shape.witness { %0 = shape.cstr_broadcastable %arg0, %arg1 : tensor, tensor %1 = shape.assuming_all %0, %0, %0 return %1 : !shape.witness }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @assuming_all_to_cstr_eq(%a : !shape.shape, %b : tensor, %c : tensor<3xindex>, %d : tensor<3xindex>) -> !shape.witness { %0 = shape.cstr_eq %a, %b : !shape.shape, tensor %1 = shape.cstr_eq %c, %d : tensor<3xindex>, tensor<3xindex> %2 = shape.assuming_all %0, %1 return %2 : !shape.witness }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %0 = shape.const_witness true %1 = shape.const_witness true %2 = shape.const_witness true %3 = shape.assuming_all %0, %1, %2 ""consume.witness""(%3) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %0 = shape.const_witness true %1 = ""test.source""() : () -> !shape.witness %2 = ""test.source""() : () -> !shape.witness %3 = shape.assuming_all %0, %1, %2 ""consume.witness""(%3) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape, %arg2 : !shape.shape) { %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.cstr_broadcastable %arg0, %arg1, %arg2 : !shape.shape, !shape.shape, !shape.shape %2 = shape.assuming_all %0, %1 ""consume.witness""(%2) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape, %arg2 : !shape.shape) { %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.cstr_broadcastable %arg1, %arg2 : !shape.shape, !shape.shape %2 = shape.assuming_all %0, %1 ""consume.witness""(%2) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg : !shape.shape) -> !shape.shape { %0 = shape.const_shape [2, 3, 4] : !shape.shape %1 = shape.any %0, %arg : !shape.shape, !shape.shape -> !shape.shape return %1 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg : tensor) -> tensor<3xindex> { %0 = shape.const_shape [2, 3, 4] : tensor<3xindex> %1 = shape.any %0, %arg : tensor<3xindex>, tensor -> tensor<3xindex> return %1 : tensor<3xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> !shape.shape { %1 = shape.any %arg0, %arg1 : !shape.shape, !shape.shape -> !shape.shape return %1 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %0 = shape.const_witness true %1 = shape.assuming %0 -> index { %2 = ""test.source""() : () -> (index) shape.assuming_yield %2 : index } ""test.sink""(%1) : (index) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %0 = ""test.source""() : () -> (!shape.witness) %1 = shape.assuming %0 -> index { %2 = ""test.source""() : () -> (index) shape.assuming_yield %2 : index } ""test.sink""(%1) : (index) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @unused_assuming_results() { %0 = ""test.source""() : () -> (!shape.witness) %1:2 = shape.assuming %0 -> (f32, f32) { %2 = ""produce.redundant""() : () -> (f32) %3 = ""produce.meaningful""() : () -> (f32) shape.assuming_yield %2, %3 : f32, f32 } ""use""(%1#1) : (f32) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [3, 1] : !shape.shape %cs1 = shape.const_shape [1, 5] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs1 : !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor<0xindex>) { %0 = shape.const_shape [] : !shape.shape %1 = shape.cstr_broadcastable %arg0, %arg1, %0, %arg2 : tensor, tensor, !shape.shape, tensor<0xindex> ""consume.witness""(%1) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @static_non_broadcastable() { %cs0 = shape.const_shape [1, 3] : !shape.shape %cs1 = shape.const_shape [1, 5] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs1 : !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) { %cs0 = shape.const_shape [1, 3] : !shape.shape %0 = shape.cstr_broadcastable %arg0, %cs0 : !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) { %0 = shape.cstr_broadcastable %arg0, %arg0 : !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcastable_on_extent_tensors(%arg : tensor) { %0 = shape.cstr_broadcastable %arg, %arg : tensor, tensor ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [8, 1] : !shape.shape %cs1 = shape.const_shape [1, 8] : !shape.shape %cs2 = shape.const_shape [1, 1] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs1, %cs2 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [8, 1] : !shape.shape %cs1 = shape.const_shape [1, -9223372036854775808] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs0, %cs1 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [8, 1] : !shape.shape %cs1 = shape.const_shape [1, 8] : !shape.shape %cs2 = shape.const_shape [1, -9223372036854775808] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs1, %cs2 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f() { %cs0 = shape.const_shape [8, 1] : !shape.shape %cs1 = shape.const_shape [1, -9223372036854775808] : !shape.shape %cs2 = shape.const_shape [8, -9223372036854775808] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs1, %cs2 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) { %cs0 = shape.const_shape [] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs0, %arg0 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @f(%arg0 : !shape.shape) { %cs0 = shape.const_shape [] : !shape.shape %cs1 = shape.const_shape [2] : !shape.shape %0 = shape.cstr_broadcastable %cs0, %cs1, %arg0 : !shape.shape, !shape.shape, !shape.shape ""consume.witness""(%0) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_rank() -> !shape.size { %shape = shape.const_shape [3, 4, 5, 6, 7] : !shape.shape %rank = shape.rank %shape : !shape.shape -> !shape.size return %rank : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_rank(%shape : !shape.shape) -> !shape.size { %rank = shape.rank %shape : !shape.shape -> !shape.size return %rank : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_rank() -> index { %shape = shape.const_shape [3, 4, 5, 6, 7] : tensor<5xindex> %rank = shape.rank %shape : tensor<5xindex> -> index return %rank : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_rank(%shape : tensor) -> index { %rank = shape.rank %shape : tensor -> index return %rank : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_rank(%arg : tensor<1x2x?xf32>) -> index { %shape = shape.shape_of %arg : tensor<1x2x?xf32> -> tensor %rank = shape.rank %shape : tensor -> index return %rank : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_rank_size(%arg : tensor<1x2x?xf32>) -> !shape.size { %shape = shape.shape_of %arg : tensor<1x2x?xf32> -> !shape.shape %rank = shape.rank %shape : !shape.shape -> !shape.size return %rank : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @dont_canonicalize_rank(%arg : tensor<*xf32>) -> index { %shape = shape.shape_of %arg : tensor<*xf32> -> tensor %rank = shape.rank %shape : tensor -> index return %rank : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @index_to_size_to_index(%index : index) -> index { %size = shape.index_to_size %index %result = shape.size_to_index %size : !shape.size return %result : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @size_to_index_to_size(%size : !shape.size) -> !shape.size { %idx = shape.size_to_index %size : !shape.size %result = shape.index_to_size %idx return %result : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_broadcastable_scalar(%arg0 : tensor) { %0 = shape.const_shape [] : !shape.shape %1 = shape.shape_of %arg0 : tensor -> tensor %2 = shape.cstr_broadcastable %0, %1 : !shape.shape, tensor ""consume.witness""(%2) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_broadcastable_unknown(%arg0 : tensor, %arg1 : tensor) { %0 = shape.shape_of %arg0 : tensor -> tensor %1 = shape.shape_of %arg1 : tensor -> tensor %2 = shape.cstr_broadcastable %0, %1 : tensor, tensor ""consume.witness""(%2) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_broadcastable_scalar_unranked(%arg0 : tensor<*xf32>, %arg1 : tensor) { %0 = shape.shape_of %arg1 : tensor -> tensor %1 = shape.shape_of %arg0 : tensor<*xf32> -> tensor %2 = shape.cstr_broadcastable %0, %1 : tensor, tensor ""consume.witness""(%2) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @shape_eq_fold_1() -> i1 { %a = shape.const_shape [1, 2, 3] : !shape.shape %b = shape.const_shape [1, 2, 3] : tensor<3xindex> %c = shape.const_shape [1, 2, 3] : tensor<3xindex> %result = shape.shape_eq %a, %b, %c : !shape.shape, tensor<3xindex>, tensor<3xindex> return %result : i1 }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @shape_eq_fold_0() -> i1 { %a = shape.const_shape [1, 2, 3] : tensor<3xindex> %b = shape.const_shape [4, 5, 6] : tensor<3xindex> %c = shape.const_shape [4, 5, 6] : tensor<3xindex> %result = shape.shape_eq %a, %b, %c : tensor<3xindex>, tensor<3xindex>, tensor<3xindex> return %result : i1 }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @shape_eq_fold_0() -> i1 { %a = shape.const_shape [1, 2, 3, 4, 5, 6] : !shape.shape %b = shape.const_shape [1, 2, 3] : !shape.shape %result = shape.shape_eq %a, %b : !shape.shape, !shape.shape return %result : i1 }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @shape_eq_do_not_fold(%a : !shape.shape) -> i1 { %b = shape.const_shape [4, 5, 6] : !shape.shape %result = shape.shape_eq %a, %b : !shape.shape, !shape.shape return %result : i1 }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_add_size() -> !shape.size { %c2 = shape.const_size 2 %c3 = shape.const_size 3 %result = shape.add %c2, %c3 : !shape.size, !shape.size -> !shape.size return %result : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_mul_size() -> !shape.size { %c2 = shape.const_size 2 %c3 = shape.const_size 3 %result = shape.mul %c2, %c3 : !shape.size, !shape.size -> !shape.size return %result : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_mul_index() -> index { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %result = shape.mul %c2, %c3 : index, index -> index return %result : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_mul_mixed() -> !shape.size { %c2 = shape.const_size 2 %c3 = arith.constant 3 : index %result = shape.mul %c2, %c3 : !shape.size, index -> !shape.size return %result : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_div_size() -> !shape.size { %c2 = shape.const_size 10 %c3 = shape.const_size 3 %result = shape.div %c2, %c3 : !shape.size, !shape.size -> !shape.size return %result : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_div_index() -> index { %c2 = arith.constant 10 : index %c3 = arith.constant 4 : index %result = shape.div %c2, %c3 : index, index -> index return %result : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_div_index_neg_lhs() -> index { %c2 = arith.constant -10 : index %c3 = arith.constant 4 : index %result = shape.div %c2, %c3 : index, index -> index return %result : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_div_index_neg_rhs() -> index { %c2 = arith.constant 10 : index %c3 = arith.constant -4 : index %result = shape.div %c2, %c3 : index, index -> index return %result : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_div_mixed() -> !shape.size { %c2 = shape.const_size 12 %c3 = arith.constant 3 : index %result = shape.div %c2, %c3 : !shape.size, index -> !shape.size return %result : !shape.size }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_index_cast_on_index(%arg: index) -> index { %0 = shape.size_to_index %arg : index return %0 : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_to_extent_tensor_on_tensor(%arg: tensor) -> tensor { %0 = shape.to_extent_tensor %arg : tensor -> tensor return %0 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_assuming_all_single_element(%arg: tensor) { %0 = ""test.source""() : () -> (!shape.witness) %1 = shape.assuming_all %0 ""consume.witness""(%1) : (!shape.witness) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @fold_tensor.cast_of_const_shape_returned(%arg: i1) -> tensor<1xindex> { %0 = shape.const_shape [2] : tensor<1xindex> %1 = tensor.cast %0 : tensor<1xindex> to tensor<1xindex> return %1 : tensor<1xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_tensor.cast_of_const_shape_returned_dynamic(%arg: i1) -> tensor { %0 = shape.const_shape [2] : tensor<1xindex> %1 = tensor.cast %0 : tensor<1xindex> to tensor return %1 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @is_broadcastable_on_same_shape(%shape : !shape.shape) -> i1 { %0 = shape.is_broadcastable %shape, %shape, %shape : !shape.shape, !shape.shape, !shape.shape return %0 : i1 }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @is_broadcastable_on_duplicate_shapes(%a : !shape.shape, %b : !shape.shape) -> i1 { %0 = shape.is_broadcastable %a, %b, %a, %a, %a, %b : !shape.shape, !shape.shape, !shape.shape, !shape.shape, !shape.shape, !shape.shape return %0 : i1 }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_broadcastable_on_duplicate_shapes(%a : !shape.shape, %b : !shape.shape) -> !shape.witness { %0 = shape.cstr_broadcastable %a, %b, %a, %a, %a, %b : !shape.shape, !shape.shape, !shape.shape, !shape.shape, !shape.shape, !shape.shape return %0 : !shape.witness }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast_on_same_shape(%shape : !shape.shape) -> !shape.shape { %0 = shape.broadcast %shape, %shape, %shape : !shape.shape, !shape.shape, !shape.shape -> !shape.shape return %0 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast_on_duplicate_shapes(%a : !shape.shape, %b : !shape.shape) -> !shape.shape { %0 = shape.broadcast %a, %b, %a, %a, %a, %b : !shape.shape, !shape.shape, !shape.shape, !shape.shape, !shape.shape, !shape.shape -> !shape.shape return %0 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast_on_single_operand(%a : tensor) { %0 = shape.broadcast %a : tensor -> tensor ""use""(%0) : (tensor) -> () return }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast_as_tensor_cast(%a : tensor<3xindex>) -> tensor { %0 = shape.broadcast %a : tensor<3xindex> -> tensor return %0 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @broadcast_as_from_extent_tensor(%a : tensor) -> !shape.shape { %0 = shape.broadcast %a : tensor -> !shape.shape return %0 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cast_extent_tensor(%arg : tensor) -> tensor { %0 = shape.shape_of %arg : tensor -> tensor<3xindex> %1 = tensor.cast %0 : tensor<3xindex> to tensor return %1 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cast_extent_tensor(%arg : tensor) -> tensor<3xindex> { %0 = shape.shape_of %arg : tensor -> tensor %1 = tensor.cast %0 : tensor to tensor<3xindex> return %1 : tensor<3xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cast_extent_tensor(%arg : tensor) -> tensor<3xindex> { %0 = shape.shape_of %arg : tensor -> tensor %1 = tensor.cast %0 : tensor to tensor<3xindex> return %1 : tensor<3xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cast_extent_tensor(%arg : tensor<*xf32>) -> tensor<3xindex> { %0 = shape.shape_of %arg : tensor<*xf32> -> tensor %1 = tensor.cast %0 : tensor to tensor<3xindex> return %1 : tensor<3xindex> }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @max_same_arg(%a: !shape.shape) -> !shape.shape { %1 = shape.max %a, %a : !shape.shape, !shape.shape -> !shape.shape return %1 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @min_same_arg(%a: !shape.shape) -> !shape.shape { %1 = shape.min %a, %a : !shape.shape, !shape.shape -> !shape.shape return %1 : !shape.shape }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cstr_broadcastable_folding(%arg : tensor) { %0 = shape.shape_of %arg : tensor -> tensor<2xindex> %1 = shape.const_shape [4] : tensor<1xindex> %2 = shape.cstr_broadcastable %0, %1: tensor<2xindex>, tensor<1xindex> ""use""(%2) : (!shape.witness) -> () }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @cast_extent_tensor_operands(%arg0 : tensor, %arg1 : tensor<3xindex>) -> (!shape.witness, tensor) { %0 = tensor.cast %arg0 : tensor to tensor<3xindex> %1 = tensor.cast %arg1 : tensor<3xindex> to tensor %2 = shape.cstr_broadcastable %0, %1 : tensor<3xindex>, tensor %3 = shape.broadcast %0, %1 :tensor<3xindex>, tensor -> tensor return %2, %3 : !shape.witness, tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @concretize_broadcast_result_type(%arg0 : tensor<2xindex>, %arg1 : tensor<3xindex>) -> tensor { %0 = shape.broadcast %arg0, %arg1 : tensor<2xindex>, tensor<3xindex> -> tensor return %0 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @extract_shapeof(%arg0 : tensor) -> index { %c1 = arith.constant 1 : index %shape = shape.shape_of %arg0 : tensor -> tensor<2xindex> %result = tensor.extract %shape[%c1] : tensor<2xindex> return %result : index }"," mlir-opt -split-input-file -allow-unregistered-dialect -canonicalize=""test-convergence"" ",1 "func.func @shape_assuming() { %0 = shape.const_witness true %1 = shape.assuming %0 -> (tensor<2xf16>) { %2 = ""test.source""() : () -> (tensor<2xf16>) shape.assuming_yield %2 : tensor<2xf16> } ""test.sink""(%1) : (tensor<2xf16>) -> () return }", mlir-opt -split-input-file -shape-bufferize < ,1 "func.func @shape_num_elements(%shape : !shape.shape) -> !shape.size { %init = shape.const_size 1 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size { ^bb0(%index : index, %extent : !shape.size, %acc : !shape.size): %acc_next = shape.mul %acc, %extent : !shape.size, !shape.size -> !shape.size shape.yield %acc_next : !shape.size } return %num_elements : !shape.size } func.func @extent_tensor_num_elements(%shape : tensor) -> index { %init = arith.constant 1 : index %num_elements = shape.reduce(%shape, %init) : tensor -> index { ^bb0(%index : index, %extent : index, %acc : index): %acc_next = shape.mul %acc, %extent : index, index -> index shape.yield %acc_next : index } return %num_elements : index } func.func @test_shape_num_elements_unknown() { %0 = ""shape.unknown_shape""() : () -> !shape.shape %1 = call @shape_num_elements(%0) : (!shape.shape) -> (!shape.size) %2 = ""shape.print""(%1) : (!shape.size) -> !shape.size return } func.func @const_shape() { %0 = shape.const_shape [1, 2, 3] : !shape.shape %2 = shape.const_shape [4, 5, 6] : tensor<3xindex> return } func.func @test_shape_num_elements_fixed() { %0 = shape.const_shape [1, 57, 92] : !shape.shape %1 = call @shape_num_elements(%0) : (!shape.shape) -> (!shape.size) %3 = ""shape.print""(%1) : (!shape.size) -> !shape.size return } func.func @test_broadcast_fixed() { %0 = shape.const_shape [10, 1, 57, 92] : !shape.shape %1 = shape.const_shape [4, 57, 92] : !shape.shape %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_broadcast_extents() -> tensor<4xindex> { %0 = shape.const_shape [10, 1, 57, 92] : tensor<4xindex> %1 = shape.const_shape [4, 57, 92] : tensor<3xindex> %2 = shape.broadcast %0, %1 : tensor<4xindex>, tensor<3xindex> -> tensor<4xindex> return %2 : tensor<4xindex> } func.func @test_shape_any_fixed() { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.const_shape [4, 57, 92] : !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_shape_any_unknown() { %0 = shape.const_shape [4, -1, 92] : !shape.shape %1 = shape.const_shape [-1, 57, 92] : !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_shape_any_fixed_mismatch() { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.const_shape [2, 57, 92] : !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_parse_const_shape() { %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [1, 2, 3] : !shape.shape %2 = shape.const_shape [1, 2, 3] : tensor<3xindex> return } func.func @test_shape_of(%arg0: tensor) -> tensor { %0 = shape.shape_of %arg0 : tensor -> tensor return %0 : tensor } func.func @test_value_of(%arg0: !shape.value_shape) -> tensor { %0 = shape.value_of %arg0 : tensor return %0 : tensor } func.func @test_constraints() { %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [1, 2, 3] : !shape.shape %true = arith.constant true %w0 = shape.cstr_broadcastable %0, %1 : !shape.shape, !shape.shape %w1 = shape.cstr_eq %0, %1 : !shape.shape, !shape.shape %w2 = shape.const_witness true %w3 = shape.const_witness false %w4 = shape.cstr_require %true, ""msg"" %w_all = shape.assuming_all %w0, %w1, %w2, %w3, %w4 shape.assuming %w_all -> !shape.shape { %2 = ""shape.any""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape shape.assuming_yield %2 : !shape.shape } return } func.func @eq_on_extent_tensors(%lhs : tensor, %rhs : tensor) { %w0 = shape.cstr_eq %lhs, %rhs : tensor, tensor return } func.func @broadcastable_on_extent_tensors(%lhs : tensor, %rhs : tensor) { %w0 = shape.cstr_broadcastable %lhs, %rhs : tensor, tensor return } func.func @mul(%size_arg : !shape.size, %index_arg : index) { %size_prod = shape.mul %size_arg, %size_arg : !shape.size, !shape.size -> !shape.size %index_prod = shape.mul %index_arg, %index_arg : index, index -> index %mixed_prod = shape.mul %size_arg, %index_arg : !shape.size, index -> !shape.size return } func.func @div(%size_arg : !shape.size, %index_arg : index) { %size_div = shape.div %size_arg, %size_arg : !shape.size, !shape.size -> !shape.size %index_div = shape.div %index_arg, %index_arg : index, index -> index %mixed_div = shape.div %size_arg, %index_arg : !shape.size, index -> !shape.size return } func.func @add(%size_arg : !shape.size, %index_arg : index) { %size_sum = shape.add %size_arg, %size_arg : !shape.size, !shape.size -> !shape.size %index_sum = shape.add %index_arg, %index_arg : index, index -> index %mixed_sum = shape.add %size_arg, %index_arg : !shape.size, index -> !shape.size return } func.func @const_size() { %0 = shape.const_size 1 %1 = shape.const_size 2 %2 = shape.const_size 2 return } func.func @test_to_extent_tensor(%arg: !shape.shape) -> tensor<3xindex> { %0 = shape.to_extent_tensor %arg : !shape.shape -> tensor<3xindex> return %0 : tensor<3xindex> } func.func @test_identity_to_extent_tensor(%arg: tensor<3xindex>) -> tensor<3xindex> { %0 = shape.to_extent_tensor %arg : tensor<3xindex> -> tensor<3xindex> return %0 : tensor<3xindex> } func.func @test_from_extent_tensor(%arg: tensor) -> !shape.shape { %0 = shape.from_extent_tensor %arg : tensor return %0 : !shape.shape } func.func @rank(%shape : !shape.shape) -> !shape.size { %rank = shape.rank %shape : !shape.shape -> !shape.size return %rank : !shape.size } func.func @rank_on_extent_tensor(%shape : tensor) -> index { %rank = shape.rank %shape : tensor -> index return %rank : index } func.func @shape_eq_on_shapes(%a : !shape.shape, %b : !shape.shape) -> i1 { %result = shape.shape_eq %a, %b : !shape.shape, !shape.shape return %result : i1 } func.func @shape_eq_on_tensors(%a : tensor, %b : tensor) -> i1 { %result = shape.shape_eq %a, %b : tensor, tensor return %result : i1 } func.func @shape_eq_on_mixed(%a : tensor, %b : !shape.shape) -> i1 { %result = shape.shape_eq %a, %b : tensor, !shape.shape return %result : i1 } func.func @get_extent_on_shape(%arg : !shape.shape) -> !shape.size { %c0 = shape.const_size 0 %result = shape.get_extent %arg, %c0 : !shape.shape, !shape.size -> !shape.size return %result : !shape.size } func.func @get_extent_on_extent_tensor(%arg : tensor) -> index { %c0 = arith.constant 0 : index %result = shape.get_extent %arg, %c0 : tensor, index -> index return %result : index } func.func @get_dim(%arg : memref) -> index { %c0 = arith.constant 0 : index %result = shape.dim %arg, %c0 : memref, index -> index return %result : index } func.func @get_extent_on_mixed_operands(%arg : tensor) -> !shape.size { %c0 = shape.const_size 0 %result = shape.get_extent %arg, %c0 : tensor, !shape.size -> !shape.size return %result : !shape.size } func.func @any() { %0 = shape.const_shape [1, 2, 3] : !shape.shape %1 = shape.const_shape [4, 5, 6] : !shape.shape %2 = ""shape.any""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = shape.const_shape [1, 2, 3] : tensor<3xindex> %4 = shape.const_shape [4, 5, 6] : tensor<3xindex> %5 = ""shape.any""(%3, %4) : (tensor<3xindex>, tensor<3xindex>) -> tensor<3xindex> return } func.func @num_elements_extent_tensor(%arg : tensor) -> index { %result = shape.num_elements %arg : tensor -> index return %result : index } func.func @num_elements_shape(%arg : !shape.shape) -> !shape.size { %result = shape.num_elements %arg : !shape.shape -> !shape.size return %result : !shape.size } func.func @shape_equal_shapes(%a : !shape.value_shape, %b : !shape.value_shape) -> !shape.shape { %0 = shape.shape_of %a : !shape.value_shape -> !shape.shape %1 = shape.shape_of %b : !shape.value_shape -> !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape return %2 : !shape.shape } func.func @shape_with_shape(%a : !shape.value_shape, %b : !shape.value_shape) -> !shape.shape { %0 = shape.shape_of %a : !shape.value_shape -> !shape.shape %1 = shape.with_shape %b, %0 : !shape.value_shape, !shape.shape %2 = call @shape_equal_shapes(%a, %1) : (!shape.value_shape, !shape.value_shape) -> !shape.shape return %2 : !shape.shape } func.func @shape_with_shape_extent_tensor_type(%a : tensor, %b : !shape.value_shape) -> !shape.value_shape { %0 = shape.shape_of %a : tensor -> tensor<3xindex> %1 = shape.with_shape %b, %0 : !shape.value_shape, tensor<3xindex> return %1 : !shape.value_shape } func.func @any_on_shape(%a : !shape.shape, %b : !shape.shape, %c : !shape.shape) -> !shape.shape { %result = shape.any %a, %b, %c : !shape.shape, !shape.shape, !shape.shape -> !shape.shape return %result : !shape.shape } func.func @any_on_mixed(%a : tensor, %b : tensor, %c : !shape.shape) -> !shape.shape { %result = shape.any %a, %b, %c : tensor, tensor, !shape.shape -> !shape.shape return %result : !shape.shape } func.func @any_on_extent_tensors(%a : tensor, %b : tensor, %c : tensor) -> tensor { %result = shape.any %a, %b, %c : tensor, tensor, tensor -> tensor return %result : tensor } func.func @is_broadcastable_on_extent_tensors(%a : tensor, %b : tensor) -> i1 { %result = shape.is_broadcastable %a, %b : tensor, tensor return %result : i1 } func.func @is_broadcastable_on_shapes(%a : !shape.shape, %b : !shape.shape) -> i1 { %result = shape.is_broadcastable %a, %b : !shape.shape, !shape.shape return %result : i1 } func.func @shape_upper_bounded_by_constant(%a: !shape.shape) -> !shape.shape { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.max %a, %0 : !shape.shape, !shape.shape -> !shape.shape %2 = shape.meet %0, %1, error=""exceeded element-wise upper bound"" : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape } func.func @shape_lower_bounded_by_constant(%a: !shape.shape) -> !shape.shape { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.min %a, %0 : !shape.shape, !shape.shape -> !shape.shape %2 = shape.meet %0, %1, error=""lower bound element-wise exceeded"" : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape } func.func @size_upper_bounded_by_constant(%a: !shape.size) -> !shape.size { %0 = shape.const_size 5 %1 = shape.max %a, %0 : !shape.size, !shape.size -> !shape.size %2 = shape.meet %0, %1, error=""exceeded element-wise upper bound"" : !shape.size, !shape.size -> !shape.size return %2 : !shape.size } func.func @size_lower_bounded_by_constant(%a: !shape.size) -> !shape.size { %0 = shape.const_size 9 %1 = shape.min %a, %0 : !shape.size, !shape.size -> !shape.size %2 = shape.meet %0, %1, error=""lower bound element-wise exceeded"" : !shape.size, !shape.size -> !shape.size return %2 : !shape.size } func.func @meet_index(%arg0 : index, %arg1 : index) -> index { %result = shape.meet %arg0, %arg1 : index, index -> index return %result : index }", mlir-opt | mlir-opt ,1 "func.func @shape_num_elements(%shape : !shape.shape) -> !shape.size { %init = shape.const_size 1 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size { ^bb0(%index : index, %extent : !shape.size, %acc : !shape.size): %acc_next = shape.mul %acc, %extent : !shape.size, !shape.size -> !shape.size shape.yield %acc_next : !shape.size } return %num_elements : !shape.size } func.func @extent_tensor_num_elements(%shape : tensor) -> index { %init = arith.constant 1 : index %num_elements = shape.reduce(%shape, %init) : tensor -> index { ^bb0(%index : index, %extent : index, %acc : index): %acc_next = shape.mul %acc, %extent : index, index -> index shape.yield %acc_next : index } return %num_elements : index } func.func @test_shape_num_elements_unknown() { %0 = ""shape.unknown_shape""() : () -> !shape.shape %1 = call @shape_num_elements(%0) : (!shape.shape) -> (!shape.size) %2 = ""shape.print""(%1) : (!shape.size) -> !shape.size return } func.func @const_shape() { %0 = shape.const_shape [1, 2, 3] : !shape.shape %2 = shape.const_shape [4, 5, 6] : tensor<3xindex> return } func.func @test_shape_num_elements_fixed() { %0 = shape.const_shape [1, 57, 92] : !shape.shape %1 = call @shape_num_elements(%0) : (!shape.shape) -> (!shape.size) %3 = ""shape.print""(%1) : (!shape.size) -> !shape.size return } func.func @test_broadcast_fixed() { %0 = shape.const_shape [10, 1, 57, 92] : !shape.shape %1 = shape.const_shape [4, 57, 92] : !shape.shape %2 = shape.broadcast %0, %1 : !shape.shape, !shape.shape -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_broadcast_extents() -> tensor<4xindex> { %0 = shape.const_shape [10, 1, 57, 92] : tensor<4xindex> %1 = shape.const_shape [4, 57, 92] : tensor<3xindex> %2 = shape.broadcast %0, %1 : tensor<4xindex>, tensor<3xindex> -> tensor<4xindex> return %2 : tensor<4xindex> } func.func @test_shape_any_fixed() { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.const_shape [4, 57, 92] : !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_shape_any_unknown() { %0 = shape.const_shape [4, -1, 92] : !shape.shape %1 = shape.const_shape [-1, 57, 92] : !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_shape_any_fixed_mismatch() { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.const_shape [2, 57, 92] : !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = ""shape.print""(%2) : (!shape.shape) -> !shape.shape return } func.func @test_parse_const_shape() { %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [1, 2, 3] : !shape.shape %2 = shape.const_shape [1, 2, 3] : tensor<3xindex> return } func.func @test_shape_of(%arg0: tensor) -> tensor { %0 = shape.shape_of %arg0 : tensor -> tensor return %0 : tensor } func.func @test_value_of(%arg0: !shape.value_shape) -> tensor { %0 = shape.value_of %arg0 : tensor return %0 : tensor } func.func @test_constraints() { %0 = shape.const_shape [] : !shape.shape %1 = shape.const_shape [1, 2, 3] : !shape.shape %true = arith.constant true %w0 = shape.cstr_broadcastable %0, %1 : !shape.shape, !shape.shape %w1 = shape.cstr_eq %0, %1 : !shape.shape, !shape.shape %w2 = shape.const_witness true %w3 = shape.const_witness false %w4 = shape.cstr_require %true, ""msg"" %w_all = shape.assuming_all %w0, %w1, %w2, %w3, %w4 shape.assuming %w_all -> !shape.shape { %2 = ""shape.any""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape shape.assuming_yield %2 : !shape.shape } return } func.func @eq_on_extent_tensors(%lhs : tensor, %rhs : tensor) { %w0 = shape.cstr_eq %lhs, %rhs : tensor, tensor return } func.func @broadcastable_on_extent_tensors(%lhs : tensor, %rhs : tensor) { %w0 = shape.cstr_broadcastable %lhs, %rhs : tensor, tensor return } func.func @mul(%size_arg : !shape.size, %index_arg : index) { %size_prod = shape.mul %size_arg, %size_arg : !shape.size, !shape.size -> !shape.size %index_prod = shape.mul %index_arg, %index_arg : index, index -> index %mixed_prod = shape.mul %size_arg, %index_arg : !shape.size, index -> !shape.size return } func.func @div(%size_arg : !shape.size, %index_arg : index) { %size_div = shape.div %size_arg, %size_arg : !shape.size, !shape.size -> !shape.size %index_div = shape.div %index_arg, %index_arg : index, index -> index %mixed_div = shape.div %size_arg, %index_arg : !shape.size, index -> !shape.size return } func.func @add(%size_arg : !shape.size, %index_arg : index) { %size_sum = shape.add %size_arg, %size_arg : !shape.size, !shape.size -> !shape.size %index_sum = shape.add %index_arg, %index_arg : index, index -> index %mixed_sum = shape.add %size_arg, %index_arg : !shape.size, index -> !shape.size return } func.func @const_size() { %0 = shape.const_size 1 %1 = shape.const_size 2 %2 = shape.const_size 2 return } func.func @test_to_extent_tensor(%arg: !shape.shape) -> tensor<3xindex> { %0 = shape.to_extent_tensor %arg : !shape.shape -> tensor<3xindex> return %0 : tensor<3xindex> } func.func @test_identity_to_extent_tensor(%arg: tensor<3xindex>) -> tensor<3xindex> { %0 = shape.to_extent_tensor %arg : tensor<3xindex> -> tensor<3xindex> return %0 : tensor<3xindex> } func.func @test_from_extent_tensor(%arg: tensor) -> !shape.shape { %0 = shape.from_extent_tensor %arg : tensor return %0 : !shape.shape } func.func @rank(%shape : !shape.shape) -> !shape.size { %rank = shape.rank %shape : !shape.shape -> !shape.size return %rank : !shape.size } func.func @rank_on_extent_tensor(%shape : tensor) -> index { %rank = shape.rank %shape : tensor -> index return %rank : index } func.func @shape_eq_on_shapes(%a : !shape.shape, %b : !shape.shape) -> i1 { %result = shape.shape_eq %a, %b : !shape.shape, !shape.shape return %result : i1 } func.func @shape_eq_on_tensors(%a : tensor, %b : tensor) -> i1 { %result = shape.shape_eq %a, %b : tensor, tensor return %result : i1 } func.func @shape_eq_on_mixed(%a : tensor, %b : !shape.shape) -> i1 { %result = shape.shape_eq %a, %b : tensor, !shape.shape return %result : i1 } func.func @get_extent_on_shape(%arg : !shape.shape) -> !shape.size { %c0 = shape.const_size 0 %result = shape.get_extent %arg, %c0 : !shape.shape, !shape.size -> !shape.size return %result : !shape.size } func.func @get_extent_on_extent_tensor(%arg : tensor) -> index { %c0 = arith.constant 0 : index %result = shape.get_extent %arg, %c0 : tensor, index -> index return %result : index } func.func @get_dim(%arg : memref) -> index { %c0 = arith.constant 0 : index %result = shape.dim %arg, %c0 : memref, index -> index return %result : index } func.func @get_extent_on_mixed_operands(%arg : tensor) -> !shape.size { %c0 = shape.const_size 0 %result = shape.get_extent %arg, %c0 : tensor, !shape.size -> !shape.size return %result : !shape.size } func.func @any() { %0 = shape.const_shape [1, 2, 3] : !shape.shape %1 = shape.const_shape [4, 5, 6] : !shape.shape %2 = ""shape.any""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape %3 = shape.const_shape [1, 2, 3] : tensor<3xindex> %4 = shape.const_shape [4, 5, 6] : tensor<3xindex> %5 = ""shape.any""(%3, %4) : (tensor<3xindex>, tensor<3xindex>) -> tensor<3xindex> return } func.func @num_elements_extent_tensor(%arg : tensor) -> index { %result = shape.num_elements %arg : tensor -> index return %result : index } func.func @num_elements_shape(%arg : !shape.shape) -> !shape.size { %result = shape.num_elements %arg : !shape.shape -> !shape.size return %result : !shape.size } func.func @shape_equal_shapes(%a : !shape.value_shape, %b : !shape.value_shape) -> !shape.shape { %0 = shape.shape_of %a : !shape.value_shape -> !shape.shape %1 = shape.shape_of %b : !shape.value_shape -> !shape.shape %2 = ""shape.meet""(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape return %2 : !shape.shape } func.func @shape_with_shape(%a : !shape.value_shape, %b : !shape.value_shape) -> !shape.shape { %0 = shape.shape_of %a : !shape.value_shape -> !shape.shape %1 = shape.with_shape %b, %0 : !shape.value_shape, !shape.shape %2 = call @shape_equal_shapes(%a, %1) : (!shape.value_shape, !shape.value_shape) -> !shape.shape return %2 : !shape.shape } func.func @shape_with_shape_extent_tensor_type(%a : tensor, %b : !shape.value_shape) -> !shape.value_shape { %0 = shape.shape_of %a : tensor -> tensor<3xindex> %1 = shape.with_shape %b, %0 : !shape.value_shape, tensor<3xindex> return %1 : !shape.value_shape } func.func @any_on_shape(%a : !shape.shape, %b : !shape.shape, %c : !shape.shape) -> !shape.shape { %result = shape.any %a, %b, %c : !shape.shape, !shape.shape, !shape.shape -> !shape.shape return %result : !shape.shape } func.func @any_on_mixed(%a : tensor, %b : tensor, %c : !shape.shape) -> !shape.shape { %result = shape.any %a, %b, %c : tensor, tensor, !shape.shape -> !shape.shape return %result : !shape.shape } func.func @any_on_extent_tensors(%a : tensor, %b : tensor, %c : tensor) -> tensor { %result = shape.any %a, %b, %c : tensor, tensor, tensor -> tensor return %result : tensor } func.func @is_broadcastable_on_extent_tensors(%a : tensor, %b : tensor) -> i1 { %result = shape.is_broadcastable %a, %b : tensor, tensor return %result : i1 } func.func @is_broadcastable_on_shapes(%a : !shape.shape, %b : !shape.shape) -> i1 { %result = shape.is_broadcastable %a, %b : !shape.shape, !shape.shape return %result : i1 } func.func @shape_upper_bounded_by_constant(%a: !shape.shape) -> !shape.shape { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.max %a, %0 : !shape.shape, !shape.shape -> !shape.shape %2 = shape.meet %0, %1, error=""exceeded element-wise upper bound"" : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape } func.func @shape_lower_bounded_by_constant(%a: !shape.shape) -> !shape.shape { %0 = shape.const_shape [4, 57, 92] : !shape.shape %1 = shape.min %a, %0 : !shape.shape, !shape.shape -> !shape.shape %2 = shape.meet %0, %1, error=""lower bound element-wise exceeded"" : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape } func.func @size_upper_bounded_by_constant(%a: !shape.size) -> !shape.size { %0 = shape.const_size 5 %1 = shape.max %a, %0 : !shape.size, !shape.size -> !shape.size %2 = shape.meet %0, %1, error=""exceeded element-wise upper bound"" : !shape.size, !shape.size -> !shape.size return %2 : !shape.size } func.func @size_lower_bounded_by_constant(%a: !shape.size) -> !shape.size { %0 = shape.const_size 9 %1 = shape.min %a, %0 : !shape.size, !shape.size -> !shape.size %2 = shape.meet %0, %1, error=""lower bound element-wise exceeded"" : !shape.size, !shape.size -> !shape.size return %2 : !shape.size } func.func @meet_index(%arg0 : index, %arg1 : index) -> index { %result = shape.meet %arg0, %arg1 : index, index -> index return %result : index }", mlir-opt -mlir-print-op-generic | mlir-opt ,1 "func.func @two_dynamic_one_direct_shape(%arg0: tensor, %arg1: tensor<2x4x?xf32>) -> tensor { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = shape.shape_of %arg0 : tensor -> tensor<3xindex> %1 = shape.get_extent %0, %c2 : tensor<3xindex>, index -> index %2 = ""test.abs""(%arg0) : (tensor) -> tensor %3 = shape.with_shape %2, %0 : tensor, tensor<3xindex> %4 = shape.value_of %3 : tensor %5 = ""test.concat""(%4, %arg1) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor %6 = shape.get_extent %0, %c0 : tensor<3xindex>, index -> index %7 = arith.addi %6, %c2 : index %8 = shape.from_extents %7, %c4, %1 : index, index, index %9 = shape.with_shape %5, %8 : tensor, !shape.shape %10 = shape.value_of %9 : tensor return %10 : tensor }", mlir-opt -outline-shape-computation -test-print-shape-mapping -split-input-file 2>%t ,1 "func.func @two_dynamic_one_direct_shape(%arg0: tensor, %arg1: tensor<2x4x?xf32>) -> tensor { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = shape.shape_of %arg0 : tensor -> tensor<3xindex> %1 = shape.get_extent %0, %c2 : tensor<3xindex>, index -> index %2 = ""test.abs""(%arg0) : (tensor) -> tensor %3 = shape.with_shape %2, %0 : tensor, tensor<3xindex> %4 = shape.value_of %3 : tensor %5 = ""test.concat""(%4, %arg1) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor %6 = shape.get_extent %0, %c0 : tensor<3xindex>, index -> index %7 = arith.addi %6, %c2 : index %8 = shape.from_extents %7, %c4, %1 : index, index, index %9 = shape.with_shape %5, %8 : tensor, !shape.shape %10 = shape.value_of %9 : tensor return %10 : tensor }", cat %t ,1 "func.func @two_dynamic_share_same_shape(%arg0: tensor, %arg1: tensor<2x4x?xf32>) -> tensor { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = shape.shape_of %arg0 : tensor -> tensor<3xindex> %1 = shape.get_extent %0, %c2 : tensor<3xindex>, index -> index %2 = ""test.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor %3 = shape.get_extent %0, %c0 : tensor<3xindex>, index -> index %4 = arith.addi %3, %c2 : index %5 = shape.from_extents %4, %c4, %1 : index, index, index %6 = shape.with_shape %2, %5 : tensor, !shape.shape %7 = shape.value_of %6 : tensor %8 = ""test.abs""(%7) : (tensor) -> tensor %9 = shape.with_shape %8, %5 : tensor, !shape.shape %10 = shape.value_of %9 : tensor return %10 : tensor }", mlir-opt -outline-shape-computation -test-print-shape-mapping -split-input-file 2>%t ,1 "func.func @two_dynamic_share_same_shape(%arg0: tensor, %arg1: tensor<2x4x?xf32>) -> tensor { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = shape.shape_of %arg0 : tensor -> tensor<3xindex> %1 = shape.get_extent %0, %c2 : tensor<3xindex>, index -> index %2 = ""test.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor<2x4x?xf32>) -> tensor %3 = shape.get_extent %0, %c0 : tensor<3xindex>, index -> index %4 = arith.addi %3, %c2 : index %5 = shape.from_extents %4, %c4, %1 : index, index, index %6 = shape.with_shape %2, %5 : tensor, !shape.shape %7 = shape.value_of %6 : tensor %8 = ""test.abs""(%7) : (tensor) -> tensor %9 = shape.with_shape %8, %5 : tensor, !shape.shape %10 = shape.value_of %9 : tensor return %10 : tensor }", cat %t ,1 "func.func @internal_dynamic_shape_source_shared(%arg0: tensor) -> tensor { %0 = ""test.nonzero""(%arg0) : (tensor) -> tensor %1 = shape.shape_of %0 : tensor -> tensor<1xindex> %2 = shape.with_shape %0, %1 : tensor, tensor<1xindex> %3 = shape.value_of %2 : tensor %4 = ""test.abs""(%3) : (tensor) -> tensor %5 = shape.with_shape %4, %1 : tensor, tensor<1xindex> %6 = shape.value_of %5 : tensor %7 = ""test.negate""(%6) : (tensor) -> tensor %8 = shape.with_shape %7, %1 : tensor, tensor<1xindex> %9 = shape.value_of %8 : tensor return %9 : tensor }", mlir-opt -outline-shape-computation -test-print-shape-mapping -split-input-file 2>%t ,1 "func.func @internal_dynamic_shape_source_shared(%arg0: tensor) -> tensor { %0 = ""test.nonzero""(%arg0) : (tensor) -> tensor %1 = shape.shape_of %0 : tensor -> tensor<1xindex> %2 = shape.with_shape %0, %1 : tensor, tensor<1xindex> %3 = shape.value_of %2 : tensor %4 = ""test.abs""(%3) : (tensor) -> tensor %5 = shape.with_shape %4, %1 : tensor, tensor<1xindex> %6 = shape.value_of %5 : tensor %7 = ""test.negate""(%6) : (tensor) -> tensor %8 = shape.with_shape %7, %1 : tensor, tensor<1xindex> %9 = shape.value_of %8 : tensor return %9 : tensor }", cat %t ,1 "func.func @only_return_of_constructed_shape(%arg0: tensor, %arg1: tensor<1xindex>) -> tensor { %0 = ""test.nonzero""(%arg0) : (tensor) -> tensor %1 = shape.with_shape %0, %arg1 : tensor, tensor<1xindex> %2 = shape.value_of %1 : tensor return %2 : tensor }", mlir-opt -outline-shape-computation -test-print-shape-mapping -split-input-file 2>%t ,1 "func.func @only_return_of_constructed_shape(%arg0: tensor, %arg1: tensor<1xindex>) -> tensor { %0 = ""test.nonzero""(%arg0) : (tensor) -> tensor %1 = shape.with_shape %0, %arg1 : tensor, tensor<1xindex> %2 = shape.value_of %1 : tensor return %2 : tensor }", cat %t ,1 "func.func @interleaved_shape_computation(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> (tensor, index) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %0 = shape.shape_of %arg0 : tensor -> tensor<3xindex> %1 = shape.shape_of %arg1 : tensor -> tensor<3xindex> %2 = shape.shape_of %arg2 : tensor -> tensor<3xindex> %3 = ""test.concat""(%arg0, %arg1, %arg2) {axis = 0 : i64} : (tensor, tensor, tensor) -> tensor %4 = shape.get_extent %0, %c0 : tensor<3xindex>, index -> index %5 = shape.get_extent %1, %c0 : tensor<3xindex>, index -> index %6 = shape.get_extent %2, %c0 : tensor<3xindex>, index -> index %7 = arith.addi %4, %5 : index %8 = arith.addi %7, %6 : index %9 = shape.from_extents %8, %c4, %c5 : index, index, index %10 = shape.with_shape %3, %9 : tensor, !shape.shape %11 = shape.value_of %10 : tensor return %11, %7 : tensor, index }", mlir-opt -outline-shape-computation -test-print-shape-mapping -split-input-file 2>%t ,1 "func.func @interleaved_shape_computation(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> (tensor, index) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %0 = shape.shape_of %arg0 : tensor -> tensor<3xindex> %1 = shape.shape_of %arg1 : tensor -> tensor<3xindex> %2 = shape.shape_of %arg2 : tensor -> tensor<3xindex> %3 = ""test.concat""(%arg0, %arg1, %arg2) {axis = 0 : i64} : (tensor, tensor, tensor) -> tensor %4 = shape.get_extent %0, %c0 : tensor<3xindex>, index -> index %5 = shape.get_extent %1, %c0 : tensor<3xindex>, index -> index %6 = shape.get_extent %2, %c0 : tensor<3xindex>, index -> index %7 = arith.addi %4, %5 : index %8 = arith.addi %7, %6 : index %9 = shape.from_extents %8, %c4, %c5 : index, index, index %10 = shape.with_shape %3, %9 : tensor, !shape.shape %11 = shape.value_of %10 : tensor return %11, %7 : tensor, index }", cat %t ,1 "func.func @multiple_reused(%arg0: tensor, %arg1: tensor) -> (tensor, tensor, tensor, tensor) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = shape.shape_of %arg0 : tensor -> tensor<2xindex> %1 = shape.shape_of %arg1 : tensor -> tensor<2xindex> %2 = ""test.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor) -> tensor %3 = ""test.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor) -> tensor %4 = shape.get_extent %0, %c0 : tensor<2xindex>, index -> index %5 = shape.get_extent %1, %c0 : tensor<2xindex>, index -> index %6 = arith.addi %4, %5 : index %7 = shape.from_extents %6, %c4 : index, index %8 = shape.with_shape %2, %7 : tensor, !shape.shape %9 = shape.with_shape %3, %7 : tensor, !shape.shape %10 = shape.value_of %8 : tensor %11 = shape.value_of %9 : tensor %12 = ""test.concat""(%arg0, %2) {axis = 0 : i64} : (tensor, tensor) -> tensor %13 = ""test.concat""(%arg0, %3) {axis = 0 : i64} : (tensor, tensor) -> tensor %14 = arith.addi %6, %4 : index %15 = shape.from_extents %14, %c4 : index, index %16 = shape.with_shape %12, %15 : tensor, !shape.shape %17 = shape.with_shape %13, %15 : tensor, !shape.shape %18 = shape.value_of %16 : tensor %19 = shape.value_of %17 : tensor return %10, %11, %18, %19 : tensor, tensor, tensor, tensor } func.func @value_shape_with_shape(%arg0: !shape.value_shape, %arg1: !shape.value_shape) -> tensor { %1 = shape.shape_of %arg0 : !shape.value_shape -> !shape.shape %2 = shape.with_shape %arg1, %1 : !shape.value_shape, !shape.shape %3 = shape.value_of %2 : tensor return %3 : tensor }", mlir-opt -outline-shape-computation -test-print-shape-mapping -split-input-file 2>%t ,1 "func.func @multiple_reused(%arg0: tensor, %arg1: tensor) -> (tensor, tensor, tensor, tensor) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = shape.shape_of %arg0 : tensor -> tensor<2xindex> %1 = shape.shape_of %arg1 : tensor -> tensor<2xindex> %2 = ""test.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor) -> tensor %3 = ""test.concat""(%arg0, %arg1) {axis = 0 : i64} : (tensor, tensor) -> tensor %4 = shape.get_extent %0, %c0 : tensor<2xindex>, index -> index %5 = shape.get_extent %1, %c0 : tensor<2xindex>, index -> index %6 = arith.addi %4, %5 : index %7 = shape.from_extents %6, %c4 : index, index %8 = shape.with_shape %2, %7 : tensor, !shape.shape %9 = shape.with_shape %3, %7 : tensor, !shape.shape %10 = shape.value_of %8 : tensor %11 = shape.value_of %9 : tensor %12 = ""test.concat""(%arg0, %2) {axis = 0 : i64} : (tensor, tensor) -> tensor %13 = ""test.concat""(%arg0, %3) {axis = 0 : i64} : (tensor, tensor) -> tensor %14 = arith.addi %6, %4 : index %15 = shape.from_extents %14, %c4 : index, index %16 = shape.with_shape %12, %15 : tensor, !shape.shape %17 = shape.with_shape %13, %15 : tensor, !shape.shape %18 = shape.value_of %16 : tensor %19 = shape.value_of %17 : tensor return %10, %11, %18, %19 : tensor, tensor, tensor, tensor } func.func @value_shape_with_shape(%arg0: !shape.value_shape, %arg1: !shape.value_shape) -> tensor { %1 = shape.shape_of %arg0 : !shape.value_shape -> !shape.shape %2 = shape.with_shape %arg1, %1 : !shape.value_shape, !shape.shape %3 = shape.value_of %2 : tensor return %3 : tensor }", cat %t ,1 "func.func @func1(%arg0: !shape.value_shape, %arg1: !shape.value_shape) -> !shape.shape { %0 = shape.shape_of %arg0 : !shape.value_shape -> !shape.shape %1 = shape.shape_of %arg1 : !shape.value_shape -> !shape.shape %2 = shape.meet %0, %1 : !shape.shape, !shape.shape -> !shape.shape return %2 : !shape.shape } func.func @func(%arg0: !shape.value_shape, %arg1: !shape.value_shape) -> !shape.shape { %0 = shape.shape_of %arg0 : !shape.value_shape -> !shape.shape %1 = shape.with_shape %arg1, %0 : !shape.value_shape, !shape.shape %2 = call @func1(%arg0, %1) : (!shape.value_shape, !shape.value_shape) -> !shape.shape return %2 : !shape.shape }", mlir-opt -outline-shape-computation -split-input-file 2>%t ,1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index { %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.assuming %0 -> index { %2 = ""test.source""() : () -> (index) shape.assuming_yield %2 : index } return %1 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints -canonicalize < ,1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index { %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.assuming %0 -> index { %2 = ""test.source""() : () -> (index) shape.assuming_yield %2 : index } return %1 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints < ,1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index { %0 = shape.cstr_eq %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.assuming %0 -> index { %2 = ""test.source""() : () -> (index) shape.assuming_yield %2 : index } return %1 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints -canonicalize < ,1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index { %0 = shape.cstr_eq %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.assuming %0 -> index { %2 = ""test.source""() : () -> (index) shape.assuming_yield %2 : index } return %1 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints < ,1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index { %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.cstr_eq %arg0, %arg1 : !shape.shape, !shape.shape %2 = shape.assuming_all %0, %1 %3 = shape.assuming %0 -> index { %4 = ""test.source""() : () -> (index) shape.assuming_yield %4 : index } return %3 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints -canonicalize < ,1 "func.func @f(%arg0 : !shape.shape, %arg1 : !shape.shape) -> index { %0 = shape.cstr_broadcastable %arg0, %arg1 : !shape.shape, !shape.shape %1 = shape.cstr_eq %arg0, %arg1 : !shape.shape, !shape.shape %2 = shape.assuming_all %0, %1 %3 = shape.assuming %0 -> index { %4 = ""test.source""() : () -> (index) shape.assuming_yield %4 : index } return %3 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -remove-shape-constraints < ,1 "func.func @num_elements_to_reduce(%shape : !shape.shape) -> !shape.size { %num_elements = shape.num_elements %shape : !shape.shape -> !shape.size return %num_elements : !shape.size }", mlir-opt -shape-to-shape-lowering -split-input-file ,1 "func.func @num_elements_to_reduce_on_index(%shape : tensor) -> index { %num_elements = shape.num_elements %shape : tensor -> index return %num_elements : index }", mlir-opt -shape-to-shape-lowering -split-input-file ,1 "func.func @create_of_real_and_imag(%cplx: complex) -> complex { %real = complex.re %cplx : complex %imag = complex.im %cplx : complex %complex = complex.create %real, %imag : complex return %complex : complex } func.func @create_of_real_and_imag_different_operand( %cplx: complex, %cplx2 : complex) -> complex { %real = complex.re %cplx : complex %imag = complex.im %cplx2 : complex %complex = complex.create %real, %imag : complex return %complex: complex } func.func @real_of_const() -> f32 { %complex = complex.constant [1.0 : f32, 0.0 : f32] : complex %1 = complex.re %complex : complex return %1 : f32 } func.func @real_of_create_op() -> f32 { %real = arith.constant 1.0 : f32 %imag = arith.constant 0.0 : f32 %complex = complex.create %real, %imag : complex %1 = complex.re %complex : complex return %1 : f32 } func.func @imag_of_const() -> f32 { %complex = complex.constant [1.0 : f32, 0.0 : f32] : complex %1 = complex.im %complex : complex return %1 : f32 } func.func @imag_of_create_op() -> f32 { %real = arith.constant 1.0 : f32 %imag = arith.constant 0.0 : f32 %complex = complex.create %real, %imag : complex %1 = complex.im %complex : complex return %1 : f32 } func.func @complex_add_sub_lhs() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %complex2 = complex.constant [0.0 : f32, 2.0 : f32] : complex %sub = complex.sub %complex1, %complex2 : complex %add = complex.add %sub, %complex2 : complex return %add : complex } func.func @complex_add_sub_rhs() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %complex2 = complex.constant [0.0 : f32, 2.0 : f32] : complex %sub = complex.sub %complex1, %complex2 : complex %add = complex.add %complex2, %sub : complex return %add : complex } func.func @complex_neg_neg() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %neg1 = complex.neg %complex1 : complex %neg2 = complex.neg %neg1 : complex return %neg2 : complex } func.func @complex_log_exp() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %exp = complex.exp %complex1 : complex %log = complex.log %exp : complex return %log : complex } func.func @complex_exp_log() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %log = complex.log %complex1 : complex %exp = complex.exp %log : complex return %exp : complex } func.func @complex_conj_conj() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %conj1 = complex.conj %complex1 : complex %conj2 = complex.conj %conj1 : complex return %conj2 : complex } func.func @complex_add_zero() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %complex2 = complex.constant [0.0 : f32, 0.0 : f32] : complex %add = complex.add %complex1, %complex2 : complex return %add : complex } func.func @complex_sub_add_lhs() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %complex2 = complex.constant [0.0 : f32, 2.0 : f32] : complex %add = complex.add %complex1, %complex2 : complex %sub = complex.sub %add, %complex2 : complex return %sub : complex } func.func @complex_sub_zero() -> complex { %complex1 = complex.constant [1.0 : f32, 0.0 : f32] : complex %complex2 = complex.constant [0.0 : f32, 0.0 : f32] : complex %sub = complex.sub %complex1, %complex2 : complex return %sub : complex } func.func @re_neg(%arg0: f32, %arg1: f32) -> f32 { %create = complex.create %arg0, %arg1: complex %neg = complex.neg %create : complex %re = complex.re %neg : complex return %re : f32 } func.func @im_neg(%arg0: f32, %arg1: f32) -> f32 { %create = complex.create %arg0, %arg1: complex %neg = complex.neg %create : complex %im = complex.im %neg : complex return %im : f32 }"," mlir-opt -canonicalize=""test-convergence"" ",1 "func.func @number_attr_f64() { ""test.number_attr""() { attr = #complex.number<:f64 1.0, 0.0> } : () -> () return } func.func @number_attr_f32() { ""test.number_attr""() { attr = #complex.number<:f32 1.0, 0.0> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @ops(%f: f32) { %cst_f64 = complex.constant [0.1, -1.0] : complex %cst_f32 = complex.constant [0.1 : f32, -1.0 : f32] : complex %complex = complex.create %f, %f : complex %real = complex.re %complex : complex %imag = complex.im %complex : complex %abs = complex.abs %complex : complex %sum = complex.add %complex, %complex : complex %cos = complex.cos %complex : complex %div = complex.div %complex, %complex : complex %eq = complex.eq %complex, %complex : complex %exp = complex.exp %complex : complex %expm1 = complex.expm1 %complex : complex %log = complex.log %complex : complex %log1p = complex.log1p %complex : complex %prod = complex.mul %complex, %complex : complex %neg = complex.neg %complex : complex %neq = complex.neq %complex, %complex : complex %sign = complex.sign %complex : complex %sin = complex.sin %complex : complex %diff = complex.sub %complex, %complex : complex %tanh = complex.tanh %complex : complex %pow = complex.pow %complex, %complex : complex %sqrt = complex.sqrt %complex : complex %rsqrt = complex.rsqrt %complex : complex %atan2 = complex.atan2 %complex, %complex : complex %tan = complex.tan %complex : complex return }", mlir-opt | mlir-opt ,1 "func.func @ops(%f: f32) { %cst_f64 = complex.constant [0.1, -1.0] : complex %cst_f32 = complex.constant [0.1 : f32, -1.0 : f32] : complex %complex = complex.create %f, %f : complex %real = complex.re %complex : complex %imag = complex.im %complex : complex %abs = complex.abs %complex : complex %sum = complex.add %complex, %complex : complex %cos = complex.cos %complex : complex %div = complex.div %complex, %complex : complex %eq = complex.eq %complex, %complex : complex %exp = complex.exp %complex : complex %expm1 = complex.expm1 %complex : complex %log = complex.log %complex : complex %log1p = complex.log1p %complex : complex %prod = complex.mul %complex, %complex : complex %neg = complex.neg %complex : complex %neq = complex.neq %complex, %complex : complex %sign = complex.sign %complex : complex %sin = complex.sin %complex : complex %diff = complex.sub %complex, %complex : complex %tanh = complex.tanh %complex : complex %pow = complex.pow %complex, %complex : complex %sqrt = complex.sqrt %complex : complex %rsqrt = complex.rsqrt %complex : complex %atan2 = complex.atan2 %complex, %complex : complex %tan = complex.tan %complex : complex return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "irdl.dialect @testd { irdl.type @self_referencing { %0 = irdl.any %1 = irdl.parametric @self_referencing<%0> %2 = irdl.is i32 %3 = irdl.any_of(%1, %2) irdl.parameters(%3) } irdl.type @type1 { %0 = irdl.any %1 = irdl.parametric @type2<%0> %2 = irdl.is i32 %3 = irdl.any_of(%1, %2) irdl.parameters(%3) } irdl.type @type2 { %0 = irdl.any %1 = irdl.parametric @type1<%0> %2 = irdl.is i32 %3 = irdl.any_of(%1, %2) irdl.parameters(%3) } }", mlir-opt | mlir-opt ,1 "module { func.func @conorm(%p: !cmath.complex, %q: !cmath.complex) -> f32 { %norm_p = ""cmath.norm""(%p) : (!cmath.complex) -> f32 %norm_q = ""cmath.norm""(%q) : (!cmath.complex) -> f32 %pq = arith.mulf %norm_p, %norm_q : f32 return %pq : f32 } func.func @conorm2(%p: !cmath.complex, %q: !cmath.complex) -> f32 { %pq = ""cmath.mul""(%p, %q) : (!cmath.complex, !cmath.complex) -> !cmath.complex %conorm = ""cmath.norm""(%pq) : (!cmath.complex) -> f32 return %conorm : f32 } }", mlir-opt --irdl-file=%S/cmath.irdl.mlir | mlir-opt --irdl-file=%S/cmath.irdl.mlir ,1 "func.func @no_references(%v: !testd.self_referencing) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @one_reference(%v: !testd.self_referencing>) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @wrong_parameter(%v: !testd.self_referencing) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @type1_no_references(%v: !testd.type1) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @type1_one_references(%v: !testd.type1>) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @type1_two_references(%v: !testd.type1>>) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @wrong_parameter_type1(%v: !testd.type1) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @wrong_parameter_type2(%v: !testd.type2) { return }", mlir-opt --irdl-file=%S/cyclic-types.irdl.mlir -split-input-file -verify-diagnostics ,1 "irdl.dialect @testd { irdl.type @parametric { %0 = irdl.any irdl.parameters(%0) } irdl.type @attr_in_type_out { %0 = irdl.any irdl.parameters(%0) } irdl.operation @eq { %0 = irdl.is i32 irdl.results(%0) } irdl.operation @anyof { %0 = irdl.is i32 %1 = irdl.is i64 %2 = irdl.any_of(%0, %1) irdl.results(%2) } irdl.operation @all_of { %0 = irdl.is i32 %1 = irdl.is i64 %2 = irdl.any_of(%0, %1) %3 = irdl.all_of(%2, %1) irdl.results(%3) } irdl.operation @any { %0 = irdl.any irdl.results(%0) } irdl.operation @dynbase { %0 = irdl.any %1 = irdl.parametric @parametric<%0> irdl.results(%1) } irdl.operation @dynparams { %0 = irdl.is i32 %1 = irdl.is i64 %2 = irdl.any_of(%0, %1) %3 = irdl.parametric @parametric<%2> irdl.results(%3) } irdl.operation @constraint_vars { %0 = irdl.is i32 %1 = irdl.is i64 %2 = irdl.any_of(%0, %1) irdl.results(%2, %2) } }", mlir-opt | mlir-opt ,1 "module { irdl.dialect @testd { irdl.type @singleton irdl.type @parametrized { %0 = irdl.any %1 = irdl.is i32 %2 = irdl.is i64 %3 = irdl.any_of(%1, %2) irdl.parameters(%0, %3) } irdl.operation @any { %0 = irdl.any irdl.results(%0) } } }", mlir-opt | mlir-opt ,1 "func.func @typeFitsType() { ""testd.any""() : () -> !testd.parametric return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @attrDoesntFitType() { ""testd.any""() : () -> !testd.parametric<""foo""> return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @attrFitsAttr() { ""testd.any""() : () -> !testd.attr_in_type_out<""foo""> return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @typeFitsAttr() { ""testd.any""() : () -> !testd.attr_in_type_out return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededEqConstraint() { ""testd.eq""() : () -> i32 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedEqConstraint() { ""testd.eq""() : () -> i64 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededAnyOfConstraint() { ""testd.anyof""() : () -> i32 ""testd.anyof""() : () -> i64 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedAnyOfConstraint() { ""testd.anyof""() : () -> i1 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededAllOfConstraint() { ""testd.all_of""() : () -> i64 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedAllOfConstraint1() { ""testd.all_of""() : () -> i1 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedAllOfConstraint2() { ""testd.all_of""() : () -> i32 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededAnyConstraint() { ""testd.any""() : () -> i32 ""testd.any""() : () -> i64 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededDynBaseConstraint() { ""testd.dynbase""() : () -> !testd.parametric ""testd.dynbase""() : () -> !testd.parametric ""testd.dynbase""() : () -> !testd.parametric> return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedDynBaseConstraint() { ""testd.dynbase""() : () -> i32 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededDynParamsConstraint() { ""testd.dynparams""() : () -> !testd.parametric ""testd.dynparams""() : () -> !testd.parametric return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedDynParamsConstraintBase() { ""testd.dynparams""() : () -> i32 return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedDynParamsConstraintParam() { ""testd.dynparams""() : () -> !testd.parametric return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededConstraintVars() { ""testd.constraint_vars""() : () -> (i32, i32) return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @succeededConstraintVars2() { ""testd.constraint_vars""() : () -> (i64, i64) return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedConstraintVars() { ""testd.constraint_vars""() : () -> (i64, i32) return }", mlir-opt --irdl-file=%S/testd.irdl.mlir -split-input-file -verify-diagnostics ,1 "module { irdl.dialect @cmath { irdl.type @complex { %0 = irdl.is f32 %1 = irdl.is f64 %2 = irdl.any_of(%0, %1) irdl.parameters(%2) } irdl.operation @norm { %0 = irdl.any %1 = irdl.parametric @complex<%0> irdl.operands(%1) irdl.results(%0) } irdl.operation @mul { %0 = irdl.is f32 %1 = irdl.is f64 %2 = irdl.any_of(%0, %1) %3 = irdl.parametric @complex<%2> irdl.operands(%3, %3) irdl.results(%3) } } }", mlir-opt | mlir-opt ,1 "func.func @succeededTypeVerifier() { ""testd.any""() : () -> !testd.singleton ""testd.any""() : () -> !testd.parametrized ""testd.any""() : () -> !testd.parametrized return }", mlir-opt --irdl-file=%S/test-type.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedSingletonVerifier() { ""testd.any""() : () -> !testd.singleton }", mlir-opt --irdl-file=%S/test-type.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedParametrizedVerifierWrongNumOfArgs() { ""testd.any""() : () -> !testd.parametrized }", mlir-opt --irdl-file=%S/test-type.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @failedParametrizedVerifierWrongArgument() { ""testd.any""() : () -> !testd.parametrized }", mlir-opt --irdl-file=%S/test-type.irdl.mlir -split-input-file -verify-diagnostics ,1 "func.func @muli(%arg0: memref, %arg1: memref) { %0 = arith.constant 0 : index %1 = amx.tile_zero : vector<16x64xi8> %2 = amx.tile_load %arg0[%0, %0] : memref into vector<16x64xi8> %3 = amx.tile_load %arg1[%0, %0] : memref into vector<16x16xi32> %4 = amx.tile_muli %1 zext, %2 zext, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> amx.tile_store %arg1[%0, %0], %4 : memref, vector<16x16xi32> %5 = amx.tile_muli %1, %2, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> amx.tile_store %arg1[%0, %0], %5 : memref, vector<16x16xi32> %6 = amx.tile_muli %1 zext, %2, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> amx.tile_store %arg1[%0, %0], %6 : memref, vector<16x16xi32> %7 = amx.tile_muli %1, %2 zext, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> amx.tile_store %arg1[%0, %0], %7 : memref, vector<16x16xi32> return } func.func @mulf(%arg0: memref, %arg1: memref) { %0 = arith.constant 0 : index %1 = amx.tile_zero : vector<16x32xbf16> %2 = amx.tile_load %arg0[%0, %0] : memref into vector<16x32xbf16> %3 = amx.tile_load %arg1[%0, %0] : memref into vector<16x16xf32> %4 = amx.tile_mulf %1, %2, %3 : vector<16x32xbf16>, vector<16x32xbf16>, vector<16x16xf32> amx.tile_store %arg1[%0, %0], %4 : memref, vector<16x16xf32> return }"," mlir-opt -convert-vector-to-llvm=""enable-amx"" | mlir-opt ",1 "func.func @tzero(%arg0: memref) { %0 = arith.constant 0 : index %1 = amx.tile_zero : vector<16x16xbf16> amx.tile_store %arg0[%0, %0], %1 : memref, vector<16x16xbf16> return } func.func @tmulf(%arg0: memref, %arg1: memref) { %0 = arith.constant 0 : index %1 = amx.tile_load %arg0[%0, %0] : memref into vector<16x32xbf16> %2 = amx.tile_load %arg1[%0, %0] : memref into vector<16x16xf32> %3 = amx.tile_mulf %1, %1, %2 : vector<16x32xbf16>, vector<16x32xbf16>, vector<16x16xf32> amx.tile_store %arg1[%0, %0], %3 : memref, vector<16x16xf32> return } func.func @tmuli(%arg0: memref, %arg1: memref, %arg2: memref) { %0 = arith.constant 0 : index %1 = amx.tile_load %arg0[%0, %0] : memref into vector<16x64xi8> %2 = amx.tile_load %arg1[%0, %0] : memref into vector<16x64xi8> %3 = amx.tile_load %arg2[%0, %0] : memref into vector<16x16xi32> %4 = amx.tile_muli %1 zext, %2 zext, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> amx.tile_store %arg2[%0, %0], %4 : memref, vector<16x16xi32> %5 = amx.tile_muli %1, %2 zext, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> %6 = amx.tile_muli %1 zext, %2, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> %7 = amx.tile_muli %1, %2, %3 : vector<16x64xi8>, vector<16x64xi8>, vector<16x16xi32> return }", mlir-opt -verify-diagnostics | mlir-opt ,1 "func.func @update_no_op(%x : memref) { omp.atomic.update %x : memref { ^bb0(%xval : i32): omp.yield(%xval : i32) } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @update_write_op(%x : memref, %value: i32) { omp.atomic.update %x : memref { ^bb0(%xval : i32): omp.yield(%value : i32) } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @update_normal(%x : memref, %value: i32) { omp.atomic.update %x : memref { ^bb0(%xval : i32): %newval = arith.addi %xval, %value : i32 omp.yield(%newval : i32) } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @update_unnecessary_computations(%x: memref) { %c0 = arith.constant 0 : i32 omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = arith.addi %xval, %c0 : i32 omp.yield(%newval: i32) } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @update_unnecessary_computations(%x: memref) { %c0 = arith.constant 0 : i32 omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = arith.muli %xval, %c0 : i32 omp.yield(%newval: i32) } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @parallel_empty() { omp.parallel {} return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @parallel_only_terminator() { omp.parallel { omp.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @parallel_no_side_effects(%a: i32, %b: i32) { omp.parallel { %x = arith.addi %a, %b : i32 omp.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @parallel_maybe_side_effects(%a: i32, %b: i32) { omp.parallel { func.call @foo() : () -> () omp.terminator } return } func.func private @foo() -> ()"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @constant_hoisting_target(%x : !llvm.ptr) { omp.target { %c1 = arith.constant 10 : i32 llvm.store %c1, %x : i32, !llvm.ptr omp.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @omp_barrier() -> () { omp.barrier return } func.func @omp_master() -> () { omp.master { omp.terminator } return } func.func @omp_taskwait() -> () { omp.taskwait return } func.func @omp_taskyield() -> () { omp.taskyield return } func.func @omp_flush(%arg0 : memref) -> () { omp.flush omp.flush(%arg0 : memref) omp.flush(%arg0, %arg0: memref, memref) return } func.func @omp_terminator() -> () { omp.terminator } func.func @omp_parallel(%data_var : memref, %if_cond : i1, %num_threads : i32) -> () { ""omp.parallel"" (%if_cond, %num_threads, %data_var, %data_var) ({ ""omp.parallel""(%num_threads, %data_var, %data_var) ({ omp.terminator }) {operand_segment_sizes = array} : (i32, memref, memref) -> () omp.barrier ""omp.parallel""(%if_cond, %data_var, %data_var) ({ omp.terminator }) {operand_segment_sizes = array} : (i1, memref, memref) -> () ""omp.parallel""(%if_cond, %num_threads) ({ omp.terminator }) {operand_segment_sizes = array} : (i1, i32) -> () omp.terminator }) {operand_segment_sizes = array, proc_bind_val = #omp} : (i1, i32, memref, memref) -> () ""omp.parallel"" (%data_var, %data_var) ({ omp.terminator }) {operand_segment_sizes = array} : (memref, memref) -> () return } func.func @omp_parallel_pretty(%data_var : memref, %if_cond : i1, %num_threads : i32, %allocator : si32) -> () { omp.parallel { omp.terminator } omp.parallel num_threads(%num_threads : i32) { omp.terminator } %n_index = arith.constant 2 : index omp.parallel num_threads(%n_index : index) { omp.terminator } %n_i64 = arith.constant 4 : i64 omp.parallel num_threads(%n_i64 : i64) { omp.terminator } omp.parallel allocate(%data_var : memref -> %data_var : memref) { omp.terminator } omp.parallel { omp.parallel if(%if_cond: i1) { omp.terminator } omp.terminator } omp.parallel num_threads(%num_threads : i32) if(%if_cond: i1) proc_bind(close) { omp.terminator } return } func.func @omp_wsloop(%lb : index, %ub : index, %step : index, %data_var : memref, %linear_var : i32, %chunk_var : i32) -> () { ""omp.wsloop"" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield }) {operand_segment_sizes = array, ordered_val = 1} : (index, index, index) -> () ""omp.wsloop"" (%lb, %ub, %step, %data_var, %linear_var) ({ ^bb0(%iv: index): omp.yield }) {operand_segment_sizes = array, schedule_val = #omp} : (index, index, index, memref, i32) -> () ""omp.wsloop"" (%lb, %ub, %step, %data_var, %data_var, %linear_var, %linear_var) ({ ^bb0(%iv: index): omp.yield }) {operand_segment_sizes = array, schedule_val = #omp} : (index, index, index, memref, memref, i32, i32) -> () ""omp.wsloop"" (%lb, %ub, %step, %data_var, %linear_var, %chunk_var) ({ ^bb0(%iv: index): omp.yield }) {operand_segment_sizes = array, schedule_val = #omp, ordered_val = 2} : (index, index, index, memref, i32, i32) -> () ""omp.wsloop"" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield }) {operand_segment_sizes = array, nowait, schedule_val = #omp} : (index, index, index) -> () return } func.func @omp_wsloop_pretty(%lb : index, %ub : index, %step : index, %data_var : memref, %linear_var : i32, %chunk_var : i32, %chunk_var2 : i16) -> () { omp.wsloop ordered(2) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop schedule(static) linear(%data_var = %linear_var : memref) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop ordered(2) linear(%data_var = %linear_var : memref) schedule(static = %chunk_var : i32) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop ordered(2) linear(%data_var = %linear_var : memref) schedule(dynamic = %chunk_var : i32, nonmonotonic) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop ordered(2) linear(%data_var = %linear_var : memref) schedule(dynamic = %chunk_var2 : i16, monotonic) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop for (%iv) : index = (%lb) to (%ub) inclusive step (%step) { omp.yield } omp.wsloop nowait for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } omp.wsloop order(concurrent) nowait for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_wsloop_pretty_multi_block(%lb : index, %ub : index, %step : index, %data1 : memref, %data2 : memref) -> () { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { %1 = ""test.payload""(%iv) : (index) -> (i32) cf.br ^bb1(%1: i32) ^bb1(%arg: i32): memref.store %arg, %data1[%iv] : memref omp.yield } omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { %c = ""test.condition""(%iv) : (index) -> (i1) %v1 = ""test.payload""(%iv) : (index) -> (i32) cf.cond_br %c, ^bb1(%v1: i32), ^bb2(%v1: i32) ^bb1(%arg0: i32): memref.store %arg0, %data1[%iv] : memref cf.br ^bb3 ^bb2(%arg1: i32): memref.store %arg1, %data2[%iv] : memref cf.br ^bb3 ^bb3: omp.yield } omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { %c = ""test.condition""(%iv) : (index) -> (i1) %v1 = ""test.payload""(%iv) : (index) -> (i32) cf.cond_br %c, ^bb1(%v1: i32), ^bb2(%v1: i32) ^bb1(%arg0: i32): memref.store %arg0, %data1[%iv] : memref omp.yield ^bb2(%arg1: i32): memref.store %arg1, %data2[%iv] : memref omp.yield } return } func.func @omp_wsloop_pretty_non_index(%lb1 : i32, %ub1 : i32, %step1 : i32, %lb2 : i64, %ub2 : i64, %step2 : i64, %data1 : memref, %data2 : memref) -> () { omp.wsloop for (%iv1) : i32 = (%lb1) to (%ub1) step (%step1) { %1 = ""test.payload""(%iv1) : (i32) -> (index) cf.br ^bb1(%1: index) ^bb1(%arg1: index): memref.store %iv1, %data1[%arg1] : memref omp.yield } omp.wsloop for (%iv2) : i64 = (%lb2) to (%ub2) step (%step2) { %2 = ""test.payload""(%iv2) : (i64) -> (index) cf.br ^bb1(%2: index) ^bb1(%arg2: index): memref.store %iv2, %data2[%arg2] : memref omp.yield } return } func.func @omp_wsloop_pretty_multiple(%lb1 : i32, %ub1 : i32, %step1 : i32, %lb2 : i32, %ub2 : i32, %step2 : i32, %data1 : memref) -> () { omp.wsloop for (%iv1, %iv2) : i32 = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { %1 = ""test.payload""(%iv1) : (i32) -> (index) %2 = ""test.payload""(%iv2) : (i32) -> (index) memref.store %iv1, %data1[%1] : memref memref.store %iv2, %data1[%2] : memref omp.yield } return } func.func @omp_simdloop(%lb : index, %ub : index, %step : index) -> () { ""omp.simdloop"" (%lb, %ub, %step) ({ ^bb0(%iv: index): omp.yield }) {operand_segment_sizes = array} : (index, index, index) -> () return } func.func @omp_simdloop_aligned_list(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : memref, %arg4 : memref) -> () { ""omp.simdloop""(%arg0, %arg1, %arg2, %arg3, %arg4) ({ ^bb0(%arg5: index): ""omp.yield""() : () -> () }) {alignment_values = [32, 128], operand_segment_sizes = array} : (index, index, index, memref, memref) -> () return } func.func @omp_simdloop_aligned_single(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : memref, %arg4 : memref) -> () { ""omp.simdloop""(%arg0, %arg1, %arg2, %arg3) ({ ^bb0(%arg5: index): ""omp.yield""() : () -> () }) {alignment_values = [32], operand_segment_sizes = array} : (index, index, index, memref) -> () return } func.func @omp_simdloop_nontemporal_list(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : memref, %arg4 : memref) -> () { ""omp.simdloop""(%arg0, %arg1, %arg2, %arg3, %arg4) ({ ^bb0(%arg5: index): ""omp.yield""() : () -> () }) {operand_segment_sizes = array} : (index, index, index, memref, memref) -> () return } func.func @omp_simdloop_nontemporal_single(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : memref, %arg4 : memref) -> () { ""omp.simdloop""(%arg0, %arg1, %arg2, %arg3) ({ ^bb0(%arg5: index): ""omp.yield""() : () -> () }) {operand_segment_sizes = array} : (index, index, index, memref) -> () return } func.func @omp_simdloop_pretty(%lb : index, %ub : index, %step : index) -> () { omp.simdloop for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_aligned(%lb : index, %ub : index, %step : index, %data_var : memref, %data_var1 : memref) -> () { omp.simdloop aligned(%data_var : memref -> 32, %data_var1 : memref -> 128) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_if(%lb : index, %ub : index, %step : index, %if_cond : i1) -> () { omp.simdloop if(%if_cond) for (%iv): index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_nontemporal(%lb : index, %ub : index, %step : index, %data_var : memref, %data_var1 : memref) -> () { omp.simdloop nontemporal(%data_var, %data_var1 : memref, memref) for (%iv) : index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_order(%lb : index, %ub : index, %step : index) -> () { omp.simdloop order(concurrent) for (%iv): index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_simdlen(%lb : index, %ub : index, %step : index) -> () { omp.simdloop simdlen(2) for (%iv): index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_safelen(%lb : index, %ub : index, %step : index) -> () { omp.simdloop safelen(2) for (%iv): index = (%lb) to (%ub) step (%step) { omp.yield } return } func.func @omp_simdloop_pretty_multiple(%lb1 : index, %ub1 : index, %step1 : index, %lb2 : index, %ub2 : index, %step2 : index) -> () { omp.simdloop for (%iv1, %iv2) : index = (%lb1, %lb2) to (%ub1, %ub2) step (%step1, %step2) { omp.yield } return } func.func @omp_target(%if_cond : i1, %device : si32, %num_threads : i32, %map1: memref, %map2: memref) -> () { ""omp.target""(%if_cond, %device, %num_threads) ({ omp.terminator }) {nowait, operand_segment_sizes = array} : ( i1, si32, i32 ) -> () omp.target map((tofrom -> %map1 : memref), (alloc -> %map2 : memref)){} omp.target map((to -> %map1 : memref), (always, from -> %map2 : memref)){} omp.barrier return } func.func @omp_target_data (%if_cond : i1, %device : si32, %device_ptr: memref, %device_addr: memref, %map1: memref, %map2: memref) -> () { omp.target_data if(%if_cond : i1) device(%device : si32) map((always, from -> %map1 : memref)){} omp.target_data use_device_ptr(%device_ptr : memref) use_device_addr(%device_addr : memref) map((close, present, to -> %map1 : memref)){} omp.target_data map((tofrom -> %map1 : memref), (alloc -> %map2 : memref)){} omp.target_enter_data if(%if_cond : i1) device(%device : si32) nowait map((alloc -> %map1 : memref)) omp.target_exit_data if(%if_cond : i1) device(%device : si32) nowait map((release -> %map2 : memref)) return } func.func @omp_target_pretty(%if_cond : i1, %device : si32, %num_threads : i32) -> () { omp.target if(%if_cond) device(%device : si32) { omp.terminator } omp.target if(%if_cond) device(%device : si32) thread_limit(%num_threads : i32) nowait { omp.terminator } return } omp.reduction.declare @add_f32 : f32 init { ^bb0(%arg: f32): %0 = arith.constant 0.0 : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = arith.addf %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield } func.func @wsloop_reduction(%lb : index, %ub : index, %step : index) { %c1 = arith.constant 1 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr) for (%iv) : index = (%lb) to (%ub) step (%step) { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } return } func.func @parallel_reduction() { %c1 = arith.constant 1 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel reduction(@add_f32 -> %0 : !llvm.ptr) { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.terminator } return } func.func @parallel_wsloop_reduction(%lb : index, %ub : index, %step : index) { %c1 = arith.constant 1 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel reduction(@add_f32 -> %0 : !llvm.ptr) { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } omp.terminator } return } func.func @sections_reduction() { %c1 = arith.constant 1 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.sections reduction(@add_f32 -> %0 : !llvm.ptr) { omp.section { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.terminator } omp.section { %1 = arith.constant 3.0 : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.terminator } omp.terminator } return } omp.reduction.declare @add2_f32 : f32 init { ^bb0(%arg: f32): %0 = arith.constant 0.0 : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = arith.addf %arg0, %arg1 : f32 omp.yield (%1 : f32) } func.func @wsloop_reduction2(%lb : index, %ub : index, %step : index) { %0 = memref.alloca() : memref<1xf32> omp.wsloop reduction(@add2_f32 -> %0 : memref<1xf32>) for (%iv) : index = (%lb) to (%ub) step (%step) { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, memref<1xf32> omp.yield } return } func.func @parallel_reduction2() { %0 = memref.alloca() : memref<1xf32> omp.parallel reduction(@add2_f32 -> %0 : memref<1xf32>) { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, memref<1xf32> omp.terminator } return } func.func @parallel_wsloop_reduction2(%lb : index, %ub : index, %step : index) { %c1 = arith.constant 1 : i32 %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr omp.parallel reduction(@add2_f32 -> %0 : !llvm.ptr) { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, !llvm.ptr omp.yield } omp.terminator } return } func.func @sections_reduction2() { %0 = memref.alloca() : memref<1xf32> omp.sections reduction(@add2_f32 -> %0 : memref<1xf32>) { omp.section { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, memref<1xf32> omp.terminator } omp.section { %1 = arith.constant 2.0 : f32 omp.reduction %1, %0 : f32, memref<1xf32> omp.terminator } omp.terminator } return } omp.critical.declare @mutex1 hint(uncontended) omp.critical.declare @mutex2 hint(contended) omp.critical.declare @mutex3 hint(nonspeculative) omp.critical.declare @mutex4 hint(speculative) omp.critical.declare @mutex5 hint(uncontended, nonspeculative) omp.critical.declare @mutex6 hint(contended, nonspeculative) omp.critical.declare @mutex7 hint(uncontended, speculative) omp.critical.declare @mutex8 hint(contended, speculative) omp.critical.declare @mutex9 hint(none) omp.critical.declare @mutex10 func.func @omp_critical() -> () { omp.critical { omp.terminator } omp.critical(@mutex1) { omp.terminator } return } func.func @omp_ordered(%arg1 : i32, %arg2 : i32, %arg3 : i32, %vec0 : i64, %vec1 : i64, %vec2 : i64, %vec3 : i64) -> () { omp.ordered_region { omp.terminator } omp.wsloop ordered(0) for (%0) : i32 = (%arg1) to (%arg2) step (%arg3) { omp.ordered_region { omp.terminator } omp.yield } omp.wsloop ordered(1) for (%0) : i32 = (%arg1) to (%arg2) step (%arg3) { omp.ordered depend_type(dependsink) depend_vec(%vec0 : i64) {num_loops_val = 1 : i64} omp.ordered depend_type(dependsource) depend_vec(%vec0 : i64) {num_loops_val = 1 : i64} omp.yield } omp.wsloop ordered(2) for (%0) : i32 = (%arg1) to (%arg2) step (%arg3) { omp.ordered depend_type(dependsink) depend_vec(%vec0, %vec1, %vec2, %vec3 : i64, i64, i64, i64) {num_loops_val = 2 : i64} omp.ordered depend_type(dependsource) depend_vec(%vec0, %vec1 : i64, i64) {num_loops_val = 2 : i64} omp.yield } return } func.func @omp_atomic_read(%v: memref, %x: memref) { omp.atomic.read %v = %x : memref, i32 omp.atomic.read %v = %x memory_order(seq_cst) : memref, i32 omp.atomic.read %v = %x memory_order(acquire) : memref, i32 omp.atomic.read %v = %x memory_order(relaxed) : memref, i32 omp.atomic.read %v = %x hint(nonspeculative, contended) : memref, i32 omp.atomic.read %v = %x hint(speculative, contended) memory_order(seq_cst) : memref, i32 omp.atomic.read %v = %x hint(none) memory_order(seq_cst) : memref, i32 return } func.func @omp_atomic_write(%addr : memref, %val : i32) { omp.atomic.write %addr = %val : memref, i32 omp.atomic.write %addr = %val memory_order(seq_cst) : memref, i32 omp.atomic.write %addr = %val memory_order(release) : memref, i32 omp.atomic.write %addr = %val memory_order(relaxed) : memref, i32 omp.atomic.write %addr = %val hint(speculative, uncontended) : memref, i32 omp.atomic.write %addr = %val hint(none) : memref, i32 return } func.func @omp_atomic_update(%x : memref, %expr : i32, %xBool : memref, %exprBool : i1) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update %xBool : memref { ^bb0(%xval: i1): %newval = llvm.and %xval, %exprBool : i1 omp.yield(%newval : i1) } omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.shl %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.intr.smax(%xval, %expr) : (i32, i32) -> i32 omp.yield(%newval : i32) } omp.atomic.update %xBool : memref { ^bb0(%xval: i1): %newval = llvm.icmp ""eq"" %xval, %exprBool : i1 omp.yield(%newval : i1) } omp.atomic.update %x : memref { ^bb0(%xval:i32): omp.yield(%xval:i32) } %const = arith.constant 42 : i32 omp.atomic.update %x : memref { ^bb0(%xval:i32): omp.yield(%const:i32) } omp.atomic.update hint(none) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(uncontended) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(contended) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(nonspeculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(speculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(uncontended, nonspeculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(contended, nonspeculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(uncontended, speculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update hint(contended, speculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update memory_order(seq_cst) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update memory_order(release) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update memory_order(relaxed) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.update memory_order(seq_cst) hint(uncontended, speculative) %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } return } func.func @omp_atomic_capture(%v: memref, %x: memref, %expr: i32) { omp.atomic.capture{ omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture{ omp.atomic.read %v = %x : memref, i32 omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } } omp.atomic.capture{ omp.atomic.read %v = %x : memref, i32 omp.atomic.write %x = %expr : memref, i32 } omp.atomic.capture hint(none) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(uncontended) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(contended) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(nonspeculative) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(speculative) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(uncontended, nonspeculative) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(contended, nonspeculative) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(uncontended, speculative) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(contended, speculative) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture memory_order(seq_cst) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture memory_order(acq_rel) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture memory_order(acquire) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture memory_order(release) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture memory_order(relaxed) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } omp.atomic.capture hint(contended, speculative) memory_order(seq_cst) { omp.atomic.update %x : memref { ^bb0(%xval: i32): %newval = llvm.add %xval, %expr : i32 omp.yield(%newval : i32) } omp.atomic.read %v = %x : memref, i32 } return } func.func @omp_sectionsop(%data_var1 : memref, %data_var2 : memref, %data_var3 : memref, %redn_var : !llvm.ptr) { ""omp.sections"" (%data_var1, %data_var1) ({ omp.terminator }) {operand_segment_sizes = array} : (memref, memref) -> () ""omp.sections"" (%redn_var) ({ omp.terminator }) {operand_segment_sizes = array, reductions=[@add_f32]} : (!llvm.ptr) -> () omp.sections nowait { omp.terminator } omp.sections reduction(@add_f32 -> %redn_var : !llvm.ptr) { omp.terminator } omp.sections allocate(%data_var1 : memref -> %data_var1 : memref) { omp.terminator } omp.sections nowait { omp.section { %1 = ""test.payload""() : () -> i32 %2 = ""test.payload""() : () -> i32 %3 = ""test.payload""(%1, %2) : (i32, i32) -> i32 } omp.section { %1 = ""test.payload""(%redn_var) : (!llvm.ptr) -> i32 } omp.section { ""test.payload""(%redn_var) : (!llvm.ptr) -> () } omp.terminator } return } func.func @omp_single() { omp.parallel { omp.single { ""test.payload""() : () -> () omp.terminator } omp.terminator } return } func.func @omp_single_nowait() { omp.parallel { omp.single nowait { ""test.payload""() : () -> () omp.terminator } omp.terminator } return } func.func @omp_single_allocate(%data_var: memref) { omp.parallel { omp.single allocate(%data_var : memref -> %data_var : memref) { ""test.payload""() : () -> () omp.terminator } omp.terminator } return } func.func @omp_single_allocate_nowait(%data_var: memref) { omp.parallel { omp.single allocate(%data_var : memref -> %data_var : memref) nowait { ""test.payload""() : () -> () omp.terminator } omp.terminator } return } func.func @omp_single_multiple_blocks() { omp.single { cf.br ^bb2 ^bb2: omp.terminator } return } func.func @omp_task(%bool_var: i1, %i64_var: i64, %i32_var: i32, %data_var: memref) { omp.task { ""test.foo""() : () -> () omp.terminator } omp.task if(%bool_var) { ""test.foo""() : () -> () omp.terminator } omp.task final(%bool_var) { ""test.foo""() : () -> () omp.terminator } omp.task untied { ""test.foo""() : () -> () omp.terminator } %c1 = arith.constant 1 : i32 %0 = llvm.alloca %c1 x f32 : (i32) -> !llvm.ptr %1 = llvm.alloca %c1 x f32 : (i32) -> !llvm.ptr omp.task in_reduction(@add_f32 -> %0 : !llvm.ptr, @add_f32 -> %1 : !llvm.ptr) { ""test.foo""() : () -> () omp.terminator } omp.task priority(%i32_var) { ""test.foo""() : () -> () omp.terminator } omp.task allocate(%data_var : memref -> %data_var : memref) { ""test.foo""() : () -> () omp.terminator } omp.task if(%bool_var) final(%bool_var) untied in_reduction(@add_f32 -> %0 : !llvm.ptr, @add_f32 -> %1 : !llvm.ptr) priority(%i32_var) allocate(%data_var : memref -> %data_var : memref) { ""test.foo""() : () -> () omp.terminator } return } func.func @omp_task_depend(%arg0: memref, %arg1: memref) { omp.task depend(taskdependin -> %arg0 : memref, taskdependin -> %arg1 : memref, taskdependinout -> %arg0 : memref) { ""test.foo""() : () -> () omp.terminator } return } func.func @omp_threadprivate() { %0 = arith.constant 1 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 3 : i32 %3 = llvm.mlir.addressof @_QFsubEx : !llvm.ptr %4 = omp.threadprivate %3 : !llvm.ptr -> !llvm.ptr llvm.store %0, %4 : !llvm.ptr omp.parallel { %5 = omp.threadprivate %3 : !llvm.ptr -> !llvm.ptr llvm.store %1, %5 : !llvm.ptr omp.terminator } llvm.store %2, %4 : !llvm.ptr return } llvm.mlir.global internal @_QFsubEx() : i32 func.func @omp_cancel_parallel(%if_cond : i1) -> () { omp.parallel { omp.cancel cancellation_construct_type(parallel) if(%if_cond) omp.terminator } return } func.func @omp_cancel_wsloop(%lb : index, %ub : index, %step : index) { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { omp.cancel cancellation_construct_type(loop) omp.terminator } return } func.func @omp_cancel_sections() -> () { omp.sections { omp.section { omp.cancel cancellation_construct_type(sections) omp.terminator } omp.terminator } return } func.func @omp_cancellationpoint_parallel() -> () { omp.parallel { omp.cancellationpoint cancellation_construct_type(parallel) omp.cancel cancellation_construct_type(parallel) omp.terminator } return } func.func @omp_cancellationpoint_wsloop(%lb : index, %ub : index, %step : index) { omp.wsloop for (%iv) : index = (%lb) to (%ub) step (%step) { omp.cancellationpoint cancellation_construct_type(loop) omp.cancel cancellation_construct_type(loop) omp.terminator } return } func.func @omp_cancellationpoint_sections() -> () { omp.sections { omp.section { omp.cancellationpoint cancellation_construct_type(sections) omp.cancel cancellation_construct_type(sections) omp.terminator } omp.terminator } return } func.func @omp_taskgroup_no_tasks() -> () { omp.taskgroup { ""test.foo""() : () -> () omp.terminator } return } func.func @omp_taskgroup_multiple_tasks() -> () { omp.taskgroup { omp.task { ""test.foo""() : () -> () omp.terminator } omp.task { ""test.foo""() : () -> () omp.terminator } omp.terminator } return } func.func @omp_taskgroup_clauses() -> () { %testmemref = ""test.memref""() : () -> (memref) %testf32 = ""test.f32""() : () -> (!llvm.ptr) omp.taskgroup allocate(%testmemref : memref -> %testmemref : memref) task_reduction(@add_f32 -> %testf32 : !llvm.ptr) { omp.task { ""test.foo""() : () -> () omp.terminator } omp.task { ""test.foo""() : () -> () omp.terminator } omp.terminator } return } func.func @omp_taskloop(%lb: i32, %ub: i32, %step: i32) -> () { omp.taskloop for (%i) : i32 = (%lb) to (%ub) step (%step) { omp.terminator } omp.taskloop for (%i) : i32 = (%lb) to (%ub) step (%step) { ""test.op1""(%lb) : (i32) -> () ""test.op2""() : () -> () omp.terminator } omp.taskloop for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) inclusive step (%step, %step) { omp.terminator } %testbool = ""test.bool""() : () -> (i1) omp.taskloop if(%testbool) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop final(%testbool) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop untied for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop mergeable for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } %testf32 = ""test.f32""() : () -> (!llvm.ptr) %testf32_2 = ""test.f32""() : () -> (!llvm.ptr) omp.taskloop in_reduction(@add_f32 -> %testf32 : !llvm.ptr, @add_f32 -> %testf32_2 : !llvm.ptr) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop reduction(@add_f32 -> %testf32 : !llvm.ptr, @add_f32 -> %testf32_2 : !llvm.ptr) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop in_reduction(@add_f32 -> %testf32 : !llvm.ptr) reduction(@add_f32 -> %testf32_2 : !llvm.ptr) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } %testi32 = ""test.i32""() : () -> (i32) omp.taskloop priority(%testi32: i32) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } %testmemref = ""test.memref""() : () -> (memref) omp.taskloop allocate(%testmemref : memref -> %testmemref : memref) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } %testi64 = ""test.i64""() : () -> (i64) omp.taskloop grain_size(%testi64: i64) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop num_tasks(%testi64: i64) for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } omp.taskloop nogroup for (%i, %j) : i32 = (%lb, %ub) to (%ub, %lb) step (%step, %step) { omp.terminator } return }", mlir-opt | mlir-opt ,1 "func.func @opaque_pointers_atomic_rwu(%v: !llvm.ptr, %x: !llvm.ptr) { omp.atomic.read %v = %x : !llvm.ptr, i32 %val = llvm.load %x : !llvm.ptr -> i32 omp.atomic.write %v = %val : !llvm.ptr, i32 omp.atomic.update %x : !llvm.ptr { ^bb0(%xval: i32): omp.yield(%xval : i32) } return } omp.reduction.declare @opaque_pointers_reduction : f32 init { ^bb0(%arg: f32): %0 = arith.constant 0.0 : f32 omp.yield (%0 : f32) } combiner { ^bb1(%arg0: f32, %arg1: f32): %1 = arith.addf %arg0, %arg1 : f32 omp.yield (%1 : f32) } atomic { ^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr): %2 = llvm.load %arg3 : !llvm.ptr -> f32 llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32 omp.yield }", mlir-opt | mlir-opt ,1 "module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags<>} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.flags = #omp.flags} {} module attributes {omp.version = #omp.version} {} func.func @omp_decl_tar_host_to() -> () attributes {omp.declare_target = #omp.declaretarget} { return } func.func @omp_decl_tar_host_link() -> () attributes {omp.declare_target = #omp.declaretarget} { return } func.func @omp_decl_tar_nohost_to() -> () attributes {omp.declare_target = #omp.declaretarget} { return } func.func @omp_decl_tar_nohost_link() -> () attributes {omp.declare_target = #omp.declaretarget} { return } func.func @omp_decl_tar_any_to() -> () attributes {omp.declare_target = #omp.declaretarget} { return } func.func @omp_decl_tar_any_link() -> () attributes {omp.declare_target = #omp.declaretarget} { return } llvm.mlir.global external @omp_decl_tar_data_host_to() {omp.declare_target = #omp.declaretarget} : i32 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 } llvm.mlir.global external @omp_decl_tar_data_host_link() {omp.declare_target = #omp.declaretarget} : i32 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 } llvm.mlir.global external @omp_decl_tar_data_nohost_to() {omp.declare_target = #omp.declaretarget} : i32 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 } llvm.mlir.global external @omp_decl_tar_data_nohost_link() {omp.declare_target = #omp.declaretarget} : i32 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 } llvm.mlir.global external @omp_decl_tar_data_any_to() {omp.declare_target = #omp.declaretarget} : i32 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 } llvm.mlir.global external @omp_decl_tar_data_any_link() {omp.declare_target = #omp.declaretarget} : i32 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 }", mlir-opt | mlir-opt ,1 "func.func @add() -> (index, index) { %0 = index.constant 1 %1 = index.constant 2100 %2 = index.constant 3000000001 %3 = index.constant 4000002100 %4 = index.add %0, %1 %5 = index.add %2, %3 return %4, %5 : index, index } func.func @add_overflow() -> (index, index) { %0 = index.constant 2000000000 %1 = index.constant 8000000000000000000 %2 = index.add %0, %0 %3 = index.add %1, %1 return %2, %3 : index, index } func.func @sub() -> index { %0 = index.constant -2000000000 %1 = index.constant 3000000000 %2 = index.sub %0, %1 return %2 : index } func.func @mul() -> index { %0 = index.constant 8000000002000000000 %1 = index.constant 2 %2 = index.mul %0, %1 return %2 : index } func.func @divs() -> index { %0 = index.constant -2 %1 = index.constant 0x200000000 %2 = index.divs %1, %0 return %2 : index } func.func @divs_nofold() -> (index, index) { %0 = index.constant 0 %1 = index.constant 0x100000000 %2 = index.constant 2 %3 = index.divs %2, %0 %4 = index.divs %1, %2 return %3, %4 : index, index } func.func @divu() -> index { %0 = index.constant -2 %1 = index.constant 0x200000000 %2 = index.divu %1, %0 return %2 : index } func.func @divu_nofold() -> (index, index) { %0 = index.constant 0 %1 = index.constant 0x100000000 %2 = index.constant 2 %3 = index.divu %2, %0 %4 = index.divu %1, %2 return %3, %4 : index, index } func.func @ceildivs() -> (index, index, index) { %c0 = index.constant 0 %c2 = index.constant 2 %c5 = index.constant 5 %0 = index.ceildivs %c0, %c5 %1 = index.ceildivs %c2, %c5 %2 = index.ceildivs %c5, %c2 return %0, %1, %2 : index, index, index } func.func @ceildivs_neg() -> index { %c5 = index.constant -5 %c2 = index.constant 2 %0 = index.ceildivs %c5, %c2 return %0 : index } func.func @ceildivs_edge() -> (index, index) { %cn1 = index.constant -1 %cIntMin = index.constant -2147483648 %cIntMax = index.constant 2147483647 %0 = index.ceildivs %cIntMin, %cn1 %1 = index.ceildivs %cIntMax, %cn1 return %0, %1 : index, index } func.func @ceildivu() -> index { %0 = index.constant 0x200000001 %1 = index.constant 2 %2 = index.ceildivu %0, %1 return %2 : index } func.func @floordivs() -> index { %0 = index.constant -5 %1 = index.constant 2 %2 = index.floordivs %0, %1 return %2 : index } func.func @floordivs_edge() -> (index, index) { %cIntMin = index.constant -2147483648 %cIntMax = index.constant 2147483647 %n1 = index.constant -1 %p1 = index.constant 1 %0 = index.floordivs %cIntMin, %p1 %1 = index.floordivs %cIntMax, %n1 return %0, %1 : index, index } func.func @floordivs_nofold() -> index { %lhs = index.constant 0x100000000 %c2 = index.constant 2 %0 = index.floordivs %lhs, %c2 return %0 : index } func.func @rems_zerodiv_nofold() -> index { %lhs = index.constant 2 %rhs = index.constant 0 %0 = index.rems %lhs, %rhs return %0 : index } func.func @remu_zerodiv_nofold() -> index { %lhs = index.constant 2 %rhs = index.constant 0 %0 = index.remu %lhs, %rhs return %0 : index } func.func @rems() -> index { %lhs = index.constant -5 %rhs = index.constant 2 %0 = index.rems %lhs, %rhs return %0 : index } func.func @rems_nofold() -> index { %lhs = index.constant 2 %rhs = index.constant 0x100000001 %0 = index.rems %lhs, %rhs return %0 : index } func.func @remu() -> index { %lhs = index.constant 2 %rhs = index.constant -1 %0 = index.remu %lhs, %rhs return %0 : index } func.func @remu_nofold() -> index { %lhs = index.constant 2 %rhs = index.constant 0x100000001 %0 = index.remu %lhs, %rhs return %0 : index } func.func @maxs() -> index { %lhs = index.constant -4 %rhs = index.constant 2 %0 = index.maxs %lhs, %rhs return %0 : index } func.func @maxs_nofold() -> index { %lhs = index.constant 1 %rhs = index.constant 0x100000000 %0 = index.maxs %lhs, %rhs return %0 : index } func.func @maxs_edge() -> index { %lhs = index.constant 1 %rhs = index.constant 0x100000001 %0 = index.maxs %lhs, %rhs return %0 : index } func.func @maxu() -> index { %lhs = index.constant -1 %rhs = index.constant 1 %0 = index.maxu %lhs, %rhs return %0 : index } func.func @mins() -> index { %lhs = index.constant -4 %rhs = index.constant 2 %0 = index.mins %lhs, %rhs return %0 : index } func.func @mins_nofold() -> index { %lhs = index.constant 1 %rhs = index.constant 0x100000000 %0 = index.mins %lhs, %rhs return %0 : index } func.func @mins_nofold_2() -> index { %lhs = index.constant 0x7fffffff %rhs = index.constant 0x80000000 %0 = index.mins %lhs, %rhs return %0 : index } func.func @minu() -> index { %lhs = index.constant -1 %rhs = index.constant 1 %0 = index.minu %lhs, %rhs return %0 : index } func.func @shl() -> index { %lhs = index.constant 128 %rhs = index.constant 2 %0 = index.shl %lhs, %rhs return %0 : index } func.func @shl_32() -> index { %lhs = index.constant 1 %rhs = index.constant 32 %0 = index.shl %lhs, %rhs return %0 : index } func.func @shl_edge() -> index { %lhs = index.constant 4000000000 %rhs = index.constant 31 %0 = index.shl %lhs, %rhs return %0 : index } func.func @shrs() -> index { %lhs = index.constant 128 %rhs = index.constant 2 %0 = index.shrs %lhs, %rhs return %0 : index } func.func @shrs_32() -> index { %lhs = index.constant 4000000000000 %rhs = index.constant 32 %0 = index.shrs %lhs, %rhs return %0 : index } func.func @shrs_nofold() -> index { %lhs = index.constant 0x100000000 %rhs = index.constant 1 %0 = index.shrs %lhs, %rhs return %0 : index } func.func @shrs_edge() -> index { %lhs = index.constant 0x10000000000 %rhs = index.constant 3 %0 = index.shrs %lhs, %rhs return %0 : index } func.func @shru() -> index { %lhs = index.constant 128 %rhs = index.constant 2 %0 = index.shru %lhs, %rhs return %0 : index } func.func @shru_32() -> index { %lhs = index.constant 4000000000000 %rhs = index.constant 32 %0 = index.shru %lhs, %rhs return %0 : index } func.func @shru_nofold() -> index { %lhs = index.constant 0x100000000 %rhs = index.constant 1 %0 = index.shru %lhs, %rhs return %0 : index } func.func @shru_edge() -> index { %lhs = index.constant 0x10000000000 %rhs = index.constant 3 %0 = index.shru %lhs, %rhs return %0 : index } func.func @and() -> index { %lhs = index.constant 5 %rhs = index.constant 1 %0 = index.and %lhs, %rhs return %0 : index } func.func @or() -> index { %lhs = index.constant 5 %rhs = index.constant 2 %0 = index.or %lhs, %rhs return %0 : index } func.func @xor() -> index { %lhs = index.constant 5 %rhs = index.constant 1 %0 = index.xor %lhs, %rhs return %0 : index } func.func @cmp() -> (i1, i1, i1, i1) { %a = index.constant 0 %b = index.constant -1 %c = index.constant -2 %d = index.constant 4 %0 = index.cmp slt(%a, %b) %1 = index.cmp ugt(%b, %a) %2 = index.cmp ne(%d, %a) %3 = index.cmp sgt(%b, %a) return %0, %1, %2, %3 : i1, i1, i1, i1 } func.func @cmp_nofold() -> i1 { %lhs = index.constant 1 %rhs = index.constant 0x100000000 %0 = index.cmp slt(%lhs, %rhs) return %0 : i1 } func.func @cmp_edge() -> i1 { %lhs = index.constant 1 %rhs = index.constant 0x100000002 %0 = index.cmp slt(%lhs, %rhs) return %0 : i1 }", mlir-opt -canonicalize ,1 "func.func @add_same_for_both(%arg0 : index) -> i1 { %c1 = index.constant 1 %calmostBig = index.constant 0xfffffffe %0 = index.minu %arg0, %calmostBig %1 = index.add %0, %c1 %2 = index.cmp uge(%1, %c1) func.return %2 : i1 } func.func @add_unsigned_ov(%arg0 : index) -> i1 { %c1 = index.constant 1 %cu32_max = index.constant 0xffffffff %0 = index.minu %arg0, %cu32_max %1 = index.add %0, %c1 %2 = index.cmp uge(%1, %c1) func.return %2 : i1 } func.func @add_signed_ov(%arg0 : index) -> i1 { %c0 = index.constant 0 %c1 = index.constant 1 %ci32_max = index.constant 0x7fffffff %0 = index.minu %arg0, %ci32_max %1 = index.add %0, %c1 %2 = index.cmp sge(%1, %c0) func.return %2 : i1 } func.func @add_big(%arg0 : index) -> i1 { %c1 = index.constant 1 %cmin = index.constant 0x300000000 %cmax = index.constant 0x30000ffff %0 = index.maxu %arg0, %cmin %1 = index.minu %0, %cmax %2 = index.add %1, %c1 %3 = index.cmp uge(%1, %cmin) func.return %3 : i1 }", mlir-opt -test-int-range-inference -canonicalize ,1 "func.func @binary_ops(%a: index, %b: index) { %0 = index.add %a, %b %1 = index.sub %a, %b %2 = index.mul %a, %b %3 = index.divs %a, %b %4 = index.divu %a, %b %5 = index.ceildivs %a, %b %6 = index.ceildivu %a, %b %7 = index.floordivs %a, %b %8 = index.rems %a, %b %9 = index.remu %a, %b %10 = index.maxs %a, %b %11 = index.maxu %a, %b %12 = index.mins %a, %b %13 = index.minu %a, %b %14 = index.shl %a, %b %15 = index.shrs %a, %b %16 = index.shru %a, %b %17 = index.and %a, %b %18 = index.or %a, %b %19 = index.xor %a, %b return } func.func @cmp_op(%a: index, %b: index) { %0 = index.cmp eq(%a, %b) %1 = index.cmp ne(%a, %b) %2 = index.cmp slt(%a, %b) %3 = index.cmp sle(%a, %b) %4 = index.cmp sgt(%a, %b) %5 = index.cmp sge(%a, %b) %6 = index.cmp ult(%a, %b) %7 = index.cmp ule(%a, %b) %8 = index.cmp ugt(%a, %b) %9 = index.cmp uge(%a, %b) return } func.func @sizeof_op() { %0 = index.sizeof return } func.func @constant_op() { %0 = index.constant 0 %1 = index.constant 1 %2 = index.constant 42 return } func.func @bool_constant_op() { %0 = index.bool.constant true %1 = index.bool.constant false return } func.func @cast_op(%a: index, %b: i32, %c: i64) { %0 = index.casts %a : index to i64 %1 = index.casts %b : i32 to index %2 = index.casts %c : i64 to index %3 = index.castu %a : index to i64 %4 = index.castu %b : i32 to index %5 = index.castu %c : i64 to index return }", mlir-opt | mlir-opt ,1 "func.func @br_folding() -> i32 { %c0_i32 = arith.constant 0 : i32 cf.br ^bb1(%c0_i32 : i32) ^bb1(%x : i32): return %x : i32 } func.func @br_passthrough(%arg0 : i32, %arg1 : i32) -> (i32, i32) { ""foo.switch""() [^bb1, ^bb2, ^bb3] : () -> () ^bb1: cf.br ^bb2(%arg0 : i32) ^bb2(%arg2 : i32): cf.br ^bb3(%arg2, %arg1 : i32, i32) ^bb3(%arg4 : i32, %arg5 : i32): return %arg4, %arg5 : i32, i32 } func.func @cond_br_folding(%cond : i1, %a : i32) { %false_cond = arith.constant false %true_cond = arith.constant true cf.cond_br %cond, ^bb1, ^bb2(%a : i32) ^bb1: cf.cond_br %true_cond, ^bb3, ^bb2(%a : i32) ^bb2(%x : i32): cf.cond_br %false_cond, ^bb2(%x : i32), ^bb3 ^bb3: return } func.func @cond_br_same_successor(%cond : i1, %a : i32) { cf.cond_br %cond, ^bb1(%a : i32), ^bb1(%a : i32) ^bb1(%result : i32): return } func.func @cond_br_same_successor_insert_select( %cond : i1, %a : i32, %b : i32, %c : tensor<2xi32>, %d : tensor<2xi32> ) -> (i32, tensor<2xi32>) { cf.cond_br %cond, ^bb1(%a, %c : i32, tensor<2xi32>), ^bb1(%b, %d : i32, tensor<2xi32>) ^bb1(%result : i32, %result2 : tensor<2xi32>): return %result, %result2 : i32, tensor<2xi32> } func.func @cond_br_and_br_folding(%a : i32) { %false_cond = arith.constant false %true_cond = arith.constant true cf.cond_br %true_cond, ^bb2, ^bb1(%a : i32) ^bb1(%x : i32): cf.cond_br %false_cond, ^bb1(%x : i32), ^bb2 ^bb2: return } func.func @cond_br_passthrough(%arg0 : i32, %arg1 : i32, %arg2 : i32, %cond : i1) -> (i32, i32) { cf.cond_br %cond, ^bb1(%arg0 : i32), ^bb2(%arg2, %arg2 : i32, i32) ^bb1(%arg3: i32): cf.br ^bb2(%arg3, %arg1 : i32, i32) ^bb2(%arg4: i32, %arg5: i32): return %arg4, %arg5 : i32, i32 } func.func @cond_br_pass_through_fail(%cond : i1) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: ""foo.op""() : () -> () cf.br ^bb2 ^bb2: return } func.func @switch_only_default(%flag : i32, %caseOperand0 : f32) { ""foo.pred""() [^bb1, ^bb2] : () -> () ^bb1: cf.switch %flag : i32, [ default: ^bb2(%caseOperand0 : f32) ] ^bb2(%bb2Arg : f32): ""foo.bb2Terminator""(%bb2Arg) : (f32) -> () } func.func @switch_case_matching_default(%flag : i32, %caseOperand0 : f32, %caseOperand1 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb3] : () -> () ^bb1: cf.switch %flag : i32, [ default: ^bb2(%caseOperand0 : f32), 42: ^bb2(%caseOperand0 : f32), 10: ^bb3(%caseOperand1 : f32), 17: ^bb2(%caseOperand0 : f32) ] ^bb2(%bb2Arg : f32): ""foo.bb2Terminator""(%bb2Arg) : (f32) -> () ^bb3(%bb3Arg : f32): ""foo.bb3Terminator""(%bb3Arg) : (f32) -> () } func.func @switch_on_const_no_match(%caseOperand0 : f32, %caseOperand1 : f32, %caseOperand2 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb3, ^bb4] : () -> () ^bb1: %c0_i32 = arith.constant 0 : i32 cf.switch %c0_i32 : i32, [ default: ^bb2(%caseOperand0 : f32), -1: ^bb3(%caseOperand1 : f32), 1: ^bb4(%caseOperand2 : f32) ] ^bb2(%bb2Arg : f32): ""foo.bb2Terminator""(%bb2Arg) : (f32) -> () ^bb3(%bb3Arg : f32): ""foo.bb3Terminator""(%bb3Arg) : (f32) -> () ^bb4(%bb4Arg : f32): ""foo.bb4Terminator""(%bb4Arg) : (f32) -> () } func.func @switch_on_const_with_match(%caseOperand0 : f32, %caseOperand1 : f32, %caseOperand2 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb3, ^bb4] : () -> () ^bb1: %c0_i32 = arith.constant 1 : i32 cf.switch %c0_i32 : i32, [ default: ^bb2(%caseOperand0 : f32), -1: ^bb3(%caseOperand1 : f32), 1: ^bb4(%caseOperand2 : f32) ] ^bb2(%bb2Arg : f32): ""foo.bb2Terminator""(%bb2Arg) : (f32) -> () ^bb3(%bb3Arg : f32): ""foo.bb3Terminator""(%bb3Arg) : (f32) -> () ^bb4(%bb4Arg : f32): ""foo.bb4Terminator""(%bb4Arg) : (f32) -> () } func.func @switch_passthrough(%flag : i32, %caseOperand0 : f32, %caseOperand1 : f32, %caseOperand2 : f32, %caseOperand3 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb3, ^bb4, ^bb5, ^bb6] : () -> () ^bb1: cf.switch %flag : i32, [ default: ^bb2(%caseOperand0 : f32), 43: ^bb3(%caseOperand1 : f32), 44: ^bb4(%caseOperand2 : f32) ] ^bb2(%bb2Arg : f32): cf.br ^bb5(%bb2Arg : f32) ^bb3(%bb3Arg : f32): cf.br ^bb6(%bb3Arg : f32) ^bb4(%bb4Arg : f32): ""foo.bb4Terminator""(%bb4Arg) : (f32) -> () ^bb5(%bb5Arg : f32): ""foo.bb5Terminator""(%bb5Arg) : (f32) -> () ^bb6(%bb6Arg : f32): ""foo.bb6Terminator""(%bb6Arg) : (f32) -> () } func.func @switch_from_switch_with_same_value_with_match(%flag : i32, %caseOperand0 : f32, %caseOperand1 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb4, ^bb5] : () -> () ^bb1: cf.switch %flag : i32, [ default: ^bb2, 42: ^bb3 ] ^bb2: ""foo.bb2Terminator""() : () -> () ^bb3: ""foo.op""() : () -> () cf.switch %flag : i32, [ default: ^bb4(%caseOperand0 : f32), 42: ^bb5(%caseOperand1 : f32) ] ^bb4(%bb4Arg : f32): ""foo.bb4Terminator""(%bb4Arg) : (f32) -> () ^bb5(%bb5Arg : f32): ""foo.bb5Terminator""(%bb5Arg) : (f32) -> () } func.func @switch_from_switch_with_same_value_no_match(%flag : i32, %caseOperand0 : f32, %caseOperand1 : f32, %caseOperand2 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb4, ^bb5, ^bb6] : () -> () ^bb1: cf.switch %flag : i32, [ default: ^bb2, 42: ^bb3 ] ^bb2: ""foo.bb2Terminator""() : () -> () ^bb3: ""foo.op""() : () -> () cf.switch %flag : i32, [ default: ^bb4(%caseOperand0 : f32), 0: ^bb5(%caseOperand1 : f32), 43: ^bb6(%caseOperand2 : f32) ] ^bb4(%bb4Arg : f32): ""foo.bb4Terminator""(%bb4Arg) : (f32) -> () ^bb5(%bb5Arg : f32): ""foo.bb5Terminator""(%bb5Arg) : (f32) -> () ^bb6(%bb6Arg : f32): ""foo.bb6Terminator""(%bb6Arg) : (f32) -> () } func.func @switch_from_switch_default_with_same_value(%flag : i32, %caseOperand0 : f32, %caseOperand1 : f32, %caseOperand2 : f32) { ""foo.pred""() [^bb1, ^bb2, ^bb4, ^bb5, ^bb6] : () -> () ^bb1: cf.switch %flag : i32, [ default: ^bb3, 42: ^bb2 ] ^bb2: ""foo.bb2Terminator""() : () -> () ^bb3: ""foo.op""() : () -> () cf.switch %flag : i32, [ default: ^bb4(%caseOperand0 : f32), 42: ^bb5(%caseOperand1 : f32), 43: ^bb6(%caseOperand2 : f32) ] ^bb4(%bb4Arg : f32): ""foo.bb4Terminator""(%bb4Arg) : (f32) -> () ^bb5(%bb5Arg : f32): ""foo.bb5Terminator""(%bb5Arg) : (f32) -> () ^bb6(%bb6Arg : f32): ""foo.bb6Terminator""(%bb6Arg) : (f32) -> () } func.func @cond_br_from_cond_br_with_same_condition(%cond : i1) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: cf.cond_br %cond, ^bb3, ^bb2 ^bb2: ""foo.terminator""() : () -> () ^bb3: return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @assert_true() { %true = arith.constant true cf.assert %true, ""Computer says no"" return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @cf.assert(%arg : i1) { cf.assert %arg, ""Computer says no"" return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @branchCondProp(%arg0: i1) { cf.cond_br %arg0, ^trueB, ^falseB ^trueB: ""test.consumer1""(%arg0) : (i1) -> () cf.br ^exit ^falseB: ""test.consumer2""(%arg0) : (i1) -> () cf.br ^exit ^exit: return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @assert(%arg : i1) { cf.assert %arg, ""Some message in case this assertion fails."" return } func.func @switch(%flag : i32, %caseOperand : i32) { cf.switch %flag : i32, [ default: ^bb1(%caseOperand : i32), 42: ^bb2(%caseOperand : i32), 43: ^bb3(%caseOperand : i32) ] ^bb1(%bb1arg : i32): return ^bb2(%bb2arg : i32): return ^bb3(%bb3arg : i32): return } func.func @switch_i64(%flag : i64, %caseOperand : i32) { cf.switch %flag : i64, [ default: ^bb1(%caseOperand : i32), 42: ^bb2(%caseOperand : i32), 43: ^bb3(%caseOperand : i32) ] ^bb1(%bb1arg : i32): return ^bb2(%bb2arg : i32): return ^bb3(%bb3arg : i32): return }", mlir-opt | mlir-opt ,1 "func.func @assert(%arg : i1) { cf.assert %arg, ""Some message in case this assertion fails."" return } func.func @switch(%flag : i32, %caseOperand : i32) { cf.switch %flag : i32, [ default: ^bb1(%caseOperand : i32), 42: ^bb2(%caseOperand : i32), 43: ^bb3(%caseOperand : i32) ] ^bb1(%bb1arg : i32): return ^bb2(%bb2arg : i32): return ^bb3(%bb3arg : i32): return } func.func @switch_i64(%flag : i64, %caseOperand : i32) { cf.switch %flag : i64, [ default: ^bb1(%caseOperand : i32), 42: ^bb2(%caseOperand : i32), 43: ^bb3(%caseOperand : i32) ] ^bb1(%bb1arg : i32): return ^bb2(%bb2arg : i32): return ^bb3(%bb3arg : i32): return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "ml_program.func private @extern_func(i32) -> i32 ml_program.func @defined_func(%arg0 : i32) -> i32 { ml_program.return %arg0 : i32 } ml_program.subgraph private @extern_subgraph(i32) -> i32 ml_program.subgraph @compute_subgraph(%arg0 : i32) -> i32 { %token = ml_program.token %1 = ""unregistered.dummy""(%0, %token) : (i32, !ml_program.token) -> i32 %0 = ""unregistered.dummy""(%arg0) : (i32) -> i32 ml_program.output %0 : i32 } ml_program.global private @global_same_type(dense<4> : tensor<4xi32>) : tensor<4xi32> ml_program.global private mutable @global_mutable_undef : tensor ml_program.global private mutable @global_extern(#ml_program.extern : tensor<4xi32>) : tensor ml_program.func @global_load_const() -> tensor<4xi32> { %0 = ml_program.global_load_const @global_same_type : tensor<4xi32> ml_program.return %0 : tensor<4xi32> } ml_program.func @global_load_store() { %0 = ml_program.global_load @global_mutable_undef : tensor ml_program.global_store @global_mutable_undef = %0 : tensor ml_program.return } ml_program.subgraph @global_load_store_tokens() -> (tensor, !ml_program.token) { %token1 = ml_program.token %0, %token2 = ml_program.global_load_graph @global_mutable_undef ordering(() -> !ml_program.token) : tensor %token3 = ml_program.global_store_graph @global_mutable_undef = %0 ordering(%token1, %token2 -> !ml_program.token) : tensor %token4 = ml_program.global_store_graph @global_mutable_undef = %0 ordering(%token3 -> !ml_program.token) : tensor ml_program.output %0, %token3 : tensor, !ml_program.token }", mlir-opt --allow-unregistered-dialect | mlir-opt --allow-unregistered-dialect ,1 "ml_program.func private @extern_func(i32) -> i32 ml_program.func @defined_func(%arg0 : i32) -> i32 { ml_program.return %arg0 : i32 } ml_program.subgraph private @extern_subgraph(i32) -> i32 ml_program.subgraph @compute_subgraph(%arg0 : i32) -> i32 { %token = ml_program.token %1 = ""unregistered.dummy""(%0, %token) : (i32, !ml_program.token) -> i32 %0 = ""unregistered.dummy""(%arg0) : (i32) -> i32 ml_program.output %0 : i32 } ml_program.global private @global_same_type(dense<4> : tensor<4xi32>) : tensor<4xi32> ml_program.global private mutable @global_mutable_undef : tensor ml_program.global private mutable @global_extern(#ml_program.extern : tensor<4xi32>) : tensor ml_program.func @global_load_const() -> tensor<4xi32> { %0 = ml_program.global_load_const @global_same_type : tensor<4xi32> ml_program.return %0 : tensor<4xi32> } ml_program.func @global_load_store() { %0 = ml_program.global_load @global_mutable_undef : tensor ml_program.global_store @global_mutable_undef = %0 : tensor ml_program.return } ml_program.subgraph @global_load_store_tokens() -> (tensor, !ml_program.token) { %token1 = ml_program.token %0, %token2 = ml_program.global_load_graph @global_mutable_undef ordering(() -> !ml_program.token) : tensor %token3 = ml_program.global_store_graph @global_mutable_undef = %0 ordering(%token1, %token2 -> !ml_program.token) : tensor %token4 = ml_program.global_store_graph @global_mutable_undef = %0 ordering(%token3 -> !ml_program.token) : tensor ml_program.output %0, %token3 : tensor, !ml_program.token }", mlir-opt --allow-unregistered-dialect --mlir-print-op-generic | mlir-opt --allow-unregistered-dialect ,1 """unregistered.attributes""() { value = #ml_program.extern : i32 } : () -> ()", mlir-opt --allow-unregistered-dialect | mlir-opt --allow-unregistered-dialect ,1 "func.func @ceildivi(%arg0: i32, %arg1: i32) -> (i32) { %res = arith.ceildivsi %arg0, %arg1 : i32 return %res : i32 }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @ceildivi_index(%arg0: index, %arg1: index) -> (index) { %res = arith.ceildivsi %arg0, %arg1 : index return %res : index }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @floordivi(%arg0: i32, %arg1: i32) -> (i32) { %res = arith.floordivsi %arg0, %arg1 : i32 return %res : i32 }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @floordivi_index(%arg0: index, %arg1: index) -> (index) { %res = arith.floordivsi %arg0, %arg1 : index return %res : index }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @floordivi_vec(%arg0: vector<4xi32>, %arg1: vector<4xi32>) -> (vector<4xi32>) { %res = arith.floordivsi %arg0, %arg1 : vector<4xi32> return %res : vector<4xi32> }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @ceildivui(%arg0: i32, %arg1: i32) -> (i32) { %res = arith.ceildivui %arg0, %arg1 : i32 return %res : i32 }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @ceildivui_index(%arg0: index, %arg1: index) -> (index) { %res = arith.ceildivui %arg0, %arg1 : index return %res : index }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @maxf(%a: f32, %b: f32) -> f32 { %result = arith.maxf %a, %b : f32 return %result : f32 }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @maxf_vector(%a: vector<4xf16>, %b: vector<4xf16>) -> vector<4xf16> { %result = arith.maxf %a, %b : vector<4xf16> return %result : vector<4xf16> }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @minf(%a: f32, %b: f32) -> f32 { %result = arith.minf %a, %b : f32 return %result : f32 }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @truncf_f32(%arg0 : f32) -> bf16 { %0 = arith.truncf %arg0 : f32 to bf16 return %0 : bf16 }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @truncf_vector_f32(%arg0 : vector<4xf32>) -> vector<4xbf16> { %0 = arith.truncf %arg0 : vector<4xf32> to vector<4xbf16> return %0 : vector<4xbf16> }"," mlir-opt -arith-expand=""include-bf16=true"" -split-input-file ",1 "func.func @not_with_maybe_overflow(%arg0 : i32) { %ci32_smax = arith.constant 0x7fffffff : i32 %c1 = arith.constant 1 : i32 %c4 = arith.constant 4 : i32 %0 = arith.minui %arg0, %ci32_smax : i32 %1 = arith.addi %0, %c1 : i32 %2 = arith.divsi %1, %c4 : i32 %3 = arith.ceildivsi %1, %c4 : i32 %4 = arith.floordivsi %1, %c4 : i32 %5 = arith.remsi %1, %c4 : i32 %6 = arith.minsi %1, %c4 : i32 %7 = arith.maxsi %1, %c4 : i32 %8 = arith.extsi %1 : i32 to i64 %9 = arith.cmpi sle, %1, %c4 : i32 %10 = arith.cmpi slt, %1, %c4 : i32 %11 = arith.cmpi sge, %1, %c4 : i32 %12 = arith.cmpi sgt, %1, %c4 : i32 func.return } func.func @yes_with_no_overflow(%arg0 : i32) { %ci32_almost_smax = arith.constant 0x7ffffffe : i32 %c1 = arith.constant 1 : i32 %c4 = arith.constant 4 : i32 %0 = arith.minui %arg0, %ci32_almost_smax : i32 %1 = arith.addi %0, %c1 : i32 %2 = arith.divsi %1, %c4 : i32 %3 = arith.ceildivsi %1, %c4 : i32 %4 = arith.floordivsi %1, %c4 : i32 %5 = arith.remsi %1, %c4 : i32 %6 = arith.minsi %1, %c4 : i32 %7 = arith.maxsi %1, %c4 : i32 %8 = arith.extsi %1 : i32 to i64 %9 = arith.cmpi sle, %1, %c4 : i32 %10 = arith.cmpi slt, %1, %c4 : i32 %11 = arith.cmpi sge, %1, %c4 : i32 %12 = arith.cmpi sgt, %1, %c4 : i32 func.return } func.func @preserves_structure(%arg0 : memref<8xindex>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c8 = arith.constant 8 : index scf.for %arg1 = %c0 to %c8 step %c1 { %v = arith.remsi %arg1, %c4 : index %w = arith.addi %v, %v : index %test = arith.cmpi sle, %w, %c4 : index scf.if %test { memref.store %w, %arg0[%arg1] : memref<8xindex> } } func.return } func.func private @external() -> i8 func.func @dead_code() { %0 = call @external() : () -> i8 %1 = arith.floordivsi %0, %0 : i8 return } func.func @no_integer_or_index() { %cst_0 = arith.constant dense<[0]> : vector<1xi32> %cmp = arith.cmpi slt, %cst_0, %cst_0 : vector<1xi32> return } func.func @gpu_func(%arg0: memref<2x32xf32>, %arg1: memref<2x32xf32>, %arg2: memref<32xf32>, %arg3: f32, %arg4: !gpu.async.token, %arg5: index, %arg6: index) -> memref<2x32xf32> { %c1 = arith.constant 1 : index %2 = gpu.launch async [%arg4] blocks(%arg7, %arg8, %arg9) in (%arg13 = %c1, %arg14 = %c1, %arg15 = %c1) threads(%arg10, %arg11, %arg12) in (%arg16 = %c1, %arg17 = %c1, %arg18 = %c1) { gpu.terminator } return %arg1 : memref<2x32xf32> }", mlir-opt -arith-unsigned-when-equivalent ,1 "func.func @arith_addi(%a: index) -> index { %0 = arith.constant 5 : index %1 = arith.addi %0, %a : index %2 = ""test.reify_bound""(%1) : (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -verify-diagnostics -split-input-file ,1 "func.func @arith_subi(%a: index) -> index { %0 = arith.constant 5 : index %1 = arith.subi %0, %a : index %2 = ""test.reify_bound""(%1) : (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -verify-diagnostics -split-input-file ,1 "func.func @arith_muli(%a: index) -> index { %0 = arith.constant 5 : index %1 = arith.muli %0, %a : index %2 = ""test.reify_bound""(%1) : (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -verify-diagnostics -split-input-file ,1 "func.func @arith_muli_non_pure(%a: index, %b: index) -> index { %0 = arith.muli %a, %b : index %1 = ""test.reify_bound""(%0) : (index) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -verify-diagnostics -split-input-file ,1 "func.func @arith_const() -> index { %c5 = arith.constant 5 : index %0 = ""test.reify_bound""(%c5) : (index) -> (index) return %0 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -verify-diagnostics -split-input-file ,1 "func.func @select_same_val(%arg0: i1, %arg1: i64) -> i64 { %0 = arith.select %arg0, %arg1, %arg1 : i64 return %0 : i64 } func.func @select_cmp_eq_select(%arg0: i64, %arg1: i64) -> i64 { %0 = arith.cmpi eq, %arg0, %arg1 : i64 %1 = arith.select %0, %arg0, %arg1 : i64 return %1 : i64 } func.func @select_cmp_ne_select(%arg0: i64, %arg1: i64) -> i64 { %0 = arith.cmpi ne, %arg0, %arg1 : i64 %1 = arith.select %0, %arg0, %arg1 : i64 return %1 : i64 } func.func @select_extui(%arg0: i1) -> i64 { %c0_i64 = arith.constant 0 : i64 %c1_i64 = arith.constant 1 : i64 %res = arith.select %arg0, %c1_i64, %c0_i64 : i64 return %res : i64 } func.func @select_extui2(%arg0: i1) -> i64 { %c0_i64 = arith.constant 0 : i64 %c1_i64 = arith.constant 1 : i64 %res = arith.select %arg0, %c0_i64, %c1_i64 : i64 return %res : i64 } func.func @select_extui_i1(%arg0: i1) -> i1 { %c0_i1 = arith.constant false %c1_i1 = arith.constant true %res = arith.select %arg0, %c1_i1, %c0_i1 : i1 return %res : i1 } func.func @select_cst_false_scalar(%arg0: i32, %arg1: i32) -> i32 { %false = arith.constant false %res = arith.select %false, %arg0, %arg1 : i32 return %res : i32 } func.func @select_cst_true_scalar(%arg0: i32, %arg1: i32) -> i32 { %true = arith.constant true %res = arith.select %true, %arg0, %arg1 : i32 return %res : i32 } func.func @select_cst_true_splat() -> vector<3xi32> { %cond = arith.constant dense : vector<3xi1> %a = arith.constant dense<[1, 2, 3]> : vector<3xi32> %b = arith.constant dense<[4, 5, 6]> : vector<3xi32> %res = arith.select %cond, %a, %b : vector<3xi1>, vector<3xi32> return %res : vector<3xi32> } func.func @select_cst_vector_i32() -> vector<3xi32> { %cond = arith.constant dense<[true, false, true]> : vector<3xi1> %a = arith.constant dense<[1, 2, 3]> : vector<3xi32> %b = arith.constant dense<[4, 5, 6]> : vector<3xi32> %res = arith.select %cond, %a, %b : vector<3xi1>, vector<3xi32> return %res : vector<3xi32> } func.func @select_cst_vector_f32() -> vector<3xf32> { %cond = arith.constant dense<[false, true, false]> : vector<3xi1> %a = arith.constant dense<[1.0, 2.0, 3.0]> : vector<3xf32> %b = arith.constant dense<[4.0, 5.0, 6.0]> : vector<3xf32> %res = arith.select %cond, %a, %b : vector<3xi1>, vector<3xf32> return %res : vector<3xf32> } func.func @selToNot(%arg0: i1) -> i1 { %true = arith.constant true %false = arith.constant false %res = arith.select %arg0, %false, %true : i1 return %res : i1 } func.func @selToArith(%arg0: i1, %arg1 : i1, %arg2 : i1) -> i1 { %res = arith.select %arg0, %arg1, %arg2 : i1 return %res : i1 } func.func @cmpi_equal_operands(%arg0: i64) -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) { %0 = arith.cmpi eq, %arg0, %arg0 : i64 %1 = arith.cmpi sle, %arg0, %arg0 : i64 %2 = arith.cmpi sge, %arg0, %arg0 : i64 %3 = arith.cmpi ule, %arg0, %arg0 : i64 %4 = arith.cmpi uge, %arg0, %arg0 : i64 %5 = arith.cmpi ne, %arg0, %arg0 : i64 %6 = arith.cmpi slt, %arg0, %arg0 : i64 %7 = arith.cmpi sgt, %arg0, %arg0 : i64 %8 = arith.cmpi ult, %arg0, %arg0 : i64 %9 = arith.cmpi ugt, %arg0, %arg0 : i64 return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9 : i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 } func.func @cmpi_equal_vector_operands(%arg0: vector<1x8xi64>) -> (vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>) { %0 = arith.cmpi eq, %arg0, %arg0 : vector<1x8xi64> %1 = arith.cmpi sle, %arg0, %arg0 : vector<1x8xi64> %2 = arith.cmpi sge, %arg0, %arg0 : vector<1x8xi64> %3 = arith.cmpi ule, %arg0, %arg0 : vector<1x8xi64> %4 = arith.cmpi uge, %arg0, %arg0 : vector<1x8xi64> %5 = arith.cmpi ne, %arg0, %arg0 : vector<1x8xi64> %6 = arith.cmpi slt, %arg0, %arg0 : vector<1x8xi64> %7 = arith.cmpi sgt, %arg0, %arg0 : vector<1x8xi64> %8 = arith.cmpi ult, %arg0, %arg0 : vector<1x8xi64> %9 = arith.cmpi ugt, %arg0, %arg0 : vector<1x8xi64> return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9 : vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1>, vector<1x8xi1> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @cmpi_const_right(%arg0: i64) -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) { %c1 = arith.constant 1 : i64 %0 = arith.cmpi eq, %c1, %arg0 : i64 %1 = arith.cmpi sle, %c1, %arg0 : i64 %2 = arith.cmpi sge, %c1, %arg0 : i64 %3 = arith.cmpi ule, %c1, %arg0 : i64 %4 = arith.cmpi uge, %c1, %arg0 : i64 %5 = arith.cmpi ne, %c1, %arg0 : i64 %6 = arith.cmpi slt, %c1, %arg0 : i64 %7 = arith.cmpi sgt, %c1, %arg0 : i64 %8 = arith.cmpi ult, %c1, %arg0 : i64 %9 = arith.cmpi ugt, %c1, %arg0 : i64 return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9 : i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @cmpOfExtSI(%arg0: i1) -> i1 { %ext = arith.extsi %arg0 : i1 to i64 %c0 = arith.constant 0 : i64 %res = arith.cmpi ne, %ext, %c0 : i64 return %res : i1 } func.func @cmpOfExtUI(%arg0: i1) -> i1 { %ext = arith.extui %arg0 : i1 to i64 %c0 = arith.constant 0 : i64 %res = arith.cmpi ne, %ext, %c0 : i64 return %res : i1 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @cmpOfExtSIVector(%arg0: vector<4xi1>) -> vector<4xi1> { %ext = arith.extsi %arg0 : vector<4xi1> to vector<4xi64> %c0 = arith.constant dense<0> : vector<4xi64> %res = arith.cmpi ne, %ext, %c0 : vector<4xi64> return %res : vector<4xi1> } func.func @cmpOfExtUIVector(%arg0: vector<4xi1>) -> vector<4xi1> { %ext = arith.extui %arg0 : vector<4xi1> to vector<4xi64> %c0 = arith.constant dense<0> : vector<4xi64> %res = arith.cmpi ne, %ext, %c0 : vector<4xi64> return %res : vector<4xi1> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @extSIOfExtUI(%arg0: i1) -> i64 { %ext1 = arith.extui %arg0 : i1 to i8 %ext2 = arith.extsi %ext1 : i8 to i64 return %ext2 : i64 } func.func @extUIOfExtUI(%arg0: i1) -> i64 { %ext1 = arith.extui %arg0 : i1 to i8 %ext2 = arith.extui %ext1 : i8 to i64 return %ext2 : i64 } func.func @extSIOfExtSI(%arg0: i1) -> i64 { %ext1 = arith.extsi %arg0 : i1 to i8 %ext2 = arith.extsi %ext1 : i8 to i64 return %ext2 : i64 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @cmpIExtSINE(%arg0: i8, %arg1: i8) -> i1 { %ext0 = arith.extsi %arg0 : i8 to i64 %ext1 = arith.extsi %arg1 : i8 to i64 %res = arith.cmpi ne, %ext0, %ext1 : i64 return %res : i1 } func.func @cmpIExtSIEQ(%arg0: i8, %arg1: i8) -> i1 { %ext0 = arith.extsi %arg0 : i8 to i64 %ext1 = arith.extsi %arg1 : i8 to i64 %res = arith.cmpi eq, %ext0, %ext1 : i64 return %res : i1 } func.func @cmpIExtUINE(%arg0: i8, %arg1: i8) -> i1 { %ext0 = arith.extui %arg0 : i8 to i64 %ext1 = arith.extui %arg1 : i8 to i64 %res = arith.cmpi ne, %ext0, %ext1 : i64 return %res : i1 } func.func @cmpIExtUIEQ(%arg0: i8, %arg1: i8) -> i1 { %ext0 = arith.extui %arg0 : i8 to i64 %ext1 = arith.extui %arg1 : i8 to i64 %res = arith.cmpi eq, %ext0, %ext1 : i64 return %res : i1 } func.func @cmpIFoldEQ() -> vector<3xi1> { %lhs = arith.constant dense<[1, 2, 3]> : vector<3xi32> %rhs = arith.constant dense<[1, 2, 4]> : vector<3xi32> %res = arith.cmpi eq, %lhs, %rhs : vector<3xi32> return %res : vector<3xi1> } func.func @cmpIFoldNE() -> vector<3xi1> { %lhs = arith.constant dense<[1, 2, 3]> : vector<3xi32> %rhs = arith.constant dense<[1, 2, 4]> : vector<3xi32> %res = arith.cmpi ne, %lhs, %rhs : vector<3xi32> return %res : vector<3xi1> } func.func @cmpIFoldSGE() -> vector<3xi1> { %lhs = arith.constant dense<2> : vector<3xi32> %rhs = arith.constant dense<[1, 2, 4]> : vector<3xi32> %res = arith.cmpi sge, %lhs, %rhs : vector<3xi32> return %res : vector<3xi1> } func.func @cmpIFoldULT() -> vector<3xi1> { %lhs = arith.constant dense<2> : vector<3xi32> %rhs = arith.constant dense<1> : vector<3xi32> %res = arith.cmpi ult, %lhs, %rhs : vector<3xi32> return %res : vector<3xi1> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @andOfExtSI(%arg0: i8, %arg1: i8) -> i64 { %ext0 = arith.extsi %arg0 : i8 to i64 %ext1 = arith.extsi %arg1 : i8 to i64 %res = arith.andi %ext0, %ext1 : i64 return %res : i64 } func.func @andOfExtUI(%arg0: i8, %arg1: i8) -> i64 { %ext0 = arith.extui %arg0 : i8 to i64 %ext1 = arith.extui %arg1 : i8 to i64 %res = arith.andi %ext0, %ext1 : i64 return %res : i64 } func.func @orOfExtSI(%arg0: i8, %arg1: i8) -> i64 { %ext0 = arith.extsi %arg0 : i8 to i64 %ext1 = arith.extsi %arg1 : i8 to i64 %res = arith.ori %ext0, %ext1 : i64 return %res : i64 } func.func @orOfExtUI(%arg0: i8, %arg1: i8) -> i64 { %ext0 = arith.extui %arg0 : i8 to i64 %ext1 = arith.extui %arg1 : i8 to i64 %res = arith.ori %ext0, %ext1 : i64 return %res : i64 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @indexCastOfSignExtend(%arg0: i8) -> index { %ext = arith.extsi %arg0 : i8 to i16 %idx = arith.index_cast %ext : i16 to index return %idx : index } func.func @indexCastUIOfUnsignedExtend(%arg0: i8) -> index { %ext = arith.extui %arg0 : i8 to i16 %idx = arith.index_castui %ext : i16 to index return %idx : index } func.func @indexCastFold() -> index { %c-2 = arith.constant -2 : i8 %idx = arith.index_cast %c-2 : i8 to index return %idx : index } func.func @indexCastFoldIndexToInt() -> i32 { %c1 = arith.constant 1 : index %int = arith.index_cast %c1 : index to i32 return %int : i32 } func.func @indexCastFoldSplatVector() -> vector<3xindex> { %cst = arith.constant dense<42> : vector<3xi32> %int = arith.index_cast %cst : vector<3xi32> to vector<3xindex> return %int : vector<3xindex> } func.func @indexCastFoldVector() -> vector<3xindex> { %cst = arith.constant dense<[1, 2, 3]> : vector<3xi32> %int = arith.index_cast %cst : vector<3xi32> to vector<3xindex> return %int : vector<3xindex> } func.func @indexCastFoldSplatVectorIndexToInt() -> vector<3xi32> { %cst = arith.constant dense<42> : vector<3xindex> %int = arith.index_cast %cst : vector<3xindex> to vector<3xi32> return %int : vector<3xi32> } func.func @indexCastFoldVectorIndexToInt() -> vector<3xi32> { %cst = arith.constant dense<[1, 2, 3]> : vector<3xindex> %int = arith.index_cast %cst : vector<3xindex> to vector<3xi32> return %int : vector<3xi32> } func.func @indexCastUIFold() -> index { %c-2 = arith.constant -2 : i8 %idx = arith.index_castui %c-2 : i8 to index return %idx : index } func.func @indexCastUIFoldSplatVector() -> vector<3xindex> { %cst = arith.constant dense<42> : vector<3xi32> %int = arith.index_castui %cst : vector<3xi32> to vector<3xindex> return %int : vector<3xindex> } func.func @indexCastUIFoldVector() -> vector<3xindex> { %cst = arith.constant dense<[1, 2, 3]> : vector<3xi32> %int = arith.index_castui %cst : vector<3xi32> to vector<3xindex> return %int : vector<3xindex> } func.func @indexCastUIFoldIndexToInt() -> i32 { %c1 = arith.constant 1 : index %int = arith.index_castui %c1 : index to i32 return %int : i32 } func.func @indexCastUIFoldSplatVectorIndexToInt() -> vector<3xi32> { %cst = arith.constant dense<42> : vector<3xindex> %int = arith.index_castui %cst : vector<3xindex> to vector<3xi32> return %int : vector<3xi32> } func.func @indexCastUIFoldVectorIndexToInt() -> vector<3xi32> { %cst = arith.constant dense<[1, 2, 3]> : vector<3xindex> %int = arith.index_castui %cst : vector<3xindex> to vector<3xi32> return %int : vector<3xi32> } func.func @signExtendConstant() -> i16 { %c-2 = arith.constant -2 : i8 %ext = arith.extsi %c-2 : i8 to i16 return %ext : i16 } func.func @signExtendConstantSplat() -> vector<4xi16> { %c-2 = arith.constant -2 : i8 %splat = vector.splat %c-2 : vector<4xi8> %ext = arith.extsi %splat : vector<4xi8> to vector<4xi16> return %ext : vector<4xi16> } func.func @signExtendConstantVector() -> vector<4xi16> { %vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi8> %ext = arith.extsi %vector : vector<4xi8> to vector<4xi16> return %ext : vector<4xi16> } func.func @unsignedExtendConstant() -> i16 { %c2 = arith.constant 2 : i8 %ext = arith.extui %c2 : i8 to i16 return %ext : i16 } func.func @unsignedExtendConstantSplat() -> vector<4xi16> { %c2 = arith.constant 2 : i8 %splat = vector.splat %c2 : vector<4xi8> %ext = arith.extui %splat : vector<4xi8> to vector<4xi16> return %ext : vector<4xi16> } func.func @unsignedExtendConstantVector() -> vector<4xi16> { %vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi8> %ext = arith.extui %vector : vector<4xi8> to vector<4xi16> return %ext : vector<4xi16> } func.func @extFPConstant() -> f64 { %cst = arith.constant 1.000000e+00 : f32 %0 = arith.extf %cst : f32 to f64 return %0 : f64 } func.func @truncConstant(%arg0: i8) -> i16 { %c-2 = arith.constant -2 : i32 %tr = arith.trunci %c-2 : i32 to i16 return %tr : i16 } func.func @truncExtui(%arg0: i32) -> i32 { %extui = arith.extui %arg0 : i32 to i64 %trunci = arith.trunci %extui : i64 to i32 return %trunci : i32 } func.func @truncExtui2(%arg0: i32) -> i16 { %extui = arith.extui %arg0 : i32 to i64 %trunci = arith.trunci %extui : i64 to i16 return %trunci : i16 } func.func @truncExtui3(%arg0: i8) -> i16 { %extui = arith.extui %arg0 : i8 to i32 %trunci = arith.trunci %extui : i32 to i16 return %trunci : i16 } func.func @truncExtuiVector(%arg0: vector<2xi32>) -> vector<2xi16> { %extsi = arith.extui %arg0 : vector<2xi32> to vector<2xi64> %trunci = arith.trunci %extsi : vector<2xi64> to vector<2xi16> return %trunci : vector<2xi16> } func.func @truncExtsi(%arg0: i32) -> i32 { %extsi = arith.extsi %arg0 : i32 to i64 %trunci = arith.trunci %extsi : i64 to i32 return %trunci : i32 } func.func @truncExtsi2(%arg0: i32) -> i16 { %extsi = arith.extsi %arg0 : i32 to i64 %trunci = arith.trunci %extsi : i64 to i16 return %trunci : i16 } func.func @truncExtsi3(%arg0: i8) -> i16 { %extsi = arith.extsi %arg0 : i8 to i32 %trunci = arith.trunci %extsi : i32 to i16 return %trunci : i16 } func.func @truncExtsiVector(%arg0: vector<2xi32>) -> vector<2xi16> { %extsi = arith.extsi %arg0 : vector<2xi32> to vector<2xi64> %trunci = arith.trunci %extsi : vector<2xi64> to vector<2xi16> return %trunci : vector<2xi16> } func.func @truncConstantSplat() -> vector<4xi8> { %c-2 = arith.constant -2 : i16 %splat = vector.splat %c-2 : vector<4xi16> %trunc = arith.trunci %splat : vector<4xi16> to vector<4xi8> return %trunc : vector<4xi8> } func.func @truncConstantVector() -> vector<4xi8> { %vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi16> %trunc = arith.trunci %vector : vector<4xi16> to vector<4xi8> return %trunc : vector<4xi8> } func.func @truncTrunc(%arg0: i64) -> i8 { %tr1 = arith.trunci %arg0 : i64 to i32 %tr2 = arith.trunci %tr1 : i32 to i8 return %tr2 : i8 } func.func @truncFPConstant() -> bf16 { %cst = arith.constant 1.000000e+00 : f32 %0 = arith.truncf %cst : f32 to bf16 return %0 : bf16 } func.func @truncFPConstantRounding() -> bf16 { %cst = arith.constant 1.444000e+25 : f32 %0 = arith.truncf %cst : f32 to bf16 return %0 : bf16 } func.func @tripleAddAdd(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.addi %c17, %arg0 : index %add2 = arith.addi %c42, %add1 : index return %add2 : index } func.func @tripleAddSub0(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.subi %c17, %arg0 : index %add2 = arith.addi %c42, %add1 : index return %add2 : index } func.func @tripleAddSub1(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.subi %arg0, %c17 : index %add2 = arith.addi %c42, %add1 : index return %add2 : index } func.func @tripleSubAdd0(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.addi %c17, %arg0 : index %add2 = arith.subi %c42, %add1 : index return %add2 : index } func.func @tripleSubAdd1(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.addi %c17, %arg0 : index %add2 = arith.subi %add1, %c42 : index return %add2 : index } func.func @subSub0(%arg0: index, %arg1: index) -> index { %sub1 = arith.subi %arg0, %arg1 : index %sub2 = arith.subi %sub1, %arg0 : index return %sub2 : index } func.func @tripleSubSub0(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.subi %c17, %arg0 : index %add2 = arith.subi %c42, %add1 : index return %add2 : index } func.func @tripleSubSub1(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.subi %c17, %arg0 : index %add2 = arith.subi %add1, %c42 : index return %add2 : index } func.func @tripleSubSub2(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.subi %arg0, %c17 : index %add2 = arith.subi %c42, %add1 : index return %add2 : index } func.func @tripleSubSub3(%arg0: index) -> index { %c17 = arith.constant 17 : index %c42 = arith.constant 42 : index %add1 = arith.subi %arg0, %c17 : index %add2 = arith.subi %add1, %c42 : index return %add2 : index } func.func @subAdd1(%arg0: index, %arg1 : index) -> index { %add = arith.addi %arg0, %arg1 : index %sub = arith.subi %add, %arg1 : index return %sub : index } func.func @subAdd2(%arg0: index, %arg1 : index) -> index { %add = arith.addi %arg0, %arg1 : index %sub = arith.subi %add, %arg0 : index return %sub : index } func.func @doubleAddSub1(%arg0: index, %arg1 : index) -> index { %sub = arith.subi %arg0, %arg1 : index %add = arith.addi %sub, %arg1 : index return %add : index } func.func @doubleAddSub2(%arg0: index, %arg1 : index) -> index { %sub = arith.subi %arg0, %arg1 : index %add = arith.addi %arg1, %sub : index return %add : index } func.func @addiMuliToSubiRhsI32(%arg0: i32, %arg1: i32) -> i32 { %c-1 = arith.constant -1 : i32 %neg = arith.muli %arg1, %c-1 : i32 %add = arith.addi %arg0, %neg : i32 return %add : i32 } func.func @addiMuliToSubiRhsIndex(%arg0: index, %arg1: index) -> index { %c-1 = arith.constant -1 : index %neg = arith.muli %arg1, %c-1 : index %add = arith.addi %arg0, %neg : index return %add : index } func.func @addiMuliToSubiRhsVector(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi64> { %c-1 = arith.constant dense<-1> : vector<3xi64> %neg = arith.muli %arg1, %c-1 : vector<3xi64> %add = arith.addi %arg0, %neg : vector<3xi64> return %add : vector<3xi64> } func.func @addiMuliToSubiLhsI32(%arg0: i32, %arg1: i32) -> i32 { %c-1 = arith.constant -1 : i32 %neg = arith.muli %arg1, %c-1 : i32 %add = arith.addi %neg, %arg0 : i32 return %add : i32 } func.func @addiMuliToSubiLhsIndex(%arg0: index, %arg1: index) -> index { %c-1 = arith.constant -1 : index %neg = arith.muli %arg1, %c-1 : index %add = arith.addi %neg, %arg0 : index return %add : index } func.func @addiMuliToSubiLhsVector(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> vector<3xi64> { %c-1 = arith.constant dense<-1> : vector<3xi64> %neg = arith.muli %arg1, %c-1 : vector<3xi64> %add = arith.addi %neg, %arg0 : vector<3xi64> return %add : vector<3xi64> } func.func @adduiExtendedZeroRhs(%arg0: i32) -> (i32, i1) { %zero = arith.constant 0 : i32 %sum, %overflow = arith.addui_extended %arg0, %zero: i32, i1 return %sum, %overflow : i32, i1 } func.func @adduiExtendedZeroRhsSplat(%arg0: vector<4xi32>) -> (vector<4xi32>, vector<4xi1>) { %zero = arith.constant dense<0> : vector<4xi32> %sum, %overflow = arith.addui_extended %arg0, %zero: vector<4xi32>, vector<4xi1> return %sum, %overflow : vector<4xi32>, vector<4xi1> } func.func @adduiExtendedZeroLhs(%arg0: i32) -> (i32, i1) { %zero = arith.constant 0 : i32 %sum, %overflow = arith.addui_extended %zero, %arg0: i32, i1 return %sum, %overflow : i32, i1 } func.func @adduiExtendedUnusedOverflowScalar(%arg0: i32, %arg1: i32) -> i32 { %sum, %overflow = arith.addui_extended %arg0, %arg1: i32, i1 return %sum : i32 } func.func @adduiExtendedUnusedOverflowVector(%arg0: vector<3xi32>, %arg1: vector<3xi32>) -> vector<3xi32> { %sum, %overflow = arith.addui_extended %arg0, %arg1: vector<3xi32>, vector<3xi1> return %sum : vector<3xi32> } func.func @adduiExtendedConstants() -> (i32, i1) { %c13 = arith.constant 13 : i32 %c37 = arith.constant 37 : i32 %sum, %overflow = arith.addui_extended %c13, %c37: i32, i1 return %sum, %overflow : i32, i1 } func.func @adduiExtendedConstantsOverflow1() -> (i32, i1) { %max = arith.constant 4294967295 : i32 %c1 = arith.constant 1 : i32 %sum, %overflow = arith.addui_extended %max, %c1: i32, i1 return %sum, %overflow : i32, i1 } func.func @adduiExtendedConstantsOverflow2() -> (i32, i1) { %max = arith.constant 4294967295 : i32 %sum, %overflow = arith.addui_extended %max, %max: i32, i1 return %sum, %overflow : i32, i1 } func.func @adduiExtendedConstantsOverflowVector() -> (vector<4xi32>, vector<4xi1>) { %v1 = arith.constant dense<[1, 3, 3, 7]> : vector<4xi32> %v2 = arith.constant dense<[0, 3, 4294967295, 7]> : vector<4xi32> %sum, %overflow = arith.addui_extended %v1, %v2 : vector<4xi32>, vector<4xi1> return %sum, %overflow : vector<4xi32>, vector<4xi1> } func.func @adduiExtendedConstantsSplatVector() -> (vector<4xi32>, vector<4xi1>) { %v1 = arith.constant dense<1> : vector<4xi32> %v2 = arith.constant dense<2> : vector<4xi32> %sum, %overflow = arith.addui_extended %v1, %v2 : vector<4xi32>, vector<4xi1> return %sum, %overflow : vector<4xi32>, vector<4xi1> } func.func @mulsiExtendedZeroRhs(%arg0: i32) -> (i32, i32) { %zero = arith.constant 0 : i32 %low, %high = arith.mulsi_extended %arg0, %zero: i32 return %low, %high : i32, i32 } func.func @mulsiExtendedZeroRhsSplat(%arg0: vector<3xi32>) -> (vector<3xi32>, vector<3xi32>) { %zero = arith.constant dense<0> : vector<3xi32> %low, %high = arith.mulsi_extended %arg0, %zero: vector<3xi32> return %low, %high : vector<3xi32>, vector<3xi32> } func.func @mulsiExtendedZeroLhs(%arg0: i32) -> (i32, i32) { %zero = arith.constant 0 : i32 %low, %high = arith.mulsi_extended %zero, %arg0: i32 return %low, %high : i32, i32 } func.func @mulsiExtendedOneRhs(%arg0: i32) -> (i32, i32) { %one = arith.constant 1 : i32 %low, %high = arith.mulsi_extended %arg0, %one: i32 return %low, %high : i32, i32 } func.func @mulsiExtendedOneRhsSplat(%arg0: vector<3xi32>) -> (vector<3xi32>, vector<3xi32>) { %one = arith.constant dense<1> : vector<3xi32> %low, %high = arith.mulsi_extended %arg0, %one: vector<3xi32> return %low, %high : vector<3xi32>, vector<3xi32> } func.func @mulsiExtendedUnusedHigh(%arg0: i32) -> i32 { %low, %high = arith.mulsi_extended %arg0, %arg0: i32 return %low : i32 } func.func @mulsiExtendedScalarConstants() -> (i8, i8) { %c57 = arith.constant 57 : i8 %c_n13 = arith.constant -13 : i8 %low, %high = arith.mulsi_extended %c57, %c_n13: i8 return %low, %high : i8, i8 } func.func @mulsiExtendedVectorConstants() -> (vector<3xi8>, vector<3xi8>) { %cstA = arith.constant dense<[5, 37, -17]> : vector<3xi8> %cstB = arith.constant dense<[13, 99, -2]> : vector<3xi8> %low, %high = arith.mulsi_extended %cstA, %cstB: vector<3xi8> return %low, %high : vector<3xi8>, vector<3xi8> } func.func @muluiExtendedZeroRhs(%arg0: i32) -> (i32, i32) { %zero = arith.constant 0 : i32 %low, %high = arith.mului_extended %arg0, %zero: i32 return %low, %high : i32, i32 } func.func @muluiExtendedZeroRhsSplat(%arg0: vector<3xi32>) -> (vector<3xi32>, vector<3xi32>) { %zero = arith.constant dense<0> : vector<3xi32> %low, %high = arith.mului_extended %arg0, %zero: vector<3xi32> return %low, %high : vector<3xi32>, vector<3xi32> } func.func @muluiExtendedZeroLhs(%arg0: i32) -> (i32, i32) { %zero = arith.constant 0 : i32 %low, %high = arith.mului_extended %zero, %arg0: i32 return %low, %high : i32, i32 } func.func @muluiExtendedOneRhs(%arg0: i32) -> (i32, i32) { %zero = arith.constant 1 : i32 %low, %high = arith.mului_extended %arg0, %zero: i32 return %low, %high : i32, i32 } func.func @muluiExtendedOneRhsSplat(%arg0: vector<3xi32>) -> (vector<3xi32>, vector<3xi32>) { %zero = arith.constant dense<1> : vector<3xi32> %low, %high = arith.mului_extended %arg0, %zero: vector<3xi32> return %low, %high : vector<3xi32>, vector<3xi32> } func.func @muluiExtendedOneLhs(%arg0: i32) -> (i32, i32) { %zero = arith.constant 1 : i32 %low, %high = arith.mului_extended %zero, %arg0: i32 return %low, %high : i32, i32 } func.func @muluiExtendedUnusedHigh(%arg0: i32) -> i32 { %low, %high = arith.mului_extended %arg0, %arg0: i32 return %low : i32 } func.func @muluiExtendedUnusedLow(%arg0: i32) -> i32 { %low, %high = arith.mului_extended %arg0, %arg0: i32 return %high : i32 } func.func @muluiExtendedScalarConstants() -> (i8, i8) { %c57 = arith.constant 57 : i8 %c133 = arith.constant 133 : i8 %low, %high = arith.mului_extended %c57, %c133: i8 return %low, %high : i8, i8 } func.func @muluiExtendedVectorConstants() -> (vector<3xi8>, vector<3xi8>) { %cstA = arith.constant dense<[5, 37, 255]> : vector<3xi8> %cstB = arith.constant dense<[13, 99, 255]> : vector<3xi8> %low, %high = arith.mului_extended %cstA, %cstB: vector<3xi8> return %low, %high : vector<3xi8>, vector<3xi8> } func.func @notCmpEQ(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""eq"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpEQ2(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""eq"", %arg0, %arg1 : i8 %ncmp = arith.xori %true, %cmp : i1 return %ncmp : i1 } func.func @notCmpNE(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""ne"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpSLT(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""slt"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpSLE(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""sle"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpSGT(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""sgt"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpSGE(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""sge"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpULT(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""ult"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpULE(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""ule"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpUGT(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""ugt"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 } func.func @notCmpUGE(%arg0: i8, %arg1: i8) -> i1 { %true = arith.constant true %cmp = arith.cmpi ""uge"", %arg0, %arg1 : i8 %ncmp = arith.xori %cmp, %true : i1 return %ncmp : i1 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @xorxor(%cmp : i1) -> i1 { %true = arith.constant true %ncmp = arith.xori %cmp, %true : i1 %nncmp = arith.xori %ncmp, %true : i1 return %nncmp : i1 } func.func @xorOfExtSI(%arg0: i8, %arg1: i8) -> i64 { %ext0 = arith.extsi %arg0 : i8 to i64 %ext1 = arith.extsi %arg1 : i8 to i64 %res = arith.xori %ext0, %ext1 : i64 return %res : i64 } func.func @xorOfExtUI(%arg0: i8, %arg1: i8) -> i64 { %ext0 = arith.extui %arg0 : i8 to i64 %ext1 = arith.extui %arg1 : i8 to i64 %res = arith.xori %ext0, %ext1 : i64 return %res : i64 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastSameType(%arg : f32) -> f32 { %res = arith.bitcast %arg : f32 to f32 return %res : f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastConstantFPtoI() -> i32 { %c0 = arith.constant 0.0 : f32 %res = arith.bitcast %c0 : f32 to i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastConstantItoFP() -> f32 { %c0 = arith.constant 0 : i32 %res = arith.bitcast %c0 : i32 to f32 return %res : f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastConstantFPtoFP() -> f16 { %c0 = arith.constant 0.0 : bf16 %res = arith.bitcast %c0 : bf16 to f16 return %res : f16 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastConstantVecFPtoI() -> vector<3xf32> { %c0 = arith.constant dense<0> : vector<3xi32> %res = arith.bitcast %c0 : vector<3xi32> to vector<3xf32> return %res : vector<3xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastConstantVecItoFP() -> vector<3xi32> { %c0 = arith.constant dense<0.0> : vector<3xf32> %res = arith.bitcast %c0 : vector<3xf32> to vector<3xi32> return %res : vector<3xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastConstantVecFPtoFP() -> vector<3xbf16> { %c0 = arith.constant dense<0.0> : vector<3xf16> %res = arith.bitcast %c0 : vector<3xf16> to vector<3xbf16> return %res : vector<3xbf16> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastBackAndForth(%arg : i32) -> i32 { %f = arith.bitcast %arg : i32 to f32 %res = arith.bitcast %f : f32 to i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @bitcastOfBitcast(%arg : i16) -> i16 { %f = arith.bitcast %arg : i16 to f16 %bf = arith.bitcast %f : f16 to bf16 %res = arith.bitcast %bf : bf16 to i16 return %res : i16 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_maxsi(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 127 : i8 %minIntCst = arith.constant -128 : i8 %c0 = arith.constant 42 : i8 %0 = arith.maxsi %arg0, %arg0 : i8 %1 = arith.maxsi %arg0, %maxIntCst : i8 %2 = arith.maxsi %arg0, %minIntCst : i8 %3 = arith.maxsi %arg0, %c0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 } func.func @test_maxsi2(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 127 : i8 %minIntCst = arith.constant -128 : i8 %c0 = arith.constant 42 : i8 %0 = arith.maxsi %arg0, %arg0 : i8 %1 = arith.maxsi %maxIntCst, %arg0: i8 %2 = arith.maxsi %minIntCst, %arg0: i8 %3 = arith.maxsi %c0, %arg0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_maxui(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 255 : i8 %minIntCst = arith.constant 0 : i8 %c0 = arith.constant 42 : i8 %0 = arith.maxui %arg0, %arg0 : i8 %1 = arith.maxui %arg0, %maxIntCst : i8 %2 = arith.maxui %arg0, %minIntCst : i8 %3 = arith.maxui %arg0, %c0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 } func.func @test_maxui2(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 255 : i8 %minIntCst = arith.constant 0 : i8 %c0 = arith.constant 42 : i8 %0 = arith.maxui %arg0, %arg0 : i8 %1 = arith.maxui %maxIntCst, %arg0 : i8 %2 = arith.maxui %minIntCst, %arg0 : i8 %3 = arith.maxui %c0, %arg0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_minsi(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 127 : i8 %minIntCst = arith.constant -128 : i8 %c0 = arith.constant 42 : i8 %0 = arith.minsi %arg0, %arg0 : i8 %1 = arith.minsi %arg0, %maxIntCst : i8 %2 = arith.minsi %arg0, %minIntCst : i8 %3 = arith.minsi %arg0, %c0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 } func.func @test_minsi2(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 127 : i8 %minIntCst = arith.constant -128 : i8 %c0 = arith.constant 42 : i8 %0 = arith.minsi %arg0, %arg0 : i8 %1 = arith.minsi %maxIntCst, %arg0 : i8 %2 = arith.minsi %minIntCst, %arg0 : i8 %3 = arith.minsi %c0, %arg0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_minui(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 255 : i8 %minIntCst = arith.constant 0 : i8 %c0 = arith.constant 42 : i8 %0 = arith.minui %arg0, %arg0 : i8 %1 = arith.minui %arg0, %maxIntCst : i8 %2 = arith.minui %arg0, %minIntCst : i8 %3 = arith.minui %arg0, %c0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 } func.func @test_minui2(%arg0 : i8) -> (i8, i8, i8, i8) { %maxIntCst = arith.constant 255 : i8 %minIntCst = arith.constant 0 : i8 %c0 = arith.constant 42 : i8 %0 = arith.minui %arg0, %arg0 : i8 %1 = arith.minui %maxIntCst, %arg0 : i8 %2 = arith.minui %minIntCst, %arg0 : i8 %3 = arith.minui %c0, %arg0 : i8 return %0, %1, %2, %3: i8, i8, i8, i8 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_minf(%arg0 : f32) -> (f32, f32, f32) { %c0 = arith.constant 0.0 : f32 %inf = arith.constant 0x7F800000 : f32 %0 = arith.minf %c0, %arg0 : f32 %1 = arith.minf %arg0, %arg0 : f32 %2 = arith.minf %inf, %arg0 : f32 return %0, %1, %2 : f32, f32, f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_maxf(%arg0 : f32) -> (f32, f32, f32) { %c0 = arith.constant 0.0 : f32 %-inf = arith.constant 0xFF800000 : f32 %0 = arith.maxf %c0, %arg0 : f32 %1 = arith.maxf %arg0, %arg0 : f32 %2 = arith.maxf %-inf, %arg0 : f32 return %0, %1, %2 : f32, f32, f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_addf(%arg0 : f32) -> (f32, f32, f32, f32) { %c0 = arith.constant 0.0 : f32 %c-0 = arith.constant -0.0 : f32 %c1 = arith.constant 1.0 : f32 %0 = arith.addf %c0, %arg0 : f32 %1 = arith.addf %arg0, %c-0 : f32 %2 = arith.addf %c-0, %arg0 : f32 %3 = arith.addf %c1, %c1 : f32 return %0, %1, %2, %3 : f32, f32, f32, f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_subf(%arg0 : f16) -> (f16, f16, f16) { %c0 = arith.constant 0.0 : f16 %c-0 = arith.constant -0.0 : f16 %c1 = arith.constant 1.0 : f16 %0 = arith.subf %arg0, %c0 : f16 %1 = arith.subf %arg0, %c-0 : f16 %2 = arith.subf %c0, %c1 : f16 return %0, %1, %2 : f16, f16, f16 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_mulf(%arg0 : f32) -> (f32, f32, f32, f32) { %c1 = arith.constant 1.0 : f32 %c2 = arith.constant 2.0 : f32 %0 = arith.mulf %c2, %arg0 : f32 %1 = arith.mulf %arg0, %c1 : f32 %2 = arith.mulf %c1, %arg0 : f32 %3 = arith.mulf %c2, %c2 : f32 return %0, %1, %2, %3 : f32, f32, f32, f32 } func.func @test_mulf1(%arg0 : f32, %arg1 : f32) -> (f32) { %0 = arith.negf %arg0 : f32 %1 = arith.negf %arg1 : f32 %2 = arith.mulf %0, %1 : f32 return %2 : f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_divf(%arg0 : f64) -> (f64, f64) { %c1 = arith.constant 1.0 : f64 %c2 = arith.constant 2.0 : f64 %0 = arith.divf %arg0, %c1 : f64 %1 = arith.divf %c1, %c2 : f64 return %0, %1 : f64, f64 } func.func @test_divf1(%arg0 : f32, %arg1 : f32) -> (f32) { %0 = arith.negf %arg0 : f32 %1 = arith.negf %arg1 : f32 %2 = arith.divf %0, %1 : f32 return %2 : f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_cmpf(%arg0 : f32) -> (i1, i1, i1, i1) { %nan = arith.constant 0x7fffffff : f32 %0 = arith.cmpf olt, %nan, %arg0 : f32 %1 = arith.cmpf olt, %arg0, %nan : f32 %2 = arith.cmpf ugt, %nan, %arg0 : f32 %3 = arith.cmpf ugt, %arg0, %nan : f32 return %0, %1, %2, %3 : i1, i1, i1, i1 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @constant_FPtoUI() -> i32 { %c0 = arith.constant 2.0 : f32 %res = arith.fptoui %c0 : f32 to i32 return %res : i32 } func.func @constant_FPtoUI_splat() -> vector<4xi32> { %c0 = arith.constant 2.0 : f32 %splat = vector.splat %c0 : vector<4xf32> %res = arith.fptoui %splat : vector<4xf32> to vector<4xi32> return %res : vector<4xi32> } func.func @constant_FPtoUI_vector() -> vector<4xi32> { %vector = arith.constant dense<[1.0, 3.0, 5.0, 7.0]> : vector<4xf32> %res = arith.fptoui %vector : vector<4xf32> to vector<4xi32> return %res : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @invalid_constant_FPtoUI() -> i32 { %c0 = arith.constant -2.0 : f32 %res = arith.fptoui %c0 : f32 to i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @constant_FPtoSI() -> i32 { %c0 = arith.constant -2.0 : f32 %res = arith.fptosi %c0 : f32 to i32 return %res : i32 } func.func @constant_FPtoSI_splat() -> vector<4xi32> { %c0 = arith.constant -2.0 : f32 %splat = vector.splat %c0 : vector<4xf32> %res = arith.fptosi %splat : vector<4xf32> to vector<4xi32> return %res : vector<4xi32> } func.func @constant_FPtoSI_vector() -> vector<4xi32> { %vector = arith.constant dense<[-1.0, -3.0, -5.0, -7.0]> : vector<4xf32> %res = arith.fptosi %vector : vector<4xf32> to vector<4xi32> return %res : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @invalid_constant_FPtoSI() -> i8 { %c0 = arith.constant 2.0e10 : f32 %res = arith.fptosi %c0 : f32 to i8 return %res : i8 } func.func @constant_SItoFP() -> f32 { %c0 = arith.constant -2 : i32 %res = arith.sitofp %c0 : i32 to f32 return %res : f32 } func.func @constant_SItoFP_splat() -> vector<4xf32> { %c0 = arith.constant 2 : i32 %splat = vector.splat %c0 : vector<4xi32> %res = arith.sitofp %splat : vector<4xi32> to vector<4xf32> return %res : vector<4xf32> } func.func @constant_SItoFP_vector() -> vector<4xf32> { %vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %res = arith.sitofp %vector : vector<4xi32> to vector<4xf32> return %res : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @constant_UItoFP() -> f32 { %c0 = arith.constant 2 : i32 %res = arith.uitofp %c0 : i32 to f32 return %res : f32 } func.func @constant_UItoFP_splat() -> vector<4xf32> { %c0 = arith.constant 2 : i32 %splat = vector.splat %c0 : vector<4xi32> %res = arith.uitofp %splat : vector<4xi32> to vector<4xf32> return %res : vector<4xf32> } func.func @constant_UItoFP_vector() -> vector<4xf32> { %vector = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %res = arith.uitofp %vector : vector<4xi32> to vector<4xf32> return %res : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test1(%arg0: i32) -> i1 { %cst = arith.constant 0.000000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf ole, %1, %cst : f64 return %2 : i1 } func.func @test2(%arg0: i32) -> i1 { %cst = arith.constant 0.000000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf olt, %1, %cst : f64 return %2 : i1 } func.func @test3(%arg0: i32) -> i1 { %cst = arith.constant 0.000000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf oge, %1, %cst : f64 return %2 : i1 } func.func @test4(%arg0: i32) -> i1 { %cst = arith.constant 0.000000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf ogt, %1, %cst : f64 return %2 : i1 } func.func @test5(%arg0: i32) -> i1 { %cst = arith.constant -4.400000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf ogt, %1, %cst : f64 return %2 : i1 } func.func @test6(%arg0: i32) -> i1 { %cst = arith.constant -4.400000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf olt, %1, %cst : f64 return %2 : i1 } func.func @test7(%arg0: i32) -> i1 { %cst = arith.constant 3.200000e+00 : f64 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.cmpf oge, %1, %cst : f64 return %2 : i1 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @foldShl() -> i64 { %c1 = arith.constant 1 : i64 %c32 = arith.constant 32 : i64 %r = arith.shli %c1, %c32 : i64 return %r : i64 } func.func @nofoldShl() -> i64 { %c1 = arith.constant 1 : i64 %c132 = arith.constant 132 : i64 %r = arith.shli %c1, %c132 : i64 return %r : i64 } func.func @nofoldShl2() -> i64 { %c1 = arith.constant 1 : i64 %cm32 = arith.constant -32 : i64 %r = arith.shli %c1, %cm32 : i64 return %r : i64 } func.func @foldShru() -> i64 { %c1 = arith.constant 8 : i64 %c32 = arith.constant 2 : i64 %r = arith.shrui %c1, %c32 : i64 return %r : i64 } func.func @foldShru2() -> i64 { %c1 = arith.constant -2 : i64 %c32 = arith.constant 1 : i64 %r = arith.shrui %c1, %c32 : i64 return %r : i64 } func.func @nofoldShru() -> i64 { %c1 = arith.constant 8 : i64 %c132 = arith.constant 132 : i64 %r = arith.shrui %c1, %c132 : i64 return %r : i64 } func.func @nofoldShru2() -> i64 { %c1 = arith.constant 8 : i64 %cm32 = arith.constant -32 : i64 %r = arith.shrui %c1, %cm32 : i64 return %r : i64 } func.func @foldShrs() -> i64 { %c1 = arith.constant 8 : i64 %c32 = arith.constant 2 : i64 %r = arith.shrsi %c1, %c32 : i64 return %r : i64 } func.func @foldShrs2() -> i64 { %c1 = arith.constant -2 : i64 %c32 = arith.constant 1 : i64 %r = arith.shrsi %c1, %c32 : i64 return %r : i64 } func.func @nofoldShrs() -> i64 { %c1 = arith.constant 8 : i64 %c132 = arith.constant 132 : i64 %r = arith.shrsi %c1, %c132 : i64 return %r : i64 } func.func @nofoldShrs2() -> i64 { %c1 = arith.constant 8 : i64 %cm32 = arith.constant -32 : i64 %r = arith.shrsi %c1, %cm32 : i64 return %r : i64 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_negf() -> (f32) { %c = arith.constant 2.0 : f32 %0 = arith.negf %c : f32 return %0: f32 } func.func @test_negf1(%f : f32) -> (f32) { %0 = arith.negf %f : f32 %1 = arith.negf %0 : f32 return %1: f32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_remui() -> (vector<4xi32>) { %v1 = arith.constant dense<[9, 9, 9, 9]> : vector<4xi32> %v2 = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %0 = arith.remui %v1, %v2 : vector<4xi32> return %0 : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_remui_1(%arg : vector<4xi32>) -> (vector<4xi32>) { %v = arith.constant dense<[1, 1, 1, 1]> : vector<4xi32> %0 = arith.remui %arg, %v : vector<4xi32> return %0 : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_remsi() -> (vector<4xi32>) { %v1 = arith.constant dense<[9, 9, 9, 9]> : vector<4xi32> %v2 = arith.constant dense<[1, 3, 5, 7]> : vector<4xi32> %0 = arith.remsi %v1, %v2 : vector<4xi32> return %0 : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_remsi_1(%arg : vector<4xi32>) -> (vector<4xi32>) { %v = arith.constant dense<[1, 1, 1, 1]> : vector<4xi32> %0 = arith.remsi %arg, %v : vector<4xi32> return %0 : vector<4xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_remf() -> (f32) { %v1 = arith.constant 3.0 : f32 %v2 = arith.constant 2.0 : f32 %0 = arith.remf %v1, %v2 : f32 return %0 : f32 } func.func @test_remf_vec() -> (vector<4xf32>) { %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32> %v2 = arith.constant dense<[2.0, 2.0, 2.0, 2.0]> : vector<4xf32> %0 = arith.remf %v1, %v2 : vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_andi_not_fold_rhs(%arg0 : index) -> index { %0 = arith.constant -1 : index %1 = arith.xori %arg0, %0 : index %2 = arith.andi %arg0, %1 : index return %2 : index } func.func @test_andi_not_fold_lhs(%arg0 : index) -> index { %0 = arith.constant -1 : index %1 = arith.xori %arg0, %0 : index %2 = arith.andi %1, %arg0 : index return %2 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @test_andi_not_fold_rhs_vec(%arg0 : vector<2xi32>) -> vector<2xi32> { %0 = arith.constant dense<[-1, -1]> : vector<2xi32> %1 = arith.xori %arg0, %0 : vector<2xi32> %2 = arith.andi %arg0, %1 : vector<2xi32> return %2 : vector<2xi32> } func.func @test_andi_not_fold_lhs_vec(%arg0 : vector<2xi32>) -> vector<2xi32> { %0 = arith.constant dense<[-1, -1]> : vector<2xi32> %1 = arith.xori %arg0, %0 : vector<2xi32> %2 = arith.andi %1, %arg0 : vector<2xi32> return %2 : vector<2xi32> }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @xorxor0(%a : i32, %b : i32) -> i32 { %c = arith.xori %a, %b : i32 %res = arith.xori %c, %b : i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @xorxor1(%a : i32, %b : i32) -> i32 { %c = arith.xori %b, %a : i32 %res = arith.xori %c, %b : i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @xorxor2(%a : i32, %b : i32) -> i32 { %c = arith.xori %a, %b : i32 %res = arith.xori %b, %c : i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @xorxor3(%a : i32, %b : i32) -> i32 { %c = arith.xori %b, %a : i32 %res = arith.xori %b, %c : i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @andand0(%a : i32, %b : i32) -> i32 { %c = arith.andi %a, %b : i32 %res = arith.andi %a, %c : i32 return %res : i32 } func.func @andand1(%a : i32, %b : i32) -> i32 { %c = arith.andi %a, %b : i32 %res = arith.andi %c, %a : i32 return %res : i32 } func.func @andand2(%a : i32, %b : i32) -> i32 { %c = arith.andi %a, %b : i32 %res = arith.andi %b, %c : i32 return %res : i32 } func.func @andand3(%a : i32, %b : i32) -> i32 { %c = arith.andi %a, %b : i32 %res = arith.andi %c, %b : i32 return %res : i32 }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @truncIShrSIToTrunciShrUI(%a: i64) -> i32 { %c32 = arith.constant 32: i64 %sh = arith.shrsi %a, %c32 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @truncIShrSIToTrunciShrUIBadShiftAmt1(%a: i64) -> i32 { %c33 = arith.constant 33: i64 %sh = arith.shrsi %a, %c33 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @truncIShrSIToTrunciShrUIBadShiftAmt2(%a: i64) -> i32 { %c31 = arith.constant 31: i64 %sh = arith.shrsi %a, %c31 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @wideMulToMulSIExtended(%a: i32, %b: i32) -> i32 { %x = arith.extsi %a: i32 to i64 %y = arith.extsi %b: i32 to i64 %m = arith.muli %x, %y: i64 %c32 = arith.constant 32: i64 %sh = arith.shrui %m, %c32 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @wideMulToMulSIExtendedVector(%a: vector<3xi32>, %b: vector<3xi32>) -> vector<3xi32> { %x = arith.extsi %a: vector<3xi32> to vector<3xi64> %y = arith.extsi %b: vector<3xi32> to vector<3xi64> %m = arith.muli %x, %y: vector<3xi64> %c32 = arith.constant dense<32>: vector<3xi64> %sh = arith.shrui %m, %c32 : vector<3xi64> %hi = arith.trunci %sh: vector<3xi64> to vector<3xi32> return %hi : vector<3xi32> } func.func @wideMulToMulUIExtended(%a: i32, %b: i32) -> i32 { %x = arith.extui %a: i32 to i64 %y = arith.extui %b: i32 to i64 %m = arith.muli %x, %y: i64 %c32 = arith.constant 32: i64 %sh = arith.shrui %m, %c32 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @wideMulToMulUIExtendedVector(%a: vector<3xi32>, %b: vector<3xi32>) -> vector<3xi32> { %x = arith.extui %a: vector<3xi32> to vector<3xi64> %y = arith.extui %b: vector<3xi32> to vector<3xi64> %m = arith.muli %x, %y: vector<3xi64> %c32 = arith.constant dense<32>: vector<3xi64> %sh = arith.shrui %m, %c32 : vector<3xi64> %hi = arith.trunci %sh: vector<3xi64> to vector<3xi32> return %hi : vector<3xi32> } func.func @wideMulToMulIExtendedMixedExt(%a: i32, %b: i32) -> i32 { %x = arith.extsi %a: i32 to i64 %y = arith.extui %b: i32 to i64 %m = arith.muli %x, %y: i64 %c32 = arith.constant 32: i64 %sh = arith.shrui %m, %c32 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @wideMulToMulSIExtendedBadExt(%a: i16, %b: i16) -> i32 { %x = arith.extsi %a: i16 to i64 %y = arith.extsi %b: i16 to i64 %m = arith.muli %x, %y: i64 %c32 = arith.constant 32: i64 %sh = arith.shrui %m, %c32 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @wideMulToMulSIExtendedBadShift1(%a: i32, %b: i32) -> i32 { %x = arith.extsi %a: i32 to i64 %y = arith.extsi %b: i32 to i64 %m = arith.muli %x, %y: i64 %c33 = arith.constant 33: i64 %sh = arith.shrui %m, %c33 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @wideMulToMulSIExtendedBadShift2(%a: i32, %b: i32) -> i32 { %x = arith.extsi %a: i32 to i64 %y = arith.extsi %b: i32 to i64 %m = arith.muli %x, %y: i64 %c31 = arith.constant 31: i64 %sh = arith.shrui %m, %c31 : i64 %hi = arith.trunci %sh: i64 to i32 return %hi : i32 } func.func @foldShli0(%x : i64) -> i64 { %c0 = arith.constant 0 : i64 %r = arith.shli %x, %c0 : i64 return %r : i64 } func.func @foldShrui0(%x : i64) -> i64 { %c0 = arith.constant 0 : i64 %r = arith.shrui %x, %c0 : i64 return %r : i64 } func.func @foldShrsi0(%x : i64) -> i64 { %c0 = arith.constant 0 : i64 %r = arith.shrsi %x, %c0 : i64 return %r : i64 } func.func @foldOrXor1(%arg0: i1) -> i1 { %0 = arith.constant true %1 = arith.xori %arg0, %0 : i1 %2 = arith.ori %arg0, %1 : i1 return %2 : i1 } func.func @foldOrXor2(%arg0: i1) -> i1 { %0 = arith.constant true %1 = arith.xori %0, %arg0 : i1 %2 = arith.ori %arg0, %1 : i1 return %2 : i1 } func.func @foldOrXor3(%arg0: i1) -> i1 { %0 = arith.constant true %1 = arith.xori %arg0, %0 : i1 %2 = arith.ori %1, %arg0 : i1 return %2 : i1 } func.func @foldOrXor4(%arg0: i1) -> i1 { %0 = arith.constant true %1 = arith.xori %0, %arg0 : i1 %2 = arith.ori %1, %arg0 : i1 return %2 : i1 } func.func @foldOrXor5(%arg0: i32) -> i32 { %0 = arith.constant -1 : i32 %1 = arith.xori %arg0, %0 : i32 %2 = arith.ori %arg0, %1 : i32 return %2 : i32 } func.func @foldOrXor6(%arg0: index) -> index { %0 = arith.constant -1 : index %1 = arith.xori %arg0, %0 : index %2 = arith.ori %arg0, %1 : index return %2 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file ",1 "func.func @addi_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.addi %a, %b : i32 return %r : i32 } func.func @addi_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.addi %a, %b : i32 return %r : i32 } func.func @addi_extsi_i24(%lhs: i16, %rhs: i16) -> i32 { %a = arith.extsi %lhs : i16 to i32 %b = arith.extsi %rhs : i16 to i32 %r = arith.addi %a, %b : i32 return %r : i32 } func.func @addi_mixed_ext_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.addi %a, %b : i32 return %r : i32 } func.func @addi_extsi_i16(%lhs: i8, %rhs: i8) -> i16 { %a = arith.extsi %lhs : i8 to i16 %b = arith.extsi %rhs : i8 to i16 %r = arith.addi %a, %b : i16 return %r : i16 } func.func @addi_extsi_3xi8_cst(%lhs: vector<3xi8>) -> vector<3xi32> { %cst = arith.constant dense<[-1, 127, 42]> : vector<3xi32> %a = arith.extsi %lhs : vector<3xi8> to vector<3xi32> %r = arith.addi %a, %cst : vector<3xi32> return %r : vector<3xi32> } func.func @subi_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.subi %a, %b : i32 return %r : i32 } func.func @subi_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.subi %a, %b : i32 return %r : i32 } func.func @subi_mixed_ext_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.subi %a, %b : i32 return %r : i32 } func.func @subi_extsi_i24(%lhs: i16, %rhs: i16) -> i32 { %a = arith.extsi %lhs : i16 to i32 %b = arith.extsi %rhs : i16 to i32 %r = arith.subi %a, %b : i32 return %r : i32 } func.func @muli_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.muli %a, %b : i32 return %r : i32 } func.func @muli_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.muli %a, %b : i32 return %r : i32 } func.func @muli_extsi_i32(%lhs: i16, %rhs: i16) -> i32 { %a = arith.extsi %lhs : i16 to i32 %b = arith.extsi %rhs : i16 to i32 %r = arith.muli %a, %b : i32 return %r : i32 } func.func @muli_mixed_ext_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.muli %a, %b : i32 return %r : i32 } func.func @muli_extsi_3xi8_cst(%lhs: vector<3xi8>) -> vector<3xi32> { %cst = arith.constant dense<[-1, 127, 42]> : vector<3xi32> %a = arith.extsi %lhs : vector<3xi8> to vector<3xi32> %r = arith.muli %a, %cst : vector<3xi32> return %r : vector<3xi32> } func.func @divsi_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.divsi %a, %b : i32 return %r : i32 } func.func @divsi_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.divsi %a, %b : i32 return %r : i32 } func.func @divsi_extsi_i24(%lhs: i16, %rhs: i16) -> i32 { %a = arith.extsi %lhs : i16 to i32 %b = arith.extsi %rhs : i16 to i32 %r = arith.divsi %a, %b : i32 return %r : i32 } func.func @divui_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.divui %a, %b : i32 return %r : i32 } func.func @divui_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.divui %a, %b : i32 return %r : i32 } func.func @sitofp_extsi_i16(%a: i16) -> f16 { %b = arith.extsi %a : i16 to i32 %f = arith.sitofp %b : i32 to f16 return %f : f16 } func.func @sitofp_extsi_vector_i16(%a: vector<3xi16>) -> vector<3xf16> { %b = arith.extsi %a : vector<3xi16> to vector<3xi32> %f = arith.sitofp %b : vector<3xi32> to vector<3xf16> return %f : vector<3xf16> } func.func @sitofp_extsi_tensor_i16(%a: tensor<3x?xi16>) -> tensor<3x?xf16> { %b = arith.extsi %a : tensor<3x?xi16> to tensor<3x?xi32> %f = arith.sitofp %b : tensor<3x?xi32> to tensor<3x?xf16> return %f : tensor<3x?xf16> } func.func @sitofp_extsi_i64(%a: i64) -> f32 { %b = arith.extsi %a : i64 to i128 %f = arith.sitofp %b : i128 to f32 return %f : f32 } func.func @uitofp_extui_i16(%a: i16) -> f16 { %b = arith.extui %a : i16 to i32 %f = arith.uitofp %b : i32 to f16 return %f : f16 } func.func @sitofp_extsi_extsi_i8(%a: i8) -> f16 { %b = arith.extsi %a : i8 to i16 %c = arith.extsi %b : i16 to i32 %f = arith.sitofp %c : i32 to f16 return %f : f16 } func.func @uitofp_extui_extui_i8(%a: i8) -> f16 { %b = arith.extui %a : i8 to i16 %c = arith.extui %b : i16 to i32 %f = arith.uitofp %c : i32 to f16 return %f : f16 } func.func @uitofp_extsi_extui_i8(%a: i8) -> f16 { %b = arith.extsi %a : i8 to i16 %c = arith.extui %b : i16 to i32 %f = arith.uitofp %c : i32 to f16 return %f : f16 } func.func @uitofp_trunci_extui_i8(%a: i16) -> f16 { %b = arith.trunci %a : i16 to i8 %c = arith.extui %b : i8 to i32 %f = arith.uitofp %c : i32 to f16 return %f : f16 } func.func @sitofp_extui_i16(%a: i16) -> f16 { %b = arith.extui %a : i16 to i32 %f = arith.sitofp %b : i32 to f16 return %f : f16 } func.func @uitofp_extsi_i16(%a: i16) -> f16 { %b = arith.extsi %a : i16 to i32 %f = arith.uitofp %b : i32 to f16 return %f : f16 } func.func @maxsi_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.maxsi %a, %b : i32 return %r : i32 } func.func @maxsi_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.maxsi %a, %b : i32 return %r : i32 } func.func @maxui_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.maxui %a, %b : i32 return %r : i32 } func.func @maxui_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.maxui %a, %b : i32 return %r : i32 } func.func @minsi_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.minsi %a, %b : i32 return %r : i32 } func.func @minsi_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.minsi %a, %b : i32 return %r : i32 } func.func @minui_extui_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extui %lhs : i8 to i32 %b = arith.extui %rhs : i8 to i32 %r = arith.minui %a, %b : i32 return %r : i32 } func.func @minui_extsi_i8(%lhs: i8, %rhs: i8) -> i32 { %a = arith.extsi %lhs : i8 to i32 %b = arith.extsi %rhs : i8 to i32 %r = arith.minui %a, %b : i32 return %r : i32 } func.func @extsi_over_extract_3xi16(%a: vector<3xi16>) -> f16 { %b = arith.extsi %a : vector<3xi16> to vector<3xi32> %c = vector.extract %b[1] : vector<3xi32> %f = arith.sitofp %c : i32 to f16 return %f : f16 } func.func @extui_over_extract_3xi16(%a: vector<3xi16>) -> f16 { %b = arith.extui %a : vector<3xi16> to vector<3xi32> %c = vector.extract %b[1] : vector<3xi32> %f = arith.uitofp %c : i32 to f16 return %f : f16 } func.func @extsi_over_extractelement_3xi16(%a: vector<3xi16>, %pos: i32) -> f16 { %b = arith.extsi %a : vector<3xi16> to vector<3xi32> %c = vector.extractelement %b[%pos : i32] : vector<3xi32> %f = arith.sitofp %c : i32 to f16 return %f : f16 } func.func @extui_over_extractelement_3xi16(%a: vector<3xi16>, %pos: i32) -> f16 { %b = arith.extui %a : vector<3xi16> to vector<3xi32> %c = vector.extractelement %b[%pos : i32] : vector<3xi32> %f = arith.uitofp %c : i32 to f16 return %f : f16 } func.func @extsi_over_extract_strided_slice_1d(%a: vector<3xi16>) -> vector<2xi32> { %b = arith.extsi %a : vector<3xi16> to vector<3xi32> %c = vector.extract_strided_slice %b {offsets = [1], sizes = [2], strides = [1]} : vector<3xi32> to vector<2xi32> return %c : vector<2xi32> } func.func @extui_over_extract_strided_slice_1d(%a: vector<3xi16>) -> vector<2xi32> { %b = arith.extui %a : vector<3xi16> to vector<3xi32> %c = vector.extract_strided_slice %b {offsets = [1], sizes = [2], strides = [1]} : vector<3xi32> to vector<2xi32> return %c : vector<2xi32> } func.func @extsi_over_extract_strided_slice_2d(%a: vector<2x3xi16>) -> vector<1x2xi32> { %b = arith.extsi %a : vector<2x3xi16> to vector<2x3xi32> %c = vector.extract_strided_slice %b {offsets = [1, 1], sizes = [1, 2], strides = [1, 1]} : vector<2x3xi32> to vector<1x2xi32> return %c : vector<1x2xi32> } func.func @extui_over_extract_strided_slice_2d(%a: vector<2x3xi16>) -> vector<1x2xi32> { %b = arith.extui %a : vector<2x3xi16> to vector<2x3xi32> %c = vector.extract_strided_slice %b {offsets = [1, 1], sizes = [1, 2], strides = [1, 1]} : vector<2x3xi32> to vector<1x2xi32> return %c : vector<1x2xi32> } func.func @extsi_over_insert_3xi16(%a: vector<3xi16>, %b: i16) -> vector<3xi32> { %c = arith.extsi %a : vector<3xi16> to vector<3xi32> %d = arith.extsi %b : i16 to i32 %e = vector.insert %d, %c [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extui_over_insert_3xi16(%a: vector<3xi16>, %b: i16) -> vector<3xi32> { %c = arith.extui %a : vector<3xi16> to vector<3xi32> %d = arith.extui %b : i16 to i32 %e = vector.insert %d, %c [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insert_3xi16_cst_0(%a: i16) -> vector<3xi32> { %cst = arith.constant dense<0> : vector<3xi32> %d = arith.extsi %a : i16 to i32 %e = vector.insert %d, %cst [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insert_3xi8_cst(%a: i8) -> vector<3xi32> { %cst = arith.constant dense<[-1, 127, -128]> : vector<3xi32> %d = arith.extsi %a : i8 to i32 %e = vector.insert %d, %cst [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extui_over_insert_3xi8_cst(%a: i8) -> vector<3xi32> { %cst = arith.constant dense<[1, 127, 255]> : vector<3xi32> %d = arith.extui %a : i8 to i32 %e = vector.insert %d, %cst [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insert_3xi16_cst_i16(%a: i8) -> vector<3xi32> { %cst = arith.constant dense<[-1, 128, 0]> : vector<3xi32> %d = arith.extsi %a : i8 to i32 %e = vector.insert %d, %cst [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extui_over_insert_3xi16_cst_i16(%a: i8) -> vector<3xi32> { %cst = arith.constant dense<[1, 256, 0]> : vector<3xi32> %d = arith.extui %a : i8 to i32 %e = vector.insert %d, %cst [1] : i32 into vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insertelement_3xi16(%a: vector<3xi16>, %b: i16, %pos: i32) -> vector<3xi32> { %c = arith.extsi %a : vector<3xi16> to vector<3xi32> %d = arith.extsi %b : i16 to i32 %e = vector.insertelement %d, %c[%pos : i32] : vector<3xi32> return %e : vector<3xi32> } func.func @extui_over_insertelement_3xi16(%a: vector<3xi16>, %b: i16, %pos: i32) -> vector<3xi32> { %c = arith.extui %a : vector<3xi16> to vector<3xi32> %d = arith.extui %b : i16 to i32 %e = vector.insertelement %d, %c[%pos : i32] : vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insertelement_3xi16_cst_i16(%a: i8, %pos: i32) -> vector<3xi32> { %cst = arith.constant dense<[-1, 128, 0]> : vector<3xi32> %d = arith.extsi %a : i8 to i32 %e = vector.insertelement %d, %cst[%pos : i32] : vector<3xi32> return %e : vector<3xi32> } func.func @extui_over_insertelement_3xi16_cst_i16(%a: i8, %pos: i32) -> vector<3xi32> { %cst = arith.constant dense<[1, 256, 0]> : vector<3xi32> %d = arith.extui %a : i8 to i32 %e = vector.insertelement %d, %cst[%pos : i32] : vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insert_strided_slice_1d(%a: vector<3xi16>, %b: vector<2xi16>) -> vector<3xi32> { %c = arith.extsi %a : vector<3xi16> to vector<3xi32> %d = arith.extsi %b : vector<2xi16> to vector<2xi32> %e = vector.insert_strided_slice %d, %c {offsets = [1], strides = [1]} : vector<2xi32> into vector<3xi32> return %e : vector<3xi32> } func.func @extui_over_insert_strided_slice_1d(%a: vector<3xi16>, %b: vector<2xi16>) -> vector<3xi32> { %c = arith.extui %a : vector<3xi16> to vector<3xi32> %d = arith.extui %b : vector<2xi16> to vector<2xi32> %e = vector.insert_strided_slice %d, %c {offsets = [1], strides = [1]} : vector<2xi32> into vector<3xi32> return %e : vector<3xi32> } func.func @extsi_over_insert_strided_slice_cst_2d(%a: vector<1x2xi8>) -> vector<2x3xi32> { %cst = arith.constant dense<[[-1, 128, 0], [-129, 42, 1337]]> : vector<2x3xi32> %d = arith.extsi %a : vector<1x2xi8> to vector<1x2xi32> %e = vector.insert_strided_slice %d, %cst {offsets = [0, 1], strides = [1, 1]} : vector<1x2xi32> into vector<2x3xi32> return %e : vector<2x3xi32> } func.func @extui_over_insert_strided_slice_cst_2d(%a: vector<1x2xi8>) -> vector<2x3xi32> { %cst = arith.constant dense<[[1, 128, 0], [256, 42, 1337]]> : vector<2x3xi32> %d = arith.extui %a : vector<1x2xi8> to vector<1x2xi32> %e = vector.insert_strided_slice %d, %cst {offsets = [0, 1], strides = [1, 1]} : vector<1x2xi32> into vector<2x3xi32> return %e : vector<2x3xi32> } func.func @extsi_over_broadcast_3xi16(%a: i16) -> vector<3xi32> { %b = arith.extsi %a : i16 to i32 %r = vector.broadcast %b : i32 to vector<3xi32> return %r : vector<3xi32> } func.func @extui_over_broadcast_2x3xi16(%a: vector<3xi16>) -> vector<2x3xi32> { %b = arith.extui %a : vector<3xi16> to vector<3xi32> %r = vector.broadcast %b : vector<3xi32> to vector<2x3xi32> return %r : vector<2x3xi32> } func.func @extsi_over_shape_cast_2x3xi16(%a: vector<2x3xi16>) -> vector<3x2xi32> { %b = arith.extsi %a : vector<2x3xi16> to vector<2x3xi32> %r = vector.shape_cast %b : vector<2x3xi32> to vector<3x2xi32> return %r : vector<3x2xi32> } func.func @extui_over_shape_cast_5x2x3xi16(%a: vector<5x2x3xi16>) -> vector<2x3x5xi32> { %b = arith.extui %a : vector<5x2x3xi16> to vector<5x2x3xi32> %r = vector.shape_cast %b : vector<5x2x3xi32> to vector<2x3x5xi32> return %r : vector<2x3x5xi32> } func.func @extsi_over_transpose_2x3xi16(%a: vector<2x3xi16>) -> vector<3x2xi32> { %b = arith.extsi %a : vector<2x3xi16> to vector<2x3xi32> %r = vector.transpose %b, [1, 0] : vector<2x3xi32> to vector<3x2xi32> return %r : vector<3x2xi32> } func.func @extui_over_transpose_5x2x3xi16(%a: vector<5x2x3xi16>) -> vector<2x3x5xi32> { %b = arith.extui %a : vector<5x2x3xi16> to vector<5x2x3xi32> %r = vector.transpose %b, [1, 2, 0] : vector<5x2x3xi32> to vector<2x3x5xi32> return %r : vector<2x3x5xi32> } func.func @extsi_over_flat_transpose_16xi16(%a: vector<16xi16>) -> vector<16xi32> { %b = arith.extsi %a : vector<16xi16> to vector<16xi32> %r = vector.flat_transpose %b {columns = 4 : i32, rows = 4 : i32} : vector<16xi32> -> vector<16xi32> return %r : vector<16xi32> } func.func @extui_over_flat_transpose_16xi16(%a: vector<16xi16>) -> vector<16xi32> { %b = arith.extui %a : vector<16xi16> to vector<16xi32> %r = vector.flat_transpose %b {columns = 8 : i32, rows = 2 : i32} : vector<16xi32> -> vector<16xi32> return %r : vector<16xi32> }"," mlir-opt --arith-int-narrowing=""int-bitwidths-supported=1,8,16,24,32"" --verify-diagnostics ",1 "func.func @entry() { %cst0 = arith.constant 0 : i64 func.call @emulate_me_please(%cst0) : (i64) -> (i64) func.call @foo(%cst0) : (i64) -> (i64) return } func.func @emulate_me_please(%x : i64) -> i64 { %r = arith.addi %x, %x : i64 return %r : i64 } func.func @foo(%x : i64) -> i64 { %r = arith.addi %x, %x : i64 return %r : i64 }"," mlir-opt --test-arith-emulate-wide-int=""function-prefix=emulate_me_"" ",1 "func.func @index_cast(%tensor: tensor, %scalar: i32) -> (tensor, index) { %index_tensor = arith.index_cast %tensor : tensor to tensor %index_scalar = arith.index_cast %scalar : i32 to index return %index_tensor, %index_scalar : tensor, index }", mlir-opt -arith-bufferize -split-input-file ,1 "func.func @index_cast(%tensor: tensor, %scalar: i32) -> (tensor, index) { %index_tensor = arith.index_cast %tensor : tensor to tensor %index_scalar = arith.index_cast %scalar : i32 to index return %index_tensor, %index_scalar : tensor, index }", mlir-opt -arith-bufferize=alignment=64 -split-input-file ,1 "func.func @basic() -> tensor<3x4xf32> { %0 = arith.constant dense<7.0> : tensor<3x4xf32> return %0 : tensor<3x4xf32> }", mlir-opt -arith-bufferize -split-input-file ,1 "func.func @basic() -> tensor<3x4xf32> { %0 = arith.constant dense<7.0> : tensor<3x4xf32> return %0 : tensor<3x4xf32> }", mlir-opt -arith-bufferize=alignment=64 -split-input-file ,1 "func.func @duplicate_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) { %0 = arith.constant dense<7.0> : tensor<3x4xf32> %1 = arith.constant dense<7.0> : tensor<3x4xf32> return %0, %1 : tensor<3x4xf32>, tensor<3x4xf32> }", mlir-opt -arith-bufferize -split-input-file ,1 "func.func @duplicate_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) { %0 = arith.constant dense<7.0> : tensor<3x4xf32> %1 = arith.constant dense<7.0> : tensor<3x4xf32> return %0, %1 : tensor<3x4xf32>, tensor<3x4xf32> }", mlir-opt -arith-bufferize=alignment=64 -split-input-file ,1 "func.func @multiple_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) { %0 = arith.constant dense<7.0> : tensor<3x4xf32> %1 = arith.constant dense<8.0> : tensor<3x4xf32> return %0, %1 : tensor<3x4xf32>, tensor<3x4xf32> }", mlir-opt -arith-bufferize -split-input-file ,1 "func.func @multiple_constants() -> (tensor<3x4xf32>, tensor<3x4xf32>) { %0 = arith.constant dense<7.0> : tensor<3x4xf32> %1 = arith.constant dense<8.0> : tensor<3x4xf32> return %0, %1 : tensor<3x4xf32>, tensor<3x4xf32> }", mlir-opt -arith-bufferize=alignment=64 -split-input-file ,1 "func.func @non_tensor() { %0 = arith.constant 7 : i32 return }", mlir-opt -arith-bufferize -split-input-file ,1 "func.func @non_tensor() { %0 = arith.constant 7 : i32 return }", mlir-opt -arith-bufferize=alignment=64 -split-input-file ,1 "func.func @select(%arg0: i1, %arg1: tensor, %arg2: tensor) -> tensor { %0 = arith.select %arg0, %arg1, %arg2 : tensor return %0 : tensor }", mlir-opt -arith-bufferize -split-input-file ,1 "func.func @select(%arg0: i1, %arg1: tensor, %arg2: tensor) -> tensor { %0 = arith.select %arg0, %arg1, %arg2 : tensor return %0 : tensor }", mlir-opt -arith-bufferize=alignment=64 -split-input-file ,1 "func.func @test() -> i1 { %cst1 = arith.constant -1 : index %0 = test.with_bounds { umin = 0 : index, umax = 0x7fffffffffffffff : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = arith.cmpi eq, %0, %cst1 : index return %1: i1 }", mlir-opt -int-range-optimizations --split-input-file ,1 "func.func @test() -> i1 { %cst1 = arith.constant -1 : index %0 = test.with_bounds { umin = 0 : index, umax = 0x7fffffffffffffff : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = arith.cmpi ne, %0, %cst1 : index return %1: i1 }", mlir-opt -int-range-optimizations --split-input-file ,1 "func.func @test() -> i1 { %cst = arith.constant 0 : index %0 = test.with_bounds { umin = 0 : index, umax = 0x7fffffffffffffff : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = arith.cmpi sge, %0, %cst : index return %1: i1 }", mlir-opt -int-range-optimizations --split-input-file ,1 "func.func @test() -> i1 { %cst = arith.constant 0 : index %0 = test.with_bounds { umin = 0 : index, umax = 0x7fffffffffffffff : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = arith.cmpi slt, %0, %cst : index return %1: i1 }", mlir-opt -int-range-optimizations --split-input-file ,1 "func.func @test() -> i1 { %cst1 = arith.constant -1 : index %0 = test.with_bounds { umin = 0 : index, umax = 0x7fffffffffffffff : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = arith.cmpi sgt, %0, %cst1 : index return %1: i1 }", mlir-opt -int-range-optimizations --split-input-file ,1 "func.func @test() -> i1 { %cst1 = arith.constant -1 : index %0 = test.with_bounds { umin = 0 : index, umax = 0x7fffffffffffffff : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = arith.cmpi sle, %0, %cst1 : index return %1: i1 }", mlir-opt -int-range-optimizations --split-input-file ,1 "func.func @test_addi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.addi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_addi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.addi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_addi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.addi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_addi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.addi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_addui_extended(%arg0 : i64, %arg1 : i64) -> i64 { %sum, %overflow = arith.addui_extended %arg0, %arg1 : i64, i1 return %sum : i64 } func.func @test_addui_extended_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %sum, %overflow = arith.addui_extended %arg0, %arg1 : tensor<8x8xi64>, tensor<8x8xi1> return %sum : tensor<8x8xi64> } func.func @test_addui_extended_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0:2 = arith.addui_extended %arg0, %arg1 : vector<8xi64>, vector<8xi1> return %0#0 : vector<8xi64> } func.func @test_addui_extended_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0:2 = arith.addui_extended %arg0, %arg1 : vector<[8]xi64>, vector<[8]xi1> return %0#0 : vector<[8]xi64> } func.func @test_subi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.subi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_subi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.subi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_subi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.subi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_subi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.subi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_muli(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.muli %arg0, %arg1 : i64 return %0 : i64 } func.func @test_muli_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.muli %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_muli_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.muli %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_muli_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.muli %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_mulsi_extended(%arg0 : i32, %arg1 : i32) -> i32 { %low, %high = arith.mulsi_extended %arg0, %arg1 : i32 return %high : i32 } func.func @test_mulsi_extended_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %low, %high = arith.mulsi_extended %arg0, %arg1 : tensor<8x8xi64> return %high : tensor<8x8xi64> } func.func @test_mulsi_extended_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0:2 = arith.mulsi_extended %arg0, %arg1 : vector<8xi64> return %0#0 : vector<8xi64> } func.func @test_mulsi_extended_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0:2 = arith.mulsi_extended %arg0, %arg1 : vector<[8]xi64> return %0#1 : vector<[8]xi64> } func.func @test_mului_extended(%arg0 : i32, %arg1 : i32) -> i32 { %low, %high = arith.mului_extended %arg0, %arg1 : i32 return %high : i32 } func.func @test_mului_extended_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %low, %high = arith.mului_extended %arg0, %arg1 : tensor<8x8xi64> return %high : tensor<8x8xi64> } func.func @test_mului_extended_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0:2 = arith.mului_extended %arg0, %arg1 : vector<8xi64> return %0#0 : vector<8xi64> } func.func @test_mului_extended_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0:2 = arith.mului_extended %arg0, %arg1 : vector<[8]xi64> return %0#1 : vector<[8]xi64> } func.func @test_divui(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.divui %arg0, %arg1 : i64 return %0 : i64 } func.func @test_divui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.divui %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_divui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.divui %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_divui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.divui %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_divsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.divsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_divsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.divsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_divsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.divsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_divsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.divsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_remui(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.remui %arg0, %arg1 : i64 return %0 : i64 } func.func @test_remui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.remui %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_remui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.remui %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_remui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.remui %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_remsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.remsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_remsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.remsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_remsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.remsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_remsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.remsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_andi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.andi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_andi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.andi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_andi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.andi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_andi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.andi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_ori(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.ori %arg0, %arg1 : i64 return %0 : i64 } func.func @test_ori_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.ori %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_ori_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.ori %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_ori_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.ori %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_xori(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.xori %arg0, %arg1 : i64 return %0 : i64 } func.func @test_xori_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.xori %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_xori_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.xori %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_xori_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.xori %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_ceildivsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.ceildivsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_ceildivsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.ceildivsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_ceildivsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.ceildivsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_ceildivsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.ceildivsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_floordivsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.floordivsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_floordivsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.floordivsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_floordivsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.floordivsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_floordivsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.floordivsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_shli(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.shli %arg0, %arg1 : i64 return %0 : i64 } func.func @test_shli_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.shli %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_shli_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.shli %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_shli_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.shli %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_shrui(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.shrui %arg0, %arg1 : i64 return %0 : i64 } func.func @test_shrui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.shrui %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_shrui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.shrui %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_shrui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.shrui %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_shrsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.shrsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_shrsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.shrsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_shrsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.shrsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_shrsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.shrsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_negf(%arg0 : f64) -> f64 { %0 = arith.negf %arg0 : f64 return %0 : f64 } func.func @test_negf_tensor(%arg0 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.negf %arg0 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_negf_vector(%arg0 : vector<8xf64>) -> vector<8xf64> { %0 = arith.negf %arg0 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_negf_scalable_vector(%arg0 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.negf %arg0 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_addf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.addf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_addf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.addf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_addf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.addf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_addf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.addf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_subf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.subf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_subf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.subf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_subf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.subf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_subf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.subf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_mulf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.mulf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_mulf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.mulf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_mulf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.mulf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_mulf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.mulf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_divf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.divf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_divf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.divf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_divf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.divf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_divf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.divf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_remf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.remf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_remf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.remf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_remf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.remf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_remf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.remf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_extui(%arg0 : i32) -> i64 { %0 = arith.extui %arg0 : i32 to i64 return %0 : i64 } func.func @test_extui_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi64> { %0 = arith.extui %arg0 : tensor<8x8xi32> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_extui_vector(%arg0 : vector<8xi32>) -> vector<8xi64> { %0 = arith.extui %arg0 : vector<8xi32> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_extui_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi64> { %0 = arith.extui %arg0 : vector<[8]xi32> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_extsi(%arg0 : i32) -> i64 { %0 = arith.extsi %arg0 : i32 to i64 return %0 : i64 } func.func @test_extsi_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi64> { %0 = arith.extsi %arg0 : tensor<8x8xi32> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_extsi_vector(%arg0 : vector<8xi32>) -> vector<8xi64> { %0 = arith.extsi %arg0 : vector<8xi32> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_extsi_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi64> { %0 = arith.extsi %arg0 : vector<[8]xi32> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_extf(%arg0 : f32) -> f64 { %0 = arith.extf %arg0 : f32 to f64 return %0 : f64 } func.func @test_extf_tensor(%arg0 : tensor<8x8xf32>) -> tensor<8x8xf64> { %0 = arith.extf %arg0 : tensor<8x8xf32> to tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_extf_vector(%arg0 : vector<8xf32>) -> vector<8xf64> { %0 = arith.extf %arg0 : vector<8xf32> to vector<8xf64> return %0 : vector<8xf64> } func.func @test_extf_scalable_vector(%arg0 : vector<[8]xf32>) -> vector<[8]xf64> { %0 = arith.extf %arg0 : vector<[8]xf32> to vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_trunci(%arg0 : i32) -> i16 { %0 = arith.trunci %arg0 : i32 to i16 return %0 : i16 } func.func @test_trunci_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi16> { %0 = arith.trunci %arg0 : tensor<8x8xi32> to tensor<8x8xi16> return %0 : tensor<8x8xi16> } func.func @test_trunci_vector(%arg0 : vector<8xi32>) -> vector<8xi16> { %0 = arith.trunci %arg0 : vector<8xi32> to vector<8xi16> return %0 : vector<8xi16> } func.func @test_trunci_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi16> { %0 = arith.trunci %arg0 : vector<[8]xi32> to vector<[8]xi16> return %0 : vector<[8]xi16> } func.func @test_truncf(%arg0 : f32) -> bf16 { %0 = arith.truncf %arg0 : f32 to bf16 return %0 : bf16 } func.func @test_truncf_tensor(%arg0 : tensor<8x8xf32>) -> tensor<8x8xbf16> { %0 = arith.truncf %arg0 : tensor<8x8xf32> to tensor<8x8xbf16> return %0 : tensor<8x8xbf16> } func.func @test_truncf_vector(%arg0 : vector<8xf32>) -> vector<8xbf16> { %0 = arith.truncf %arg0 : vector<8xf32> to vector<8xbf16> return %0 : vector<8xbf16> } func.func @test_truncf_scalable_vector(%arg0 : vector<[8]xf32>) -> vector<[8]xbf16> { %0 = arith.truncf %arg0 : vector<[8]xf32> to vector<[8]xbf16> return %0 : vector<[8]xbf16> } func.func @test_uitofp(%arg0 : i32) -> f32 { %0 = arith.uitofp %arg0 : i32 to f32 return %0 : f32 } func.func @test_uitofp_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xf32> { %0 = arith.uitofp %arg0 : tensor<8x8xi32> to tensor<8x8xf32> return %0 : tensor<8x8xf32> } func.func @test_uitofp_vector(%arg0 : vector<8xi32>) -> vector<8xf32> { %0 = arith.uitofp %arg0 : vector<8xi32> to vector<8xf32> return %0 : vector<8xf32> } func.func @test_uitofp_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xf32> { %0 = arith.uitofp %arg0 : vector<[8]xi32> to vector<[8]xf32> return %0 : vector<[8]xf32> } func.func @test_sitofp(%arg0 : i16) -> f64 { %0 = arith.sitofp %arg0 : i16 to f64 return %0 : f64 } func.func @test_sitofp_tensor(%arg0 : tensor<8x8xi16>) -> tensor<8x8xf64> { %0 = arith.sitofp %arg0 : tensor<8x8xi16> to tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_sitofp_vector(%arg0 : vector<8xi16>) -> vector<8xf64> { %0 = arith.sitofp %arg0 : vector<8xi16> to vector<8xf64> return %0 : vector<8xf64> } func.func @test_sitofp_scalable_vector(%arg0 : vector<[8]xi16>) -> vector<[8]xf64> { %0 = arith.sitofp %arg0 : vector<[8]xi16> to vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_fptoui(%arg0 : bf16) -> i8 { %0 = arith.fptoui %arg0 : bf16 to i8 return %0 : i8 } func.func @test_fptoui_tensor(%arg0 : tensor<8x8xbf16>) -> tensor<8x8xi8> { %0 = arith.fptoui %arg0 : tensor<8x8xbf16> to tensor<8x8xi8> return %0 : tensor<8x8xi8> } func.func @test_fptoui_vector(%arg0 : vector<8xbf16>) -> vector<8xi8> { %0 = arith.fptoui %arg0 : vector<8xbf16> to vector<8xi8> return %0 : vector<8xi8> } func.func @test_fptoui_scalable_vector(%arg0 : vector<[8]xbf16>) -> vector<[8]xi8> { %0 = arith.fptoui %arg0 : vector<[8]xbf16> to vector<[8]xi8> return %0 : vector<[8]xi8> } func.func @test_fptosi(%arg0 : f64) -> i64 { %0 = arith.fptosi %arg0 : f64 to i64 return %0 : i64 } func.func @test_fptosi_tensor(%arg0 : tensor<8x8xf64>) -> tensor<8x8xi64> { %0 = arith.fptosi %arg0 : tensor<8x8xf64> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_fptosi_vector(%arg0 : vector<8xf64>) -> vector<8xi64> { %0 = arith.fptosi %arg0 : vector<8xf64> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_fptosi_scalable_vector(%arg0 : vector<[8]xf64>) -> vector<[8]xi64> { %0 = arith.fptosi %arg0 : vector<[8]xf64> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_index_cast0(%arg0 : i32) -> index { %0 = arith.index_cast %arg0 : i32 to index return %0 : index } func.func @test_index_cast_tensor0(%arg0 : tensor<8x8xi32>) -> tensor<8x8xindex> { %0 = arith.index_cast %arg0 : tensor<8x8xi32> to tensor<8x8xindex> return %0 : tensor<8x8xindex> } func.func @test_index_cast_vector0(%arg0 : vector<8xi32>) -> vector<8xindex> { %0 = arith.index_cast %arg0 : vector<8xi32> to vector<8xindex> return %0 : vector<8xindex> } func.func @test_index_cast_scalable_vector0(%arg0 : vector<[8]xi32>) -> vector<[8]xindex> { %0 = arith.index_cast %arg0 : vector<[8]xi32> to vector<[8]xindex> return %0 : vector<[8]xindex> } func.func @test_index_cast1(%arg0 : index) -> i64 { %0 = arith.index_cast %arg0 : index to i64 return %0 : i64 } func.func @test_index_cast_tensor1(%arg0 : tensor<8x8xindex>) -> tensor<8x8xi64> { %0 = arith.index_cast %arg0 : tensor<8x8xindex> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_index_cast_vector1(%arg0 : vector<8xindex>) -> vector<8xi64> { %0 = arith.index_cast %arg0 : vector<8xindex> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_index_cast_scalable_vector1(%arg0 : vector<[8]xindex>) -> vector<[8]xi64> { %0 = arith.index_cast %arg0 : vector<[8]xindex> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_index_castui0(%arg0 : i32) -> index { %0 = arith.index_castui %arg0 : i32 to index return %0 : index } func.func @test_index_castui_tensor0(%arg0 : tensor<8x8xi32>) -> tensor<8x8xindex> { %0 = arith.index_castui %arg0 : tensor<8x8xi32> to tensor<8x8xindex> return %0 : tensor<8x8xindex> } func.func @test_index_castui_vector0(%arg0 : vector<8xi32>) -> vector<8xindex> { %0 = arith.index_castui %arg0 : vector<8xi32> to vector<8xindex> return %0 : vector<8xindex> } func.func @test_index_castui_scalable_vector0(%arg0 : vector<[8]xi32>) -> vector<[8]xindex> { %0 = arith.index_castui %arg0 : vector<[8]xi32> to vector<[8]xindex> return %0 : vector<[8]xindex> } func.func @test_indexui_cast1(%arg0 : index) -> i64 { %0 = arith.index_castui %arg0 : index to i64 return %0 : i64 } func.func @test_index_castui_tensor1(%arg0 : tensor<8x8xindex>) -> tensor<8x8xi64> { %0 = arith.index_castui %arg0 : tensor<8x8xindex> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_index_castui_vector1(%arg0 : vector<8xindex>) -> vector<8xi64> { %0 = arith.index_castui %arg0 : vector<8xindex> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_index_castui_scalable_vector1(%arg0 : vector<[8]xindex>) -> vector<[8]xi64> { %0 = arith.index_castui %arg0 : vector<[8]xindex> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_bitcast0(%arg0 : i64) -> f64 { %0 = arith.bitcast %arg0 : i64 to f64 return %0 : f64 } func.func @test_bitcast_tensor0(%arg0 : tensor<8x8xi64>) -> tensor<8x8xf64> { %0 = arith.bitcast %arg0 : tensor<8x8xi64> to tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_bitcast_vector0(%arg0 : vector<8xi64>) -> vector<8xf64> { %0 = arith.bitcast %arg0 : vector<8xi64> to vector<8xf64> return %0 : vector<8xf64> } func.func @test_bitcast_scalable_vector0(%arg0 : vector<[8]xi64>) -> vector<[8]xf64> { %0 = arith.bitcast %arg0 : vector<[8]xi64> to vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_bitcast1(%arg0 : f32) -> i32 { %0 = arith.bitcast %arg0 : f32 to i32 return %0 : i32 } func.func @test_bitcast_tensor1(%arg0 : tensor<8x8xf32>) -> tensor<8x8xi32> { %0 = arith.bitcast %arg0 : tensor<8x8xf32> to tensor<8x8xi32> return %0 : tensor<8x8xi32> } func.func @test_bitcast_vector1(%arg0 : vector<8xf32>) -> vector<8xi32> { %0 = arith.bitcast %arg0 : vector<8xf32> to vector<8xi32> return %0 : vector<8xi32> } func.func @test_bitcast_scalable_vector1(%arg0 : vector<[8]xf32>) -> vector<[8]xi32> { %0 = arith.bitcast %arg0 : vector<[8]xf32> to vector<[8]xi32> return %0 : vector<[8]xi32> } func.func @test_cmpi(%arg0 : i64, %arg1 : i64) -> i1 { %0 = arith.cmpi ne, %arg0, %arg1 : i64 return %0 : i1 } func.func @test_cmpi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi1> { %0 = arith.cmpi slt, %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi1> } func.func @test_cmpi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi1> { %0 = arith.cmpi ult, %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi1> } func.func @test_cmpi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi1> { %0 = arith.cmpi ult, %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi1> } func.func @test_cmpi_vector_0d(%arg0 : vector, %arg1 : vector) -> vector { %0 = arith.cmpi ult, %arg0, %arg1 : vector return %0 : vector } func.func @test_cmpf(%arg0 : f64, %arg1 : f64) -> i1 { %0 = arith.cmpf oeq, %arg0, %arg1 : f64 return %0 : i1 } func.func @test_cmpf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xi1> { %0 = arith.cmpf olt, %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xi1> } func.func @test_cmpf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xi1> { %0 = arith.cmpf ult, %arg0, %arg1 : vector<8xf64> return %0 : vector<8xi1> } func.func @test_cmpf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xi1> { %0 = arith.cmpf ult, %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xi1> } func.func @test_index_cast(%arg0 : index) -> i64 { %0 = arith.index_cast %arg0 : index to i64 return %0 : i64 } func.func @test_index_cast_tensor(%arg0 : tensor) -> tensor { %0 = arith.index_cast %arg0 : tensor to tensor return %0 : tensor } func.func @test_index_cast_tensor_reverse(%arg0 : tensor) -> tensor { %0 = arith.index_cast %arg0 : tensor to tensor return %0 : tensor } func.func @bitcast(%arg : f32) -> i32 { %res = arith.bitcast %arg : f32 to i32 return %res : i32 } func.func @test_constant() -> () { %0 = ""arith.constant""(){value = 42 : i32} : () -> i32 %1 = arith.constant 42 : i32 %2 = arith.constant {crazy = ""func.foo""} 43: index %3 = arith.constant 43.0 : bf16 %4 = arith.constant dense<0> : vector<4 x i32> %5 = arith.constant dense<0> : tensor<42 x i32> %6 = arith.constant dense<0> : vector<42 x i32> %7 = arith.constant true %8 = arith.constant false %9 = arith.constant 340282366920938463463374607431768211455 : i128 %10 = arith.constant 85070591730234615865843651857942052864 : i128 return } func.func @maximum(%v1: vector<4xf32>, %v2: vector<4xf32>, %sv1: vector<[4]xf32>, %sv2: vector<[4]xf32>, %f1: f32, %f2: f32, %i1: i32, %i2: i32) { %max_vector = arith.maxf %v1, %v2 : vector<4xf32> %max_scalable_vector = arith.maxf %sv1, %sv2 : vector<[4]xf32> %max_float = arith.maxf %f1, %f2 : f32 %max_signed = arith.maxsi %i1, %i2 : i32 %max_unsigned = arith.maxui %i1, %i2 : i32 return } func.func @minimum(%v1: vector<4xf32>, %v2: vector<4xf32>, %sv1: vector<[4]xf32>, %sv2: vector<[4]xf32>, %f1: f32, %f2: f32, %i1: i32, %i2: i32) { %min_vector = arith.minf %v1, %v2 : vector<4xf32> %min_scalable_vector = arith.minf %sv1, %sv2 : vector<[4]xf32> %min_float = arith.minf %f1, %f2 : f32 %min_signed = arith.minsi %i1, %i2 : i32 %min_unsigned = arith.minui %i1, %i2 : i32 return } func.func @fastmath(%arg0: f32, %arg1: f32, %arg2: i32) { %0 = arith.addf %arg0, %arg1 fastmath : f32 %1 = arith.subf %arg0, %arg1 fastmath : f32 %2 = arith.mulf %arg0, %arg1 fastmath : f32 %3 = arith.divf %arg0, %arg1 fastmath : f32 %4 = arith.remf %arg0, %arg1 fastmath : f32 %5 = arith.negf %arg0 fastmath : f32 %6 = arith.addf %arg0, %arg1 fastmath : f32 %7 = arith.addf %arg0, %arg1 fastmath : f32 %8 = arith.mulf %arg0, %arg1 fastmath : f32 return }", mlir-opt | mlir-opt ,1 "func.func @test_addi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.addi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_addi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.addi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_addi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.addi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_addi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.addi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_addui_extended(%arg0 : i64, %arg1 : i64) -> i64 { %sum, %overflow = arith.addui_extended %arg0, %arg1 : i64, i1 return %sum : i64 } func.func @test_addui_extended_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %sum, %overflow = arith.addui_extended %arg0, %arg1 : tensor<8x8xi64>, tensor<8x8xi1> return %sum : tensor<8x8xi64> } func.func @test_addui_extended_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0:2 = arith.addui_extended %arg0, %arg1 : vector<8xi64>, vector<8xi1> return %0#0 : vector<8xi64> } func.func @test_addui_extended_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0:2 = arith.addui_extended %arg0, %arg1 : vector<[8]xi64>, vector<[8]xi1> return %0#0 : vector<[8]xi64> } func.func @test_subi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.subi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_subi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.subi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_subi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.subi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_subi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.subi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_muli(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.muli %arg0, %arg1 : i64 return %0 : i64 } func.func @test_muli_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.muli %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_muli_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.muli %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_muli_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.muli %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_mulsi_extended(%arg0 : i32, %arg1 : i32) -> i32 { %low, %high = arith.mulsi_extended %arg0, %arg1 : i32 return %high : i32 } func.func @test_mulsi_extended_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %low, %high = arith.mulsi_extended %arg0, %arg1 : tensor<8x8xi64> return %high : tensor<8x8xi64> } func.func @test_mulsi_extended_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0:2 = arith.mulsi_extended %arg0, %arg1 : vector<8xi64> return %0#0 : vector<8xi64> } func.func @test_mulsi_extended_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0:2 = arith.mulsi_extended %arg0, %arg1 : vector<[8]xi64> return %0#1 : vector<[8]xi64> } func.func @test_mului_extended(%arg0 : i32, %arg1 : i32) -> i32 { %low, %high = arith.mului_extended %arg0, %arg1 : i32 return %high : i32 } func.func @test_mului_extended_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %low, %high = arith.mului_extended %arg0, %arg1 : tensor<8x8xi64> return %high : tensor<8x8xi64> } func.func @test_mului_extended_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0:2 = arith.mului_extended %arg0, %arg1 : vector<8xi64> return %0#0 : vector<8xi64> } func.func @test_mului_extended_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0:2 = arith.mului_extended %arg0, %arg1 : vector<[8]xi64> return %0#1 : vector<[8]xi64> } func.func @test_divui(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.divui %arg0, %arg1 : i64 return %0 : i64 } func.func @test_divui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.divui %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_divui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.divui %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_divui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.divui %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_divsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.divsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_divsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.divsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_divsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.divsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_divsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.divsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_remui(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.remui %arg0, %arg1 : i64 return %0 : i64 } func.func @test_remui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.remui %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_remui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.remui %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_remui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.remui %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_remsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.remsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_remsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.remsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_remsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.remsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_remsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.remsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_andi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.andi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_andi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.andi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_andi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.andi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_andi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.andi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_ori(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.ori %arg0, %arg1 : i64 return %0 : i64 } func.func @test_ori_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.ori %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_ori_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.ori %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_ori_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.ori %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_xori(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.xori %arg0, %arg1 : i64 return %0 : i64 } func.func @test_xori_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.xori %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_xori_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.xori %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_xori_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.xori %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_ceildivsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.ceildivsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_ceildivsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.ceildivsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_ceildivsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.ceildivsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_ceildivsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.ceildivsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_floordivsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.floordivsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_floordivsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.floordivsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_floordivsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.floordivsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_floordivsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.floordivsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_shli(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.shli %arg0, %arg1 : i64 return %0 : i64 } func.func @test_shli_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.shli %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_shli_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.shli %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_shli_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.shli %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_shrui(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.shrui %arg0, %arg1 : i64 return %0 : i64 } func.func @test_shrui_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.shrui %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_shrui_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.shrui %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_shrui_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.shrui %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_shrsi(%arg0 : i64, %arg1 : i64) -> i64 { %0 = arith.shrsi %arg0, %arg1 : i64 return %0 : i64 } func.func @test_shrsi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi64> { %0 = arith.shrsi %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_shrsi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi64> { %0 = arith.shrsi %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi64> } func.func @test_shrsi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi64> { %0 = arith.shrsi %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_negf(%arg0 : f64) -> f64 { %0 = arith.negf %arg0 : f64 return %0 : f64 } func.func @test_negf_tensor(%arg0 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.negf %arg0 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_negf_vector(%arg0 : vector<8xf64>) -> vector<8xf64> { %0 = arith.negf %arg0 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_negf_scalable_vector(%arg0 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.negf %arg0 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_addf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.addf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_addf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.addf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_addf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.addf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_addf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.addf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_subf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.subf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_subf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.subf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_subf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.subf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_subf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.subf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_mulf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.mulf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_mulf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.mulf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_mulf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.mulf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_mulf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.mulf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_divf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.divf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_divf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.divf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_divf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.divf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_divf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.divf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_remf(%arg0 : f64, %arg1 : f64) -> f64 { %0 = arith.remf %arg0, %arg1 : f64 return %0 : f64 } func.func @test_remf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xf64> { %0 = arith.remf %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_remf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xf64> { %0 = arith.remf %arg0, %arg1 : vector<8xf64> return %0 : vector<8xf64> } func.func @test_remf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xf64> { %0 = arith.remf %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_extui(%arg0 : i32) -> i64 { %0 = arith.extui %arg0 : i32 to i64 return %0 : i64 } func.func @test_extui_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi64> { %0 = arith.extui %arg0 : tensor<8x8xi32> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_extui_vector(%arg0 : vector<8xi32>) -> vector<8xi64> { %0 = arith.extui %arg0 : vector<8xi32> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_extui_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi64> { %0 = arith.extui %arg0 : vector<[8]xi32> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_extsi(%arg0 : i32) -> i64 { %0 = arith.extsi %arg0 : i32 to i64 return %0 : i64 } func.func @test_extsi_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi64> { %0 = arith.extsi %arg0 : tensor<8x8xi32> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_extsi_vector(%arg0 : vector<8xi32>) -> vector<8xi64> { %0 = arith.extsi %arg0 : vector<8xi32> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_extsi_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi64> { %0 = arith.extsi %arg0 : vector<[8]xi32> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_extf(%arg0 : f32) -> f64 { %0 = arith.extf %arg0 : f32 to f64 return %0 : f64 } func.func @test_extf_tensor(%arg0 : tensor<8x8xf32>) -> tensor<8x8xf64> { %0 = arith.extf %arg0 : tensor<8x8xf32> to tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_extf_vector(%arg0 : vector<8xf32>) -> vector<8xf64> { %0 = arith.extf %arg0 : vector<8xf32> to vector<8xf64> return %0 : vector<8xf64> } func.func @test_extf_scalable_vector(%arg0 : vector<[8]xf32>) -> vector<[8]xf64> { %0 = arith.extf %arg0 : vector<[8]xf32> to vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_trunci(%arg0 : i32) -> i16 { %0 = arith.trunci %arg0 : i32 to i16 return %0 : i16 } func.func @test_trunci_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xi16> { %0 = arith.trunci %arg0 : tensor<8x8xi32> to tensor<8x8xi16> return %0 : tensor<8x8xi16> } func.func @test_trunci_vector(%arg0 : vector<8xi32>) -> vector<8xi16> { %0 = arith.trunci %arg0 : vector<8xi32> to vector<8xi16> return %0 : vector<8xi16> } func.func @test_trunci_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xi16> { %0 = arith.trunci %arg0 : vector<[8]xi32> to vector<[8]xi16> return %0 : vector<[8]xi16> } func.func @test_truncf(%arg0 : f32) -> bf16 { %0 = arith.truncf %arg0 : f32 to bf16 return %0 : bf16 } func.func @test_truncf_tensor(%arg0 : tensor<8x8xf32>) -> tensor<8x8xbf16> { %0 = arith.truncf %arg0 : tensor<8x8xf32> to tensor<8x8xbf16> return %0 : tensor<8x8xbf16> } func.func @test_truncf_vector(%arg0 : vector<8xf32>) -> vector<8xbf16> { %0 = arith.truncf %arg0 : vector<8xf32> to vector<8xbf16> return %0 : vector<8xbf16> } func.func @test_truncf_scalable_vector(%arg0 : vector<[8]xf32>) -> vector<[8]xbf16> { %0 = arith.truncf %arg0 : vector<[8]xf32> to vector<[8]xbf16> return %0 : vector<[8]xbf16> } func.func @test_uitofp(%arg0 : i32) -> f32 { %0 = arith.uitofp %arg0 : i32 to f32 return %0 : f32 } func.func @test_uitofp_tensor(%arg0 : tensor<8x8xi32>) -> tensor<8x8xf32> { %0 = arith.uitofp %arg0 : tensor<8x8xi32> to tensor<8x8xf32> return %0 : tensor<8x8xf32> } func.func @test_uitofp_vector(%arg0 : vector<8xi32>) -> vector<8xf32> { %0 = arith.uitofp %arg0 : vector<8xi32> to vector<8xf32> return %0 : vector<8xf32> } func.func @test_uitofp_scalable_vector(%arg0 : vector<[8]xi32>) -> vector<[8]xf32> { %0 = arith.uitofp %arg0 : vector<[8]xi32> to vector<[8]xf32> return %0 : vector<[8]xf32> } func.func @test_sitofp(%arg0 : i16) -> f64 { %0 = arith.sitofp %arg0 : i16 to f64 return %0 : f64 } func.func @test_sitofp_tensor(%arg0 : tensor<8x8xi16>) -> tensor<8x8xf64> { %0 = arith.sitofp %arg0 : tensor<8x8xi16> to tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_sitofp_vector(%arg0 : vector<8xi16>) -> vector<8xf64> { %0 = arith.sitofp %arg0 : vector<8xi16> to vector<8xf64> return %0 : vector<8xf64> } func.func @test_sitofp_scalable_vector(%arg0 : vector<[8]xi16>) -> vector<[8]xf64> { %0 = arith.sitofp %arg0 : vector<[8]xi16> to vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_fptoui(%arg0 : bf16) -> i8 { %0 = arith.fptoui %arg0 : bf16 to i8 return %0 : i8 } func.func @test_fptoui_tensor(%arg0 : tensor<8x8xbf16>) -> tensor<8x8xi8> { %0 = arith.fptoui %arg0 : tensor<8x8xbf16> to tensor<8x8xi8> return %0 : tensor<8x8xi8> } func.func @test_fptoui_vector(%arg0 : vector<8xbf16>) -> vector<8xi8> { %0 = arith.fptoui %arg0 : vector<8xbf16> to vector<8xi8> return %0 : vector<8xi8> } func.func @test_fptoui_scalable_vector(%arg0 : vector<[8]xbf16>) -> vector<[8]xi8> { %0 = arith.fptoui %arg0 : vector<[8]xbf16> to vector<[8]xi8> return %0 : vector<[8]xi8> } func.func @test_fptosi(%arg0 : f64) -> i64 { %0 = arith.fptosi %arg0 : f64 to i64 return %0 : i64 } func.func @test_fptosi_tensor(%arg0 : tensor<8x8xf64>) -> tensor<8x8xi64> { %0 = arith.fptosi %arg0 : tensor<8x8xf64> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_fptosi_vector(%arg0 : vector<8xf64>) -> vector<8xi64> { %0 = arith.fptosi %arg0 : vector<8xf64> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_fptosi_scalable_vector(%arg0 : vector<[8]xf64>) -> vector<[8]xi64> { %0 = arith.fptosi %arg0 : vector<[8]xf64> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_index_cast0(%arg0 : i32) -> index { %0 = arith.index_cast %arg0 : i32 to index return %0 : index } func.func @test_index_cast_tensor0(%arg0 : tensor<8x8xi32>) -> tensor<8x8xindex> { %0 = arith.index_cast %arg0 : tensor<8x8xi32> to tensor<8x8xindex> return %0 : tensor<8x8xindex> } func.func @test_index_cast_vector0(%arg0 : vector<8xi32>) -> vector<8xindex> { %0 = arith.index_cast %arg0 : vector<8xi32> to vector<8xindex> return %0 : vector<8xindex> } func.func @test_index_cast_scalable_vector0(%arg0 : vector<[8]xi32>) -> vector<[8]xindex> { %0 = arith.index_cast %arg0 : vector<[8]xi32> to vector<[8]xindex> return %0 : vector<[8]xindex> } func.func @test_index_cast1(%arg0 : index) -> i64 { %0 = arith.index_cast %arg0 : index to i64 return %0 : i64 } func.func @test_index_cast_tensor1(%arg0 : tensor<8x8xindex>) -> tensor<8x8xi64> { %0 = arith.index_cast %arg0 : tensor<8x8xindex> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_index_cast_vector1(%arg0 : vector<8xindex>) -> vector<8xi64> { %0 = arith.index_cast %arg0 : vector<8xindex> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_index_cast_scalable_vector1(%arg0 : vector<[8]xindex>) -> vector<[8]xi64> { %0 = arith.index_cast %arg0 : vector<[8]xindex> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_index_castui0(%arg0 : i32) -> index { %0 = arith.index_castui %arg0 : i32 to index return %0 : index } func.func @test_index_castui_tensor0(%arg0 : tensor<8x8xi32>) -> tensor<8x8xindex> { %0 = arith.index_castui %arg0 : tensor<8x8xi32> to tensor<8x8xindex> return %0 : tensor<8x8xindex> } func.func @test_index_castui_vector0(%arg0 : vector<8xi32>) -> vector<8xindex> { %0 = arith.index_castui %arg0 : vector<8xi32> to vector<8xindex> return %0 : vector<8xindex> } func.func @test_index_castui_scalable_vector0(%arg0 : vector<[8]xi32>) -> vector<[8]xindex> { %0 = arith.index_castui %arg0 : vector<[8]xi32> to vector<[8]xindex> return %0 : vector<[8]xindex> } func.func @test_indexui_cast1(%arg0 : index) -> i64 { %0 = arith.index_castui %arg0 : index to i64 return %0 : i64 } func.func @test_index_castui_tensor1(%arg0 : tensor<8x8xindex>) -> tensor<8x8xi64> { %0 = arith.index_castui %arg0 : tensor<8x8xindex> to tensor<8x8xi64> return %0 : tensor<8x8xi64> } func.func @test_index_castui_vector1(%arg0 : vector<8xindex>) -> vector<8xi64> { %0 = arith.index_castui %arg0 : vector<8xindex> to vector<8xi64> return %0 : vector<8xi64> } func.func @test_index_castui_scalable_vector1(%arg0 : vector<[8]xindex>) -> vector<[8]xi64> { %0 = arith.index_castui %arg0 : vector<[8]xindex> to vector<[8]xi64> return %0 : vector<[8]xi64> } func.func @test_bitcast0(%arg0 : i64) -> f64 { %0 = arith.bitcast %arg0 : i64 to f64 return %0 : f64 } func.func @test_bitcast_tensor0(%arg0 : tensor<8x8xi64>) -> tensor<8x8xf64> { %0 = arith.bitcast %arg0 : tensor<8x8xi64> to tensor<8x8xf64> return %0 : tensor<8x8xf64> } func.func @test_bitcast_vector0(%arg0 : vector<8xi64>) -> vector<8xf64> { %0 = arith.bitcast %arg0 : vector<8xi64> to vector<8xf64> return %0 : vector<8xf64> } func.func @test_bitcast_scalable_vector0(%arg0 : vector<[8]xi64>) -> vector<[8]xf64> { %0 = arith.bitcast %arg0 : vector<[8]xi64> to vector<[8]xf64> return %0 : vector<[8]xf64> } func.func @test_bitcast1(%arg0 : f32) -> i32 { %0 = arith.bitcast %arg0 : f32 to i32 return %0 : i32 } func.func @test_bitcast_tensor1(%arg0 : tensor<8x8xf32>) -> tensor<8x8xi32> { %0 = arith.bitcast %arg0 : tensor<8x8xf32> to tensor<8x8xi32> return %0 : tensor<8x8xi32> } func.func @test_bitcast_vector1(%arg0 : vector<8xf32>) -> vector<8xi32> { %0 = arith.bitcast %arg0 : vector<8xf32> to vector<8xi32> return %0 : vector<8xi32> } func.func @test_bitcast_scalable_vector1(%arg0 : vector<[8]xf32>) -> vector<[8]xi32> { %0 = arith.bitcast %arg0 : vector<[8]xf32> to vector<[8]xi32> return %0 : vector<[8]xi32> } func.func @test_cmpi(%arg0 : i64, %arg1 : i64) -> i1 { %0 = arith.cmpi ne, %arg0, %arg1 : i64 return %0 : i1 } func.func @test_cmpi_tensor(%arg0 : tensor<8x8xi64>, %arg1 : tensor<8x8xi64>) -> tensor<8x8xi1> { %0 = arith.cmpi slt, %arg0, %arg1 : tensor<8x8xi64> return %0 : tensor<8x8xi1> } func.func @test_cmpi_vector(%arg0 : vector<8xi64>, %arg1 : vector<8xi64>) -> vector<8xi1> { %0 = arith.cmpi ult, %arg0, %arg1 : vector<8xi64> return %0 : vector<8xi1> } func.func @test_cmpi_scalable_vector(%arg0 : vector<[8]xi64>, %arg1 : vector<[8]xi64>) -> vector<[8]xi1> { %0 = arith.cmpi ult, %arg0, %arg1 : vector<[8]xi64> return %0 : vector<[8]xi1> } func.func @test_cmpi_vector_0d(%arg0 : vector, %arg1 : vector) -> vector { %0 = arith.cmpi ult, %arg0, %arg1 : vector return %0 : vector } func.func @test_cmpf(%arg0 : f64, %arg1 : f64) -> i1 { %0 = arith.cmpf oeq, %arg0, %arg1 : f64 return %0 : i1 } func.func @test_cmpf_tensor(%arg0 : tensor<8x8xf64>, %arg1 : tensor<8x8xf64>) -> tensor<8x8xi1> { %0 = arith.cmpf olt, %arg0, %arg1 : tensor<8x8xf64> return %0 : tensor<8x8xi1> } func.func @test_cmpf_vector(%arg0 : vector<8xf64>, %arg1 : vector<8xf64>) -> vector<8xi1> { %0 = arith.cmpf ult, %arg0, %arg1 : vector<8xf64> return %0 : vector<8xi1> } func.func @test_cmpf_scalable_vector(%arg0 : vector<[8]xf64>, %arg1 : vector<[8]xf64>) -> vector<[8]xi1> { %0 = arith.cmpf ult, %arg0, %arg1 : vector<[8]xf64> return %0 : vector<[8]xi1> } func.func @test_index_cast(%arg0 : index) -> i64 { %0 = arith.index_cast %arg0 : index to i64 return %0 : i64 } func.func @test_index_cast_tensor(%arg0 : tensor) -> tensor { %0 = arith.index_cast %arg0 : tensor to tensor return %0 : tensor } func.func @test_index_cast_tensor_reverse(%arg0 : tensor) -> tensor { %0 = arith.index_cast %arg0 : tensor to tensor return %0 : tensor } func.func @bitcast(%arg : f32) -> i32 { %res = arith.bitcast %arg : f32 to i32 return %res : i32 } func.func @test_constant() -> () { %0 = ""arith.constant""(){value = 42 : i32} : () -> i32 %1 = arith.constant 42 : i32 %2 = arith.constant {crazy = ""func.foo""} 43: index %3 = arith.constant 43.0 : bf16 %4 = arith.constant dense<0> : vector<4 x i32> %5 = arith.constant dense<0> : tensor<42 x i32> %6 = arith.constant dense<0> : vector<42 x i32> %7 = arith.constant true %8 = arith.constant false %9 = arith.constant 340282366920938463463374607431768211455 : i128 %10 = arith.constant 85070591730234615865843651857942052864 : i128 return } func.func @maximum(%v1: vector<4xf32>, %v2: vector<4xf32>, %sv1: vector<[4]xf32>, %sv2: vector<[4]xf32>, %f1: f32, %f2: f32, %i1: i32, %i2: i32) { %max_vector = arith.maxf %v1, %v2 : vector<4xf32> %max_scalable_vector = arith.maxf %sv1, %sv2 : vector<[4]xf32> %max_float = arith.maxf %f1, %f2 : f32 %max_signed = arith.maxsi %i1, %i2 : i32 %max_unsigned = arith.maxui %i1, %i2 : i32 return } func.func @minimum(%v1: vector<4xf32>, %v2: vector<4xf32>, %sv1: vector<[4]xf32>, %sv2: vector<[4]xf32>, %f1: f32, %f2: f32, %i1: i32, %i2: i32) { %min_vector = arith.minf %v1, %v2 : vector<4xf32> %min_scalable_vector = arith.minf %sv1, %sv2 : vector<[4]xf32> %min_float = arith.minf %f1, %f2 : f32 %min_signed = arith.minsi %i1, %i2 : i32 %min_unsigned = arith.minui %i1, %i2 : i32 return } func.func @fastmath(%arg0: f32, %arg1: f32, %arg2: i32) { %0 = arith.addf %arg0, %arg1 fastmath : f32 %1 = arith.subf %arg0, %arg1 fastmath : f32 %2 = arith.mulf %arg0, %arg1 fastmath : f32 %3 = arith.divf %arg0, %arg1 fastmath : f32 %4 = arith.remf %arg0, %arg1 fastmath : f32 %5 = arith.negf %arg0 fastmath : f32 %6 = arith.addf %arg0, %arg1 fastmath : f32 %7 = arith.addf %arg0, %arg1 fastmath : f32 %8 = arith.mulf %arg0, %arg1 fastmath : f32 return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @write_to_select_op_source( %t1 : tensor {bufferization.writable = true}, %t2 : tensor {bufferization.writable = true}, %c : i1) -> (tensor, tensor) { %cst = arith.constant 0.0 : f32 %idx = arith.constant 0 : index %w = tensor.insert %cst into %t1[%idx] : tensor %s = arith.select %c, %t1, %t2 : tensor return %s, %w : tensor, tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -split-input-file ",1 "func.func @write_after_select_read_one( %t1 : tensor {bufferization.writable = true}, %t2 : tensor {bufferization.writable = true}, %c : i1) -> (f32, tensor) { %cst = arith.constant 0.0 : f32 %idx = arith.constant 0 : index %s = arith.select %c, %t1, %t2 : tensor %w = tensor.insert %cst into %s[%idx] : tensor %f = tensor.extract %t1[%idx] : tensor return %f, %w : f32, tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -split-input-file ",1 "func.func @uitofp_i16_ext_f64(%a : i16) -> f64 { %ext = arith.extui %a : i16 to i64 %r = arith.uitofp %ext : i64 to f64 return %r : f64 }"," mlir-opt --arith-emulate-wide-int=""widest-int-supported=32"" --canonicalize ",1 "func.func @muli_scalar(%a : i1024, %b : i1024) -> i1024 { %m = arith.muli %a, %b : i1024 return %m : i1024 }"," mlir-opt --arith-emulate-wide-int=""widest-int-supported=512"" ",1 "func.func @add_min_max(%a: index, %b: index) -> index { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = arith.minsi %a, %c1 : index %1 = arith.maxsi %0, %c1 : index %2 = arith.minui %b, %c2 : index %3 = arith.maxui %2, %c2 : index %4 = arith.addi %1, %3 : index func.return %4 : index } func.func @add_lower_bound(%a : i32, %b : i32) -> i1 { %c1 = arith.constant 1 : i32 %c2 = arith.constant 2 : i32 %0 = arith.maxsi %a, %c1 : i32 %1 = arith.maxsi %b, %c1 : i32 %2 = arith.addi %0, %1 : i32 %3 = arith.cmpi sge, %2, %c2 : i32 %4 = arith.cmpi uge, %2, %c2 : i32 %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @sub_signed_vs_unsigned(%v : i64) -> i1 { %c0 = arith.constant 0 : i64 %c2 = arith.constant 2 : i64 %c-5 = arith.constant -5 : i64 %0 = arith.minsi %v, %c2 : i64 %1 = arith.maxsi %0, %c-5 : i64 %2 = arith.subi %1, %c2 : i64 %3 = arith.cmpi sle, %2, %c0 : i64 %4 = arith.cmpi ule, %2, %c0 : i64 %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @multiply_negatives(%a : index, %b : index) -> i1 { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c_1 = arith.constant -1 : index %c_2 = arith.constant -2 : index %c_4 = arith.constant -4 : index %c_12 = arith.constant -12 : index %0 = arith.maxsi %a, %c2 : index %1 = arith.minsi %0, %c3 : index %2 = arith.minsi %b, %c_1 : index %3 = arith.maxsi %2, %c_4 : index %4 = arith.muli %1, %3 : index %5 = arith.cmpi slt, %4, %c_12 : index %6 = arith.cmpi slt, %c_1, %4 : index %7 = arith.ori %5, %6 : i1 func.return %7 : i1 } func.func @multiply_unsigned_bounds(%a : i16, %b : i16) -> i1 { %c0 = arith.constant 0 : i16 %c4 = arith.constant 4 : i16 %c_mask = arith.constant 0x3fff : i16 %c_bound = arith.constant 0xfffc : i16 %0 = arith.andi %a, %c_mask : i16 %1 = arith.minui %b, %c4 : i16 %2 = arith.muli %0, %1 : i16 %3 = arith.cmpi uge, %2, %c0 : i16 %4 = arith.cmpi ule, %2, %c_bound : i16 %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @for_loop_with_increasing_arg() -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index %0 = scf.for %arg0 = %c0 to %c4 step %c1 iter_args(%arg1 = %c0) -> index { %10 = arith.addi %arg0, %arg1 : index scf.yield %10 : index } %1 = arith.cmpi ule, %0, %c16 : index func.return %1 : i1 } func.func @for_loop_with_constant_result() -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %true = arith.constant true %0 = scf.for %arg0 = %c0 to %c4 step %c1 iter_args(%arg1 = %true) -> i1 { %10 = arith.cmpi ule, %arg0, %c4 : index %11 = arith.andi %10, %arg1 : i1 scf.yield %11 : i1 } func.return %0 : i1 } func.func @while_false(%arg0 : index) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = arith.divui %arg0, %c2 : index %1 = scf.while (%arg1 = %0) : (index) -> index { %2 = arith.cmpi slt, %arg1, %c0 : index scf.condition(%2) %arg1 : index } do { ^bb0(%arg2 : index): scf.yield %c2 : index } func.return %1 : index } func.func @div_bounds_positive(%arg0 : index) -> i1 { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %0 = arith.maxsi %arg0, %c2 : index %1 = arith.divsi %c4, %0 : index %2 = arith.divui %c4, %0 : index %3 = arith.cmpi sge, %1, %c0 : index %4 = arith.cmpi sle, %1, %c2 : index %5 = arith.cmpi sge, %2, %c0 : index %6 = arith.cmpi sle, %1, %c2 : index %7 = arith.andi %3, %4 : i1 %8 = arith.andi %7, %5 : i1 %9 = arith.andi %8, %6 : i1 func.return %9 : i1 } func.func @div_bounds_negative(%arg0 : index) -> i1 { %c0 = arith.constant 0 : index %c_2 = arith.constant -2 : index %c4 = arith.constant 4 : index %0 = arith.minsi %arg0, %c_2 : index %1 = arith.divsi %c4, %0 : index %2 = arith.divui %c4, %0 : index %3 = arith.cmpi sle, %1, %c0 : index %4 = arith.cmpi sge, %1, %c_2 : index %5 = arith.cmpi eq, %2, %c0 : index %7 = arith.andi %3, %4 : i1 %8 = arith.andi %7, %5 : i1 func.return %8 : i1 } func.func @div_zero_undefined(%arg0 : index) -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = arith.andi %arg0, %c1 : index %1 = arith.divui %c4, %0 : index %2 = arith.cmpi ule, %1, %c4 : index func.return %2 : i1 } func.func @ceil_divui(%arg0 : index) -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %0 = arith.minui %arg0, %c3 : index %1 = arith.maxui %0, %c1 : index %2 = arith.ceildivui %1, %c4 : index %3 = arith.cmpi eq, %2, %c1 : index %4 = arith.maxui %0, %c0 : index %5 = arith.ceildivui %4, %c4 : index %6 = arith.cmpi eq, %5, %c1 : index %7 = arith.andi %3, %6 : i1 func.return %7 : i1 } func.func @ceil_divsi(%arg0 : index) -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c-4 = arith.constant -4 : index %0 = arith.minsi %arg0, %c3 : index %1 = arith.maxsi %0, %c1 : index %2 = arith.ceildivsi %1, %c4 : index %3 = arith.cmpi eq, %2, %c1 : index %4 = arith.ceildivsi %1, %c-4 : index %5 = arith.cmpi eq, %4, %c0 : index %6 = arith.andi %3, %5 : i1 %7 = arith.maxsi %0, %c0 : index %8 = arith.ceildivsi %7, %c4 : index %9 = arith.cmpi eq, %8, %c1 : index %10 = arith.andi %6, %9 : i1 func.return %10 : i1 } func.func @floor_divsi(%arg0 : index) -> i1 { %c4 = arith.constant 4 : index %c-1 = arith.constant -1 : index %c-3 = arith.constant -3 : index %c-4 = arith.constant -4 : index %0 = arith.minsi %arg0, %c-1 : index %1 = arith.maxsi %0, %c-4 : index %2 = arith.floordivsi %1, %c4 : index %3 = arith.cmpi eq, %2, %c-1 : index func.return %3 : i1 } func.func @remui_base(%arg0 : index, %arg1 : index ) -> i1 { %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %0 = arith.minui %arg1, %c4 : index %1 = arith.maxui %0, %c2 : index %2 = arith.remui %arg0, %1 : index %3 = arith.cmpi ult, %2, %c4 : index func.return %3 : i1 } func.func @remsi_base(%arg0 : index, %arg1 : index ) -> i1 { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %c-4 = arith.constant -4 : index %true = arith.constant true %0 = arith.minsi %arg1, %c4 : index %1 = arith.maxsi %0, %c2 : index %2 = arith.remsi %arg0, %1 : index %3 = arith.cmpi sgt, %2, %c-4 : index %4 = arith.cmpi slt, %2, %c4 : index %5 = arith.cmpi sge, %2, %c0 : index %6 = arith.andi %3, %4 : i1 %7 = arith.andi %5, %6 : i1 func.return %7 : i1 } func.func @remsi_positive(%arg0 : index, %arg1 : index ) -> i1 { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %true = arith.constant true %0 = arith.minsi %arg1, %c4 : index %1 = arith.maxsi %0, %c2 : index %2 = arith.maxsi %arg0, %c0 : index %3 = arith.remsi %2, %1 : index %4 = arith.cmpi sge, %3, %c0 : index %5 = arith.cmpi slt, %3, %c4 : index %6 = arith.andi %4, %5 : i1 func.return %6 : i1 } func.func @remui_restricted(%arg0 : index) -> i1 { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %0 = arith.minui %arg0, %c3 : index %1 = arith.maxui %0, %c2 : index %2 = arith.remui %1, %c4 : index %3 = arith.cmpi ule, %2, %c3 : index %4 = arith.cmpi uge, %2, %c2 : index %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @remsi_restricted(%arg0 : index) -> i1 { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c-4 = arith.constant -4 : index %0 = arith.minsi %arg0, %c3 : index %1 = arith.maxsi %0, %c2 : index %2 = arith.remsi %1, %c-4 : index %3 = arith.cmpi ule, %2, %c3 : index %4 = arith.cmpi uge, %2, %c2 : index %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @remui_restricted_fails(%arg0 : index) -> i1 { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %0 = arith.minui %arg0, %c5 : index %1 = arith.maxui %0, %c3 : index %2 = arith.remui %1, %c4 : index %3 = arith.cmpi ne, %2, %c2 : index func.return %3 : i1 } func.func @remsi_restricted_fails(%arg0 : index) -> i1 { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c5 = arith.constant 5 : index %c-4 = arith.constant -4 : index %0 = arith.minsi %arg0, %c5 : index %1 = arith.maxsi %0, %c3 : index %2 = arith.remsi %1, %c-4 : index %3 = arith.cmpi ne, %2, %c2 : index func.return %3 : i1 } func.func @andi(%arg0 : index) -> i1 { %c2 = arith.constant 2 : index %c5 = arith.constant 5 : index %c7 = arith.constant 7 : index %0 = arith.minsi %arg0, %c5 : index %1 = arith.maxsi %0, %c2 : index %2 = arith.andi %1, %c7 : index %3 = arith.cmpi ugt, %2, %c5 : index %4 = arith.cmpi ule, %2, %c7 : index %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @andi_doesnt_make_nonnegative(%arg0 : index) -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = arith.addi %arg0, %c1 : index %1 = arith.andi %arg0, %0 : index %2 = arith.cmpi sge, %1, %c0 : index func.return %2 : i1 } func.func @ori(%arg0 : i128, %arg1 : i128) -> i1 { %c-1 = arith.constant -1 : i128 %c0 = arith.constant 0 : i128 %0 = arith.minsi %arg1, %c-1 : i128 %1 = arith.ori %arg0, %0 : i128 %2 = arith.cmpi slt, %1, %c0 : i128 func.return %2 : i1 } func.func @xori(%arg0 : i64, %arg1 : i64) -> i1 { %c0 = arith.constant 0 : i64 %c7 = arith.constant 7 : i64 %c15 = arith.constant 15 : i64 %true = arith.constant true %0 = arith.minui %arg0, %c7 : i64 %1 = arith.minui %arg1, %c15 : i64 %2 = arith.xori %0, %1 : i64 %3 = arith.cmpi sle, %2, %c15 : i64 %4 = arith.xori %3, %true : i1 func.return %4 : i1 } func.func @extui(%arg0 : i16) -> i1 { %ci16_max = arith.constant 0xffff : i32 %0 = arith.extui %arg0 : i16 to i32 %1 = arith.cmpi ule, %0, %ci16_max : i32 func.return %1 : i1 } func.func @extsi(%arg0 : i16) -> i1 { %ci16_smax = arith.constant 0x7fff : i32 %ci16_smin = arith.constant 0xffff8000 : i32 %0 = arith.extsi %arg0 : i16 to i32 %1 = arith.cmpi sle, %0, %ci16_smax : i32 %2 = arith.cmpi sge, %0, %ci16_smin : i32 %3 = arith.andi %1, %2 : i1 func.return %3 : i1 } func.func @trunci(%arg0 : i32) -> i1 { %c-14_i32 = arith.constant -14 : i32 %c-14_i16 = arith.constant -14 : i16 %ci16_smin = arith.constant 0xffff8000 : i32 %0 = arith.minsi %arg0, %c-14_i32 : i32 %1 = arith.maxsi %0, %ci16_smin : i32 %2 = arith.trunci %1 : i32 to i16 %3 = arith.cmpi sle, %2, %c-14_i16 : i16 %4 = arith.extsi %2 : i16 to i32 %5 = arith.cmpi sle, %4, %c-14_i32 : i32 %6 = arith.cmpi sge, %4, %ci16_smin : i32 %7 = arith.andi %3, %5 : i1 %8 = arith.andi %7, %6 : i1 func.return %8 : i1 } func.func @index_cast(%arg0 : index) -> i1 { %ci32_smin = arith.constant 0xffffffff80000000 : i64 %0 = arith.index_cast %arg0 : index to i32 %1 = arith.index_cast %0 : i32 to index %2 = arith.index_cast %ci32_smin : i64 to index %3 = arith.cmpi sge, %1, %2 : index func.return %3 : i1 } func.func @shli(%arg0 : i32, %arg1 : i1) -> i1 { %c2 = arith.constant 2 : i32 %c4 = arith.constant 4 : i32 %c8 = arith.constant 8 : i32 %c32 = arith.constant 32 : i32 %c-1 = arith.constant -1 : i32 %c-16 = arith.constant -16 : i32 %0 = arith.maxsi %arg0, %c-1 : i32 %1 = arith.minsi %0, %c2 : i32 %2 = arith.select %arg1, %c2, %c4 : i32 %3 = arith.shli %1, %2 : i32 %4 = arith.cmpi sge, %3, %c-16 : i32 %5 = arith.cmpi sle, %3, %c32 : i32 %6 = arith.cmpi sgt, %3, %c8 : i32 %7 = arith.andi %4, %5 : i1 %8 = arith.andi %7, %6 : i1 func.return %8 : i1 } func.func @shrui(%arg0 : i1) -> i1 { %c2 = arith.constant 2 : i32 %c4 = arith.constant 4 : i32 %c8 = arith.constant 8 : i32 %c32 = arith.constant 32 : i32 %0 = arith.select %arg0, %c2, %c4 : i32 %1 = arith.shrui %c32, %0 : i32 %2 = arith.cmpi ule, %1, %c8 : i32 %3 = arith.cmpi uge, %1, %c2 : i32 %4 = arith.cmpi uge, %1, %c8 : i32 %5 = arith.andi %2, %3 : i1 %6 = arith.andi %5, %4 : i1 func.return %6 : i1 } func.func @shrsi(%arg0 : i32, %arg1 : i1) -> i1 { %c2 = arith.constant 2 : i32 %c4 = arith.constant 4 : i32 %c8 = arith.constant 8 : i32 %c32 = arith.constant 32 : i32 %c-8 = arith.constant -8 : i32 %c-32 = arith.constant -32 : i32 %0 = arith.maxsi %arg0, %c-32 : i32 %1 = arith.minsi %0, %c32 : i32 %2 = arith.select %arg1, %c2, %c4 : i32 %3 = arith.shrsi %1, %2 : i32 %4 = arith.cmpi sge, %3, %c-8 : i32 %5 = arith.cmpi sle, %3, %c8 : i32 %6 = arith.cmpi slt, %3, %c2 : i32 %7 = arith.andi %4, %5 : i1 %8 = arith.andi %7, %6 : i1 func.return %8 : i1 } func.func @no_aggressive_eq(%arg0 : index) -> i1 { %c1 = arith.constant 1 : index %0 = arith.andi %arg0, %c1 : index %1 = arith.minui %arg0, %c1 : index %2 = arith.cmpi eq, %0, %1 : index func.return %2 : i1 } func.func @select_union(%arg0 : index, %arg1 : i1) -> i1 { %c64 = arith.constant 64 : index %c100 = arith.constant 100 : index %c128 = arith.constant 128 : index %c192 = arith.constant 192 : index %0 = arith.remui %arg0, %c64 : index %1 = arith.addi %0, %c128 : index %2 = arith.select %arg1, %0, %1 : index %3 = arith.cmpi slt, %2, %c192 : index %4 = arith.cmpi ne, %c100, %2 : index %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @if_union(%arg0 : index, %arg1 : i1) -> i1 { %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index %c-1 = arith.constant -1 : index %c-4 = arith.constant -4 : index %0 = arith.minui %arg0, %c4 : index %1 = scf.if %arg1 -> index { %10 = arith.muli %0, %0 : index scf.yield %10 : index } else { %20 = arith.muli %0, %c-1 : index scf.yield %20 : index } %2 = arith.cmpi sle, %1, %c16 : index %3 = arith.cmpi sge, %1, %c-4 : index %4 = arith.andi %2, %3 : i1 func.return %4 : i1 } func.func @branch_union(%arg0 : index, %arg1 : i1) -> i1 { %c4 = arith.constant 4 : index %c16 = arith.constant 16 : index %c-1 = arith.constant -1 : index %c-4 = arith.constant -4 : index %0 = arith.minui %arg0, %c4 : index cf.cond_br %arg1, ^bb1, ^bb2 ^bb1 : %1 = arith.muli %0, %0 : index cf.br ^bb3(%1 : index) ^bb2 : %2 = arith.muli %0, %c-1 : index cf.br ^bb3(%2 : index) ^bb3(%3 : index) : %4 = arith.cmpi sle, %3, %c16 : index %5 = arith.cmpi sge, %3, %c-4 : index %6 = arith.andi %4, %5 : i1 func.return %6 : i1 } func.func @loop_bound_not_inferred_with_branch(%arg0 : index, %arg1 : i1) -> i1 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = arith.minui %arg0, %c4 : index cf.br ^bb2(%c0 : index) ^bb1(%1 : index) : %2 = arith.addi %1, %c1 : index cf.br ^bb2(%2 : index) ^bb2(%3 : index): %4 = arith.cmpi ult, %3, %c4 : index cf.cond_br %4, ^bb1(%3 : index), ^bb3(%3 : index) ^bb3(%5 : index) : %6 = arith.cmpi sge, %5, %c0 : index %7 = arith.cmpi slt, %5, %c4 : index %8 = arith.andi %6, %7 : i1 func.return %8 : i1 } func.func @truncation_spillover(%arg0 : memref) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c49 = arith.constant 49 : index %0 = scf.for %arg1 = %c0 to %c2 step %c1 iter_args(%arg2 = %c0) -> index { %1 = arith.divsi %arg2, %c49 : index %2 = arith.index_cast %1 : index to i32 memref.store %2, %arg0[%c0] : memref %3 = arith.addi %arg2, %arg1 : index scf.yield %3 : index } func.return %0 : index } func.func @trunc_catches_overflow(%arg0 : i16) -> i1 { %c0_i16 = arith.constant 0 : i16 %c130_i16 = arith.constant 130 : i16 %c0_i8 = arith.constant 0 : i8 %0 = arith.maxui %arg0, %c0_i16 : i16 %1 = arith.minui %0, %c130_i16 : i16 %2 = arith.trunci %1 : i16 to i8 %3 = arith.cmpi sge, %2, %c0_i8 : i8 %4 = arith.cmpi uge, %2, %c0_i8 : i8 %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @trunc_respects_same_high_half(%arg0 : i16) -> i1 { %c256_i16 = arith.constant 256 : i16 %c257_i16 = arith.constant 257 : i16 %c2_i8 = arith.constant 2 : i8 %0 = arith.maxui %arg0, %c256_i16 : i16 %1 = arith.minui %0, %c257_i16 : i16 %2 = arith.trunci %1 : i16 to i8 %3 = arith.cmpi sge, %2, %c2_i8 : i8 func.return %3 : i1 } func.func @trunc_handles_small_signed_ranges(%arg0 : i16) -> i1 { %c-2_i16 = arith.constant -2 : i16 %c2_i16 = arith.constant 2 : i16 %c-2_i8 = arith.constant -2 : i8 %c2_i8 = arith.constant 2 : i8 %0 = arith.maxsi %arg0, %c-2_i16 : i16 %1 = arith.minsi %0, %c2_i16 : i16 %2 = arith.trunci %1 : i16 to i8 %3 = arith.cmpi sge, %2, %c-2_i8 : i8 %4 = arith.cmpi sle, %2, %c2_i8 : i8 %5 = arith.andi %3, %4 : i1 func.return %5 : i1 } func.func @extui_uses_unsigned(%arg0 : i32) -> i1 { %ci32_smin = arith.constant 0x80000000 : i32 %ci32_smin_64 = arith.constant 0x80000000 : i64 %c0_i64 = arith.constant 0 : i64 %0 = arith.minui %arg0, %ci32_smin : i32 %1 = arith.extui %0 : i32 to i64 %2 = arith.cmpi sge, %1, %c0_i64 : i64 %3 = arith.cmpi ule, %1, %ci32_smin_64 : i64 %4 = arith.andi %2, %3 : i1 func.return %4 : i1 }", mlir-opt -test-int-range-inference -canonicalize ,1 "func.func @addi_same_i32(%a : i32) -> i32 { %x = arith.addi %a, %a : i32 return %x : i32 } func.func @addi_same_index(%a : index) -> index { %x = arith.addi %a, %a : index return %x : index } func.func @identity_f64(%a : f64) -> f64 { return %a : f64 } func.func @addi_same_vector_i32(%a : vector<2xi32>) -> vector<2xi32> { %x = arith.addi %a, %a : vector<2xi32> return %x : vector<2xi32> } func.func @identity_scalar(%x : i64) -> i64 { return %x : i64 } func.func @identity_vector(%x : vector<4xi64>) -> vector<4xi64> { return %x : vector<4xi64> } func.func @identity_vector2d(%x : vector<3x4xi64>) -> vector<3x4xi64> { return %x : vector<3x4xi64> } func.func @call(%a : vector<4xi64>) -> vector<4xi64> { %res = func.call @identity_vector(%a) : (vector<4xi64>) -> vector<4xi64> return %res : vector<4xi64> } func.func @constant_scalar() -> i64 { %c0 = arith.constant 0 : i64 %c1 = arith.constant 4294967296 : i64 %c2 = arith.constant -7 : i64 return %c0 : i64 } func.func @constant_vector() -> vector<3xi64> { %c0 = arith.constant dense<4294967296> : vector<3xi64> %c1 = arith.constant dense<[0, 1, -2]> : vector<3xi64> return %c0 : vector<3xi64> } func.func @addi_scalar_a_b(%a : i64, %b : i64) -> i64 { %x = arith.addi %a, %b : i64 return %x : i64 } func.func @addi_vector_a_b(%a : vector<4xi64>, %b : vector<4xi64>) -> vector<4xi64> { %x = arith.addi %a, %b : vector<4xi64> return %x : vector<4xi64> } func.func @cmpi_eq_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi eq, %a, %b : i64 return %r : i1 } func.func @cmpi_eq_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi1> { %r = arith.cmpi eq, %a, %b : vector<3xi64> return %r : vector<3xi1> } func.func @cmpi_ne_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi ne, %a, %b : i64 return %r : i1 } func.func @cmpi_ne_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi1> { %r = arith.cmpi ne, %a, %b : vector<3xi64> return %r : vector<3xi1> } func.func @cmpi_sge_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi sge, %a, %b : i64 return %r : i1 } func.func @cmpi_sge_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi1> { %r = arith.cmpi sge, %a, %b : vector<3xi64> return %r : vector<3xi1> } func.func @cmpi_sgt_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi sgt, %a, %b : i64 return %r : i1 } func.func @cmpi_sle_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi sle, %a, %b : i64 return %r : i1 } func.func @cmpi_slt_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi slt, %a, %b : i64 return %r : i1 } func.func @cmpi_uge_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi uge, %a, %b : i64 return %r : i1 } func.func @cmpi_ugt_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi ugt, %a, %b : i64 return %r : i1 } func.func @cmpi_ule_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi ule, %a, %b : i64 return %r : i1 } func.func @cmpi_ult_scalar(%a : i64, %b : i64) -> i1 { %r = arith.cmpi ult, %a, %b : i64 return %r : i1 } func.func @extsi_scalar(%a : i16) -> i64 { %r = arith.extsi %a : i16 to i64 return %r : i64 } func.func @extsi_vector(%a : vector<3xi16>) -> vector<3xi64> { %r = arith.extsi %a : vector<3xi16> to vector<3xi64> return %r : vector<3xi64> } func.func @extui_scalar1(%a : i16) -> i64 { %r = arith.extui %a : i16 to i64 return %r : i64 } func.func @extui_scalar2(%a : i32) -> i64 { %r = arith.extui %a : i32 to i64 return %r : i64 } func.func @extui_vector(%a : vector<3xi16>) -> vector<3xi64> { %r = arith.extui %a : vector<3xi16> to vector<3xi64> return %r : vector<3xi64> } func.func @index_cast_int_to_index_scalar(%a : i64) -> index { %r = arith.index_cast %a : i64 to index return %r : index } func.func @index_cast_int_to_index_vector(%a : vector<3xi64>) -> vector<3xindex> { %r = arith.index_cast %a : vector<3xi64> to vector<3xindex> return %r : vector<3xindex> } func.func @index_castui_int_to_index_scalar(%a : i64) -> index { %r = arith.index_castui %a : i64 to index return %r : index } func.func @index_castui_int_to_index_vector(%a : vector<3xi64>) -> vector<3xindex> { %r = arith.index_castui %a : vector<3xi64> to vector<3xindex> return %r : vector<3xindex> } func.func @index_cast_index_to_int_scalar(%a : index) -> i64 { %r = arith.index_cast %a : index to i64 return %r : i64 } func.func @index_cast_index_to_int_vector(%a : vector<3xindex>) -> vector<3xi64> { %r = arith.index_cast %a : vector<3xindex> to vector<3xi64> return %r : vector<3xi64> } func.func @index_castui_index_to_int_scalar(%a : index) -> i64 { %r = arith.index_castui %a : index to i64 return %r : i64 } func.func @index_castui_index_to_int_vector(%a : vector<3xindex>) -> vector<3xi64> { %r = arith.index_castui %a : vector<3xindex> to vector<3xi64> return %r : vector<3xi64> } func.func @trunci_scalar1(%a : i64) -> i32 { %b = arith.trunci %a : i64 to i32 return %b : i32 } func.func @trunci_scalar2(%a : i64) -> i16 { %b = arith.trunci %a : i64 to i16 return %b : i16 } func.func @trunci_vector(%a : vector<3xi64>) -> vector<3xi16> { %b = arith.trunci %a : vector<3xi64> to vector<3xi16> return %b : vector<3xi16> } func.func @maxui_scalar(%a : i64, %b : i64) -> i64 { %x = arith.maxui %a, %b : i64 return %x : i64 } func.func @maxui_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.maxui %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @maxsi_scalar(%a : i64, %b : i64) -> i64 { %x = arith.maxsi %a, %b : i64 return %x : i64 } func.func @maxsi_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.maxsi %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @minui_scalar(%a : i64, %b : i64) -> i64 { %x = arith.minui %a, %b : i64 return %x : i64 } func.func @minui_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.minui %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @minsi_scalar(%a : i64, %b : i64) -> i64 { %x = arith.minsi %a, %b : i64 return %x : i64 } func.func @minsi_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.minsi %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @select_scalar(%a : i64, %b : i64, %c : i1) -> i64 { %r = arith.select %c, %a, %b : i64 return %r : i64 } func.func @select_vector_whole(%a : vector<3xi64>, %b : vector<3xi64>, %c : i1) -> vector<3xi64> { %r = arith.select %c, %a, %b : vector<3xi64> return %r : vector<3xi64> } func.func @select_vector_elementwise(%a : vector<3xi64>, %b : vector<3xi64>, %c : vector<3xi1>) -> vector<3xi64> { %r = arith.select %c, %a, %b : vector<3xi1>, vector<3xi64> return %r : vector<3xi64> } func.func @muli_scalar(%a : i64, %b : i64) -> i64 { %m = arith.muli %a, %b : i64 return %m : i64 } func.func @muli_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %m = arith.muli %a, %b : vector<3xi64> return %m : vector<3xi64> } func.func @shli_scalar(%a : i64, %b : i64) -> i64 { %c = arith.shli %a, %b : i64 return %c : i64 } func.func @shli_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %m = arith.shli %a, %b : vector<3xi64> return %m : vector<3xi64> } func.func @shrui_scalar(%a : i64, %b : i64) -> i64 { %c = arith.shrui %a, %b : i64 return %c : i64 } func.func @shrui_scalar_cst_2(%a : i64) -> i64 { %b = arith.constant 2 : i64 %c = arith.shrui %a, %b : i64 return %c : i64 } func.func @shrui_scalar_cst_36(%a : i64) -> i64 { %b = arith.constant 36 : i64 %c = arith.shrui %a, %b : i64 return %c : i64 } func.func @shrui_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %m = arith.shrui %a, %b : vector<3xi64> return %m : vector<3xi64> } func.func @shrsi_scalar(%a : i64, %b : i64) -> i64 { %c = arith.shrsi %a, %b : i64 return %c : i64 } func.func @shrsi_vector(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %m = arith.shrsi %a, %b : vector<3xi64> return %m : vector<3xi64> } func.func @andi_scalar_a_b(%a : i64, %b : i64) -> i64 { %x = arith.andi %a, %b : i64 return %x : i64 } func.func @andi_vector_a_b(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.andi %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @ori_scalar_a_b(%a : i64, %b : i64) -> i64 { %x = arith.ori %a, %b : i64 return %x : i64 } func.func @ori_vector_a_b(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.ori %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @xori_scalar_a_b(%a : i64, %b : i64) -> i64 { %x = arith.xori %a, %b : i64 return %x : i64 } func.func @xori_vector_a_b(%a : vector<3xi64>, %b : vector<3xi64>) -> vector<3xi64> { %x = arith.xori %a, %b : vector<3xi64> return %x : vector<3xi64> } func.func @uitofp_i64_f64(%a : i64) -> f64 { %r = arith.uitofp %a : i64 to f64 return %r : f64 } func.func @uitofp_i64_f64_vector(%a : vector<3xi64>) -> vector<3xf64> { %r = arith.uitofp %a : vector<3xi64> to vector<3xf64> return %r : vector<3xf64> } func.func @uitofp_i64_f16(%a : i64) -> f16 { %r = arith.uitofp %a : i64 to f16 return %r : f16 } func.func @sitofp_i64_f64(%a : i64) -> f64 { %r = arith.sitofp %a : i64 to f64 return %r : f64 } func.func @sitofp_i64_f64_vector(%a : vector<3xi64>) -> vector<3xf64> { %r = arith.sitofp %a : vector<3xi64> to vector<3xf64> return %r : vector<3xf64> }"," mlir-opt --arith-emulate-wide-int=""widest-int-supported=32"" ",1 "llvm.func @basic() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ",1 "llvm.func @basic_no_memory_benefit() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, i32)> %3 = llvm.getelementptr inbounds %1[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, i32)> %4 = llvm.load %2 : !llvm.ptr -> i32 %5 = llvm.load %3 : !llvm.ptr -> i32 %6 = llvm.add %4, %5 : i32 llvm.return %6 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ",1 "llvm.func @basic_array() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.array<10 x i32> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<10 x i32> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ",1 "llvm.func @multi_level_direct() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, struct<""bar"", (i8, array<10 x array<10 x i32>>, i8)>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2, 1, 5, 8] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, struct<""bar"", (i8, array<10 x array<10 x i32>>, i8)>)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file --mlir-pass-statistics 2>&1 >/dev/null ",1 "llvm.func @func_no_debug() { llvm.return loc(unknown) } loc(unknown)"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(ensure-debug-info-scope-on-llvm-func))"" --split-input-file --mlir-print-debuginfo ",1 "module { llvm.func @func_with_debug() { llvm.return loc(#loc1) } loc(#loc2) } loc(#loc) #di_file = #llvm.di_file<"""" in """"> #di_subroutine_type = #llvm.di_subroutine_type #loc = loc(""foo"":0:0) #loc1 = loc(unknown) #di_compile_unit = #llvm.di_compile_unit #di_subprogram = #llvm.di_subprogram #loc2 = loc(fused<#di_subprogram>[#loc1])"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(ensure-debug-info-scope-on-llvm-func))"" --split-input-file --mlir-print-debuginfo ",1 "module { llvm.func @propagate_compile_unit() { llvm.return loc(unknown) } loc(""file.mlir"":9:8) } loc(#loc) #di_file = #llvm.di_file<""bar.mlir"" in ""baz""> #di_compile_unit = #llvm.di_compile_unit #loc = loc(fused<#di_compile_unit>[""foo.mlir"":2:1])"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(ensure-debug-info-scope-on-llvm-func))"" --split-input-file --mlir-print-debuginfo ",1 "func.func @ptr() { ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr> ""some.op""() : () -> !llvm.ptr>>>> ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr, 9> ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr<42> return } func.func @vec() { ""some.op""() : () -> vector<4xi32> ""some.op""() : () -> vector<4xf32> ""some.op""() : () -> !llvm.vec ""some.op""() : () -> !llvm.vec ""some.op""() : () -> !llvm.vec<4 x ptr> return } func.func @array() { ""some.op""() : () -> !llvm.array<10 x i32> ""some.op""() : () -> !llvm.array<8 x f32> ""some.op""() : () -> !llvm.array<10 x ptr> ""some.op""() : () -> !llvm.array<10 x array<4 x f32>> return } func.func @identified_struct() { ""some.op""() : () -> !llvm.struct<""empty"", ()> ""some.op""() : () -> !llvm.struct<""opaque"", opaque> ""some.op""() : () -> !llvm.struct<""long"", (i32, struct<(i32, i1)>, f32, ptr>)> ""some.op""() : () -> !llvm.struct<""self-recursive"", (ptr>)> ""some.op""() : () -> !llvm.struct<""unpacked"", (i32)> ""some.op""() : () -> !llvm.struct<""packed"", packed (i32)> ""some.op""() : () -> !llvm.struct<""name with spaces and !^$@$#"", packed (i32)> ""some.op""() : () -> !llvm.struct<""mutually-a"", (ptr, 3>)>>)> ""some.op""() : () -> !llvm.struct<""mutually-b"", (ptr>)>, 3>)> ""some.op""() : () -> !llvm.struct<""referring-another"", (ptr>)> ""some.op""() : () -> !llvm.struct<""struct-of-arrays"", (array<10 x i32>)> ""some.op""() : () -> !llvm.array<10 x struct<""array-of-structs"", (i32)>> ""some.op""() : () -> !llvm.ptr> return } func.func @ptr_elem_interface(%arg0: !llvm.ptr) { %0 = llvm.load %arg0 : !llvm.ptr llvm.store %0, %arg0 : !llvm.ptr llvm.mlir.undef : !llvm.ptr return }", mlir-opt -allow-unregistered-dialect -split-input-file | mlir-opt -allow-unregistered-dialect ,1 "!baz = i64 !qux = !llvm.struct<(!baz)> !rec = !llvm.struct<""a"", (ptr>)> llvm.func @aliases() { ""some.op""() : () -> !llvm.struct<(i32, f32, !qux)> ""some.op""() : () -> !rec llvm.return }", mlir-opt -allow-unregistered-dialect -split-input-file | mlir-opt -allow-unregistered-dialect ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>>} { llvm.func @foo(%arg0: !llvm.ptr, %arg1: i32) { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = ""llvm.getelementptr""(%arg0, %0, %arg1) {elem_type = !llvm.struct<""my_struct"", (struct<""sub_struct"", (i32, i8)>, array<4 x i32>)>, rawConstantIndices = array} : (!llvm.ptr, i32, i32) -> !llvm.ptr llvm.return } }", mlir-opt ,1 "func.func @nvvm_wmma_load_tf32(%arg0: !llvm.ptr, %arg1 : i32) -> !llvm.struct<(i32, i32, i32, i32)> { %0 = nvvm.wmma.load %arg0, %arg1 {eltype = #nvvm.mma_type, frag = #nvvm.mma_frag, k = 8 : i32, layout = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (!llvm.ptr) -> !llvm.struct<(i32, i32, i32, i32)> llvm.return %0 : !llvm.struct<(i32, i32, i32, i32)> } llvm.func @cp_async(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { nvvm.cp.async.shared.global %arg0, %arg1, 16 : !llvm.ptr, !llvm.ptr nvvm.cp.async.shared.global %arg0, %arg1, 16 {bypass_l1} : !llvm.ptr, !llvm.ptr nvvm.cp.async.commit.group nvvm.cp.async.wait.group 0 llvm.return } llvm.func @ld_matrix(%arg0: !llvm.ptr) { %l1 = nvvm.ldmatrix %arg0 {num = 1 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> i32 %l2 = nvvm.ldmatrix %arg0 {num = 2 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> !llvm.struct<(i32, i32)> %l4 = nvvm.ldmatrix %arg0 {num = 4 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr) -> !llvm.struct<(i32, i32, i32, i32)> llvm.return } llvm.func @redux_sync(%value : i32, %offset : i32) -> i32 { %r1 = nvvm.redux.sync add %value, %offset : i32 -> i32 %r2 = nvvm.redux.sync max %value, %offset : i32 -> i32 %r3 = nvvm.redux.sync min %value, %offset : i32 -> i32 %r5 = nvvm.redux.sync umax %value, %offset : i32 -> i32 %r6 = nvvm.redux.sync umin %value, %offset : i32 -> i32 %r7 = nvvm.redux.sync and %value, %offset : i32 -> i32 %r8 = nvvm.redux.sync or %value, %offset : i32 -> i32 %r9 = nvvm.redux.sync xor %value, %offset : i32 -> i32 llvm.return %r1 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>>>} { llvm.func @foo(%arg0: !llvm.ptr, array<4 x i32>)>>, %arg1: i32) { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = ""llvm.getelementptr""(%arg0, %0, %arg1) {rawConstantIndices = array} : (!llvm.ptr, array<4 x i32>)>>, i32, i32) -> !llvm.ptr llvm.return } }", mlir-opt ,1 "llvm.func @fold_bitcast(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.bitcast %x : !llvm.ptr to !llvm.ptr llvm.return %c : !llvm.ptr } llvm.func @fold_bitcast2(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.bitcast %x : !llvm.ptr to !llvm.ptr %d = llvm.bitcast %c : !llvm.ptr to !llvm.ptr llvm.return %d : !llvm.ptr }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_addrcast(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.addrspacecast %x : !llvm.ptr to !llvm.ptr llvm.return %c : !llvm.ptr } llvm.func @fold_addrcast2(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.addrspacecast %x : !llvm.ptr to !llvm.ptr %d = llvm.addrspacecast %c : !llvm.ptr to !llvm.ptr llvm.return %d : !llvm.ptr }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_gep(%x : !llvm.ptr) -> !llvm.ptr { %c0 = arith.constant 0 : i32 %c = llvm.getelementptr %x[%c0] : (!llvm.ptr, i32) -> !llvm.ptr llvm.return %c : !llvm.ptr }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_gep_canon(%x : !llvm.ptr) -> !llvm.ptr { %c2 = arith.constant 2 : i32 %c = llvm.getelementptr %x[%c2] : (!llvm.ptr, i32) -> !llvm.ptr llvm.return %c : !llvm.ptr }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @load_dce(%x : !llvm.ptr) { %0 = llvm.load %x : !llvm.ptr llvm.return } llvm.mlir.global external @fp() : !llvm.ptr llvm.func @addr_dce(%x : !llvm.ptr) { %0 = llvm.mlir.addressof @fp : !llvm.ptr> llvm.return } llvm.func @alloca_dce() { %c1_i64 = arith.constant 1 : i64 %0 = llvm.alloca %c1_i64 x i32 : (i64) -> !llvm.ptr llvm.return }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @repeated_successor_different_args(%arg0: i1, %arg1: i32, %arg2: i32) { llvm.cond_br %arg0, ^bb1(%arg1: i32), ^bb1(%arg2: i32) ^bb1(%arg3: i32): llvm.return } llvm.func @repeated_successor_no_args(%arg0: i1) { llvm.cond_br %arg0, ^bb1, ^bb1 ^bb1: llvm.return } llvm.func @repeated_successor_openmp(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i1) { omp.wsloop for (%arg4) : i64 = (%arg0) to (%arg1) step (%arg2) { llvm.cond_br %arg3, ^bb1(%arg0 : i64), ^bb1(%arg1 : i64) ^bb1(%0: i64): omp.yield } llvm.return }", mlir-opt -llvm-legalize-for-export --split-input-file ,1 "func.func @func1(%arg0: i1, %arg1 : i1) { cf.cond_br %arg0, ^bb40(%arg0 : i1), ^bb40(%arg1 : i1) ^bb40(%47: i1): return }", mlir-opt -llvm-legalize-for-export --split-input-file ,1 "llvm.func @default_value() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %2 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @store_of_ptr() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(4 : i32) : i32 %2 = llvm.mlir.null : !llvm.ptr %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %1, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.store %3, %2 {alignment = 8 : i64} : !llvm.ptr, !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @unreachable() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.return ^bb1: llvm.store %1, %2 {alignment = 4 : i64} : i32, !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @unreachable_in_loop() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(6 : i32) : i32 %2 = llvm.mlir.constant(5 : i32) : i32 %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %1, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb1 ^bb1: llvm.store %2, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb3 ^bb2: llvm.br ^bb3 ^bb3: llvm.br ^bb1 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @branching(%arg0: i1, %arg1: i1) -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.cond_br %arg0, ^bb2, ^bb1 ^bb1: llvm.store %1, %2 {alignment = 4 : i64} : i32, !llvm.ptr llvm.cond_br %arg1, ^bb2, ^bb2 ^bb2: %3 = llvm.load %2 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @recursive_alloca() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %4 = llvm.alloca %0 x !llvm.ptr {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.store %1, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.store %3, %4 {alignment = 8 : i64} : !llvm.ptr, !llvm.ptr %5 = llvm.load %4 {alignment = 8 : i64} : !llvm.ptr -> !llvm.ptr %6 = llvm.load %5 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.store %6, %2 {alignment = 4 : i64} : i32, !llvm.ptr %7 = llvm.load %2 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %7 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @reset_in_branch(%arg0: i32, %arg1: i1) { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(true) : i1 %2 = llvm.mlir.constant(false) : i1 %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %arg0, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.cond_br %arg1, ^bb1, ^bb2 ^bb1: llvm.store %arg0, %3 {alignment = 4 : i64} : i32, !llvm.ptr %4 = llvm.load %3 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.call @reset_in_branch(%4, %2) : (i32, i1) -> () llvm.br ^bb3 ^bb2: %5 = llvm.load %3 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.call @reset_in_branch(%5, %1) : (i32, i1) -> () llvm.br ^bb3 ^bb3: llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @intertwined_alloca(%arg0: !llvm.ptr, %arg1: i32) { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.alloca %0 x !llvm.ptr {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %4 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %5 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %6 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %arg0, %2 {alignment = 8 : i64} : !llvm.ptr, !llvm.ptr llvm.store %arg1, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.store %1, %4 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb1 ^bb1: %7 = llvm.load %3 {alignment = 4 : i64} : !llvm.ptr -> i32 %8 = llvm.add %7, %0 : i32 %9 = llvm.load %4 {alignment = 4 : i64} : !llvm.ptr -> i32 %10 = llvm.icmp ""sgt"" %8, %9 : i32 %11 = llvm.zext %10 : i1 to i32 llvm.cond_br %10, ^bb2, ^bb5 ^bb2: %12 = llvm.load %6 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.store %12, %5 {alignment = 4 : i64} : i32, !llvm.ptr llvm.store %1, %6 {alignment = 4 : i64} : i32, !llvm.ptr %13 = llvm.load %4 {alignment = 4 : i64} : !llvm.ptr -> i32 %14 = llvm.icmp ""sgt"" %13, %1 : i32 %15 = llvm.zext %14 : i1 to i32 llvm.cond_br %14, ^bb3, ^bb4 ^bb3: %16 = llvm.load %2 {alignment = 8 : i64} : !llvm.ptr -> !llvm.ptr %17 = llvm.load %4 {alignment = 4 : i64} : !llvm.ptr -> i32 %18 = llvm.sub %17, %0 : i32 %19 = llvm.getelementptr %16[%18] : (!llvm.ptr, i32) -> !llvm.ptr, i8 %20 = llvm.load %5 {alignment = 4 : i64} : !llvm.ptr -> i32 %21 = llvm.trunc %20 : i32 to i8 llvm.store %21, %19 {alignment = 1 : i64} : i8, !llvm.ptr llvm.br ^bb4 ^bb4: %22 = llvm.load %4 {alignment = 4 : i64} : !llvm.ptr -> i32 %23 = llvm.add %22, %0 : i32 llvm.store %23, %4 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb1 ^bb5: llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @complex_cf(%arg0: i32, ...) { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(false) : i1 %2 = llvm.mlir.constant(0 : i32) : i32 %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.cond_br %1, ^bb1, ^bb2 ^bb1: llvm.br ^bb2 ^bb2: llvm.store %2, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb3 ^bb3: llvm.cond_br %1, ^bb4, ^bb17 ^bb4: llvm.cond_br %1, ^bb5, ^bb14 ^bb5: llvm.cond_br %1, ^bb7, ^bb6 ^bb6: llvm.br ^bb7 ^bb7: llvm.cond_br %1, ^bb9, ^bb8 ^bb8: llvm.br ^bb9 ^bb9: llvm.cond_br %1, ^bb11, ^bb10 ^bb10: llvm.br ^bb11 ^bb11: llvm.cond_br %1, ^bb12, ^bb13 ^bb12: llvm.br ^bb13 ^bb13: llvm.br ^bb14 ^bb14: llvm.cond_br %1, ^bb15, ^bb16 ^bb15: llvm.br ^bb16 ^bb16: llvm.br ^bb3 ^bb17: llvm.br ^bb20 ^bb18: %4 = llvm.load %3 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.br ^bb24 ^bb19: llvm.br ^bb20 ^bb20: llvm.cond_br %1, ^bb21, ^bb22 ^bb21: llvm.br ^bb23 ^bb22: llvm.br ^bb23 ^bb23: llvm.br ^bb24 ^bb24: llvm.br ^bb26 ^bb25: llvm.br ^bb26 ^bb26: llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @llvm_crash() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.mlir.addressof @j : !llvm.ptr %3 = llvm.mlir.constant(0 : i8) : i8 %4 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %5 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %6 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %7 = llvm.bitcast %1 : i32 to i32 llvm.store volatile %1, %5 {alignment = 4 : i64} : i32, !llvm.ptr %8 = llvm.call @_setjmp(%2) : (!llvm.ptr) -> i32 %9 = llvm.icmp ""ne"" %8, %1 : i32 %10 = llvm.zext %9 : i1 to i8 %11 = llvm.icmp ""ne"" %10, %3 : i8 llvm.cond_br %11, ^bb1, ^bb2 ^bb1: %12 = llvm.load volatile %5 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.store %12, %6 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb3 ^bb2: llvm.store volatile %0, %5 {alignment = 4 : i64} : i32, !llvm.ptr llvm.call @g() : () -> () llvm.store %1, %6 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb3 ^bb3: %13 = llvm.load %6 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.store %13, %4 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb4 ^bb4: %14 = llvm.load %4 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %14 : i32 } llvm.mlir.global external @j() {addr_space = 0 : i32} : !llvm.array<1 x struct<""struct.__jmp_buf_tag"", (array<6 x i32>, i32, struct<""struct.__sigset_t"", (array<32 x i32>)>)>> llvm.func @_setjmp(!llvm.ptr) -> i32 attributes {passthrough = [""returns_twice""]} llvm.func @g()"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func amdgpu_kernelcc @addrspace_discard() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i64) : i64 %2 = llvm.alloca %0 x i8 {alignment = 8 : i64} : (i32) -> !llvm.ptr<5> %3 = llvm.addrspacecast %2 : !llvm.ptr<5> to !llvm.ptr llvm.intr.lifetime.start 2, %3 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @ignore_atomic(%arg0: i32) -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %arg0, %1 atomic seq_cst {alignment = 4 : i64} : i32, !llvm.ptr %2 = llvm.load %1 atomic seq_cst {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %2 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @landing_pad() -> i32 attributes {personality = @__gxx_personality_v0} { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr %2 = llvm.invoke @landing_padf() to ^bb1 unwind ^bb3 : () -> i32 ^bb1: llvm.store %2, %1 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb2 ^bb2: %3 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %3 : i32 ^bb3: %4 = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)> llvm.br ^bb2 } llvm.func @landing_padf() -> i32 llvm.func @__gxx_personality_v0(...) -> i32"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @unreachable_defines() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.br ^bb1 ^bb1: %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %2 : i32 ^bb2: %3 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.store %3, %1 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb1 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @unreachable_jumps_to_merge_point(%arg0: i1) -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(6 : i32) : i32 %2 = llvm.mlir.constant(5 : i32) : i32 %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.cond_br %arg0, ^bb1, ^bb2 ^bb1: llvm.store %1, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb4 ^bb2: llvm.store %2, %3 {alignment = 4 : i64} : i32, !llvm.ptr llvm.br ^bb4 ^bb3: llvm.br ^bb4 ^bb4: %4 = llvm.load %3 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %4 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @ignore_lifetime() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.intr.lifetime.start 2, %1 : !llvm.ptr llvm.store %0, %1 {alignment = 4 : i64} : i32, !llvm.ptr llvm.intr.lifetime.end 2, %1 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @ignore_discardable_tree() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i16) : i16 %2 = llvm.mlir.constant(0 : i8) : i8 %3 = llvm.mlir.undef : !llvm.struct<(i8, i16)> %4 = llvm.insertvalue %2, %3[0] : !llvm.struct<(i8, i16)> %5 = llvm.insertvalue %1, %4[1] : !llvm.struct<(i8, i16)> %6 = llvm.alloca %0 x !llvm.struct<(i8, i16)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %7 = llvm.getelementptr %6[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i8, i16)> llvm.intr.lifetime.start 2, %7 : !llvm.ptr llvm.store %5, %6 {alignment = 2 : i64} : !llvm.struct<(i8, i16)>, !llvm.ptr llvm.intr.lifetime.end 2, %7 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @store_load_forward() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %1, %2 {alignment = 4 : i64} : i32, !llvm.ptr %3 = llvm.load %2 {alignment = 4 : i64} : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @store_load_wrong_type() -> i16 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.store %1, %2 {alignment = 4 : i64} : i32, !llvm.ptr %3 = llvm.load %2 {alignment = 2 : i64} : !llvm.ptr -> i16 llvm.return %3 : i16 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @merge_point_cycle() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(7 : i32) : i32 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.br ^bb1 ^bb1: %3 = llvm.load %2 {alignment = 4 : i64} : !llvm.ptr -> i32 %4 = llvm.call @use(%3) : (i32) -> i1 %5 = llvm.call @def(%1) : (i32) -> i32 llvm.store %5, %2 {alignment = 4 : i64} : i32, !llvm.ptr llvm.cond_br %4, ^bb1, ^bb2 ^bb2: llvm.return } llvm.func @def(i32) -> i32 llvm.func @use(i32) -> i1"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @no_unnecessary_arguments() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr llvm.br ^bb1 ^bb1: %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 %3 = llvm.call @use(%2) : (i32) -> i1 llvm.cond_br %3, ^bb1, ^bb2 ^bb2: llvm.return } llvm.func @use(i32) -> i1"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @discardable_use_tree() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i64) : i64 %2 = llvm.alloca %0 x i8 {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.bitcast %2 : !llvm.ptr to !llvm.ptr %4 = llvm.bitcast %3 : !llvm.ptr to !llvm.ptr llvm.intr.lifetime.start 2, %3 : !llvm.ptr llvm.intr.lifetime.start 2, %4 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @non_discardable_use_tree() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i64) : i64 %2 = llvm.alloca %0 x i8 {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.bitcast %2 : !llvm.ptr to !llvm.ptr %4 = llvm.bitcast %3 : !llvm.ptr to !llvm.ptr llvm.intr.lifetime.start 2, %3 : !llvm.ptr llvm.intr.lifetime.start 2, %4 : !llvm.ptr llvm.call @use(%4) : (!llvm.ptr) -> i1 llvm.return } llvm.func @use(!llvm.ptr) -> i1"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @trivial_get_element_ptr() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i64) : i64 %2 = llvm.alloca %0 x i8 {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.bitcast %2 : !llvm.ptr to !llvm.ptr %4 = llvm.getelementptr %3[0, 0, 0] : (!llvm.ptr) -> !llvm.ptr, i8 llvm.intr.lifetime.start 2, %3 : !llvm.ptr llvm.intr.lifetime.start 2, %4 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @nontrivial_get_element_ptr() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i64) : i64 %2 = llvm.alloca %0 x i8 {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.bitcast %2 : !llvm.ptr to !llvm.ptr %4 = llvm.getelementptr %3[0, 1, 0] : (!llvm.ptr) -> !llvm.ptr, i8 llvm.intr.lifetime.start 2, %3 : !llvm.ptr llvm.intr.lifetime.start 2, %4 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @dynamic_get_element_ptr() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(2 : i64) : i64 %2 = llvm.alloca %0 x i8 {alignment = 8 : i64} : (i32) -> !llvm.ptr %3 = llvm.bitcast %2 : !llvm.ptr to !llvm.ptr %4 = llvm.getelementptr %3[0, %0] : (!llvm.ptr, i32) -> !llvm.ptr, i8 llvm.intr.lifetime.start 2, %3 : !llvm.ptr llvm.intr.lifetime.start 2, %4 : !llvm.ptr llvm.return }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @live_cycle(%arg0: i64, %arg1: i1, %arg2: i64) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.store %arg2, %1 {alignment = 4 : i64} : i64, !llvm.ptr llvm.cond_br %arg1, ^bb1, ^bb2 ^bb1: %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 llvm.call @use(%2) : (i64) -> () llvm.store %arg0, %1 {alignment = 4 : i64} : i64, !llvm.ptr llvm.br ^bb2 ^bb2: llvm.br ^bb1 } llvm.func @use(i64)"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @subregion_block_promotion(%arg0: i64, %arg1: i64) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.store %arg1, %1 {alignment = 4 : i64} : i64, !llvm.ptr scf.execute_region { llvm.store %arg0, %1 {alignment = 4 : i64} : i64, !llvm.ptr scf.yield } %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 llvm.return %2 : i64 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @subregion_simple_transitive_promotion(%arg0: i64, %arg1: i64) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.store %arg1, %1 {alignment = 4 : i64} : i64, !llvm.ptr %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 scf.execute_region { llvm.call @use(%2) : (i64) -> () scf.yield } llvm.return %2 : i64 } llvm.func @use(i64)"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @no_inner_alloca_promotion(%arg: i64) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.br ^bb1 ^bb1: %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.store %arg, %1 {alignment = 4 : i64} : i64, !llvm.ptr %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 llvm.return %2 : i64 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(mem2reg{region-simplify=false}))"" --split-input-file ",1 "llvm.func @fold_extractvalue() -> i32 { %c0 = arith.constant 0 : i32 %c1 = arith.constant 1 : i32 %0 = llvm.mlir.undef : !llvm.struct<(i32, i32)> %1 = llvm.insertvalue %c0, %0[0] : !llvm.struct<(i32, i32)> %2 = llvm.insertvalue %c1, %1[1] : !llvm.struct<(i32, i32)> %3 = llvm.extractvalue %2[0] : !llvm.struct<(i32, i32)> %4 = llvm.extractvalue %2[1] : !llvm.struct<(i32, i32)> %5 = llvm.add %3, %4 : i32 llvm.return %5 : i32 }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @no_fold_extractvalue(%arr: !llvm.array<4 x f32>) -> f32 { %f0 = arith.constant 0.0 : f32 %0 = llvm.mlir.undef : !llvm.array<4 x !llvm.array<4 x f32>> %1 = llvm.insertvalue %f0, %0[0, 0] : !llvm.array<4 x !llvm.array<4 x f32>> %2 = llvm.insertvalue %arr, %1[0] : !llvm.array<4 x !llvm.array<4 x f32>> %3 = llvm.extractvalue %2[0, 0] : !llvm.array<4 x !llvm.array<4 x f32>> llvm.return %3 : f32 }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_unrelated_extractvalue(%arr: !llvm.array<4 x f32>) -> f32 { %f0 = arith.constant 0.0 : f32 %2 = llvm.insertvalue %f0, %arr[0] : !llvm.array<4 x f32> %3 = llvm.extractvalue %2[1] : !llvm.array<4 x f32> llvm.return %3 : f32 }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_bitcast(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.bitcast %x : !llvm.ptr to !llvm.ptr llvm.return %c : !llvm.ptr } llvm.func @fold_bitcast2(%x : i32) -> i32 { %c = llvm.bitcast %x : i32 to f32 %d = llvm.bitcast %c : f32 to i32 llvm.return %d : i32 }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_addrcast(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.addrspacecast %x : !llvm.ptr to !llvm.ptr llvm.return %c : !llvm.ptr } llvm.func @fold_addrcast2(%x : !llvm.ptr) -> !llvm.ptr { %c = llvm.addrspacecast %x : !llvm.ptr to !llvm.ptr<5> %d = llvm.addrspacecast %c : !llvm.ptr<5> to !llvm.ptr llvm.return %d : !llvm.ptr }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @fold_gep(%x : !llvm.ptr) -> !llvm.ptr { %c0 = arith.constant 0 : i32 %c = llvm.getelementptr %x[%c0] : (!llvm.ptr, i32) -> !llvm.ptr, i8 llvm.return %c : !llvm.ptr } llvm.func @fold_gep_neg(%x : !llvm.ptr) -> !llvm.ptr { %c0 = arith.constant 0 : i32 %0 = llvm.getelementptr inbounds %x[%c0, 1] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<(i32, i32)> llvm.return %0 : !llvm.ptr } llvm.func @fold_gep_canon(%x : !llvm.ptr) -> !llvm.ptr { %c2 = arith.constant 2 : i32 %c = llvm.getelementptr %x[%c2] : (!llvm.ptr, i32) -> !llvm.ptr, i8 llvm.return %c : !llvm.ptr }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @llvm_constant() -> i32 { %0 = llvm.mlir.constant(40 : i32) : i32 %1 = llvm.mlir.constant(42 : i32) : i32 %2 = arith.addi %0, %1 : i32 llvm.return %2 : i32 }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.func @load_dce(%x : !llvm.ptr) { %0 = llvm.load %x : !llvm.ptr -> i8 llvm.return } llvm.mlir.global external @fp() : !llvm.ptr llvm.func @addr_dce(%x : !llvm.ptr) { %0 = llvm.mlir.addressof @fp : !llvm.ptr llvm.return } llvm.func @alloca_dce() { %c1_i64 = arith.constant 1 : i64 %0 = llvm.alloca %c1_i64 x i32 : (i64) -> !llvm.ptr llvm.return }", mlir-opt --pass-pipeline='builtin.module(llvm.func(canonicalize{test-convergence}))' -split-input-file ,1 "llvm.mlir.global @default_external() : i64 llvm.mlir.global constant @default_external_constant(42) : i64 llvm.mlir.global internal @global(42 : i64) : i64 llvm.mlir.global private @aligned_global(42 : i64) {aligned = 64} : i64 llvm.mlir.global private constant @aligned_global_const(42 : i64) {aligned = 32} : i64 llvm.mlir.global internal constant @constant(37.0) : f32 llvm.mlir.global internal constant @"".string""(""foobar"") : !llvm.array<6 x i8> llvm.mlir.global internal @string_notype(""1234567"") llvm.mlir.global internal @global_undef() : i64 llvm.mlir.global internal @global_mega_initializer() : i64 { %c = llvm.mlir.constant(42 : i64) : i64 llvm.return %c : i64 } llvm.mlir.global private @private() : i64 llvm.mlir.global internal @internal() : i64 llvm.mlir.global available_externally @available_externally() : i64 llvm.mlir.global linkonce @linkonce() : i64 llvm.mlir.global weak @weak() : i64 llvm.mlir.global common @common() : i64 llvm.mlir.global appending @appending() : !llvm.array<2 x i64> llvm.mlir.global extern_weak @extern_weak() : i64 llvm.mlir.global linkonce_odr @linkonce_odr() : i64 llvm.mlir.global weak_odr @weak_odr() : i64 llvm.mlir.global external @has_thr_local(42 : i64) {thr_local} : i64 llvm.mlir.global external @has_dso_local(42 : i64) {dso_local} : i64 llvm.mlir.global external @has_addr_space(32 : i64) {addr_space = 3: i32} : i64 func.func @references() { %0 = llvm.mlir.addressof @"".string"" : !llvm.ptr %1 = llvm.mlir.addressof @global : !llvm.ptr %2 = llvm.mlir.addressof @has_addr_space : !llvm.ptr<3> llvm.return } llvm.mlir.global private local_unnamed_addr constant @local(42 : i64) : i64 llvm.mlir.global private unnamed_addr constant @foo(42 : i64) : i64 llvm.mlir.global internal constant @sectionvar(""teststring"") {section = "".mysection""}: !llvm.array<10 x i8> llvm.mlir.global internal thread_local constant @thread_local(42 : i32) : i32 llvm.mlir.global internal hidden constant @hidden(42 : i32) : i32 llvm.mlir.global internal protected unnamed_addr @protected(42 : i32) : i32", mlir-opt -split-input-file -verify-diagnostics ,1 """llvm.mlir.global""() ({}) {linkage = #llvm.linkage, type = i64, constant, global_type = i64, value = 42 : i64} : () -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 """llvm.mlir.global""() ({}) {sym_name = ""foo"", constant, value = 42 : i64} : () -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 llvm.mlir.global internal constant @constant(37.0) : !llvm.label, mlir-opt -split-input-file -verify-diagnostics ,1 """llvm.mlir.global""() ({}) {sym_name = ""foo"", global_type = i64, value = 42 : i64, addr_space = -1 : i32, linkage = #llvm.linkage} : () -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 """llvm.mlir.global""() ({}) {sym_name = ""foo"", global_type = i64, value = 42 : i64, addr_space = 1.0 : f32, linkage = #llvm.linkage} : () -> ()", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @foo() { llvm.mlir.global internal @bar(42) : i32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal constant @string(""foobar"") : !llvm.array<42 x i8>", mlir-opt -split-input-file -verify-diagnostics ,1 llvm.mlir.global internal @i64_needs_type(0: i64), mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @more_than_one_type(0) : i64, i32", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @foo(0: i32) : i32 func.func @bar() { llvm.mlir.addressof @foo }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @foo() { llvm.mlir.addressof ""foo"" : i64 : !llvm.ptr llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @foo() { llvm.mlir.addressof @foo : !llvm.ptr llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @g() : i64 { %c = llvm.mlir.constant(42 : i64) : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @g() : i32 { %c = llvm.mlir.constant(42 : i64) : i64 llvm.return %c : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @g(43 : i64) : i64 { %c = llvm.mlir.constant(42 : i64) : i64 llvm.return %c : i64 }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @g(32 : i64) {addr_space = 3: i32} : i64 func.func @mismatch_addr_space_implicit_global() { llvm.mlir.addressof @g : !llvm.ptr llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @g(32 : i64) {addr_space = 3: i32} : i64 func.func @mismatch_addr_space() { llvm.mlir.addressof @g : !llvm.ptr<4> llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.func @ctor() { llvm.return } llvm.mlir.global_ctors { ctors = [@ctor], priorities = [0 : i32]}", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.func @dtor() { llvm.return } llvm.mlir.global_dtors { dtors = [@dtor], priorities = [0 : i32]}", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global @target_ext() : !llvm.target<""spirv.Image"", i32, 0> llvm.mlir.global @target_ext_init(0 : i64) : !llvm.target<""spirv.Image"", i32, 0>", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global @target_fail(1 : i64) : !llvm.target<""spirv.Image"", i32, 0>", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.func @opaque_ptr_load(%arg0: !llvm.ptr) -> i32 { %0 = llvm.load %arg0 : !llvm.ptr -> i32 llvm.return %0 : i32 } llvm.func @opaque_ptr_store(%arg0: i32, %arg1: !llvm.ptr){ llvm.store %arg0, %arg1 : i32, !llvm.ptr llvm.return } llvm.func @opaque_ptr_ptr_store(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { llvm.store %arg0, %arg1 : !llvm.ptr, !llvm.ptr llvm.return } llvm.func @opaque_ptr_alloca(%arg0: i32) -> !llvm.ptr { %0 = llvm.alloca %arg0 x f32 : (i32) -> !llvm.ptr llvm.return %0 : !llvm.ptr } llvm.func @opaque_ptr_gep(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr { %0 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i32) -> !llvm.ptr, f32 llvm.return %0 : !llvm.ptr } llvm.func @opaque_ptr_gep_struct(%arg0: !llvm.ptr, %arg1: i32) -> !llvm.ptr { %0 = llvm.getelementptr %arg0[%arg1, 0, 1] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<(struct<(f32, f64)>, struct<(i32, i64)>)> llvm.return %0 : !llvm.ptr } llvm.func @opaque_ptr_matrix_load_store(%ptr: !llvm.ptr, %stride: i64) -> vector<48 x f32> { %0 = llvm.intr.matrix.column.major.load %ptr, { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} : vector<48 x f32> from !llvm.ptr stride i64 llvm.intr.matrix.column.major.store %0, %ptr, { isVolatile = 0: i1, rows = 3: i32, columns = 16: i32} : vector<48 x f32> to !llvm.ptr stride i64 llvm.return %0 : vector<48 x f32> } llvm.func @opaque_ptr_masked_load(%arg0: !llvm.ptr, %arg1: vector<7xi1>) -> vector<7xf32> { %0 = llvm.intr.masked.load %arg0, %arg1 { alignment = 1: i32} : (!llvm.ptr, vector<7xi1>) -> vector<7xf32> llvm.return %0 : vector<7 x f32> } llvm.func @opaque_ptr_gather(%M: !llvm.vec<7 x ptr>, %mask: vector<7xi1>) -> vector<7xf32> { %a = llvm.intr.masked.gather %M, %mask { alignment = 1: i32} : (!llvm.vec<7 x ptr>, vector<7xi1>) -> vector<7xf32> llvm.return %a : vector<7xf32> }", mlir-opt | mlir-opt ,1 "func.func @nvvm_special_regs() -> i32 { %0 = nvvm.read.ptx.sreg.tid.x : i32 %1 = nvvm.read.ptx.sreg.tid.y : i32 %2 = nvvm.read.ptx.sreg.tid.z : i32 %3 = nvvm.read.ptx.sreg.ntid.x : i32 %4 = nvvm.read.ptx.sreg.ntid.y : i32 %5 = nvvm.read.ptx.sreg.ntid.z : i32 %6 = nvvm.read.ptx.sreg.ctaid.x : i32 %7 = nvvm.read.ptx.sreg.ctaid.y : i32 %8 = nvvm.read.ptx.sreg.ctaid.z : i32 %9 = nvvm.read.ptx.sreg.nctaid.x : i32 %10 = nvvm.read.ptx.sreg.nctaid.y : i32 %11 = nvvm.read.ptx.sreg.nctaid.z : i32 llvm.return %0 : i32 } func.func @nvvm_rcp(%arg0: f32) -> f32 { %0 = nvvm.rcp.approx.ftz.f %arg0 : f32 llvm.return %0 : f32 } func.func @llvm_nvvm_barrier0() { nvvm.barrier0 llvm.return } func.func @nvvm_shfl( %arg0 : i32, %arg1 : i32, %arg2 : i32, %arg3 : i32, %arg4 : f32) -> i32 { %0 = nvvm.shfl.sync bfly %arg0, %arg3, %arg1, %arg2 : i32 -> i32 %1 = nvvm.shfl.sync bfly %arg0, %arg4, %arg1, %arg2 : f32 -> f32 %2 = nvvm.shfl.sync up %arg0, %arg4, %arg1, %arg2 : f32 -> f32 %3 = nvvm.shfl.sync down %arg0, %arg4, %arg1, %arg2 : f32 -> f32 %4 = nvvm.shfl.sync idx %arg0, %arg4, %arg1, %arg2 : f32 -> f32 llvm.return %0 : i32 } func.func @nvvm_shfl_pred( %arg0 : i32, %arg1 : i32, %arg2 : i32, %arg3 : i32, %arg4 : f32) -> !llvm.struct<(i32, i1)> { %0 = nvvm.shfl.sync bfly %arg0, %arg3, %arg1, %arg2 {return_value_and_is_valid} : i32 -> !llvm.struct<(i32, i1)> %1 = nvvm.shfl.sync bfly %arg0, %arg4, %arg1, %arg2 {return_value_and_is_valid} : f32 -> !llvm.struct<(f32, i1)> llvm.return %0 : !llvm.struct<(i32, i1)> } func.func @nvvm_vote(%arg0 : i32, %arg1 : i1) -> i32 { %0 = nvvm.vote.ballot.sync %arg0, %arg1 : i32 llvm.return %0 : i32 } func.func @llvm_nvvm_bar_warp_sync(%mask : i32) { nvvm.bar.warp.sync %mask : i32 llvm.return } func.func @nvvm_mma_m8n8k4_row_col_f32_f32(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32, %c4 : f32, %c5 : f32, %c6 : f32, %c7 : f32) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0, %b1] C[%c0, %c1, %c2, %c3, %c4, %c5, %c6, %c7] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, f32) -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> } func.func @nvvm_mma_m8n8k4_f16_f16(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : vector<2xf16>, %c1 : vector<2xf16>, %c2 : vector<2xf16>, %c3 : vector<2xf16>) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0, %b1] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>,vector<2xf16>,vector<2xf16>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)> llvm.return %0 : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)> } func.func @nvvm_mma_m8n8k16_s8_s8(%a0 : i32, %b0 : i32, %c0 : i32, %c1 : i32) { %0 = nvvm.mma.sync A[%a0] B[%b0] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32, i32)> llvm.return %0 : !llvm.struct<(i32, i32)> } func.func @nvvm_mma_m16n8k8_f16_f16(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %b0 : vector<2xf16>, %c0 : vector<2xf16>, %c1 : vector<2xf16>) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, vector<2xf16>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> llvm.return %0 : !llvm.struct<(vector<2xf16>, vector<2xf16>)> } func.func @nvvm_mma_m16n8k16_f16_f16(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : vector<2xf16>, %c1 : vector<2xf16>) { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, vector<2xf16>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> llvm.return %0 : !llvm.struct<(vector<2xf16>, vector<2xf16>)> } func.func @nvvm_mma_m16n8k16_f32_f16(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : vector<2xf16>, %c1 : vector<2xf16>) { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>,vector<2xf16>,vector<2xf16>) -> !llvm.struct<(f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32)> } func.func @nvvm_mma_m16n8k16_f16_f32(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32) { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, f32) -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> llvm.return %0 : !llvm.struct<(vector<2xf16>, vector<2xf16>)> } func.func @nvvm_mma_m16n8k16_f32_f32(%a0 : vector<2xf16>, %a1 : vector<2xf16>, %a2 : vector<2xf16>, %a3 : vector<2xf16>, %b0 : vector<2xf16>, %b1 : vector<2xf16>, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32) { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, shape = #nvvm.shape} : (vector<2xf16>, vector<2xf16>, f32) -> !llvm.struct<(f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32)> } func.func @nvvm_mma_m16n8k4_tf32_f32(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : f32, %c1 : f32, %c2 : f32, %c3 : f32) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, shape = #nvvm.shape} : (i32, i32, f32) -> !llvm.struct<(f32, f32, f32, f32)> llvm.return %0 : !llvm.struct<(f32, f32, f32, f32)> } func.func @nvvm_mma_m16n8k16_s8_s8(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } func.func @nvvm_mma_m16n8k16_s8_u8(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } func.func @nvvm_mma_m16n8k256_b1_b1(%a0 : i32, %a1 : i32, %a2 : i32, %a3 : i32, %b0 : i32, %b1 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) { %0 = nvvm.mma.sync A[%a0, %a1, %a2, %a3] B[%b0, %b1] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, b1Op = #nvvm.mma_b1op, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } func.func @nvvm_mma_m16n8k128_b1_b1(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, b1Op = #nvvm.mma_b1op, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } func.func @nvvm_mma_m8n8k128_b1_b1(%a0 : i32, %b0 : i32, %c0 : i32, %c1 : i32) { %0 = nvvm.mma.sync A[%a0] B[%b0] C[%c0, %c1] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, b1Op = #nvvm.mma_b1op, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32)> } func.func @nvvm_mma_m16n8k32_s4_s4(%a0 : i32, %a1 : i32, %b0 : i32, %c0 : i32, %c1 : i32, %c2 : i32, %c3 : i32) { %0 = nvvm.mma.sync A[%a0, %a1] B[%b0] C[%c0, %c1, %c2, %c3] {layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, multiplicandAPtxType = #nvvm.mma_type, multiplicandBPtxType = #nvvm.mma_type, intOverflowBehavior=#nvvm.mma_int_overflow, shape = #nvvm.shape} : (i32, i32, i32) -> !llvm.struct<(i32,i32,i32,i32)> llvm.return %0 : !llvm.struct<(i32,i32,i32,i32)> } func.func @nvvm_wmma_load_tf32(%arg0: !llvm.ptr, %arg1 : i32) -> !llvm.struct<(i32, i32, i32, i32)> { %0 = nvvm.wmma.load %arg0, %arg1 {eltype = #nvvm.mma_type, frag = #nvvm.mma_frag, k = 8 : i32, layout = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (!llvm.ptr) -> !llvm.struct<(i32, i32, i32, i32)> llvm.return %0 : !llvm.struct<(i32, i32, i32, i32)> } func.func @nvvm_wmma_mma(%0 : i32, %1 : i32, %2 : i32, %3 : i32, %4 : i32, %5 : i32, %6 : i32, %7 : i32, %8 : f32, %9 : f32, %10 : f32, %11 : f32, %12 : f32, %13 : f32, %14 : f32, %15 : f32) -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> { %r = nvvm.wmma.mma %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15 {eltypeA = #nvvm.mma_type, eltypeB = #nvvm.mma_type, k = 8 : i32, layoutA = #nvvm.mma_layout, layoutB = #nvvm.mma_layout, m = 16 : i32, n = 16 : i32} : (i32, i32, i32, i32, i32, i32, i32, i32, f32, f32, f32, f32, f32, f32, f32, f32) -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> llvm.return %r : !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32)> } llvm.func @cp_async(%arg0: !llvm.ptr<3>, %arg1: !llvm.ptr<1>) { nvvm.cp.async.shared.global %arg0, %arg1, 16 : !llvm.ptr<3>, !llvm.ptr<1> nvvm.cp.async.shared.global %arg0, %arg1, 16 {bypass_l1} : !llvm.ptr<3>, !llvm.ptr<1> nvvm.cp.async.commit.group nvvm.cp.async.wait.group 0 llvm.return } llvm.func @ld_matrix(%arg0: !llvm.ptr<3>) { %l1 = nvvm.ldmatrix %arg0 {num = 1 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr<3>) -> i32 %l2 = nvvm.ldmatrix %arg0 {num = 2 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr<3>) -> !llvm.struct<(i32, i32)> %l4 = nvvm.ldmatrix %arg0 {num = 4 : i32, layout = #nvvm.mma_layout} : (!llvm.ptr<3>) -> !llvm.struct<(i32, i32, i32, i32)> llvm.return } llvm.func @redux_sync(%value : i32, %offset : i32) -> i32 { %r1 = nvvm.redux.sync add %value, %offset : i32 -> i32 %r2 = nvvm.redux.sync max %value, %offset : i32 -> i32 %r3 = nvvm.redux.sync min %value, %offset : i32 -> i32 %r5 = nvvm.redux.sync umax %value, %offset : i32 -> i32 %r6 = nvvm.redux.sync umin %value, %offset : i32 -> i32 %r7 = nvvm.redux.sync and %value, %offset : i32 -> i32 %r8 = nvvm.redux.sync or %value, %offset : i32 -> i32 %r9 = nvvm.redux.sync xor %value, %offset : i32 -> i32 llvm.return %r1 : i32 }", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @expected_llvm_func() attributes { nvvm.kernel }, mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @return() { llvm.return } func.func @control_flow(%cond : i1) { llvm.br ^bb1 ^bb1: llvm.cond_br %cond, ^bb2, ^bb1 ^bb2: llvm.return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "module { func.func @no_spec() { ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr> ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr<5> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[32, 32, 64]> : vector<3xi32>>, #dlti.dl_entry, dense<[64, 64, 64]> : vector<3xi32>>, #dlti.dl_entry, dense<[32, 64, 64]> : vector<3xi32>>, #dlti.dl_entry<""dlti.alloca_memory_space"", 5 : ui32> >} { func.func @spec() { ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr> ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr<3> ""test.data_layout_query""() : () -> !llvm.ptr<4> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64, 64, 64]> : vector<3xi32>> >} { func.func @pointer() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64.0, 64.0, 64.0]> : vector<3xf32>> >} { func.func @pointer() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64, 64, 32]> : vector<3xi32>> >} { func.func @pointer() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "func.func @primitive() { ""some.op""() : () -> !llvm.void ""some.op""() : () -> !llvm.ppc_fp128 ""some.op""() : () -> !llvm.x86_mmx ""some.op""() : () -> !llvm.token ""some.op""() : () -> !llvm.label ""some.op""() : () -> !llvm.metadata return } func.func @func() { ""some.op""() : () -> !llvm.func ""some.op""() : () -> !llvm.func ""some.op""() : () -> !llvm.func ""some.op""() : () -> !llvm.func ""some.op""() : () -> !llvm.func ""some.op""() : () -> !llvm.func ""some.op""() : () -> !llvm.func return } func.func @integer() { ""some.op""() : () -> i1 ""some.op""() : () -> i8 ""some.op""() : () -> i16 ""some.op""() : () -> i32 ""some.op""() : () -> i64 ""some.op""() : () -> i57 ""some.op""() : () -> i129 return } func.func @ptr() { ""some.op""() : () -> !llvm.ptr ""some.op""() : () -> !llvm.ptr<0> ""some.op""() : () -> !llvm.ptr<42> ""some.op""() : () -> !llvm.ptr, 9> return } func.func @vec() { ""some.op""() : () -> vector<4xi32> ""some.op""() : () -> vector<4xf32> ""some.op""() : () -> !llvm.vec ""some.op""() : () -> !llvm.vec ""some.op""() : () -> !llvm.vec<4 x ptr> return } func.func @array() { ""some.op""() : () -> !llvm.array<10 x i32> ""some.op""() : () -> !llvm.array<8 x f32> ""some.op""() : () -> !llvm.array<10 x ptr<4>> ""some.op""() : () -> !llvm.array<10 x array<4 x f32>> return } func.func @literal_struct() { ""some.op""() : () -> !llvm.struct<()> ""some.op""() : () -> !llvm.struct<(i32)> ""some.op""() : () -> !llvm.struct<(f32, i32)> ""some.op""() : () -> !llvm.struct<(struct<(i32)>)> ""some.op""() : () -> !llvm.struct<(i32, struct<(i32)>, f32)> ""some.op""() : () -> !llvm.struct ""some.op""() : () -> !llvm.struct ""some.op""() : () -> !llvm.struct ""some.op""() : () -> !llvm.struct ""some.op""() : () -> !llvm.struct)> ""some.op""() : () -> !llvm.struct, f32)> ""some.op""() : () -> !llvm.struct<(struct)> ""some.op""() : () -> !llvm.struct)> return } func.func @identified_struct() { ""some.op""() : () -> !llvm.struct<""empty"", ()> ""some.op""() : () -> !llvm.struct<""opaque"", opaque> ""some.op""() : () -> !llvm.struct<""long"", (i32, struct<(i32, i1)>, f32, ptr)> ""some.op""() : () -> !llvm.struct<""unpacked"", (i32)> ""some.op""() : () -> !llvm.struct<""packed"", packed (i32)> ""some.op""() : () -> !llvm.struct<""name with spaces and !^$@$#"", packed (i32)> ""some.op""() : () -> !llvm.struct<""outer"", (struct<""nested"", ()>)> ""some.op""() : () -> !llvm.struct<""referring-another"", (ptr)> ""some.op""() : () -> !llvm.struct<""struct-of-arrays"", (array<10 x i32>)> ""some.op""() : () -> !llvm.array<10 x struct<""array-of-structs"", (i32)>> return } func.func @verbose() { ""some.op""() : () -> !llvm.struct<(i64, !llvm.struct<(f32)>)> return }", mlir-opt -allow-unregistered-dialect -split-input-file | mlir-opt -allow-unregistered-dialect ,1 "!baz = i64 !qux = !llvm.struct<(!baz)> llvm.func @aliases() { ""some.op""() : () -> !llvm.struct<(i32, f32, !qux)> llvm.return }", mlir-opt -allow-unregistered-dialect -split-input-file | mlir-opt -allow-unregistered-dialect ,1 "llvm.func @ext_target() { %0 = ""some.op""() : () -> !llvm.target<""target1"", i32, 1> %1 = ""some.op""() : () -> !llvm.target<""target2""> %2 = ""some.op""() : () -> !llvm.target<""target3"", i32, i64, f64> %3 = ""some.op""() : () -> !llvm.target<""target4"", 1, 0, 42> %4 = ""some.op""() : () -> !llvm.target<""target5"", i32, f64, 0, 5> llvm.return }", mlir-opt -allow-unregistered-dialect -split-input-file | mlir-opt -allow-unregistered-dialect ,1 "module { func.func @no_spec() { ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr<3> ""test.data_layout_query""() : () -> !llvm.ptr<5> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xi32>>, #dlti.dl_entry, dense<[64, 64, 64]> : vector<3xi32>>, #dlti.dl_entry, dense<[32, 64, 64]> : vector<3xi32>>, #dlti.dl_entry<""dlti.alloca_memory_space"", 5 : ui32>, #dlti.dl_entry<""dlti.stack_alignment"", 128 : i32> >} { func.func @spec() { ""test.data_layout_query""() : () -> !llvm.ptr ""test.data_layout_query""() : () -> !llvm.ptr<3> ""test.data_layout_query""() : () -> !llvm.ptr<5> ""test.data_layout_query""() : () -> !llvm.ptr<3> ""test.data_layout_query""() : () -> !llvm.ptr<4> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xf32>> >} { func.func @pointer() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xi32>> >} { func.func @pointer() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module { func.func @no_spec() { ""test.data_layout_query""() : () -> !llvm.struct<(i32)> ""test.data_layout_query""() : () -> !llvm.struct<(i32, f64)> ""test.data_layout_query""() : () -> !llvm.struct<(f64, i32)> ""test.data_layout_query""() : () -> !llvm.struct ""test.data_layout_query""() : () -> !llvm.struct<()> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[32, 32]> : vector<2xi32>> >} { func.func @spec() { ""test.data_layout_query""() : () -> !llvm.struct<(i16)> ""test.data_layout_query""() : () -> !llvm.struct<(i32, f64)> ""test.data_layout_query""() : () -> !llvm.struct ""test.data_layout_query""() : () -> !llvm.struct<()> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[32]> : vector<1xi32>> >} { func.func @spec_without_preferred() { ""test.data_layout_query""() : () -> !llvm.struct<(i16)> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64, 64]> : vector<2xi32>> >} { func.func @struct() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64, 64, 64]> : vector<3xi32>> >} { func.func @struct() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64, 32]> : vector<2xi32>> >} { func.func @struct() { return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module { func.func @arrays() { ""test.data_layout_query""() : () -> !llvm.array<2 x i32> ""test.data_layout_query""() : () -> !llvm.array<0 x f64> ""test.data_layout_query""() : () -> !llvm.array<1 x i64> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, dense<[64]> : vector<1xi32>> >} { func.func @overaligned() { ""test.data_layout_query""() : () -> !llvm.array<2 x struct<(i8)>> return } }", mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics ,1 "module attributes {""test.name"" = ""Normal function call""} { llvm.func @foo(%arg0: i32) -> i32 { %0 = llvm.mlir.constant(2 : i32) : i32 %1 = llvm.sub %arg0, %0 : i32 %2 = llvm.call @bar(%arg0, %1) : (i32, i32) -> i32 llvm.return %2 : i32 } llvm.func @bar(%arg0: i32, %arg1: i32) -> i32 { %0 = llvm.add %arg0, %arg1 : i32 %1 = llvm.call @foo(%0) : (i32) -> i32 llvm.return %1 : i32 } llvm.func @entry(%arg0: i32) -> i32 { %0 = llvm.mlir.constant(2 : i32) : i32 %1 = llvm.mlir.constant(0 : i32) : i32 %2 = llvm.icmp ""sgt"" %arg0, %1 : i32 llvm.cond_br %2, ^bb1, ^bb2 ^bb1: %3 = llvm.call @foo(%arg0) : (i32) -> i32 llvm.br ^bb3(%3 : i32) ^bb2: %4 = llvm.add %arg0, %0 : i32 %5 = llvm.call @bar(%arg0, %4) : (i32, i32) -> i32 llvm.br ^bb3(%5 : i32) ^bb3(%6: i32): llvm.return %6 : i32 } }", mlir-opt --test-print-callgraph --split-input-file 2>&1 ,1 "module attributes {""test.name"" = ""Invoke call""} { llvm.mlir.global external constant @_ZTIi() : !llvm.ptr llvm.func @foo(%arg0: i32) -> !llvm.struct<(i32, f64, i32)> llvm.func @bar(!llvm.ptr, !llvm.ptr, !llvm.ptr) llvm.func @__gxx_personality_v0(...) -> i32 llvm.func @invokeLandingpad() -> i32 attributes { personality = @__gxx_personality_v0 } { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = llvm.mlir.constant(3 : i32) : i32 %2 = llvm.mlir.constant(""\01"") : !llvm.array<1 x i8> %3 = llvm.mlir.null : !llvm.ptr %4 = llvm.mlir.null : !llvm.ptr %5 = llvm.mlir.addressof @_ZTIi : !llvm.ptr %6 = llvm.mlir.constant(1 : i32) : i32 %7 = llvm.alloca %6 x i8 : (i32) -> !llvm.ptr %8 = llvm.invoke @foo(%6) to ^bb2 unwind ^bb1 : (i32) -> !llvm.struct<(i32, f64, i32)> ^bb1: %10 = llvm.landingpad cleanup (catch %3 : !llvm.ptr) (catch %5 : !llvm.ptr) (filter %2 : !llvm.array<1 x i8>) : !llvm.struct<(ptr, i32)> %11 = llvm.intr.eh.typeid.for %5 : (!llvm.ptr) -> i32 llvm.resume %10 : !llvm.struct<(ptr, i32)> ^bb2: llvm.return %6 : i32 ^bb3: llvm.invoke @bar(%7, %5, %4) to ^bb2 unwind ^bb1 : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> () ^bb4: llvm.return %0 : i32 } }", mlir-opt --test-print-callgraph --split-input-file 2>&1 ,1 "llvm.func @fdiv_fp16(%arg0 : f16, %arg1 : f16) -> f16 { %result = llvm.fdiv %arg0, %arg1 : f16 llvm.return %result : f16 }", mlir-opt -llvm-optimize-for-nvvm-target ,1 "func.func @rocdl_special_regs() -> i32 { %0 = rocdl.workitem.id.x : i32 %1 = rocdl.workitem.id.y : i32 %2 = rocdl.workitem.id.z : i32 %3 = rocdl.workgroup.id.x : i32 %4 = rocdl.workgroup.id.y : i32 %5 = rocdl.workgroup.id.z : i32 %6 = rocdl.workgroup.dim.x : i32 %7 = rocdl.workgroup.dim.y : i32 %8 = rocdl.workgroup.dim.z : i32 %9 = rocdl.grid.dim.x : i32 %10 = rocdl.grid.dim.y : i32 %11 = rocdl.grid.dim.z : i32 llvm.return %0 : i32 } func.func @rocdl.barrier() { rocdl.barrier llvm.return } func.func @rocdl.xdlops(%arg0 : f32, %arg1 : f32, %arg2 : vector<32xf32>, %arg3 : i32, %arg4 : vector<16xf32>, %arg5 : vector<4xf32>, %arg6 : vector<4xf16>, %arg7 : vector<32xi32>, %arg8 : vector<16xi32>, %arg9 : vector<4xi32>, %arg10 : vector<2xi16>, %arg11 : vector<4xi16>, %arg12 : vector<4xf64>, %arg13 : f64, %arg14 : i64, %arg15 : vector<2xf32>) { %r0 = rocdl.mfma.f32.32x32x1f32 %arg0, %arg1, %arg2, %arg3, %arg3, %arg3 : (f32, f32, vector<32xf32>, i32, i32, i32) -> vector<32xf32> %r1 = rocdl.mfma.f32.16x16x1f32 %arg0, %arg1, %arg4, %arg3, %arg3, %arg3 : (f32, f32, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r2 = rocdl.mfma.f32.4x4x1f32 %arg0, %arg1, %arg5, %arg3, %arg3, %arg3 : (f32, f32, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r3= rocdl.mfma.f32.32x32x2f32 %arg0, %arg1, %arg4, %arg3, %arg3, %arg3 : (f32, f32, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r4 = rocdl.mfma.f32.16x16x4f32 %arg0, %arg1, %arg5, %arg3, %arg3, %arg3 : (f32, f32, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r5 = rocdl.mfma.f32.32x32x4f16 %arg6, %arg6, %arg2, %arg3, %arg3, %arg3 : (vector<4xf16>, vector<4xf16>, vector<32xf32>, i32, i32, i32) -> vector<32xf32> %r6 = rocdl.mfma.f32.16x16x4f16 %arg6, %arg6, %arg4, %arg3, %arg3, %arg3 : (vector<4xf16>, vector<4xf16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r7 = rocdl.mfma.f32.4x4x4f16 %arg6, %arg6, %arg5, %arg3, %arg3, %arg3 : (vector<4xf16>, vector<4xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r8 = rocdl.mfma.f32.32x32x8f16 %arg6, %arg6, %arg4, %arg3, %arg3, %arg3 : (vector<4xf16>, vector<4xf16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r9 = rocdl.mfma.f32.16x16x16f16 %arg6, %arg6, %arg5, %arg3, %arg3, %arg3 : (vector<4xf16>, vector<4xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r10 = rocdl.mfma.i32.32x32x4i8 %arg3, %arg3, %arg7, %arg3, %arg3, %arg3 : (i32, i32, vector<32xi32>, i32, i32, i32) -> vector<32xi32> %r11 = rocdl.mfma.i32.16x16x4i8 %arg3, %arg3, %arg8, %arg3, %arg3, %arg3 : (i32, i32, vector<16xi32>, i32, i32, i32) -> vector<16xi32> %r12 = rocdl.mfma.i32.4x4x4i8 %arg3, %arg3, %arg9, %arg3, %arg3, %arg3 : (i32, i32, vector<4xi32>, i32, i32, i32) -> vector<4xi32> %r13 = rocdl.mfma.i32.32x32x8i8 %arg3, %arg3, %arg8, %arg3, %arg3, %arg3 : (i32, i32, vector<16xi32>, i32, i32, i32) -> vector<16xi32> %r14 = rocdl.mfma.i32.16x16x16i8 %arg3, %arg3, %arg9, %arg3, %arg3, %arg3 : (i32, i32, vector<4xi32>, i32, i32, i32) -> vector<4xi32> %r15 = rocdl.mfma.f32.32x32x2bf16 %arg10, %arg10, %arg2, %arg3, %arg3, %arg3 : (vector<2xi16>, vector<2xi16>, vector<32xf32>, i32, i32, i32) -> vector<32xf32> %r16 = rocdl.mfma.f32.16x16x2bf16 %arg10, %arg10, %arg4, %arg3, %arg3, %arg3 : (vector<2xi16>, vector<2xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r17 = rocdl.mfma.f32.4x4x2bf16 %arg10, %arg10, %arg5, %arg3, %arg3, %arg3 : (vector<2xi16>, vector<2xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r18 = rocdl.mfma.f32.32x32x4bf16 %arg10, %arg10, %arg4, %arg3, %arg3, %arg3 : (vector<2xi16>, vector<2xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r19 = rocdl.mfma.f32.16x16x8bf16 %arg10, %arg10, %arg5, %arg3, %arg3, %arg3 : (vector<2xi16>, vector<2xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r20 = rocdl.mfma.f32.32x32x4bf16.1k %arg11, %arg11, %arg2, %arg3, %arg3, %arg3 : (vector<4xi16>, vector<4xi16>, vector<32xf32>, i32, i32, i32) -> vector<32xf32> %r21 = rocdl.mfma.f32.16x16x4bf16.1k %arg11, %arg11, %arg4, %arg3, %arg3, %arg3 : (vector<4xi16>, vector<4xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r22 = rocdl.mfma.f32.4x4x4bf16.1k %arg11, %arg11, %arg5, %arg3, %arg3, %arg3 : (vector<4xi16>, vector<4xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r23 = rocdl.mfma.f32.32x32x8bf16.1k %arg11, %arg11, %arg4, %arg3, %arg3, %arg3 : (vector<4xi16>, vector<4xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> %r24 = rocdl.mfma.f32.16x16x16bf16.1k %arg11, %arg11, %arg5, %arg3, %arg3, %arg3 : (vector<4xi16>, vector<4xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r25 = rocdl.mfma.f64.16x16x4f64 %arg13, %arg13, %arg12, %arg3, %arg3, %arg3 : (f64, f64, vector<4xf64>, i32, i32, i32) -> vector<4xf64> %r26 = rocdl.mfma.f64.4x4x4f64 %arg13, %arg13, %arg13, %arg3, %arg3, %arg3 : (f64, f64, f64, i32, i32, i32) -> f64 %r27 = rocdl.mfma.i32.16x16x32.i8 %arg14, %arg14, %arg9, %arg3, %arg3, %arg3 : (i64, i64, vector<4xi32>, i32, i32, i32) -> vector<4xi32> %r28 = rocdl.mfma.i32.32x32x16.i8 %arg14, %arg14, %arg8, %arg3, %arg3, %arg3 : (i64, i64, vector<16xi32>, i32, i32, i32) -> vector<16xi32> %r29 = rocdl.mfma.f32.16x16x8.xf32 %arg15, %arg15, %arg5, %arg3, %arg3, %arg3 : (vector<2xf32>, vector<2xf32>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> %r30 = rocdl.mfma.f32.32x32x4.xf32 %arg15, %arg15, %arg4, %arg3, %arg3, %arg3 : (vector<2xf32>, vector<2xf32>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> llvm.return } llvm.func @rocdl.mubuf(%rsrc : vector<4xi32>, %vindex : i32, %offset : i32, %glc : i1, %slc : i1, %vdata1 : vector<1xf32>, %vdata2 : vector<2xf32>, %vdata4 : vector<4xf32>) { %r1 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32> %r2 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32> %r4 = rocdl.buffer.load %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32> rocdl.buffer.store %vdata1, %rsrc, %vindex, %offset, %glc, %slc : vector<1xf32> rocdl.buffer.store %vdata2, %rsrc, %vindex, %offset, %glc, %slc : vector<2xf32> rocdl.buffer.store %vdata4, %rsrc, %vindex, %offset, %glc, %slc : vector<4xf32> llvm.return } llvm.func @rocdl.raw.buffer.f32(%rsrc : vector<4xi32>, %offset : i32, %soffset : i32, %aux : i32, %vdata1 : f32, %vdata2 : vector<2xf32>, %vdata4 : vector<4xf32>) { %r1 = rocdl.raw.buffer.load %rsrc, %offset, %soffset, %aux : f32 %r2 = rocdl.raw.buffer.load %rsrc, %offset, %soffset, %aux : vector<2xf32> %r4 = rocdl.raw.buffer.load %rsrc, %offset, %soffset, %aux : vector<4xf32> rocdl.raw.buffer.store %vdata1, %rsrc, %offset, %soffset, %aux : f32 rocdl.raw.buffer.store %vdata2, %rsrc, %offset, %soffset, %aux : vector<2xf32> rocdl.raw.buffer.store %vdata4, %rsrc, %offset, %offset, %aux : vector<4xf32> rocdl.raw.buffer.atomic.fadd %vdata1, %rsrc, %offset, %soffset, %aux : f32 rocdl.raw.buffer.atomic.fmax %vdata1, %rsrc, %offset, %soffset, %aux : f32 llvm.return } llvm.func @rocdl.raw.buffer.i32(%rsrc : vector<4xi32>, %offset : i32, %soffset : i32, %aux : i32, %vdata1 : i32, %vdata2 : vector<2xi32>, %vdata4 : vector<4xi32>) { rocdl.raw.buffer.atomic.smax %vdata1, %rsrc, %offset, %soffset, %aux : i32 rocdl.raw.buffer.atomic.umin %vdata1, %rsrc, %offset, %soffset, %aux : i32 %val = rocdl.raw.buffer.atomic.cmpswap(%vdata1, %vdata1, %rsrc, %offset, %soffset, %aux) : i32, vector<4xi32> llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 func.func private @expected_llvm_func() attributes { rocdl.kernel }, mlir-opt -split-input-file -verify-diagnostics ,1 "#file = #llvm.di_file<""debuginfo.mlir"" in ""/test/""> #cu = #llvm.di_compile_unit< sourceLanguage = DW_LANG_C, file = #file, producer = ""MLIR"", isOptimized = true, emissionKind = Full > #null = #llvm.di_null_type #int0 = #llvm.di_basic_type< tag = DW_TAG_base_type, name = ""int0"" > #int1 = #llvm.di_basic_type< tag = DW_TAG_base_type, name = ""int1"", sizeInBits = 32, encoding = DW_ATE_signed > #ptr0 = #llvm.di_derived_type< tag = DW_TAG_pointer_type, baseType = #int0, sizeInBits = 64, alignInBits = 32, offsetInBits = 4 > #ptr1 = #llvm.di_derived_type< tag = DW_TAG_pointer_type, name = ""ptr1"" > #comp0 = #llvm.di_composite_type< tag = DW_TAG_array_type, name = ""array0"", line = 10, sizeInBits = 128, alignInBits = 32 > #comp1 = #llvm.di_composite_type< tag = DW_TAG_array_type, name = ""array1"", file = #file, scope = #file, baseType = #int0, elements = #llvm.di_subrange > #toplevel_namespace = #llvm.di_namespace< name = ""toplevel"", exportSymbols = true > #nested_namespace = #llvm.di_namespace< name = ""nested"", scope = #toplevel_namespace, exportSymbols = false > #anonymous_namespace = #llvm.di_namespace< scope = #file, exportSymbols = false > #comp2 = #llvm.di_composite_type< tag = DW_TAG_class_type, name = ""class_name"", file = #file, scope = #nested_namespace, flags = ""TypePassByReference|NonTrivial"" > #spType0 = #llvm.di_subroutine_type< callingConvention = DW_CC_normal, types = #null, #int0, #ptr0, #ptr1, #comp0, #comp1, #comp2 > #spType1 = #llvm.di_subroutine_type< types = #int1, #int1 > #spType2 = #llvm.di_subroutine_type< callingConvention = DW_CC_normal > #sp0 = #llvm.di_subprogram< compileUnit = #cu, scope = #anonymous_namespace, name = ""addr"", linkageName = ""addr"", file = #file, line = 3, scopeLine = 3, subprogramFlags = ""Definition|Optimized"", type = #spType0 > #sp1 = #llvm.di_subprogram< compileUnit = #cu, scope = #comp2, name = ""value"", file = #file, subprogramFlags = ""Definition"", type = #spType1 > #sp2 = #llvm.di_subprogram< compileUnit = #cu, scope = #file, name = ""value"", file = #file, subprogramFlags = ""Definition"", type = #spType2 > #block0 = #llvm.di_lexical_block #block1 = #llvm.di_lexical_block #block2 = #llvm.di_lexical_block #var0 = #llvm.di_local_variable< scope = #block0, name = ""alloc"", file = #file, line = 6, arg = 1, alignInBits = 32, type = #int0 > #var1 = #llvm.di_local_variable< scope = #block1, name = ""arg1"" > #var2 = #llvm.di_local_variable< scope = #block2, name = ""arg2"" > llvm.func @addr(%arg: i64) { %allocCount = llvm.mlir.constant(1 : i32) : i32 %alloc = llvm.alloca %allocCount x i64 : (i32) -> !llvm.ptr llvm.intr.dbg.declare #var0 = %alloc : !llvm.ptr llvm.return } llvm.func @value(%arg1: i32, %arg2: i32) { llvm.intr.dbg.value #var1 = %arg1 : i32 llvm.intr.dbg.value #var2 = %arg2 : i32 llvm.return }", mlir-opt | mlir-opt ,1 "#file = #llvm.di_file<""foo.mlir"" in ""/foo/""> #variable = #llvm.di_local_variable #variableAddr = #llvm.di_local_variable func.func @inner_func_inlinable(%ptr : !llvm.ptr) -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 %stack = llvm.intr.stacksave : !llvm.ptr llvm.store %0, %ptr { alignment = 8 } : i32, !llvm.ptr %1 = llvm.load %ptr { alignment = 8 } : !llvm.ptr -> i32 llvm.intr.dbg.value #variable = %0 : i32 llvm.intr.dbg.declare #variableAddr = %ptr : !llvm.ptr %byte = llvm.mlir.constant(43 : i8) : i8 %true = llvm.mlir.constant(1 : i1) : i1 ""llvm.intr.memset""(%ptr, %byte, %0, %true) : (!llvm.ptr, i8, i32, i1) -> () ""llvm.intr.memmove""(%ptr, %ptr, %0, %true) : (!llvm.ptr, !llvm.ptr, i32, i1) -> () ""llvm.intr.memcpy""(%ptr, %ptr, %0, %true) : (!llvm.ptr, !llvm.ptr, i32, i1) -> () ""llvm.intr.assume""(%true) : (i1) -> () llvm.fence release %2 = llvm.atomicrmw add %ptr, %0 monotonic : !llvm.ptr, i32 %3 = llvm.cmpxchg %ptr, %0, %1 acq_rel monotonic : !llvm.ptr, i32 llvm.inline_asm has_side_effects ""foo"", ""bar"" : () -> () llvm.cond_br %true, ^bb1, ^bb2 ^bb1: llvm.unreachable ^bb2: llvm.intr.stackrestore %stack : !llvm.ptr return %1 : i32 } func.func @test_inline(%ptr : !llvm.ptr) -> i32 { %0 = call @inner_func_inlinable(%ptr) : (!llvm.ptr) -> i32 return %0 : i32 }", mlir-opt -inline -split-input-file ,1 "llvm.metadata @metadata { llvm.access_group @group llvm.return } llvm.func @inlinee(%ptr : !llvm.ptr) -> i32 { %0 = llvm.load %ptr { access_groups = [@metadata::@group] } : !llvm.ptr -> i32 llvm.return %0 : i32 } llvm.func @test_not_inline(%ptr : !llvm.ptr) -> i32 { %0 = llvm.call @inlinee(%ptr) : (!llvm.ptr) -> (i32) llvm.return %0 : i32 }", mlir-opt -inline -split-input-file ,1 "llvm.metadata @metadata { llvm.access_group @group llvm.return } func.func private @with_mem_attr(%ptr : !llvm.ptr) { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.store %0, %ptr { access_groups = [@metadata::@group] }: i32, !llvm.ptr return } func.func @test_not_inline(%ptr : !llvm.ptr) { call @with_mem_attr(%ptr) : (!llvm.ptr) -> () return }", mlir-opt -inline -split-input-file ,1 "func.func @func(%arg0 : i32) -> i32 { llvm.return %arg0 : i32 } func.func @llvm_ret(%arg0 : i32) -> i32 { %res = call @func(%arg0) : (i32) -> (i32) return %res : i32 }", mlir-opt -inline -split-input-file ,1 "llvm.func internal fastcc @callee() -> (i32) attributes { function_entry_count = 42 : i64, dso_local } { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @caller() -> (i32) { %0 = llvm.call @callee() { fastmathFlags = #llvm.fastmath, branch_weights = dense<42> : vector<1xi32> } : () -> (i32) llvm.return %0 : i32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @foo() -> (i32) attributes { passthrough = [""noinline""] } { %0 = llvm.mlir.constant(0 : i32) : i32 llvm.return %0 : i32 } llvm.func @bar() -> (i32) attributes { passthrough = [""noinline""] } { %0 = llvm.mlir.constant(1 : i32) : i32 llvm.return %0 : i32 } llvm.func @callee_with_multiple_blocks(%cond: i1) -> (i32) { llvm.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = llvm.call @foo() : () -> (i32) llvm.br ^bb3(%0: i32) ^bb2: %1 = llvm.call @bar() : () -> (i32) llvm.br ^bb3(%1: i32) ^bb3(%arg: i32): llvm.return %arg : i32 } llvm.func @caller(%cond: i1) -> (i32) { %0 = llvm.call @callee_with_multiple_blocks(%cond) : (i1) -> (i32) llvm.return %0 : i32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @personality() -> i32 llvm.func @callee() -> (i32) attributes { personality = @personality } { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @caller() -> (i32) { %0 = llvm.call @callee() : () -> (i32) llvm.return %0 : i32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @callee() attributes { passthrough = [""foo"", ""bar""] } { llvm.return } llvm.func @caller() { llvm.call @callee() : () -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @callee_noinline() attributes { passthrough = [""noinline""] } { llvm.return } llvm.func @callee_optnone() attributes { passthrough = [""optnone""] } { llvm.return } llvm.func @callee_noduplicate() attributes { passthrough = [""noduplicate""] } { llvm.return } llvm.func @callee_presplitcoroutine() attributes { passthrough = [""presplitcoroutine""] } { llvm.return } llvm.func @callee_returns_twice() attributes { passthrough = [""returns_twice""] } { llvm.return } llvm.func @callee_strictfp() attributes { passthrough = [""strictfp""] } { llvm.return } llvm.func @caller() { llvm.call @callee_noinline() : () -> () llvm.call @callee_optnone() : () -> () llvm.call @callee_noduplicate() : () -> () llvm.call @callee_presplitcoroutine() : () -> () llvm.call @callee_returns_twice() : () -> () llvm.call @callee_strictfp() : () -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @static_alloca() -> f32 { %0 = llvm.mlir.constant(4 : i32) : i32 %1 = llvm.alloca %0 x f32 : (i32) -> !llvm.ptr %2 = llvm.load %1 : !llvm.ptr -> f32 llvm.return %2 : f32 } llvm.func @dynamic_alloca(%size : i32) -> f32 { %0 = llvm.add %size, %size : i32 %1 = llvm.alloca %0 x f32 : (i32) -> !llvm.ptr %2 = llvm.load %1 : !llvm.ptr -> f32 llvm.return %2 : f32 } llvm.func @test_inline(%cond : i1, %size : i32) -> f32 { llvm.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = llvm.call @static_alloca() : () -> f32 llvm.br ^bb3(%0: f32) ^bb2: %1 = llvm.call @dynamic_alloca(%size) : (i32) -> f32 llvm.br ^bb3(%1: f32) ^bb3(%arg : f32): llvm.return %arg : f32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @static_alloca_not_in_entry(%cond : i1) -> f32 { llvm.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = llvm.mlir.constant(4 : i32) : i32 %1 = llvm.alloca %0 x f32 : (i32) -> !llvm.ptr llvm.br ^bb3(%1: !llvm.ptr) ^bb2: %2 = llvm.mlir.constant(8 : i32) : i32 %3 = llvm.alloca %2 x f32 : (i32) -> !llvm.ptr llvm.br ^bb3(%3: !llvm.ptr) ^bb3(%ptr : !llvm.ptr): %4 = llvm.load %ptr : !llvm.ptr -> f32 llvm.return %4 : f32 } llvm.func @test_inline(%cond : i1) -> f32 { %0 = llvm.call @static_alloca_not_in_entry(%cond) : (i1) -> f32 llvm.return %0 : f32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @static_alloca(%cond: i1) -> f32 { %0 = llvm.mlir.constant(4 : i32) : i32 %1 = llvm.alloca %0 x f32 : (i32) -> !llvm.ptr llvm.cond_br %cond, ^bb1, ^bb2 ^bb1: %2 = llvm.load %1 : !llvm.ptr -> f32 llvm.return %2 : f32 ^bb2: %3 = llvm.mlir.constant(3.14192 : f32) : f32 llvm.return %3 : f32 } llvm.func @test_inline(%cond0 : i1, %cond1 : i1, %funcArg : f32) -> f32 { llvm.cond_br %cond0, ^bb1, ^bb2 ^bb1: %0 = llvm.call @static_alloca(%cond1) : (i1) -> f32 llvm.br ^bb3(%0: f32) ^bb2: llvm.br ^bb3(%funcArg: f32) ^bb3(%blockArg: f32): llvm.return %blockArg : f32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @alloca_with_lifetime(%cond: i1) -> f32 { %0 = llvm.mlir.constant(4 : i32) : i32 %1 = llvm.alloca %0 x f32 : (i32) -> !llvm.ptr llvm.intr.lifetime.start 4, %1 : !llvm.ptr %2 = llvm.load %1 : !llvm.ptr -> f32 llvm.intr.lifetime.end 4, %1 : !llvm.ptr %3 = llvm.fadd %2, %2 : f32 llvm.return %3 : f32 } llvm.func @test_inline(%cond0 : i1, %cond1 : i1, %funcArg : f32) -> f32 { llvm.cond_br %cond0, ^bb1, ^bb2 ^bb1: %0 = llvm.call @alloca_with_lifetime(%cond1) : (i1) -> f32 llvm.br ^bb3(%0: f32) ^bb2: llvm.br ^bb3(%funcArg: f32) ^bb3(%blockArg: f32): llvm.return %blockArg : f32 }", mlir-opt -inline -split-input-file ,1 "llvm.func @with_byval_arg(%ptr : !llvm.ptr { llvm.byval = f64 }) { llvm.return } llvm.func @test_byval(%ptr : !llvm.ptr) { llvm.br ^bb1 ^bb1: llvm.call @with_byval_arg(%ptr) : (!llvm.ptr) -> () llvm.br ^bb2 ^bb2: llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @with_byval_arg(%ptr : !llvm.ptr { llvm.byval = f64 }) attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func @test_byval_read_only(%ptr : !llvm.ptr) { llvm.call @with_byval_arg(%ptr) : (!llvm.ptr) -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @with_byval_arg(%ptr : !llvm.ptr { llvm.byval = f64 }) attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func @test_byval_write_only(%ptr : !llvm.ptr) { llvm.call @with_byval_arg(%ptr) : (!llvm.ptr) -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @aligned_byval_arg(%ptr : !llvm.ptr { llvm.byval = i16, llvm.align = 16 }) attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func @test_byval_input_aligned(%unaligned : !llvm.ptr, %aligned : !llvm.ptr { llvm.align = 16 }) { llvm.call @aligned_byval_arg(%unaligned) : (!llvm.ptr) -> () llvm.call @aligned_byval_arg(%aligned) : (!llvm.ptr) -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @func_that_uses_ptr(%ptr : !llvm.ptr) llvm.func @aligned_byval_arg(%ptr : !llvm.ptr { llvm.byval = i16, llvm.align = 16 }) attributes {memory = #llvm.memory_effects} { llvm.call @func_that_uses_ptr(%ptr) : (!llvm.ptr) -> () llvm.return } llvm.func @test_byval_realign_alloca() { %size = llvm.mlir.constant(4 : i64) : i64 %unaligned = llvm.alloca %size x i16 { alignment = 1 } : (i64) -> !llvm.ptr llvm.call @aligned_byval_arg(%unaligned) : (!llvm.ptr) -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""dlti.stack_alignment"", 32 : i32>> } { llvm.func @func_that_uses_ptr(%ptr : !llvm.ptr) llvm.func @aligned_byval_arg(%ptr : !llvm.ptr { llvm.byval = i16, llvm.align = 16 }) attributes {memory = #llvm.memory_effects} { llvm.call @func_that_uses_ptr(%ptr) : (!llvm.ptr) -> () llvm.return } llvm.func @test_exceeds_natural_stack_alignment() { %size = llvm.mlir.constant(4 : i64) : i64 %unaligned = llvm.alloca %size x i16 { alignment = 2 } : (i64) -> !llvm.ptr llvm.call @aligned_byval_arg(%unaligned) : (!llvm.ptr) -> () llvm.return } }", mlir-opt -inline -split-input-file ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""dlti.stack_alignment"", 32 : i32>> } { llvm.func @func_that_uses_ptr(%ptr : !llvm.ptr) llvm.func @aligned_byval_arg(%ptr : !llvm.ptr { llvm.byval = i16, llvm.align = 16 }) attributes {memory = #llvm.memory_effects} { llvm.call @func_that_uses_ptr(%ptr) : (!llvm.ptr) -> () llvm.return } llvm.func @test_alignment_exceeded_anyway() { %size = llvm.mlir.constant(4 : i64) : i64 %unaligned = llvm.alloca %size x i16 { alignment = 8 } : (i64) -> !llvm.ptr llvm.call @aligned_byval_arg(%unaligned) : (!llvm.ptr) -> () llvm.return } }", mlir-opt -inline -split-input-file ,1 "llvm.mlir.global private @unaligned_global(42 : i64) : i64 llvm.mlir.global private @aligned_global(42 : i64) { alignment = 64 } : i64 llvm.func @aligned_byval_arg(%ptr : !llvm.ptr { llvm.byval = i16, llvm.align = 16 }) attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func @test_byval_global() { %unaligned = llvm.mlir.addressof @unaligned_global : !llvm.ptr llvm.call @aligned_byval_arg(%unaligned) : (!llvm.ptr) -> () %aligned = llvm.mlir.addressof @aligned_global : !llvm.ptr llvm.call @aligned_byval_arg(%aligned) : (!llvm.ptr) -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @ignored_attrs(%ptr : !llvm.ptr { llvm.inreg, llvm.noalias, llvm.nocapture, llvm.nofree, llvm.preallocated = i32, llvm.returned, llvm.alignstack = 32 : i64, llvm.writeonly, llvm.noundef, llvm.nonnull }, %x : i32 { llvm.zeroext }) -> (!llvm.ptr { llvm.noundef, llvm.inreg, llvm.nonnull }) { llvm.return %ptr : !llvm.ptr } llvm.func @test_ignored_attrs(%ptr : !llvm.ptr, %x : i32) { llvm.call @ignored_attrs(%ptr, %x) : (!llvm.ptr, i32) -> (!llvm.ptr) llvm.return }", mlir-opt -inline -split-input-file ,1 "llvm.func @disallowed_arg_attr(%ptr : !llvm.ptr { llvm.inalloca = i64 }) { llvm.return } llvm.func @test_disallow_arg_attr(%ptr : !llvm.ptr) { llvm.call @disallowed_arg_attr(%ptr) : (!llvm.ptr) -> () llvm.return }", mlir-opt -inline -split-input-file ,1 "func.func @ops(%arg0: i32) { %13 = llvm.alloca %arg0 x f64 : (i32) -> !llvm.ptr %14 = llvm.getelementptr %13[%arg0, %arg0] : (!llvm.ptr, i32, i32) -> !llvm.ptr %15 = llvm.load %14 : !llvm.ptr llvm.store %15, %13 : !llvm.ptr %16 = llvm.bitcast %13 : !llvm.ptr to !llvm.ptr llvm.return } llvm.func @gep(%ptr: !llvm.ptr)>>, %idx: i64, %ptr2: !llvm.ptr)>>) { llvm.getelementptr %ptr[%idx, 1, 0] : (!llvm.ptr)>>, i64) -> !llvm.ptr llvm.getelementptr inbounds %ptr2[%idx, 0, %idx] : (!llvm.ptr)>>, i64, i64) -> !llvm.ptr llvm.return } func.func @alloca(%size : i64) { llvm.alloca %size x i32 {alignment = 0} : (i64) -> (!llvm.ptr) llvm.alloca inalloca %size x i32 {alignment = 8} : (i64) -> (!llvm.ptr) llvm.return } func.func @null() { %0 = llvm.mlir.null : !llvm.ptr %1 = llvm.mlir.null : !llvm.ptr>)>>, i64)>> llvm.return } llvm.func @vararg_func(%arg0: i32, ...) { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(1 : i32) : i32 %2 = llvm.alloca %1 x !llvm.struct<""struct.va_list"", (ptr)> {alignment = 8 : i64} : (i32) -> !llvm.ptr)>> %3 = llvm.bitcast %2 : !llvm.ptr)>> to !llvm.ptr llvm.intr.vastart %3 : !llvm.ptr %4 = llvm.alloca %0 x !llvm.ptr {alignment = 8 : i64} : (i32) -> !llvm.ptr> %5 = llvm.bitcast %4 : !llvm.ptr> to !llvm.ptr llvm.intr.vacopy %3 to %5 : !llvm.ptr, !llvm.ptr llvm.intr.vaend %5 : !llvm.ptr llvm.intr.vaend %3 : !llvm.ptr llvm.return }", mlir-opt | mlir-opt ,1 "func.func private @foo() func.func @bar() { return }", mlir-opt -llvm-request-c-wrappers ,1 "func.func @ops(%arg0: i32, %arg1: f32, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: i1, %arg5 : !llvm.vec<2x!llvm.ptr>) { %0 = llvm.add %arg0, %arg0 : i32 %1 = llvm.sub %arg0, %arg0 : i32 %2 = llvm.mul %arg0, %arg0 : i32 %3 = llvm.udiv %arg0, %arg0 : i32 %4 = llvm.sdiv %arg0, %arg0 : i32 %5 = llvm.urem %arg0, %arg0 : i32 %6 = llvm.srem %arg0, %arg0 : i32 %7 = llvm.icmp ""ne"" %arg0, %arg0 : i32 %typecheck_7 = llvm.add %7, %7 : i1 %ptrcmp = llvm.icmp ""ne"" %arg2, %arg2 : !llvm.ptr %typecheck_ptrcmp = llvm.add %ptrcmp, %ptrcmp : i1 %vptrcmp = llvm.icmp ""ne"" %arg5, %arg5 : !llvm.vec<2 x ptr> %typecheck_vptrcmp = llvm.add %vptrcmp, %vptrcmp : vector<2 x i1> %8 = llvm.fadd %arg1, %arg1 : f32 %9 = llvm.fsub %arg1, %arg1 : f32 %10 = llvm.fmul %arg1, %arg1 : f32 %11 = llvm.fdiv %arg1, %arg1 : f32 %12 = llvm.frem %arg1, %arg1 : f32 %13 = llvm.alloca %arg0 x f64 : (i32) -> !llvm.ptr %14 = llvm.getelementptr %13[%arg0, %arg0] : (!llvm.ptr, i32, i32) -> !llvm.ptr, f64 %15 = llvm.load %14 : !llvm.ptr -> f64 llvm.store %15, %13 : f64, !llvm.ptr %17 = llvm.call @foo(%arg0) : (i32) -> !llvm.struct<(i32, f64, i32)> %18 = llvm.extractvalue %17[0] : !llvm.struct<(i32, f64, i32)> %19 = llvm.insertvalue %18, %17[2] : !llvm.struct<(i32, f64, i32)> %20 = llvm.mlir.addressof @foo : !llvm.ptr %21 = llvm.call %20(%arg0) : !llvm.ptr, (i32) -> !llvm.struct<(i32, f64, i32)> llvm.br ^bb1 ^bb1: llvm.cond_br %7, ^bb2, ^bb3 ^bb2: %22 = llvm.mlir.undef : !llvm.struct<(i32, f64, i32)> %23 = llvm.mlir.constant(42) : i47 llvm.switch %0 : i32, ^bb3 [ 1: ^bb4, 2: ^bb5, 3: ^bb6 ] ^bb3: llvm.switch %0 : i32, ^bb7 [ ] ^bb4: llvm.switch %0 : i32, ^bb7 [ ] ^bb5: llvm.switch %0 : i32, ^bb7 [ ] ^bb6: llvm.switch %0 : i32, ^bb7 [ ] ^bb7: %24 = llvm.select %7, %0, %1 : i1, i32 %25 = llvm.inttoptr %arg0 : i32 to !llvm.ptr %26 = llvm.ptrtoint %25 : !llvm.ptr to i32 %27 = llvm.fpext %arg1 : f32 to f80 %28 = llvm.fpext %arg1 : f32 to f128 %29 = llvm.fneg %arg1 : f32 %30 = llvm.intr.sin(%arg1) : (f32) -> f32 %31 = llvm.intr.pow(%arg1, %arg1) : (f32, f32) -> f32 %a31 = llvm.intr.powi(%arg1, %arg0) : (f32, i32) -> f32 %32 = llvm.intr.bitreverse(%arg0) : (i32) -> i32 %33 = llvm.intr.ctpop(%arg0) : (i32) -> i32 %34 = llvm.intr.round(%arg1) : (f32) -> f32 ""llvm.intr.memcpy""(%arg2, %arg3, %arg0, %arg4) : (!llvm.ptr, !llvm.ptr, i32, i1) -> () ""llvm.intr.memcpy""(%arg2, %arg3, %arg0, %arg4) : (!llvm.ptr, !llvm.ptr, i32, i1) -> () %sz = llvm.mlir.constant(10: i64) : i64 ""llvm.intr.memcpy.inline""(%arg2, %arg3, %sz, %arg4) : (!llvm.ptr, !llvm.ptr, i64, i1) -> () llvm.return } llvm.func @gep(%ptr: !llvm.ptr, %idx: i64, %ptr2: !llvm.ptr) { llvm.getelementptr %ptr[%idx, 1, 0] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, struct<(i32, f32)>)> llvm.getelementptr inbounds %ptr2[%idx, 0, %idx] : (!llvm.ptr, i64, i64) -> !llvm.ptr, !llvm.struct<(array<10 x f32>)> llvm.return } llvm.func @foo(%arg0: i32) -> !llvm.struct<(i32, f64, i32)> { %0 = llvm.mlir.constant(3) : i32 %1 = llvm.mlir.constant(3) : i32 %2 = llvm.mlir.constant(4.200000e+01) : f64 %3 = llvm.mlir.constant(4.200000e+01) : f64 %4 = llvm.add %0, %1 : i32 %5 = llvm.mul %4, %1 : i32 %6 = llvm.fadd %2, %3 : f64 %7 = llvm.fsub %3, %6 : f64 %8 = llvm.mlir.constant(1) : i1 llvm.cond_br %8, ^bb1(%4 : i32), ^bb2(%4 : i32) ^bb1(%9: i32): %10 = llvm.call @foo(%9) : (i32) -> !llvm.struct<(i32, f64, i32)> %11 = llvm.extractvalue %10[0] : !llvm.struct<(i32, f64, i32)> %12 = llvm.extractvalue %10[1] : !llvm.struct<(i32, f64, i32)> %13 = llvm.extractvalue %10[2] : !llvm.struct<(i32, f64, i32)> %14 = llvm.mlir.undef : !llvm.struct<(i32, f64, i32)> %15 = llvm.insertvalue %5, %14[0] : !llvm.struct<(i32, f64, i32)> %16 = llvm.insertvalue %7, %15[1] : !llvm.struct<(i32, f64, i32)> %17 = llvm.insertvalue %11, %16[2] : !llvm.struct<(i32, f64, i32)> llvm.return %17 : !llvm.struct<(i32, f64, i32)> ^bb2(%18: i32): %19 = llvm.mlir.undef : !llvm.struct<(i32, f64, i32)> %20 = llvm.insertvalue %18, %19[0] : !llvm.struct<(i32, f64, i32)> %21 = llvm.insertvalue %7, %20[1] : !llvm.struct<(i32, f64, i32)> %22 = llvm.insertvalue %5, %21[2] : !llvm.struct<(i32, f64, i32)> llvm.return %22 : !llvm.struct<(i32, f64, i32)> } func.func @casts(%arg0: i32, %arg1: i64, %arg2: vector<4xi32>, %arg3: vector<4xi64>, %arg4: !llvm.ptr) { %0 = llvm.sext %arg0 : i32 to i56 %1 = llvm.zext %arg0 : i32 to i64 %2 = llvm.trunc %arg1 : i64 to i56 %3 = llvm.sext %arg2 : vector<4xi32> to vector<4xi56> %4 = llvm.zext %arg2 : vector<4xi32> to vector<4xi64> %5 = llvm.trunc %arg3 : vector<4xi64> to vector<4xi56> %6 = llvm.sitofp %arg0 : i32 to f32 %7 = llvm.uitofp %arg0 : i32 to f32 %8 = llvm.fptosi %7 : f32 to i32 %9 = llvm.fptoui %7 : f32 to i32 %10 = llvm.addrspacecast %arg4 : !llvm.ptr to !llvm.ptr<2> %11 = llvm.bitcast %arg1 : i64 to f64 llvm.return } func.func @vect(%arg0: vector<4xf32>, %arg1: i32, %arg2: f32, %arg3: !llvm.vec<2 x ptr>) { %0 = llvm.extractelement %arg0[%arg1 : i32] : vector<4xf32> %1 = llvm.insertelement %arg2, %arg0[%arg1 : i32] : vector<4xf32> %2 = llvm.shufflevector %arg0, %arg0 [0, 0, 0, 0, 7] : vector<4xf32> %3 = llvm.shufflevector %arg3, %arg3 [1, 0] : !llvm.vec<2 x ptr> %4 = llvm.mlir.constant(dense<1.0> : vector<4xf32>) : vector<4xf32> return } func.func @scalable_vect(%arg0: vector<[4]xf32>, %arg1: i32, %arg2: f32) { %0 = llvm.extractelement %arg0[%arg1 : i32] : vector<[4]xf32> %1 = llvm.insertelement %arg2, %arg0[%arg1 : i32] : vector<[4]xf32> %2 = llvm.shufflevector %arg0, %arg0 [0, 0, 0, 0] : vector<[4]xf32> %3 = llvm.mlir.constant(dense<1.0> : vector<[4]xf32>) : vector<[4]xf32> return } func.func @mixed_vect(%arg0: vector<8xf32>, %arg1: vector<4xf32>, %arg2: vector<[4]xf32>) { %0 = llvm.intr.vector.insert %arg0, %arg2[0] : vector<8xf32> into vector<[4]xf32> %1 = llvm.intr.vector.insert %arg1, %arg2[0] : vector<4xf32> into vector<[4]xf32> %2 = llvm.intr.vector.insert %arg1, %1[4] : vector<4xf32> into vector<[4]xf32> %3 = llvm.intr.vector.insert %arg1, %arg0[4] : vector<4xf32> into vector<8xf32> %4 = llvm.intr.vector.extract %2[0] : vector<8xf32> from vector<[4]xf32> %5 = llvm.intr.vector.extract %arg0[6] : vector<2xf32> from vector<8xf32> return } func.func @alloca(%size : i64) { llvm.alloca %size x i32 {alignment = 0} : (i64) -> (!llvm.ptr) llvm.alloca inalloca %size x i32 {alignment = 8} : (i64) -> (!llvm.ptr) llvm.return } func.func @null() { %0 = llvm.mlir.null : !llvm.ptr llvm.return } func.func @atomic_load(%ptr : !llvm.ptr) { %0 = llvm.load %ptr atomic monotonic {alignment = 4 : i64} : !llvm.ptr -> f32 %1 = llvm.load volatile %ptr atomic syncscope(""singlethread"") monotonic {alignment = 16 : i64} : !llvm.ptr -> f32 llvm.return } func.func @atomic_store(%val : f32, %ptr : !llvm.ptr) { llvm.store %val, %ptr atomic monotonic {alignment = 4 : i64} : f32, !llvm.ptr llvm.store volatile %val, %ptr atomic syncscope(""singlethread"") monotonic {alignment = 16 : i64} : f32, !llvm.ptr llvm.return } func.func @atomicrmw(%ptr : !llvm.ptr, %val : f32) { %0 = llvm.atomicrmw fadd %ptr, %val monotonic : !llvm.ptr, f32 %1 = llvm.atomicrmw volatile fsub %ptr, %val syncscope(""singlethread"") monotonic {alignment = 16 : i64} : !llvm.ptr, f32 llvm.return } func.func @cmpxchg(%ptr : !llvm.ptr, %cmp : i32, %new : i32) { %0 = llvm.cmpxchg %ptr, %cmp, %new acq_rel monotonic : !llvm.ptr, i32 %1 = llvm.cmpxchg weak volatile %ptr, %cmp, %new syncscope(""singlethread"") acq_rel monotonic {alignment = 16 : i64} : !llvm.ptr, i32 llvm.return } llvm.mlir.global external constant @_ZTIi() : !llvm.ptr llvm.func @bar(!llvm.ptr, !llvm.ptr, !llvm.ptr) llvm.func @__gxx_personality_v0(...) -> i32 llvm.func @invokeLandingpad() -> i32 attributes { personality = @__gxx_personality_v0 } { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = llvm.mlir.constant(3 : i32) : i32 %2 = llvm.mlir.constant(""\01"") : !llvm.array<1 x i8> %3 = llvm.mlir.null : !llvm.ptr %4 = llvm.mlir.addressof @_ZTIi : !llvm.ptr %5 = llvm.mlir.constant(1 : i32) : i32 %6 = llvm.alloca %5 x i8 : (i32) -> !llvm.ptr %7 = llvm.invoke @foo(%5) to ^bb2 unwind ^bb1 : (i32) -> !llvm.struct<(i32, f64, i32)> ^bb1: %10 = llvm.landingpad cleanup (catch %3 : !llvm.ptr) (catch %4 : !llvm.ptr) (filter %2 : !llvm.array<1 x i8>) : !llvm.struct<(ptr, i32)> %11 = llvm.intr.eh.typeid.for %4 : (!llvm.ptr) -> i32 llvm.resume %10 : !llvm.struct<(ptr, i32)> ^bb2: llvm.return %5 : i32 ^bb3: llvm.invoke @bar(%6, %4, %3) to ^bb2 unwind ^bb1 : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> () ^bb4: %12 = llvm.mlir.addressof @foo : !llvm.ptr %13 = llvm.invoke %12(%5) to ^bb2 unwind ^bb1 : !llvm.ptr, (i32) -> !llvm.struct<(i32, f64, i32)> ^bb5: llvm.return %0 : i32 } func.func @useFreezeOp(%arg0: i32) { %0 = llvm.freeze %arg0 : i32 %1 = llvm.mlir.undef : i8 %2 = llvm.freeze %1 : i8 %3 = llvm.mlir.poison : i8 %4 = llvm.freeze %3 : i8 return } func.func @useFenceInst() { llvm.fence syncscope(""agent"") seq_cst llvm.fence syncscope("""") seq_cst llvm.fence release return } llvm.func @useInlineAsm(%arg0: i32) { %0 = llvm.inline_asm ""bswap $0"", ""=r,r"" %arg0 : (i32) -> i8 %1 = llvm.inline_asm ""foo"", ""bar"" %arg0, %arg0 : (i32, i32) -> i8 %2 = llvm.inline_asm has_side_effects ""foo"", ""bar"" %arg0, %arg0 : (i32, i32) -> i8 %3 = llvm.inline_asm is_align_stack ""foo"", ""bar"" %arg0, %arg0 : (i32, i32) -> i8 %5 = llvm.inline_asm ""foo"", ""=r,=r,r"" %arg0 : (i32) -> !llvm.struct<(i8, i8)> llvm.return } func.func @fastmathFlags(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: vector<2 x f32>, %arg4: vector<2 x f32>) { %0 = llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %1 = llvm.fsub %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %2 = llvm.fmul %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %3 = llvm.fdiv %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %4 = llvm.frem %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %5 = llvm.fcmp ""oeq"" %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %typecheck_5 = llvm.add %5, %5 : i1 %vcmp = llvm.fcmp ""oeq"" %arg3, %arg4 {fastmathFlags = #llvm.fastmath} : vector<2xf32> %typecheck_vcmp = llvm.add %vcmp, %vcmp : vector<2xi1> %6 = llvm.fneg %arg0 {fastmathFlags = #llvm.fastmath} : f32 %7 = llvm.call @foo(%arg2) {fastmathFlags = #llvm.fastmath} : (i32) -> !llvm.struct<(i32, f64, i32)> %8 = llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %9 = llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath} : f32 %10 = llvm.fneg %arg0 {fastmathFlags = #llvm.fastmath} : f32 %11 = llvm.intr.sin(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> f32 %12 = llvm.intr.sin(%arg0) {fastmathFlags = #llvm.fastmath} : (f32) -> f32 %13 = llvm.intr.vector.reduce.fmin(%arg3) {fastmathFlags = #llvm.fastmath} : (vector<2xf32>) -> f32 %14 = llvm.intr.vector.reduce.fmax(%arg3) {fastmathFlags = #llvm.fastmath} : (vector<2xf32>) -> f32 return } llvm.func @lifetime(%p: !llvm.ptr) { llvm.intr.lifetime.start 16, %p : !llvm.ptr llvm.intr.lifetime.end 16, %p : !llvm.ptr llvm.return } llvm.func @vararg_func(%arg0: i32, ...) { %1 = llvm.mlir.constant(1 : i32) : i32 %list = llvm.alloca %1 x !llvm.struct<""struct.va_list_opaque"", (ptr)> : (i32) -> !llvm.ptr llvm.intr.vastart %list : !llvm.ptr %list2 = llvm.alloca %1 x !llvm.struct<""struct.va_list_opaque"", (ptr)> : (i32) -> !llvm.ptr llvm.intr.vacopy %list to %list2 : !llvm.ptr, !llvm.ptr llvm.intr.vaend %list : !llvm.ptr llvm.intr.vaend %list2 : !llvm.ptr llvm.return } llvm.func @eh_typeid(%arg0: !llvm.ptr) -> i32 { %0 = llvm.intr.eh.typeid.for %arg0 : (!llvm.ptr) -> i32 llvm.return %0 : i32 } llvm.func @stackrestore(%arg0: !llvm.ptr) { llvm.intr.stackrestore %arg0 : !llvm.ptr llvm.return } llvm.func @experimental_noalias_scope_decl() { llvm.intr.experimental.noalias.scope.decl @metadata::@scope llvm.return } llvm.metadata @metadata { llvm.alias_scope_domain @domain {description = ""The domain""} llvm.alias_scope @scope {domain = @domain, description = ""The first scope""} }", mlir-opt | mlir-opt ,1 "llvm.func @round_sse41() -> vector<4xf32> { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.mlir.constant(dense<0.2> : vector<4xf32>) : vector<4xf32> %res = llvm.call_intrinsic ""llvm.x86.sse41.round.ss""(%1, %1, %0) : (vector<4xf32>, vector<4xf32>, i32) -> vector<4xf32> {fastmathFlags = #llvm.fastmath} llvm.return %res: vector<4xf32> }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.func @round_overloaded() -> f32 { %0 = llvm.mlir.constant(1.0 : f32) : f32 %res = llvm.call_intrinsic ""llvm.round""(%0) : (f32) -> f32 {} llvm.return %res: f32 }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.func @lifetime_start() { %0 = llvm.mlir.constant(4 : i64) : i64 %1 = llvm.mlir.constant(1 : i8) : i8 %2 = llvm.alloca %1 x f32 : (i8) -> !llvm.ptr llvm.call_intrinsic ""llvm.lifetime.start""(%0, %2) : (i64, !llvm.ptr) -> () {} llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.func @variadic() { %0 = llvm.mlir.constant(1 : i8) : i8 %1 = llvm.alloca %0 x f32 : (i8) -> !llvm.ptr llvm.call_intrinsic ""llvm.localescape""(%1, %1) : (!llvm.ptr, !llvm.ptr) -> () llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.func @no_intrinsic() { llvm.call_intrinsic ""llvm.does_not_exist""() : () -> () llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.func @bad_types() { %0 = llvm.mlir.constant(1 : i8) : i8 llvm.call_intrinsic ""llvm.round""(%0) : (i8) -> i8 {} llvm.return }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.func @use(i64) llvm.func @use_ptr(!llvm.ptr) #di_basic_type = #llvm.di_basic_type #di_file = #llvm.di_file<""test.ll"" in """"> #di_compile_unit = #llvm.di_compile_unit #di_subprogram = #llvm.di_subprogram #di_local_variable = #llvm.di_local_variable #di_local_variable_2 = #llvm.di_local_variable llvm.func @basic_store_load(%arg0: i64) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.store %arg0, %1 {alignment = 4 : i64} : i64, !llvm.ptr llvm.intr.dbg.declare #di_local_variable = %1 : !llvm.ptr %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 llvm.return %2 : i64 } llvm.func @block_argument_value(%arg0: i64, %arg1: i1) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.intr.dbg.declare #di_local_variable = %1 : !llvm.ptr llvm.cond_br %arg1, ^bb1, ^bb2 ^bb1: llvm.store %arg0, %1 {alignment = 4 : i64} : i64, !llvm.ptr llvm.br ^bb2 ^bb2: %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 llvm.return %2 : i64 } llvm.func @double_block_argument_value(%arg0: i64, %arg1: i1) -> i64 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.intr.dbg.declare #di_local_variable = %1 : !llvm.ptr llvm.cond_br %arg1, ^bb1, ^bb2 ^bb1: %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i64 llvm.call @use(%2) : (i64) -> () llvm.store %arg0, %1 {alignment = 4 : i64} : i64, !llvm.ptr llvm.br ^bb2 ^bb2: llvm.br ^bb1 } llvm.func @always_drop_promoted_declare() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.intr.dbg.declare #di_local_variable = %1 : !llvm.ptr llvm.return } llvm.func @keep_dbg_if_not_promoted() { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.intr.dbg.declare #di_local_variable = %1 : !llvm.ptr %2 = llvm.alloca %0 x i64 {alignment = 8 : i64} : (i32) -> !llvm.ptr llvm.intr.dbg.declare #di_local_variable_2 = %2 : !llvm.ptr llvm.call @use_ptr(%1) : (!llvm.ptr) -> () llvm.return }", mlir-opt --pass-pipeline='builtin.module(llvm.func(mem2reg{region-simplify=false}))' ,1 "#followup = #llvm.loop_annotation #vectorize = #llvm.loop_vectorize< disable = false, predicateEnable = false, scalableEnable = true, width = 16 : i32, followupVectorized = #followup, followupEpilogue = #followup, followupAll = #followup > #interleave = #llvm.loop_interleave #unroll = #llvm.loop_unroll< disable = true, count = 32 : i32, runtimeDisable = true, full = false, followupUnrolled = #followup, followupRemainder = #followup, followupAll = #followup > #unrollAndJam = #llvm.loop_unroll_and_jam< disable = false, count = 16 : i32, followupOuter = #followup, followupInner = #followup, followupRemainderOuter = #followup, followupRemainderInner = #followup, followupAll = #followup > #licm = #llvm.loop_licm #distribute = #llvm.loop_distribute< disable = true, followupCoincident = #followup, followupSequential = #followup, followupFallback = #followup, followupAll = #followup > #pipeline = #llvm.loop_pipeline #peeled = #llvm.loop_peeled #unswitch = #llvm.loop_unswitch #loopMD = #llvm.loop_annotation llvm.func @loop_annotation() { llvm.br ^bb1 {llvm.loop = #loopMD} ^bb1: llvm.return } llvm.metadata @metadata { llvm.access_group @group1 llvm.access_group @group2 }", mlir-opt --split-input-file | mlir-opt --split-input-file ,1 "#di_file = #llvm.di_file<""metadata-loop.ll"" in ""/""> #loc1 = loc(""loop-metadata.mlir"":42:4) #loc2 = loc(""loop-metadata.mlir"":52:4) #di_compile_unit = #llvm.di_compile_unit #di_subprogram = #llvm.di_subprogram #start_loc_fused = loc(fused<#di_subprogram>[#loc1]) #end_loc_fused= loc(fused<#di_subprogram>[#loc2]) #loopMD = #llvm.loop_annotation llvm.func @loop_annotation_with_locs() { llvm.br ^bb1 {loop_annotation = #loopMD} ^bb1: llvm.return }", mlir-opt --split-input-file | mlir-opt --split-input-file ,1 "module { llvm.metadata @__tbaa { llvm.tbaa_root @tbaa_root_0 {id = ""Simple C/C++ TBAA""} llvm.tbaa_tag @tbaa_tag_1 {access_type = @tbaa_root_0, base_type = @tbaa_root_0, offset = 0 : i64} llvm.tbaa_root @tbaa_root_2 {id = ""Other language TBAA""} llvm.tbaa_tag @tbaa_tag_3 {access_type = @tbaa_root_2, base_type = @tbaa_root_2, offset = 0 : i64} } llvm.func @tbaa1(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { %0 = llvm.mlir.constant(1 : i8) : i8 llvm.store %0, %arg0 {tbaa = [@__tbaa::@tbaa_tag_1]} : i8, !llvm.ptr llvm.store %0, %arg1 {tbaa = [@__tbaa::@tbaa_tag_3]} : i8, !llvm.ptr llvm.return } } module { llvm.metadata @__tbaa { llvm.tbaa_root @tbaa_root_0 {id = ""Simple C/C++ TBAA""} llvm.tbaa_type_desc @tbaa_type_desc_1 {id = ""omnipotent char"", members = {<@tbaa_root_0, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_2 {id = ""long long"", members = {<@tbaa_type_desc_1, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_3 {id = ""agg2_t"", members = {<@tbaa_type_desc_2, 0>, <@tbaa_type_desc_2, 8>}} llvm.tbaa_tag @tbaa_tag_4 {access_type = @tbaa_type_desc_2, base_type = @tbaa_type_desc_3, offset = 8 : i64} llvm.tbaa_type_desc @tbaa_type_desc_5 {id = ""int"", members = {<@tbaa_type_desc_1, 0>}} llvm.tbaa_type_desc @tbaa_type_desc_6 {id = ""agg1_t"", members = {<@tbaa_type_desc_5, 0>, <@tbaa_type_desc_5, 4>}} llvm.tbaa_tag @tbaa_tag_7 {access_type = @tbaa_type_desc_5, base_type = @tbaa_type_desc_6, offset = 0 : i64} } llvm.func @tbaa2(%arg0: !llvm.ptr, %arg1: !llvm.ptr) { %0 = llvm.mlir.constant(0 : i32) : i32 %1 = llvm.mlir.constant(1 : i32) : i32 %2 = llvm.getelementptr inbounds %arg1[%0, 1] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<""struct.agg2_t"", (i64, i64)> %3 = llvm.load %2 {tbaa = [@__tbaa::@tbaa_tag_4]} : !llvm.ptr -> i64 %4 = llvm.trunc %3 : i64 to i32 %5 = llvm.getelementptr inbounds %arg0[%0, 0] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.struct<""struct.agg1_t"", (i32, i32)> llvm.store %4, %5 {tbaa = [@__tbaa::@tbaa_tag_7]} : i32, !llvm.ptr llvm.return } } module { llvm.metadata @__tbaa { llvm.tbaa_root @tbaa_root_0 {id = ""Simple C/C++ TBAA""} llvm.tbaa_tag @tbaa_tag_1 {access_type = @tbaa_root_0, base_type = @tbaa_root_0, offset = 0 : i64} llvm.tbaa_root @tbaa_root_2 {id = ""Other language TBAA""} llvm.tbaa_tag @tbaa_tag_3 {access_type = @tbaa_root_2, base_type = @tbaa_root_2, offset = 0 : i64} } llvm.func @tbaa1(%arg0: !llvm.ptr) { %0 = llvm.mlir.constant(1 : i8) : i8 llvm.store %0, %arg0 {tbaa = [@__tbaa::@tbaa_tag_1, @__tbaa::@tbaa_tag_3]} : i8, !llvm.ptr llvm.return } }", mlir-opt | mlir-opt ,1 "module { ""llvm.func"" () ({ }) {sym_name = ""foo"", function_type = !llvm.func} : () -> () ""llvm.func""() ({ }) {sym_name = ""bar"", function_type = !llvm.func} : () -> () ""llvm.func""() <{sym_name = ""baz"", function_type = !llvm.func}> ({ ^bb0(%arg0: i64): llvm.return %arg0 : i64 }) : () -> () ""llvm.func""() ({ }) {sym_name = ""qux"", function_type = !llvm.func, arg_attrs = [{llvm.noalias}, {}], xxx = {yyy = 42}} : () -> () llvm.func @roundtrip1() llvm.func @roundtrip2(i64, f32) -> f64 llvm.func @roundtrip3(%a: i32, %b: i1) llvm.func @roundtrip4(%a: i32, %b: i1) { llvm.return } llvm.func @roundtrip5() attributes {foo = ""bar"", baz = 42} llvm.func @roundtrip6() attributes {foo = ""bar"", baz = 42} { llvm.return } llvm.func @roundtrip7() attributes {} { llvm.return } llvm.func @roundtrip8() -> i32 attributes {} llvm.func @roundtrip9(!llvm.ptr {llvm.noalias}) llvm.func @roundtrip10(%arg0: !llvm.ptr {llvm.noalias}) llvm.func @roundtrip11(%arg0: !llvm.ptr {llvm.noalias}) { llvm.return } llvm.func @roundtrip12(%arg0: !llvm.ptr {llvm.noalias}) attributes {foo = 42 : i32} { llvm.return } llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval = i32}) { llvm.return } llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret = i32} loc(""some_source_loc"")) { llvm.return } llvm.func @nestattr(%arg0: !llvm.ptr {llvm.nest}) { llvm.return } llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias}) llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32}) llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32}) llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32}) llvm.func @nestattr_decl(!llvm.ptr {llvm.nest}) llvm.func @noundefattr_decl(i32 {llvm.noundef}) llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4}) llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32}) llvm.func @variadic(...) llvm.func @variadic_args(i32, i32, ...) llvm.func internal @internal_func() { llvm.return } llvm.func weak @weak_linkage() { llvm.return } llvm.func ptx_kernelcc @calling_conv() { llvm.return } llvm.func external @external_func() llvm.func @arg_struct_attr( %arg0 : !llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return } llvm.func @res_struct_attr(%arg0 : !llvm.struct<(i32)>) -> (!llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return %arg0 : !llvm.struct<(i32)> } llvm.func ccc @cconv1() { llvm.return } llvm.func weak ccc @cconv2() { llvm.return } llvm.func weak fastcc @cconv3() { llvm.return } llvm.func @variadic_def(...) { llvm.return } llvm.func @memory_attr() attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func hidden @hidden() { llvm.return } llvm.func protected @protected() { llvm.return } }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func"" () ({ }) {sym_name = ""foo"", function_type = !llvm.func} : () -> () ""llvm.func""() ({ }) {sym_name = ""bar"", function_type = !llvm.func} : () -> () ""llvm.func""() <{sym_name = ""baz"", function_type = !llvm.func}> ({ ^bb0(%arg0: i64): llvm.return %arg0 : i64 }) : () -> () ""llvm.func""() ({ }) {sym_name = ""qux"", function_type = !llvm.func, arg_attrs = [{llvm.noalias}, {}], xxx = {yyy = 42}} : () -> () llvm.func @roundtrip1() llvm.func @roundtrip2(i64, f32) -> f64 llvm.func @roundtrip3(%a: i32, %b: i1) llvm.func @roundtrip4(%a: i32, %b: i1) { llvm.return } llvm.func @roundtrip5() attributes {foo = ""bar"", baz = 42} llvm.func @roundtrip6() attributes {foo = ""bar"", baz = 42} { llvm.return } llvm.func @roundtrip7() attributes {} { llvm.return } llvm.func @roundtrip8() -> i32 attributes {} llvm.func @roundtrip9(!llvm.ptr {llvm.noalias}) llvm.func @roundtrip10(%arg0: !llvm.ptr {llvm.noalias}) llvm.func @roundtrip11(%arg0: !llvm.ptr {llvm.noalias}) { llvm.return } llvm.func @roundtrip12(%arg0: !llvm.ptr {llvm.noalias}) attributes {foo = 42 : i32} { llvm.return } llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval = i32}) { llvm.return } llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret = i32} loc(""some_source_loc"")) { llvm.return } llvm.func @nestattr(%arg0: !llvm.ptr {llvm.nest}) { llvm.return } llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias}) llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32}) llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32}) llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32}) llvm.func @nestattr_decl(!llvm.ptr {llvm.nest}) llvm.func @noundefattr_decl(i32 {llvm.noundef}) llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4}) llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32}) llvm.func @variadic(...) llvm.func @variadic_args(i32, i32, ...) llvm.func internal @internal_func() { llvm.return } llvm.func weak @weak_linkage() { llvm.return } llvm.func ptx_kernelcc @calling_conv() { llvm.return } llvm.func external @external_func() llvm.func @arg_struct_attr( %arg0 : !llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return } llvm.func @res_struct_attr(%arg0 : !llvm.struct<(i32)>) -> (!llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return %arg0 : !llvm.struct<(i32)> } llvm.func ccc @cconv1() { llvm.return } llvm.func weak ccc @cconv2() { llvm.return } llvm.func weak fastcc @cconv3() { llvm.return } llvm.func @variadic_def(...) { llvm.return } llvm.func @memory_attr() attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func hidden @hidden() { llvm.return } llvm.func protected @protected() { llvm.return } }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func"" () ({ }) {sym_name = ""foo"", function_type = !llvm.func} : () -> () ""llvm.func""() ({ }) {sym_name = ""bar"", function_type = !llvm.func} : () -> () ""llvm.func""() <{sym_name = ""baz"", function_type = !llvm.func}> ({ ^bb0(%arg0: i64): llvm.return %arg0 : i64 }) : () -> () ""llvm.func""() ({ }) {sym_name = ""qux"", function_type = !llvm.func, arg_attrs = [{llvm.noalias}, {}], xxx = {yyy = 42}} : () -> () llvm.func @roundtrip1() llvm.func @roundtrip2(i64, f32) -> f64 llvm.func @roundtrip3(%a: i32, %b: i1) llvm.func @roundtrip4(%a: i32, %b: i1) { llvm.return } llvm.func @roundtrip5() attributes {foo = ""bar"", baz = 42} llvm.func @roundtrip6() attributes {foo = ""bar"", baz = 42} { llvm.return } llvm.func @roundtrip7() attributes {} { llvm.return } llvm.func @roundtrip8() -> i32 attributes {} llvm.func @roundtrip9(!llvm.ptr {llvm.noalias}) llvm.func @roundtrip10(%arg0: !llvm.ptr {llvm.noalias}) llvm.func @roundtrip11(%arg0: !llvm.ptr {llvm.noalias}) { llvm.return } llvm.func @roundtrip12(%arg0: !llvm.ptr {llvm.noalias}) attributes {foo = 42 : i32} { llvm.return } llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval = i32}) { llvm.return } llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret = i32} loc(""some_source_loc"")) { llvm.return } llvm.func @nestattr(%arg0: !llvm.ptr {llvm.nest}) { llvm.return } llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias}) llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32}) llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32}) llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32}) llvm.func @nestattr_decl(!llvm.ptr {llvm.nest}) llvm.func @noundefattr_decl(i32 {llvm.noundef}) llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4}) llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32}) llvm.func @variadic(...) llvm.func @variadic_args(i32, i32, ...) llvm.func internal @internal_func() { llvm.return } llvm.func weak @weak_linkage() { llvm.return } llvm.func ptx_kernelcc @calling_conv() { llvm.return } llvm.func external @external_func() llvm.func @arg_struct_attr( %arg0 : !llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return } llvm.func @res_struct_attr(%arg0 : !llvm.struct<(i32)>) -> (!llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return %arg0 : !llvm.struct<(i32)> } llvm.func ccc @cconv1() { llvm.return } llvm.func weak ccc @cconv2() { llvm.return } llvm.func weak fastcc @cconv3() { llvm.return } llvm.func @variadic_def(...) { llvm.return } llvm.func @memory_attr() attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func hidden @hidden() { llvm.return } llvm.func protected @protected() { llvm.return } }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func"" () ({ }) {sym_name = ""foo"", function_type = !llvm.func} : () -> () ""llvm.func""() ({ }) {sym_name = ""bar"", function_type = !llvm.func} : () -> () ""llvm.func""() <{sym_name = ""baz"", function_type = !llvm.func}> ({ ^bb0(%arg0: i64): llvm.return %arg0 : i64 }) : () -> () ""llvm.func""() ({ }) {sym_name = ""qux"", function_type = !llvm.func, arg_attrs = [{llvm.noalias}, {}], xxx = {yyy = 42}} : () -> () llvm.func @roundtrip1() llvm.func @roundtrip2(i64, f32) -> f64 llvm.func @roundtrip3(%a: i32, %b: i1) llvm.func @roundtrip4(%a: i32, %b: i1) { llvm.return } llvm.func @roundtrip5() attributes {foo = ""bar"", baz = 42} llvm.func @roundtrip6() attributes {foo = ""bar"", baz = 42} { llvm.return } llvm.func @roundtrip7() attributes {} { llvm.return } llvm.func @roundtrip8() -> i32 attributes {} llvm.func @roundtrip9(!llvm.ptr {llvm.noalias}) llvm.func @roundtrip10(%arg0: !llvm.ptr {llvm.noalias}) llvm.func @roundtrip11(%arg0: !llvm.ptr {llvm.noalias}) { llvm.return } llvm.func @roundtrip12(%arg0: !llvm.ptr {llvm.noalias}) attributes {foo = 42 : i32} { llvm.return } llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval = i32}) { llvm.return } llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret = i32} loc(""some_source_loc"")) { llvm.return } llvm.func @nestattr(%arg0: !llvm.ptr {llvm.nest}) { llvm.return } llvm.func @llvm_noalias_decl(!llvm.ptr {llvm.noalias}) llvm.func @byrefattr_decl(!llvm.ptr {llvm.byref = i32}) llvm.func @byvalattr_decl(!llvm.ptr {llvm.byval = i32}) llvm.func @sretattr_decl(!llvm.ptr {llvm.sret = i32}) llvm.func @nestattr_decl(!llvm.ptr {llvm.nest}) llvm.func @noundefattr_decl(i32 {llvm.noundef}) llvm.func @llvm_align_decl(!llvm.ptr {llvm.align = 4}) llvm.func @inallocaattr_decl(!llvm.ptr {llvm.inalloca = i32}) llvm.func @variadic(...) llvm.func @variadic_args(i32, i32, ...) llvm.func internal @internal_func() { llvm.return } llvm.func weak @weak_linkage() { llvm.return } llvm.func ptx_kernelcc @calling_conv() { llvm.return } llvm.func external @external_func() llvm.func @arg_struct_attr( %arg0 : !llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return } llvm.func @res_struct_attr(%arg0 : !llvm.struct<(i32)>) -> (!llvm.struct<(i32)> {llvm.struct_attrs = [{llvm.noalias}]}) { llvm.return %arg0 : !llvm.struct<(i32)> } llvm.func ccc @cconv1() { llvm.return } llvm.func weak ccc @cconv2() { llvm.return } llvm.func weak fastcc @cconv3() { llvm.return } llvm.func @variadic_def(...) { llvm.return } llvm.func @memory_attr() attributes {memory = #llvm.memory_effects} { llvm.return } llvm.func hidden @hidden() { llvm.return } llvm.func protected @protected() { llvm.return } }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() {function_type = !llvm.func, sym_name = ""no_region""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() {function_type = !llvm.func, sym_name = ""no_region""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() {function_type = !llvm.func, sym_name = ""no_region""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() {function_type = !llvm.func, sym_name = ""no_region""} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() ({}) {sym_name = ""missing_type""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() ({}) {sym_name = ""missing_type""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() ({}) {sym_name = ""missing_type""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() ({}) {sym_name = ""missing_type""} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_llvm_type"", function_type = i64} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_llvm_type"", function_type = i64} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_llvm_type"", function_type = i64} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_llvm_type"", function_type = i64} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_function_type"", function_type = i64} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_function_type"", function_type = i64} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_function_type"", function_type = i64} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() ({}) {sym_name = ""non_function_type"", function_type = i64} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: i64): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: i64): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: i64): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: i64): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: tensor<*xf32>): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: tensor<*xf32>): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: tensor<*xf32>): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() ({ ^bb0(%arg0: tensor<*xf32>): llvm.return }) {function_type = !llvm.func, sym_name = ""wrong_arg_number""} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func @foo(tensor<*xf32>) }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func @foo(tensor<*xf32>) }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func @foo(tensor<*xf32>) }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func @foo(tensor<*xf32>) }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func @foo() -> tensor<*xf32> }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func @foo() -> tensor<*xf32> }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func @foo() -> tensor<*xf32> }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func @foo() -> tensor<*xf32> }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func @foo() -> (i64, i64) }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func @foo() -> (i64, i64) }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func @foo() -> (i64, i64) }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func @foo() -> (i64, i64) }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func @variadic_inside(%arg0: i32, ..., %arg1: i32) }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func @variadic_inside(%arg0: i32, ..., %arg1: i32) }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func @variadic_inside(%arg0: i32, ..., %arg1: i32) }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func @variadic_inside(%arg0: i32, ..., %arg1: i32) }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func internal @internal_external_func() }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func internal @internal_external_func() }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func internal @internal_external_func() }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func internal @internal_external_func() }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func common @common_linkage_func() }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func common @common_linkage_func() }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func common @common_linkage_func() }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func common @common_linkage_func() }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { llvm.func cc_12 @unknown_calling_convention() }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { llvm.func cc_12 @unknown_calling_convention() }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { llvm.func cc_12 @unknown_calling_convention() }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { llvm.func cc_12 @unknown_calling_convention() }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "module { ""llvm.func""() ({ }) {sym_name = ""generic_unknown_calling_convention"", CConv = #llvm.cconv, function_type = !llvm.func} : () -> () }", mlir-opt -split-input-file -verify-diagnostics | mlir-opt ,1 "module { ""llvm.func""() ({ }) {sym_name = ""generic_unknown_calling_convention"", CConv = #llvm.cconv, function_type = !llvm.func} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic ,1 "module { ""llvm.func""() ({ }) {sym_name = ""generic_unknown_calling_convention"", CConv = #llvm.cconv, function_type = !llvm.func} : () -> () }", mlir-opt -split-input-file -verify-diagnostics -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo ,1 "module { ""llvm.func""() ({ }) {sym_name = ""generic_unknown_calling_convention"", CConv = #llvm.cconv, function_type = !llvm.func} : () -> () }", mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @global(42 : i64) : i64 llvm.mlir.global internal constant @"".string""(""foobar"") : !llvm.array<6 x i8> func.func @references() { %0 = llvm.mlir.addressof @global : !llvm.ptr %1 = llvm.mlir.addressof @"".string"" : !llvm.ptr> llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @foo(0: i32) : i32 func.func @bar() { llvm.mlir.addressof @foo : !llvm.ptr llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.func @foo() llvm.func @bar() { llvm.mlir.addressof @foo : !llvm.ptr llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @g(32 : i64) {addr_space = 3: i32} : i64 func.func @mismatch_addr_space() { llvm.mlir.addressof @g : !llvm.ptr llvm.return }", mlir-opt -split-input-file -verify-diagnostics ,1 "llvm.func @basic_struct() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @basic_array() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.array<10 x i32> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<10 x i32> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @multi_level_direct() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, struct<""bar"", (i8, array<10 x array<10 x i32>>, i8)>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2, 1, 5, 8] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, struct<""bar"", (i8, array<10 x array<10 x i32>>, i8)>)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @multi_level_direct_two_applications() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, array<10 x i32>, i8)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, array<10 x i32>, i8)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @multi_level_indirect() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, struct<""bar"", (i8, array<10 x array<10 x i32>>, i8)>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2, 1, 5] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, struct<""bar"", (i8, array<10 x array<10 x i32>>, i8)>)> %3 = llvm.getelementptr inbounds %2[0, 8] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<10 x i32> %4 = llvm.load %3 : !llvm.ptr -> i32 llvm.return %4 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @resolve_alias(%arg: i32) -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.getelementptr inbounds %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> llvm.store %arg, %2 : i32, !llvm.ptr %4 = llvm.load %3 : !llvm.ptr -> i32 llvm.return %4 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @no_non_single_support() -> i32 { %0 = llvm.mlir.constant(2 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr inbounds %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @no_pointer_indexing() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr %1[1, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @no_direct_use() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.call @use(%1) : (!llvm.ptr) -> () llvm.return %3 : i32 } llvm.func @use(!llvm.ptr)"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @direct_promotable_use_is_fine() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.intr.lifetime.start 2, %1 : !llvm.ptr llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @direct_promotable_use_is_fine_on_accessor() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.struct<""foo"", (i32, f64, i32)> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr %1[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<""foo"", (i32, f64, i32)> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.intr.lifetime.start 2, %2 : !llvm.ptr llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @no_dynamic_indexing(%arg: i32) -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.array<10 x i32> {alignment = 8 : i64} : (i32) -> !llvm.ptr %2 = llvm.getelementptr %1[0, %arg] : (!llvm.ptr, i32) -> !llvm.ptr, !llvm.array<10 x i32> %3 = llvm.load %2 : !llvm.ptr -> i32 llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "llvm.func @no_typed_pointers() -> i32 { %0 = llvm.mlir.constant(1 : i32) : i32 %1 = llvm.alloca %0 x !llvm.array<10 x i32> {alignment = 8 : i64} : (i32) -> !llvm.ptr> %2 = llvm.getelementptr %1[0, 1] : (!llvm.ptr>) -> !llvm.ptr %3 = llvm.load %2 : !llvm.ptr llvm.return %3 : i32 }"," mlir-opt --pass-pipeline=""builtin.module(llvm.func(sroa))"" --split-input-file ",1 "func.func @scf_for_yield_only( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { scf.yield %t : tensor } %r1 = scf.for %i = %lb to %ub step %step iter_args(%t = %B) -> (tensor) { scf.yield %t : tensor } return %r0, %r1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_for_with_tensor.insert_slice( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = false}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttA, %ttB : tensor, tensor } return %r0#0, %r0#1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @some_use(tensor) -> () func.func @scf_for_deps( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor) { %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { func.call @some_use(%t) : (tensor) -> () scf.yield %t : tensor } %r1 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { func.call @some_use(%t) : (tensor) -> () scf.yield %t : tensor } return %r1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @reading_scf_for(%t1: tensor {bufferization.writable = true}, %s: index, %v: vector<5xf32>) -> (tensor, vector<5xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %t3 = vector.transfer_write %v, %t1[%s] : vector<5xf32>, tensor %r, %v3 = scf.for %i = %c0 to %s step %c1 iter_args(%t2 = %t1, %v0 = %v) -> (tensor, vector<5xf32>) { %e = tensor.extract_slice %t2[%s][%s][1] : tensor to tensor %v2 = vector.transfer_read %e[%s], %cst : tensor, vector<5xf32> scf.yield %t2, %v2 : tensor, vector<5xf32> } %o = linalg.generic #trait outs (%t3 : tensor) { ^bb(%0: f32) : linalg.yield %cst : f32 } -> (tensor) return %o, %v3 : tensor, vector<5xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @non_reading_scf_for(%t1: tensor {bufferization.writable = true}, %s: index, %v: vector<5xf32>) -> (tensor, vector<5xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cst = arith.constant 0.0 : f32 %t3 = vector.transfer_write %v, %t1[%s] : vector<5xf32>, tensor %r, %v3 = scf.for %i = %c0 to %c10 step %c1 iter_args(%t2 = %t1, %v0 = %v) -> (tensor, vector<5xf32>) { %o2 = linalg.generic #trait outs (%t2 : tensor) { ^bb(%0: f32) : linalg.yield %cst : f32 } -> (tensor) %v2 = vector.transfer_read %o2[%s], %cst : tensor, vector<5xf32> scf.yield %o2, %v2 : tensor, vector<5xf32> } %o = linalg.generic #trait outs (%t3 : tensor) { ^bb(%0: f32) : linalg.yield %cst : f32 } -> (tensor) return %o, %v3 : tensor, vector<5xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_inplace1(%t1: tensor {bufferization.writable = true}, %t2: tensor {bufferization.writable = true}, %cond: i1) -> tensor { %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { scf.yield %t2 : tensor } return %r : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_inplace2(%t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index, %cond: i1) -> tensor { %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { %t2 = vector.transfer_write %v, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } return %r : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_inplace3(%t1: tensor {bufferization.writable = true}, %v1: vector<5xf32>, %v2: vector<5xf32>, %idx: index, %cond: i1) -> tensor { %e = tensor.extract_slice %t1[%idx][%idx][1] : tensor to tensor %r = scf.if %cond -> (tensor) { %t2 = vector.transfer_write %v1, %e[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } else { %t3 = vector.transfer_write %v2, %t1[%idx] : vector<5xf32>, tensor scf.yield %t3 : tensor } return %r : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_in_place4(%t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index, %cond: i1, %cond2: i1) -> (tensor, vector<10xf32>) { %cst = arith.constant 0.0 : f32 %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { %t2 = vector.transfer_write %v, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } %r_alias = scf.if %cond2 -> (tensor) { scf.yield %r : tensor } else { scf.yield %r : tensor } %v2 = vector.transfer_read %r_alias[%idx], %cst : tensor, vector<10xf32> return %r_alias, %v2 : tensor, vector<10xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_inplace5(%t1: tensor {bufferization.writable = true}, %idx: index, %cond: i1) -> tensor { %r = scf.if %cond -> (tensor) { %e = tensor.extract_slice %t1[%idx][%idx][1] : tensor to tensor scf.yield %e : tensor } else { %f = tensor.extract_slice %t1[%idx][%idx][1] : tensor to tensor scf.yield %f : tensor } %r2 = tensor.insert_slice %r into %t1[%idx][%idx][1] : tensor into tensor return %r2 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_inplace6(%t1: tensor {bufferization.writable = true}, %v1: vector<5xf32>, %v2: vector<5xf32>, %v3: vector<5xf32>, %idx: index, %cond: i1, %cond2: i1) -> tensor { %r = scf.if %cond -> (tensor) { %t2 = scf.if %cond2 -> (tensor) { %t3 = vector.transfer_write %v1, %t1[%idx] : vector<5xf32>, tensor scf.yield %t3 : tensor } else { %t4 = vector.transfer_write %v3, %t1[%idx] : vector<5xf32>, tensor scf.yield %t4 : tensor } scf.yield %t2 : tensor } else { %t3 = vector.transfer_write %v2, %t1[%idx] : vector<5xf32>, tensor scf.yield %t3 : tensor } return %r : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_inplace7(%t1: tensor {bufferization.writable = true}, %v1: vector<5xf32>, %v2: vector<5xf32>, %idx: index, %idx2: index, %cond: i1) -> (tensor, vector<5xf32>) { %cst = arith.constant 0.0 : f32 %r, %v_r2 = scf.if %cond -> (tensor, vector<5xf32>) { %t2 = vector.transfer_write %v1, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2, %v1 : tensor, vector<5xf32> } else { %t3 = vector.transfer_write %v2, %t1[%idx] : vector<5xf32>, tensor %v_r = vector.transfer_read %t1[%idx2], %cst : tensor, vector<5xf32> scf.yield %t3, %v_r : tensor, vector<5xf32> } return %r, %v_r2 : tensor, vector<5xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_out_of_place1a(%t1: tensor {bufferization.writable = true}, %idx: index, %idx2: index, %cond: i1) -> tensor { %r = scf.if %cond -> (tensor) { %e = tensor.extract_slice %t1[%idx][%idx][1] : tensor to tensor scf.yield %e : tensor } else { scf.yield %t1 : tensor } %r2 = tensor.insert_slice %r into %t1[%idx2][%idx2][1] : tensor into tensor return %r2 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_out_of_place1b(%t1: tensor {bufferization.writable = true}, %idx: index, %idx2: index, %idx3: index, %cond: i1) -> tensor { %r = scf.if %cond -> (tensor) { %e = tensor.extract_slice %t1[%idx][%idx][1] : tensor to tensor scf.yield %e : tensor } else { %f = tensor.extract_slice %t1[%idx2][%idx2][1] : tensor to tensor scf.yield %f : tensor } %r2 = tensor.insert_slice %r into %t1[%idx3][%idx3][1] : tensor into tensor return %r2 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_out_of_place1c(%t1: tensor {bufferization.writable = true}, %idx: index, %idx2: index, %cond: i1) -> tensor { %r = scf.if %cond -> (tensor) { %e = tensor.extract_slice %t1[%idx][%idx][1] : tensor to tensor scf.yield %e : tensor } else { %f = tensor.extract_slice %t1[%idx2][%idx2][1] : tensor to tensor scf.yield %f : tensor } %r2 = tensor.insert_slice %r into %t1[%idx2][%idx2][1] : tensor into tensor return %r2 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_out_of_place2(%t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index, %cond: i1) -> (tensor, vector<10xf32>) { %cst = arith.constant 0.0 : f32 %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { %t2 = vector.transfer_write %v, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } %v2 = vector.transfer_read %t1[%idx], %cst : tensor, vector<10xf32> return %r, %v2 : tensor, vector<10xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @scf_if_out_of_place3(%t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index, %cond: i1, %cond2: i1) -> (tensor, vector<10xf32>) { %cst = arith.constant 0.0 : f32 %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { %t2 = vector.transfer_write %v, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } %t1_alias = scf.if %cond2 -> (tensor) { scf.yield %t1 : tensor } else { scf.yield %t1 : tensor } %v2 = vector.transfer_read %t1_alias[%idx], %cst : tensor, vector<10xf32> return %r, %v2 : tensor, vector<10xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_to_same_tensor_in_loop_in_place( %A : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index, %sz: index) -> (tensor) { %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { %B = bufferization.alloc_tensor(%sz) : tensor %i2 = arith.index_cast %i : index to i32 %i3 = arith.sitofp %i2 : i32 to f32 %B2 = tensor.insert %i3 into %B[%i] : tensor %A2 = tensor.insert_slice %B2 into %t[%i][%sz][1] : tensor into tensor scf.yield %A2 : tensor } return %r0 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @same_enclosing_repetitive_region(%2: tensor<320xf32>, %3: tensor<320x10240xf32>) -> tensor<320xf32> { %c0 = arith.constant 0 : index %cst = arith.constant -0.000000e+00 : f32 %c320 = arith.constant 320 : index %4 = scf.forall (%arg0) in (%c320) shared_outs(%arg1 = %2) -> (tensor<320xf32>) { %5 = tensor.extract_slice %3[%arg0, 0] [1, 10240] [1, 1] : tensor<320x10240xf32> to tensor<1x10240xf32> %6 = tensor.extract_slice %arg1[%arg0] [1] [1] : tensor<320xf32> to tensor<1xf32> %7 = linalg.fill ins(%cst : f32) outs(%6 : tensor<1xf32>) -> tensor<1xf32> %8 = linalg.fill ins(%cst : f32) outs(%7 : tensor<1xf32>) -> tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %arg1[%arg0] [1] [1] : tensor<1xf32> into tensor<320xf32> } } return %4 : tensor<320xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @different_repetitive_region_via_alias(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>, %arg2: index, %arg3: index, %arg4: index) -> (tensor<4xf32>) { %cst = arith.constant 0.000000e+00 : f32 %cst2 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<4xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<4xf32>) -> tensor<4xf32> %2 = scf.for %arg5 = %arg2 to %arg3 step %arg4 iter_args(%arg6 = %arg1) -> (tensor<4xf32>) { %4 = tensor.extract %1[%arg4] : tensor<4xf32> vector.print %4 : f32 %5 = linalg.fill ins(%cst2 : f32) outs(%0 : tensor<4xf32>) -> tensor<4xf32> scf.yield %5 : tensor<4xf32> } return %2 : tensor<4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @no_raw_conflict_after_repetitive_use(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>, %arg2: index, %arg3: index, %arg4: index) -> (tensor<4xf32>, tensor<4xf32>) { %cst = arith.constant 0.000000e+00 : f32 %cst2 = arith.constant 1.000000e+00 : f32 %cst3 = arith.constant 2.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<4xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<4xf32>) -> tensor<4xf32> %2 = scf.for %arg5 = %arg2 to %arg3 step %arg4 iter_args(%arg6 = %arg1) -> (tensor<4xf32>) { %4 = tensor.extract %1[%arg4] : tensor<4xf32> vector.print %4 : f32 %5 = linalg.fill ins(%cst2 : f32) outs(%1 : tensor<4xf32>) -> tensor<4xf32> scf.yield %5 : tensor<4xf32> } %6 = tensor.extract %1[%arg4] : tensor<4xf32> vector.print %6 : f32 %7 = linalg.fill ins(%cst3 : f32) outs(%1 : tensor<4xf32>) -> tensor<4xf32> return %2, %7 : tensor<4xf32>, tensor<4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @read_of_bbarg_in_repetitive_region( %t: tensor<10xf32>, %a: index, %b: index, %c: index, %cst: f32) { scf.for %iv = %a to %b step %c { %2 = tensor.extract_slice %t[0][4][1] : tensor<10xf32> to tensor<4xf32> %3 = tensor.extract %2[%a] : tensor<4xf32> vector.print %3 : f32 %4 = tensor.insert %cst into %2[%a] : tensor<4xf32> %5 = tensor.extract %4[%a] : tensor<4xf32> vector.print %5 : f32 } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @read_definition_in_same_repetitive_region_as_write( %t: tensor<10xf32>, %a: index, %b: index, %c: index, %cst: f32) { %1 = tensor.insert %cst into %t[%a] : tensor<10xf32> scf.for %iv = %a to %b step %c { %2 = tensor.extract_slice %1[0][4][1] : tensor<10xf32> to tensor<4xf32> %3 = tensor.extract %2[%a] : tensor<4xf32> vector.print %3 : f32 } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @read_definition_in_same_repetitive_region_as_conflicting_write( %t: tensor<10xf32>, %a: index, %b: index, %c: index, %cst: f32) { %1 = tensor.insert %cst into %t[%a] : tensor<10xf32> scf.for %iv = %a to %b step %c { %2 = tensor.extract_slice %t[0][4][1] : tensor<10xf32> to tensor<4xf32> %3 = tensor.extract %2[%a] : tensor<4xf32> vector.print %3 : f32 } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_value_in_repetitive_region( %t: tensor<10xf32>, %a: index, %b: index, %c: index, %cst: f32) { %0 = tensor.extract %t[%a] : tensor<10xf32> vector.print %0 : f32 scf.for %iv = %a to %b step %c { %2 = tensor.extract_slice %t[0][4][1] : tensor<10xf32> to tensor<4xf32> %filled = linalg.fill ins(%cst : f32) outs(%2 : tensor<4xf32>) -> tensor<4xf32> %3 = tensor.extract %filled[%a] : tensor<4xf32> vector.print %3 : f32 } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @nesting_op_repetitive_regions( %t: tensor<10xf32>, %a: index, %b: index, %c: index, %cst: f32) { %1 = tensor.insert %cst into %t[%a] : tensor<10xf32> scf.for %iv1 = %a to %b step %c { scf.for %iv2 = %a to %b step %c { scf.for %iv3 = %a to %b step %c { %2 = tensor.extract_slice %t[0][4][1] : tensor<10xf32> to tensor<4xf32> %3 = tensor.extract %2[%a] : tensor<4xf32> vector.print %3 : f32 } } } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @if_no_else(%cond: i1, %a: index, %b: memref, %c: i8) { scf.if %cond { ""some_op""(%cond, %b) : (i1, memref) -> () scf.yield } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %if = transform.structured.match ops{[""scf.if""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.scf.take_assumed_branch %if take_else_branch : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics --allow-unregistered-dialect ,1 "func.func @if_no_else(%cond: i1, %a: index, %b: memref, %c: i8) { scf.if %cond { ""some_op""(%cond, %b) : (i1, memref) -> () scf.yield } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %if = transform.structured.match ops{[""scf.if""]} in %arg1 : (!transform.any_op) -> !transform.any_op %some_op = transform.structured.match ops{[""some_op""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.scf.take_assumed_branch %if : (!transform.any_op) -> () transform.print %some_op: !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics --allow-unregistered-dialect ,1 "func.func @tile_tensor_pad( %arg0 : tensor, %cst : f32, %low: index, %high: index) -> tensor<20x40xf32> { %0 = tensor.pad %arg0 nofold low[%low, %low] high[%high, %high] { ^bb0(%arg9: index, %arg10: index): tensor.yield %cst : f32 } : tensor to tensor<20x40xf32> return %0 : tensor<20x40xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.tile_to_forall_op %0 tile_sizes[1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %if = transform.structured.match ops{[""scf.if""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.scf.take_assumed_branch %if take_else_branch : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics --allow-unregistered-dialect ,1 "func.func @scf_for(%a: index, %b: index, %c: index) { scf.for %iv = %a to %b step %c { %0 = ""test.reify_bound""(%iv) {type = ""LB""} : (index) -> (index) %1 = ""test.reify_bound""(%iv) {type = ""UB""} : (index) -> (index) ""test.some_use""(%0, %1) : (index, index) -> () } return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @scf_for_index_result_small(%i: index, %a: index, %b: index, %c: index) { %0 = scf.for %iv = %a to %b step %c iter_args(%arg = %i) -> index { %1 = ""test.reify_bound""(%arg) {type = ""EQ""} : (index) -> (index) ""test.some_use""(%1) : (index) -> () scf.yield %arg : index } %2 = ""test.reify_bound""(%0) {type = ""EQ""} : (index) -> (index) ""test.some_use""(%2) : (index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @scf_for_index_result(%i: index, %a: index, %b: index, %c: index) { %0 = scf.for %iv = %a to %b step %c iter_args(%arg = %i) -> index { %add = arith.addi %arg, %a : index %sub = arith.subi %add, %a : index %1 = ""test.reify_bound""(%arg) {type = ""EQ""} : (index) -> (index) ""test.some_use""(%1) : (index) -> () scf.yield %sub : index } %2 = ""test.reify_bound""(%0) {type = ""EQ""} : (index) -> (index) ""test.some_use""(%2) : (index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @scf_for_tensor_result_small(%t: tensor, %a: index, %b: index, %c: index) { %0 = scf.for %iv = %a to %b step %c iter_args(%arg = %t) -> tensor { %1 = ""test.reify_bound""(%arg) {type = ""EQ"", dim = 0} : (tensor) -> (index) ""test.some_use""(%1) : (index) -> () scf.yield %arg : tensor } %2 = ""test.reify_bound""(%0) {type = ""EQ"", dim = 0} : (tensor) -> (index) ""test.some_use""(%2) : (index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @scf_for_tensor_result(%t: tensor, %a: index, %b: index, %c: index) { %cst = arith.constant 5.0 : f32 %0 = scf.for %iv = %a to %b step %c iter_args(%arg = %t) -> tensor { %filled = linalg.fill ins(%cst : f32) outs(%arg : tensor) -> tensor %1 = ""test.reify_bound""(%arg) {type = ""EQ"", dim = 0} : (tensor) -> (index) ""test.some_use""(%1) : (index) -> () scf.yield %filled : tensor } %2 = ""test.reify_bound""(%0) {type = ""EQ"", dim = 0} : (tensor) -> (index) ""test.some_use""(%2) : (index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @scf_for_swapping_yield(%t1: tensor, %t2: tensor, %a: index, %b: index, %c: index) { %cst = arith.constant 5.0 : f32 %r1, %r2 = scf.for %iv = %a to %b step %c iter_args(%arg1 = %t1, %arg2 = %t2) -> (tensor, tensor) { %filled1 = linalg.fill ins(%cst : f32) outs(%arg1 : tensor) -> tensor %filled2 = linalg.fill ins(%cst : f32) outs(%arg2 : tensor) -> tensor scf.yield %filled2, %filled1 : tensor, tensor } %reify1 = ""test.reify_bound""(%r1) {type = ""EQ"", dim = 0} : (tensor) -> (index) ""test.some_use""(%reify1) : (index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %A: memref, %B: memref, %C: memref, %result: memref) { scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %arg5) { %B_elem = memref.load %B[%i0, %i1] : memref %C_elem = memref.load %C[%i0, %i1] : memref %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %result[%i0, %i1] : memref } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4 no-min-max-bounds=true}))' -split-input-file ",1 "func.func @static_loop_with_step() { %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c22 = arith.constant 22 : index %c24 = arith.constant 24 : index scf.parallel (%i0, %i1) = (%c0, %c0) to (%c22, %c24) step (%c3, %c3) { } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4 no-min-max-bounds=true}))' -split-input-file ",1 "func.func @tile_nested_innermost() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { } } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4 no-min-max-bounds=true}))' -split-input-file ",1 "func.func @tile_nested_in_non_ploop() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index scf.for %i = %c0 to %c2 step %c1 { scf.for %j = %c0 to %c2 step %c1 { scf.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { } } } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4 no-min-max-bounds=true}))' -split-input-file ",1 "func.func @coalesce_inner() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c0 to %c10 step %c1 { scf.for %j = %c0 to %c10 step %c1 { scf.for %k = %i to %j step %c1 { scf.for %l = %i to %j step %c1 { arith.addi %i, %j : index } } {coalesce} } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""scf.for""]} attributes {coalesce} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.cast %0 : !transform.any_op to !transform.op<""scf.for""> %2 = transform.loop.coalesce %1: (!transform.op<""scf.for"">) -> (!transform.op<""scf.for"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @coalesce_outer(%arg1: memref<64x64xf32, 1>, %arg2: memref<64x64xf32, 1>, %arg3: memref<64x64xf32, 1>) attributes {} { affine.for %arg4 = 0 to 64 { affine.for %arg5 = 0 to 64 { %0 = affine.load %arg1[%arg4, %arg5] : memref<64x64xf32, 1> %1 = affine.load %arg2[%arg4, %arg5] : memref<64x64xf32, 1> %2 = arith.addf %0, %1 : f32 affine.store %2, %arg3[%arg4, %arg5] : memref<64x64xf32, 1> } } {coalesce} return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""affine.for""]} attributes {coalesce} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.cast %0 : !transform.any_op to !transform.op<""affine.for""> %2 = transform.loop.coalesce %1 : (!transform.op<""affine.for"">) -> (!transform.op<""affine.for"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @coalesce_and_unroll(%arg1: memref<64x64xf32, 1>, %arg2: memref<64x64xf32, 1>, %arg3: memref<64x64xf32, 1>) attributes {} { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c64 = arith.constant 64 : index scf.for %arg4 = %c0 to %c64 step %c1 { scf.for %arg5 = %c0 to %c64 step %c1 { %0 = memref.load %arg1[%arg4, %arg5] : memref<64x64xf32, 1> %1 = memref.load %arg2[%arg4, %arg5] : memref<64x64xf32, 1> %2 = arith.addf %0, %1 : f32 memref.store %2, %arg3[%arg4, %arg5] : memref<64x64xf32, 1> } } {coalesce} return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""scf.for""]} attributes {coalesce} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.cast %0 : !transform.any_op to !transform.op<""scf.for""> %2 = transform.loop.coalesce %1 : (!transform.op<""scf.for"">) -> (!transform.op<""scf.for"">) transform.loop.unroll %2 {factor = 3} : !transform.op<""scf.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @single_iteration_some(%A: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c7 = arith.constant 7 : index %c10 = arith.constant 10 : index scf.parallel (%i0, %i1, %i2) = (%c0, %c3, %c7) to (%c1, %c6, %c10) step (%c1, %c2, %c3) { %c42 = arith.constant 42 : i32 memref.store %c42, %A[%i0, %i1, %i2] : memref scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @single_iteration_all(%A: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c7 = arith.constant 7 : index %c10 = arith.constant 10 : index scf.parallel (%i0, %i1, %i2) = (%c0, %c3, %c7) to (%c1, %c6, %c10) step (%c1, %c3, %c3) { %c42 = arith.constant 42 : i32 memref.store %c42, %A[%i0, %i1, %i2] : memref scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @single_iteration_reduce(%A: index, %B: index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %0:2 = scf.parallel (%i0, %i1) = (%c1, %c3) to (%c2, %c6) step (%c1, %c3) init(%A, %B) -> (index, index) { scf.reduce(%i0) : index { ^bb0(%lhs: index, %rhs: index): %1 = arith.addi %lhs, %rhs : index scf.reduce.return %1 : index } scf.reduce(%i1) : index { ^bb0(%lhs: index, %rhs: index): %2 = arith.muli %lhs, %rhs : index scf.reduce.return %2 : index } scf.yield } return %0#0, %0#1 : index, index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @nested_parallel(%0: memref) -> memref { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %1 = memref.dim %0, %c0 : memref %2 = memref.dim %0, %c1 : memref %3 = memref.dim %0, %c2 : memref %4 = memref.alloc(%1, %2, %3) : memref scf.parallel (%arg1) = (%c0) to (%1) step (%c1) { scf.parallel (%arg2) = (%c0) to (%2) step (%c1) { scf.parallel (%arg3) = (%c0) to (%3) step (%c1) { %5 = memref.load %0[%arg1, %arg2, %arg3] : memref memref.store %5, %4[%arg1, %arg2, %arg3] : memref scf.yield } scf.yield } scf.yield } return %4 : memref }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @side_effect() func.func @one_unused(%cond: i1) -> (index) { %0, %1 = scf.if %cond -> (index, index) { func.call @side_effect() : () -> () %c0 = ""test.value0""() : () -> (index) %c1 = ""test.value1""() : () -> (index) scf.yield %c0, %c1 : index, index } else { %c2 = ""test.value2""() : () -> (index) %c3 = ""test.value3""() : () -> (index) scf.yield %c2, %c3 : index, index } return %1 : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @side_effect() func.func @nested_unused(%cond1: i1, %cond2: i1) -> (index) { %0, %1 = scf.if %cond1 -> (index, index) { %2, %3 = scf.if %cond2 -> (index, index) { func.call @side_effect() : () -> () %c0 = ""test.value0""() : () -> (index) %c1 = ""test.value1""() : () -> (index) scf.yield %c0, %c1 : index, index } else { %c2 = ""test.value2""() : () -> (index) %c3 = ""test.value3""() : () -> (index) scf.yield %c2, %c3 : index, index } scf.yield %2, %3 : index, index } else { %c0 = ""test.value0_2""() : () -> (index) %c1 = ""test.value1_2""() : () -> (index) scf.yield %c0, %c1 : index, index } return %1 : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @side_effect() func.func @all_unused(%cond: i1) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0, %1 = scf.if %cond -> (index, index) { func.call @side_effect() : () -> () scf.yield %c0, %c1 : index, index } else { func.call @side_effect() : () -> () scf.yield %c0, %c1 : index, index } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @empty_if1(%cond: i1) { scf.if %cond { scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @empty_if2(%cond: i1) { scf.if %cond { scf.yield } else { scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @empty_else(%cond: i1, %v : memref) { scf.if %cond { memref.store %cond, %v[] : memref } else { } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @to_select1(%cond: i1) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = scf.if %cond -> index { scf.yield %c0 : index } else { scf.yield %c1 : index } return %0 : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @to_select_same_val(%cond: i1) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0, %1 = scf.if %cond -> (index, index) { scf.yield %c0, %c1 : index, index } else { scf.yield %c1, %c1 : index, index } return %0, %1 : index, index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @to_select_with_body(%cond: i1) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = scf.if %cond -> index { ""test.op""() : () -> () scf.yield %c0 : index } else { scf.yield %c1 : index } return %0 : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @to_select2(%cond: i1) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %0, %1 = scf.if %cond -> (index, index) { scf.yield %c0, %c1 : index, index } else { scf.yield %c2, %c3 : index, index } return %0, %1 : index, index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @make_i32() -> i32 func.func @for_yields_2(%lb : index, %ub : index, %step : index) -> i32 { %a = call @make_i32() : () -> (i32) %b = scf.for %i = %lb to %ub step %step iter_args(%0 = %a) -> i32 { scf.yield %0 : i32 } return %b : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @make_i32() -> i32 func.func @for_yields_3(%lb : index, %ub : index, %step : index) -> (i32, i32, i32) { %a = call @make_i32() : () -> (i32) %b = call @make_i32() : () -> (i32) %r:3 = scf.for %i = %lb to %ub step %step iter_args(%0 = %a, %1 = %a, %2 = %b) -> (i32, i32, i32) { %c = func.call @make_i32() : () -> (i32) scf.yield %0, %c, %2 : i32, i32, i32 } {some_attr} return %r#0, %r#1, %r#2 : i32, i32, i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @for_yields_4() -> i32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %a = arith.constant 3 : i32 %b = arith.constant 4 : i32 %r = scf.for %i = %c0 to %c2 step %c1 iter_args(%0 = %a) -> i32 { scf.yield %b : i32 } return %r : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_true_if() { %true = arith.constant true scf.if %true { ""test.op""() : () -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @remove_false_if() { %false = arith.constant false scf.if %false { ""test.op""() : () -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_true_if_with_values() { %true = arith.constant true %0 = scf.if %true -> (i32) { %1 = ""test.op""() : () -> i32 scf.yield %1 : i32 } else { %2 = ""test.other_op""() : () -> i32 scf.yield %2 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_false_if_with_values() { %false = arith.constant false %0 = scf.if %false -> (i32) { %1 = ""test.op""() : () -> i32 scf.yield %1 : i32 } else { %2 = ""test.other_op""() : () -> i32 scf.yield %2 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @merge_nested_if(%arg0: i1, %arg1: i1) { scf.if %arg0 { scf.if %arg1 { ""test.op""() : () -> () scf.yield } scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @merge_yielding_nested_if(%arg0: i1, %arg1: i1) -> (i32, f32, i32, i8) { %0 = ""test.op""() : () -> (i32) %1 = ""test.op1""() : () -> (f32) %2 = ""test.op2""() : () -> (i32) %3 = ""test.op3""() : () -> (i8) %r:4 = scf.if %arg0 -> (i32, f32, i32, i8) { %a:2 = scf.if %arg1 -> (i32, f32) { %i = ""test.inop""() : () -> (i32) %i1 = ""test.inop1""() : () -> (f32) scf.yield %i, %i1 : i32, f32 } else { scf.yield %2, %1 : i32, f32 } scf.yield %0, %a#1, %a#0, %3 : i32, f32, i32, i8 } else { scf.yield %0, %1, %2, %3 : i32, f32, i32, i8 } return %r#0, %r#1, %r#2, %r#3 : i32, f32, i32, i8 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @merge_yielding_nested_if_nv1(%arg0: i1, %arg1: i1) { %0 = ""test.op""() : () -> (i32) %1 = ""test.op1""() : () -> (f32) scf.if %arg0 { %a:2 = scf.if %arg1 -> (i32, f32) { %i = ""test.inop""() : () -> (i32) %i1 = ""test.inop1""() : () -> (f32) scf.yield %i, %i1 : i32, f32 } else { scf.yield %0, %1 : i32, f32 } } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @merge_yielding_nested_if_nv2(%arg0: i1, %arg1: i1) -> i32 { %0 = ""test.op""() : () -> (i32) %1 = ""test.op1""() : () -> (i32) %r = scf.if %arg0 -> i32 { scf.if %arg1 { ""test.run""() : () -> () } scf.yield %0 : i32 } else { scf.yield %1 : i32 } return %r : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @merge_fail_yielding_nested_if(%arg0: i1, %arg1: i1) -> (i32, f32, i32, i8) { %0 = ""test.op""() : () -> (i32) %1 = ""test.op1""() : () -> (f32) %2 = ""test.op2""() : () -> (i32) %3 = ""test.op3""() : () -> (i8) %r:4 = scf.if %arg0 -> (i32, f32, i32, i8) { %a:2 = scf.if %arg1 -> (i32, f32) { %i = ""test.inop""() : () -> (i32) %i1 = ""test.inop1""() : () -> (f32) scf.yield %i, %i1 : i32, f32 } else { scf.yield %0, %1 : i32, f32 } scf.yield %0, %a#1, %a#0, %3 : i32, f32, i32, i8 } else { scf.yield %0, %1, %2, %3 : i32, f32, i32, i8 } return %r#0, %r#1, %r#2, %r#3 : i32, f32, i32, i8 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @if_condition_swap(%cond: i1) -> index { %true = arith.constant true %not = arith.xori %cond, %true : i1 %0 = scf.if %not -> (index) { %1 = ""test.origTrue""() : () -> index scf.yield %1 : index } else { %1 = ""test.origFalse""() : () -> index scf.yield %1 : index } return %0 : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @remove_zero_iteration_loop() { %c42 = arith.constant 42 : index %c1 = arith.constant 1 : index %init = ""test.init""() : () -> i32 %0 = scf.for %i = %c42 to %c1 step %c1 iter_args(%arg = %init) -> (i32) { %1 = ""test.op""(%i, %arg) : (index, i32) -> i32 scf.yield %1 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @remove_zero_iteration_loop_vals(%arg0: index) { %c2 = arith.constant 2 : index %init = ""test.init""() : () -> i32 %0 = scf.for %i = %arg0 to %arg0 step %c2 iter_args(%arg = %init) -> (i32) { %1 = ""test.op""(%i, %arg) : (index, i32) -> i32 scf.yield %1 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_single_iteration_loop_1() { %c42 = arith.constant 42 : index %c43 = arith.constant 43 : index %c1 = arith.constant 1 : index %init = ""test.init""() : () -> i32 %0 = scf.for %i = %c42 to %c43 step %c1 iter_args(%arg = %init) -> (i32) { %1 = ""test.op""(%i, %arg) : (index, i32) -> i32 scf.yield %1 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_single_iteration_loop_2() { %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %c11 = arith.constant 11 : index %init = ""test.init""() : () -> i32 %0 = scf.for %i = %c5 to %c11 step %c6 iter_args(%arg = %init) -> (i32) { %1 = ""test.op""(%i, %arg) : (index, i32) -> i32 scf.yield %1 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_single_iteration_loop_non_unit_step() { %c42 = arith.constant 42 : index %c47 = arith.constant 47 : index %c5 = arith.constant 5 : index %init = ""test.init""() : () -> i32 %0 = scf.for %i = %c42 to %c47 step %c5 iter_args(%arg = %init) -> (i32) { %1 = ""test.op""(%i, %arg) : (index, i32) -> i32 scf.yield %1 : i32 } ""test.consume""(%0) : (i32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_single_iteration_const_diff(%arg0 : index) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %5 = arith.addi %arg0, %c1 : index scf.for %arg2 = %arg0 to %5 step %c1 { %7 = arith.muli %c2, %arg2 : index ""test.consume""(%7) : (index) -> () } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @remove_empty_parallel_loop(%lb: index, %ub: index, %s: index) { %init = ""test.init""() : () -> f32 %0 = scf.parallel (%i, %j, %k) = (%lb, %ub, %lb) to (%ub, %ub, %ub) step (%s, %s, %s) init(%init) -> f32 { %1 = ""test.produce""() : () -> f32 scf.reduce(%1) : f32 { ^bb0(%lhs: f32, %rhs: f32): %2 = ""test.transform""(%lhs, %rhs) : (f32, f32) -> f32 scf.reduce.return %2 : f32 } scf.yield } ""test.consume""(%0) : (f32) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @process(%0 : memref<128x128xf32>) func.func private @process_tensor(%0 : tensor<128x128xf32>) -> memref<128x128xf32> func.func @last_value(%t0: tensor<128x128xf32>, %t1: tensor<128x128xf32>, %t2: tensor<128x128xf32>, %m0: memref<128x128xf32>, %lb : index, %ub : index, %step : index) -> (tensor<128x128xf32>, tensor<128x128xf32>, tensor<128x128xf32>) { %0:3 = scf.for %arg0 = %lb to %ub step %step iter_args(%arg1 = %t0, %arg2 = %t1, %arg3 = %t2) -> (tensor<128x128xf32>, tensor<128x128xf32>, tensor<128x128xf32>) { %m1 = bufferization.to_memref %arg2 : memref<128x128xf32> func.call @process(%m0) : (memref<128x128xf32>) -> () func.call @process(%m1) : (memref<128x128xf32>) -> () %m2 = func.call @process_tensor(%arg3): (tensor<128x128xf32>) -> memref<128x128xf32> %3 = bufferization.to_tensor %m2 : memref<128x128xf32> %1 = bufferization.to_tensor %m0 : memref<128x128xf32> %2 = bufferization.to_tensor %m1 : memref<128x128xf32> scf.yield %1, %2, %3 : tensor<128x128xf32>, tensor<128x128xf32>, tensor<128x128xf32> } return %0#0, %0#1, %0#2 : tensor<128x128xf32>, tensor<128x128xf32>, tensor<128x128xf32> }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_away_iter_with_no_use_and_yielded_input(%arg0 : i32, %ub : index, %lb : index, %step : index) -> (i32, i32) { %cst = arith.constant 32 : i32 %0:2 = scf.for %arg1 = %lb to %ub step %step iter_args(%arg2 = %arg0, %arg3 = %cst) -> (i32, i32) { %1 = arith.addi %arg2, %cst : i32 scf.yield %1, %cst : i32, i32 } return %0#0, %0#1 : i32, i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_away_iter_and_result_with_no_use(%arg0 : i32, %ub : index, %lb : index, %step : index) -> (i32) { %cst = arith.constant 32 : i32 %0:2 = scf.for %arg1 = %lb to %ub step %step iter_args(%arg2 = %arg0, %arg3 = %cst) -> (i32, i32) { %1 = arith.addi %arg2, %cst : i32 scf.yield %1, %1 : i32, i32 } return %0#0 : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func private @do(%arg0: tensor) -> tensor func.func @matmul_on_tensors(%t0: tensor<32x1024xf32>) -> tensor { %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %c1024 = arith.constant 1024 : index %0 = tensor.cast %t0 : tensor<32x1024xf32> to tensor %1 = scf.for %i = %c0 to %c1024 step %c32 iter_args(%iter_t0 = %0) -> (tensor) { %2 = func.call @do(%iter_t0) : (tensor) -> tensor scf.yield %2 : tensor } {some_attr} return %1 : tensor }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @cond_prop(%arg0 : i1) -> index { %res = scf.if %arg0 -> index { %res1 = scf.if %arg0 -> index { %v1 = ""test.get_some_value1""() : () -> index scf.yield %v1 : index } else { %v2 = ""test.get_some_value2""() : () -> index scf.yield %v2 : index } scf.yield %res1 : index } else { %res2 = scf.if %arg0 -> index { %v3 = ""test.get_some_value3""() : () -> index scf.yield %v3 : index } else { %v4 = ""test.get_some_value4""() : () -> index scf.yield %v4 : index } scf.yield %res2 : index } return %res : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_if_with_cond1(%arg0 : i1) -> (i32, i1) { %true = arith.constant true %false = arith.constant false %res:2 = scf.if %arg0 -> (i32, i1) { %v = ""test.get_some_value""() : () -> i32 scf.yield %v, %true : i32, i1 } else { %v2 = ""test.get_some_value""() : () -> i32 scf.yield %v2, %false : i32, i1 } return %res#0, %res#1 : i32, i1 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_if_with_cond2(%arg0 : i1) -> (i32, i1) { %true = arith.constant true %false = arith.constant false %res:2 = scf.if %arg0 -> (i32, i1) { %v = ""test.get_some_value""() : () -> i32 scf.yield %v, %false : i32, i1 } else { %v2 = ""test.get_some_value""() : () -> i32 scf.yield %v2, %true : i32, i1 } return %res#0, %res#1 : i32, i1 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @replace_if_with_cond3(%arg0 : i1, %arg2: i64) -> (i32, i64) { %res:2 = scf.if %arg0 -> (i32, i64) { %v = ""test.get_some_value""() : () -> i32 scf.yield %v, %arg2 : i32, i64 } else { %v2 = ""test.get_some_value""() : () -> i32 scf.yield %v2, %arg2 : i32, i64 } return %res#0, %res#1 : i32, i64 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_cond_true() -> i1 { %0 = scf.while () : () -> i1 { %condition = ""test.condition""() : () -> i1 scf.condition(%condition) %condition : i1 } do { ^bb0(%arg0: i1): ""test.use""(%arg0) : (i1) -> () scf.yield } return %0 : i1 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @invariant_loop_args_in_same_order(%f_arg0: tensor) -> (tensor, tensor, tensor, tensor, tensor) { %cst_0 = arith.constant dense<0> : tensor %cst_1 = arith.constant dense<1> : tensor %cst_42 = arith.constant dense<42> : tensor %0:5 = scf.while (%arg0 = %cst_0, %arg1 = %f_arg0, %arg2 = %cst_1, %arg3 = %cst_1, %arg4 = %cst_0) : (tensor, tensor, tensor, tensor, tensor) -> (tensor, tensor, tensor, tensor, tensor) { %1 = arith.cmpi slt, %arg0, %cst_42 : tensor %2 = tensor.extract %1[] : tensor scf.condition(%2) %arg0, %arg1, %arg2, %arg3, %arg4 : tensor, tensor, tensor, tensor, tensor } do { ^bb0(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor, %arg4: tensor): %1 = arith.addi %arg0, %arg1 : tensor %2 = arith.addi %arg2, %arg3 : tensor scf.yield %1, %arg1, %2, %2, %arg4 : tensor, tensor, tensor, tensor, tensor } return %0#0, %0#1, %0#2, %0#3, %0#4 : tensor, tensor, tensor, tensor, tensor } func.func @while_loop_invariant_argument_different_order(%arg : tensor) -> (tensor, tensor, tensor, tensor, tensor, tensor) { %cst_0 = arith.constant dense<0> : tensor %cst_1 = arith.constant dense<1> : tensor %cst_42 = arith.constant dense<42> : tensor %0:6 = scf.while (%arg0 = %cst_0, %arg1 = %cst_1, %arg2 = %cst_1, %arg3 = %cst_1, %arg4 = %cst_0) : (tensor, tensor, tensor, tensor, tensor) -> (tensor, tensor, tensor, tensor, tensor, tensor) { %1 = arith.cmpi slt, %arg0, %arg : tensor %2 = tensor.extract %1[] : tensor scf.condition(%2) %arg1, %arg0, %arg2, %arg0, %arg3, %arg4 : tensor, tensor, tensor, tensor, tensor, tensor } do { ^bb0(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor, %arg4: tensor, %arg5: tensor): %1 = arith.addi %arg0, %cst_1 : tensor %2 = arith.addi %arg2, %arg3 : tensor scf.yield %arg3, %arg1, %2, %2, %arg4 : tensor, tensor, tensor, tensor, tensor } return %0#0, %0#1, %0#2, %0#3, %0#4, %0#5 : tensor, tensor, tensor, tensor, tensor, tensor }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_unused_result() -> i32 { %0:2 = scf.while () : () -> (i32, i64) { %condition = ""test.condition""() : () -> i1 %v1 = ""test.get_some_value""() : () -> i32 %v2 = ""test.get_some_value""() : () -> i64 scf.condition(%condition) %v1, %v2 : i32, i64 } do { ^bb0(%arg0: i32, %arg1: i64): ""test.use""(%arg0) : (i32) -> () scf.yield } return %0#0 : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_cmp_lhs(%arg0 : i32) { %0 = scf.while () : () -> i32 { %val = ""test.val""() : () -> i32 %condition = arith.cmpi ne, %val, %arg0 : i32 scf.condition(%condition) %val : i32 } do { ^bb0(%val2: i32): %condition2 = arith.cmpi ne, %val2, %arg0 : i32 %negcondition2 = arith.cmpi eq, %val2, %arg0 : i32 ""test.use""(%condition2, %negcondition2, %val2) : (i1, i1, i32) -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_cmp_rhs(%arg0 : i32) { %0 = scf.while () : () -> i32 { %val = ""test.val""() : () -> i32 %condition = arith.cmpi ne, %arg0, %val : i32 scf.condition(%condition) %val : i32 } do { ^bb0(%val2: i32): %condition2 = arith.cmpi ne, %arg0, %val2 : i32 %negcondition2 = arith.cmpi eq, %arg0, %val2 : i32 ""test.use""(%condition2, %negcondition2, %val2) : (i1, i1, i32) -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_duplicated_res() -> (i32, i32) { %0:2 = scf.while () : () -> (i32, i32) { %val = ""test.val""() : () -> i32 %condition = ""test.condition""() : () -> i1 scf.condition(%condition) %val, %val : i32, i32 } do { ^bb0(%val2: i32, %val3: i32): ""test.use""(%val2, %val3) : (i32, i32) -> () scf.yield } return %0#0, %0#1: i32, i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_unused_arg1(%x : i32, %y : f64) -> i32 { %0 = scf.while (%arg1 = %x, %arg2 = %y) : (i32, f64) -> (i32) { %condition = ""test.condition""(%arg1) : (i32) -> i1 scf.condition(%condition) %arg1 : i32 } do { ^bb0(%arg1: i32): %next = ""test.use""(%arg1) : (i32) -> (i32) scf.yield %next, %y : i32, f64 } return %0 : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @while_unused_arg2(%val0: i32) -> i32 { %0 = scf.while (%val1 = %val0) : (i32) -> i32 { %val = ""test.val""() : () -> i32 %condition = ""test.condition""() : () -> i1 scf.condition(%condition) %val: i32 } do { ^bb0(%val2: i32): ""test.use""(%val2) : (i32) -> () %val1 = ""test.val1""() : () -> i32 scf.yield %val1 : i32 } return %0 : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfs(%arg0 : i1, %arg2: i64) -> (i32, i32) { %res = scf.if %arg0 -> i32 { %v = ""test.firstCodeTrue""() : () -> i32 scf.yield %v : i32 } else { %v2 = ""test.firstCodeFalse""() : () -> i32 scf.yield %v2 : i32 } %res2 = scf.if %arg0 -> i32 { %v = ""test.secondCodeTrue""() : () -> i32 scf.yield %v : i32 } else { %v2 = ""test.secondCodeFalse""() : () -> i32 scf.yield %v2 : i32 } return %res, %res2 : i32, i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfs2(%arg0 : i1, %arg2: i64) -> i32 { scf.if %arg0 { ""test.firstCodeTrue""() : () -> () scf.yield } %res = scf.if %arg0 -> i32 { %v = ""test.secondCodeTrue""() : () -> i32 scf.yield %v : i32 } else { %v2 = ""test.secondCodeFalse""() : () -> i32 scf.yield %v2 : i32 } return %res : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfs3(%arg0 : i1, %arg2: i64) -> i32 { %res = scf.if %arg0 -> i32 { %v = ""test.firstCodeTrue""() : () -> i32 scf.yield %v : i32 } else { %v2 = ""test.firstCodeFalse""() : () -> i32 scf.yield %v2 : i32 } scf.if %arg0 { ""test.secondCodeTrue""() : () -> () scf.yield } return %res : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfs4(%arg0 : i1, %arg2: i64) { scf.if %arg0 { ""test.firstCodeTrue""() : () -> () scf.yield } scf.if %arg0 { ""test.secondCodeTrue""() : () -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfsUsed(%arg0 : i1, %arg2: i64) -> (i32, i32) { %res = scf.if %arg0 -> i32 { %v = ""test.firstCodeTrue""() : () -> i32 scf.yield %v : i32 } else { %v2 = ""test.firstCodeFalse""() : () -> i32 scf.yield %v2 : i32 } %res2 = scf.if %arg0 -> i32 { %v = ""test.secondCodeTrue""(%res) : (i32) -> i32 scf.yield %v : i32 } else { %v2 = ""test.secondCodeFalse""(%res) : (i32) -> i32 scf.yield %v2 : i32 } return %res, %res2 : i32, i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfsNot(%arg0 : i1, %arg2: i64) { %true = arith.constant true %not = arith.xori %arg0, %true : i1 scf.if %arg0 { ""test.firstCodeTrue""() : () -> () scf.yield } scf.if %not { ""test.secondCodeTrue""() : () -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @combineIfsNot2(%arg0 : i1, %arg2: i64) { %true = arith.constant true %not = arith.xori %arg0, %true : i1 scf.if %not { ""test.firstCodeTrue""() : () -> () scf.yield } scf.if %arg0 { ""test.secondCodeTrue""() : () -> () scf.yield } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @propagate_into_execute_region() { %cond = arith.constant 0 : i1 affine.for %i = 0 to 100 { ""test.foo""() : () -> () %v = scf.execute_region -> i64 { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %c1 = arith.constant 1 : i64 cf.br ^bb3(%c1 : i64) ^bb2: %c2 = arith.constant 2 : i64 cf.br ^bb3(%c2 : i64) ^bb3(%x : i64): scf.yield %x : i64 } ""test.bar""(%v) : (i64) -> () } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @execute_region_elim() { affine.for %i = 0 to 100 { ""test.foo""() : () -> () %v = scf.execute_region -> i64 { %x = ""test.val""() : () -> i64 scf.yield %x : i64 } ""test.bar""(%v) : (i64) -> () } return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @func_execute_region_elim() { ""test.foo""() : () -> () %v = scf.execute_region -> i64 { %c = ""test.cmp""() : () -> i1 cf.cond_br %c, ^bb2, ^bb3 ^bb2: %x = ""test.val1""() : () -> i64 cf.br ^bb4(%x : i64) ^bb3: %y = ""test.val2""() : () -> i64 cf.br ^bb4(%y : i64) ^bb4(%z : i64): scf.yield %z : i64 } ""test.bar""(%v) : (i64) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @func_execute_region_elim_multi_yield() { ""test.foo""() : () -> () %v = scf.execute_region -> i64 { %c = ""test.cmp""() : () -> i1 cf.cond_br %c, ^bb2, ^bb3 ^bb2: %x = ""test.val1""() : () -> i64 scf.yield %x : i64 ^bb3: %y = ""test.val2""() : () -> i64 scf.yield %y : i64 } ""test.bar""(%v) : (i64) -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @canonicalize_parallel_insert_slice_indices( %arg0 : tensor<1x5xf32>, %arg1: tensor, %num_threads : index) -> index { %c1 = arith.constant 1 : index %2 = scf.forall (%tidx) in (%num_threads) shared_outs(%o = %arg1) -> (tensor) { scf.forall.in_parallel { tensor.parallel_insert_slice %arg0 into %o[%tidx, 0] [1, 5] [1, 1] : tensor<1x5xf32> into tensor } } %dim = tensor.dim %2, %c1 : tensor return %dim : index }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @forall_fold_control_operands( %arg0 : tensor, %arg1: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %dim0 = tensor.dim %arg0, %c0 : tensor %dim1 = tensor.dim %arg0, %c1 : tensor %result = scf.forall (%i, %j) = (%c0, %c0) to (%dim0, %dim1) step (%c1, %c1) shared_outs(%o = %arg1) -> (tensor) { %slice = tensor.extract_slice %arg1[%i, %j] [1, 1] [1, 1] : tensor to tensor<1x1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %slice into %o[%i, %j] [1, 1] [1, 1] : tensor<1x1xf32> into tensor } } return %result : tensor }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @inline_forall_loop(%in: tensor<8x8xf32>) -> tensor<8x8xf32> { %c8 = arith.constant 8 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<8x8xf32> %1 = scf.forall (%i, %j) = (%c0, %c0) to (%c1, %c1) step (%c8, %c8) shared_outs (%out_ = %0) -> (tensor<8x8xf32>) { %slice = tensor.extract_slice %out_[%i, %j] [2, 3] [1, 1] : tensor<8x8xf32> to tensor<2x3xf32> %fill = linalg.fill ins(%cst : f32) outs(%slice : tensor<2x3xf32>) -> tensor<2x3xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %fill into %out_[%i, %j] [2, 3] [1, 1] : tensor<2x3xf32> into tensor<8x8xf32> } } return %1 : tensor<8x8xf32> }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @do_not_inline_distributed_forall_loop( %in: tensor<8x8xf32>) -> tensor<8x8xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<8x8xf32> %1 = scf.forall (%i, %j) = (0, 0) to (1, 1) step (8, 8) shared_outs (%out_ = %0) -> (tensor<8x8xf32>) { %slice = tensor.extract_slice %out_[%i, %j] [2, 3] [1, 1] : tensor<8x8xf32> to tensor<2x3xf32> %fill = linalg.fill ins(%cst : f32) outs(%slice : tensor<2x3xf32>) -> tensor<2x3xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %fill into %out_[%i, %j] [2, 3] [1, 1] : tensor<2x3xf32> into tensor<8x8xf32> } }{ mapping = [#gpu.thread, #gpu.thread] } return %1 : tensor<8x8xf32> }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @collapse_one_dim_parallel(%in: tensor<8x8xf32>) -> tensor<8x8xf32> { %c8 = arith.constant 8 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c16 = arith.constant 16 : index %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<8x8xf32> %1 = scf.forall (%i, %j) = (0, %c0) to (1, %c16) step (8, %c8) shared_outs (%out_ = %0) -> (tensor<8x8xf32>) { %fill = linalg.fill ins(%cst : f32) outs(%out_ : tensor<8x8xf32>) -> tensor<8x8xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %fill into %out_[%i, %j] [8, 8] [1, 1] : tensor<8x8xf32> into tensor<8x8xf32> } } return %1 : tensor<8x8xf32> }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @remove_empty_forall(%in: tensor<8x8xf32>) -> tensor<8x8xf32> { %c8 = arith.constant 8 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c16 = arith.constant 16 : index %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<8x8xf32> %1 = scf.forall (%i, %j) = (%c0, %c16) to (%c1, %c16) step (%c8, %c8) shared_outs (%out_ = %0) -> (tensor<8x8xf32>) { %fill = linalg.fill ins(%cst : f32) outs(%out_ : tensor<8x8xf32>) -> tensor<8x8xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %fill into %out_[%i, %j] [8, 8] [1, 1] : tensor<8x8xf32> into tensor<8x8xf32> } } return %1 : tensor<8x8xf32> }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_tensor_cast_into_forall( %in: tensor<2xi32>, %out: tensor<2xi32>) -> tensor<2xi32> { %cst = arith.constant dense<[100500]> : tensor<1xi32> %out_cast = tensor.cast %out : tensor<2xi32> to tensor %result = scf.forall (%i) = (0) to (2) step (1) shared_outs (%out_ = %out_cast) -> tensor { scf.forall.in_parallel { tensor.parallel_insert_slice %cst into %out_[%i] [1] [1] : tensor<1xi32> into tensor } } %result_cast = tensor.cast %result : tensor to tensor<2xi32> func.return %result_cast : tensor<2xi32> }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @do_not_fold_tensor_cast_from_dynamic_to_static_type_into_forall( %in: tensor, %out: tensor) -> tensor { %cst = arith.constant dense<[100500]> : tensor<1xi32> %out_cast = tensor.cast %out : tensor to tensor<2xi32> %result = scf.forall (%i) = (0) to (2) step (1) shared_outs (%out_ = %out_cast) -> tensor<2xi32> { scf.forall.in_parallel { tensor.parallel_insert_slice %cst into %out_[%i] [1] [1] : tensor<1xi32> into tensor<2xi32> } } %result_cast = tensor.cast %result : tensor<2xi32> to tensor func.return %result_cast : tensor }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %A: memref, %B: memref, %C: memref, %result: memref) { scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %arg5) { %B_elem = memref.load %B[%i0, %i1] : memref %C_elem = memref.load %C[%i0, %i1] : memref %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %result[%i0, %i1] : memref } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4}))' -split-input-file ",1 "func.func @static_loop_with_step() { %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c22 = arith.constant 22 : index %c24 = arith.constant 24 : index scf.parallel (%i0, %i1) = (%c0, %c0) to (%c22, %c24) step (%c3, %c3) { } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4}))' -split-input-file ",1 "func.func @tile_nested_innermost() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { } } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4}))' -split-input-file ",1 "func.func @tile_nested_in_non_ploop() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index scf.for %i = %c0 to %c2 step %c1 { scf.for %j = %c0 to %c2 step %c1 { scf.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { } } } return }"," mlir-opt -pass-pipeline='builtin.module(func.func(scf-parallel-loop-tiling{parallel-loop-tile-sizes=1,4}))' -split-input-file ",1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt -test-loop-unrolling='unroll-factor=2' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt -test-loop-unrolling='unroll-factor=3' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=0' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=1' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 annotate=true' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt --affine-loop-unroll='unroll-factor=6 unroll-up-to-factor=true' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt --affine-loop-unroll='unroll-factor=5 cleanup-unroll=true' ,1 "func.func @dynamic_loop_unroll(%arg0 : index, %arg1 : index, %arg2 : index, %arg3: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { memref.store %0, %arg3[%i0] : memref } return } func.func @dynamic_loop_unroll_outer_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @dynamic_loop_unroll_inner_by_2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6: memref) { %0 = arith.constant 7.0 : f32 scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg3 to %arg4 step %arg5 { memref.store %0, %arg6[%i1] : memref } } return } func.func @static_loop_unroll_by_2(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_promote_epilogue(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 10 : index %step = arith.constant 1 : index scf.for %i0 = %lb to %ub step %step { memref.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_up_to_factor(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 2 : index affine.for %i0 = %lb to %ub { affine.store %0, %arg0[%i0] : memref } return } func.func @static_loop_unroll_by_3_rename_epilogue_arguments() -> (f32, f32) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 20 : index %step = arith.constant 1 : index %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%arg0 = %0, %arg1 = %0) -> (f32, f32) { %add = arith.addf %arg0, %arg1 : f32 %mul = arith.mulf %arg0, %arg1 : f32 scf.yield %add, %mul : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @static_loop_unroll_by_5_with_cleanup(%arg0 : memref) { %0 = arith.constant 7.0 : f32 %lb = arith.constant 0 : index %ub = arith.constant 3 : index affine.for %i0 = %lb to %ub { memref.store %0, %arg0[%i0] : memref } return }", mlir-opt --affine-loop-unroll --split-input-file ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt -test-loop-unrolling='unroll-factor=2' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt -test-loop-unrolling='unroll-factor=3' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=0' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=1' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 annotate=true' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt --affine-loop-unroll='unroll-factor=6 unroll-up-to-factor=true' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt --affine-loop-unroll='unroll-factor=5 cleanup-unroll=true' ,1 "func.func @loop_unroll_static_yield_value_test1() { %true_4 = arith.constant true %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 iter_args(%arg3 = %true_4) -> (i1) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%c1) affine.yield %true_4 : i1 } return }", mlir-opt --affine-loop-unroll --split-input-file ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=3' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=0' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=1' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 annotate=true' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt --affine-loop-unroll='unroll-factor=6 unroll-up-to-factor=true' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt --affine-loop-unroll='unroll-factor=5 cleanup-unroll=true' ,1 "func.func @loop_unroll_yield_loop_iv() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg2) affine.yield %arg2 : index } return }", mlir-opt --affine-loop-unroll --split-input-file ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=3' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=0' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 loop-depth=1' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt -test-loop-unrolling='unroll-factor=2 annotate=true' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt --affine-loop-unroll='unroll-factor=6 unroll-up-to-factor=true' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt --affine-loop-unroll='unroll-factor=5 cleanup-unroll=true' ,1 "func.func @loop_unroll_yield_iter_arg() { %c1 = arith.constant 1 : index %103 = affine.for %arg2 = 0 to 40 step 2 iter_args(%arg3 = %c1) -> (index) { %324 = affine.max affine_map<(d0) -> (-d0 + 64, (d0 floordiv 8) ceildiv 64, -d0 - 16, d0 * -64)>(%arg3) affine.yield %arg3 : index } return }", mlir-opt --affine-loop-unroll --split-input-file ,1 "func.func @if(%pred: i1, %true_val: tensor, %false_val: tensor) -> tensor { %0 = scf.if %pred -> (tensor) { scf.yield %true_val : tensor } else { scf.yield %false_val : tensor } return %0 : tensor } func.func @for(%arg0: tensor, %lb: index, %ub: index, %step: index) -> tensor { %ret = scf.for %iv = %lb to %ub step %step iter_args(%iter = %arg0) -> tensor { scf.yield %iter : tensor } {some_attr} return %ret : tensor } func.func @if_correct_recursive_legalization_behavior(%pred: i1, %tensor: tensor) -> tensor { %0 = scf.if %pred -> (tensor) { %1 = ""test.munge_tensor""(%tensor) : (tensor) -> (tensor) scf.yield %1: tensor } else { %1 = ""test.munge_tensor""(%tensor) : (tensor) -> (tensor) scf.yield %1 : tensor } return %0 : tensor } func.func @for_correct_recursive_legalization_behavior(%arg0: tensor, %index: index) -> tensor { %ret = scf.for %iv = %index to %index step %index iter_args(%iter = %arg0) -> tensor { %0 = ""test.munge_tensor""(%iter) : (tensor) -> (tensor) scf.yield %0 : tensor } return %ret : tensor } func.func @bufferize_while(%arg0: i64, %arg1: i64, %arg2: tensor) -> (i64, tensor) { %c2_i64 = arith.constant 2 : i64 %0:3 = scf.while (%arg3 = %arg0, %arg4 = %arg2) : (i64, tensor) -> (i64, i64, tensor) { %1 = arith.cmpi slt, %arg3, %arg1 : i64 scf.condition(%1) %arg3, %arg3, %arg4 : i64, i64, tensor } do { ^bb0(%arg5: i64, %arg6: i64, %arg7: tensor): %1 = arith.muli %arg6, %c2_i64 : i64 scf.yield %1, %arg7 : i64, tensor } return %0#1, %0#2 : i64, tensor }", mlir-opt -scf-bufferize ,1 "#map0 = affine_map<()[s0, s1] -> (1024, s0 - s1)> #map1 = affine_map<()[s0, s1] -> (64, s0 - s1)> func.func @parallel_loop(%outer_i0: index, %outer_i1: index, %A: memref, %B: memref, %C: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = memref.dim %A, %c0 : memref %d1 = memref.dim %A, %c1 : memref %b0 = affine.min #map0()[%d0, %outer_i0] %b1 = affine.min #map1()[%d1, %outer_i1] scf.parallel (%i0, %i1) = (%c0, %c0) to (%b0, %b1) step (%c1, %c1) { %B_elem = memref.load %B[%i0, %i1] : memref %C_elem = memref.load %C[%i0, %i1] : memref %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %result[%i0, %i1] : memref } return }", mlir-opt -scf-parallel-loop-specialization -split-input-file ,1 "func.func @testMatchingTypes(%arg0 : i32) { %0 = scf.while (%arg1 = %arg0) : (i32) -> (i32) { %c10 = arith.constant 10 : i32 %1 = arith.cmpi slt, %arg1, %c10 : i32 scf.condition(%1) %arg1 : i32 } do { ^bb0(%arg1: i32): scf.yield %arg1 : i32 } return } func.func @testNonMatchingTypes(%arg0 : i32) { %c1 = arith.constant 1 : i32 %c10 = arith.constant 10 : i32 %0:2 = scf.while (%arg1 = %arg0) : (i32) -> (i32, i32) { %1 = arith.cmpi slt, %arg1, %c10 : i32 scf.condition(%1) %arg1, %c1 : i32, i32 } do { ^bb0(%arg1: i32, %arg2: i32): %1 = arith.addi %arg1, %arg2 : i32 scf.yield %1 : i32 } return }", mlir-opt -test-scf-while-op-builder ,1 "#map0 = affine_map<()[s0, s1] -> (1024, s0 - s1)> #map1 = affine_map<()[s0, s1] -> (64, s0 - s1)> func.func @for(%outer: index, %A: memref, %B: memref, %C: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = memref.dim %A, %c0 : memref %b0 = affine.min #map0()[%d0, %outer] scf.for %i0 = %c0 to %b0 step %c1 { %B_elem = memref.load %B[%i0] : memref %C_elem = memref.load %C[%i0] : memref %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %result[%i0] : memref } return }", mlir-opt -scf-for-loop-specialization -split-input-file ,1 "func.func @std_for(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg0 to %arg1 step %arg2 { %min_cmp = arith.cmpi slt, %i0, %i1 : index %min = arith.select %min_cmp, %i0, %i1 : index %max_cmp = arith.cmpi sge, %i0, %i1 : index %max = arith.select %max_cmp, %i0, %i1 : index scf.for %i2 = %min to %max step %i1 { } } } return } func.func @std_for_i32(%arg0 : i32, %arg1 : i32, %arg2 : i32) { scf.for %i0 = %arg0 to %arg1 step %arg2 : i32 { scf.for %i1 = %arg0 to %arg1 step %arg2 : i32 { } } return } func.func @scf_for_i64_iter(%arg1: i64, %arg2: i64) { %c1_i64 = arith.constant 1 : i64 %c0_i64 = arith.constant 0 : i64 %0 = scf.for %arg3 = %arg1 to %arg2 step %c1_i64 iter_args(%arg4 = %c0_i64) -> (i64) : i64 { %1 = arith.addi %arg4, %arg3 : i64 scf.yield %1 : i64 } return } func.func @std_if(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = arith.addf %arg1, %arg1 : f32 } return } func.func @std_if_else(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = arith.addf %arg1, %arg1 : f32 } else { %1 = arith.addf %arg1, %arg1 : f32 } return } func.func @std_parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) { %min_cmp = arith.cmpi slt, %i0, %i1 : index %min = arith.select %min_cmp, %i0, %i1 : index %max_cmp = arith.cmpi sge, %i0, %i1 : index %max = arith.select %max_cmp, %i0, %i1 : index %zero = arith.constant 0.0 : f32 %int_zero = arith.constant 0 : i32 %red:2 = scf.parallel (%i2) = (%min) to (%max) step (%i1) init (%zero, %int_zero) -> (f32, i32) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32 } %int_one = arith.constant 1 : i32 scf.reduce(%int_one) : i32 { ^bb0(%lhs : i32, %rhs: i32): %res = arith.muli %lhs, %rhs : i32 scf.reduce.return %res : i32 } } } return } func.func @parallel_explicit_yield( %arg0: index, %arg1: index, %arg2: index) { scf.parallel (%i0) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @std_if_yield(%arg0: i1, %arg1: f32) { %x, %y = scf.if %arg0 -> (f32, f32) { %0 = arith.addf %arg1, %arg1 : f32 %1 = arith.subf %arg1, %arg1 : f32 scf.yield %0, %1 : f32, f32 } else { %0 = arith.subf %arg1, %arg1 : f32 %1 = arith.addf %arg1, %arg1 : f32 scf.yield %0, %1 : f32, f32 } return } func.func @std_for_yield(%arg0 : index, %arg1 : index, %arg2 : index) { %s0 = arith.constant 0.0 : f32 %result = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0) -> (f32) { %sn = arith.addf %si, %si : f32 scf.yield %sn : f32 } return } func.func @std_for_yield_multi(%arg0 : index, %arg1 : index, %arg2 : index) { %s0 = arith.constant 0.0 : f32 %t0 = arith.constant 1 : i32 %u0 = arith.constant 1.0 : f32 %result1:3 = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0, %ti = %t0, %ui = %u0) -> (f32, i32, f32) { %sn = arith.addf %si, %si : f32 %tn = arith.addi %ti, %ti : i32 %un = arith.subf %ui, %ui : f32 scf.yield %sn, %tn, %un : f32, i32, f32 } return } func.func @conditional_reduce(%buffer: memref<1024xf32>, %lb: index, %ub: index, %step: index) -> (f32) { %sum_0 = arith.constant 0.0 : f32 %c0 = arith.constant 0.0 : f32 %sum = scf.for %iv = %lb to %ub step %step iter_args(%sum_iter = %sum_0) -> (f32) { %t = memref.load %buffer[%iv] : memref<1024xf32> %cond = arith.cmpf ugt, %t, %c0 : f32 %sum_next = scf.if %cond -> (f32) { %new_sum = arith.addf %sum_iter, %t : f32 scf.yield %new_sum : f32 } else { scf.yield %sum_iter : f32 } scf.yield %sum_next : f32 } return %sum : f32 } func.func @while() { %0 = ""test.get_some_value""() : () -> i32 %1 = ""test.get_some_value""() : () -> f32 %2:2 = scf.while (%arg0 = %0, %arg1 = %1) : (i32, f32) -> (i64, f64) { %3:2 = ""test.some_operation""(%arg0, %arg1) : (i32, f32) -> (i64, f64) %4 = ""test.some_condition""(%arg0, %arg1) : (i32, f32) -> i1 scf.condition(%4) %3#0, %3#1 : i64, f64 } do { ^bb0(%arg2: i64, %arg3: f64): %5:2 = ""test.some_operation""(%arg2, %arg3): (i64, f64) -> (i32, f32) scf.yield %5#0, %5#1 : i32, f32 } attributes {foo=""bar""} return } func.func @infinite_while() { %true = arith.constant true scf.while : () -> () { scf.condition(%true) } do { scf.yield } return } func.func @execute_region() -> i64 { %res = scf.execute_region -> i64 { %c1 = arith.constant 1 : i64 scf.yield %c1 : i64 } %res2:2 = scf.execute_region -> (i64, i64) { %c1 = arith.constant 1 : i64 scf.yield %c1, %c1 : i64, i64 } ""scf.execute_region""() ({ ^bb0: cf.br ^bb1 ^bb1: scf.yield }) : () -> () return %res : i64 } func.func @normalized_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return } func.func @explicit_loop_bounds_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) = (%c0) to (%num_threads) step (%c1) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return } func.func @normalized_forall_elide_terminator() -> () { %num_threads = arith.constant 100 : index scf.forall (%thread_idx) in (%num_threads) { scf.forall.in_parallel { } } {mapping = [#gpu.thread]} return } func.func @explicit_loop_bounds_forall_elide_terminator() -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index scf.forall (%thread_idx) = (%c0) to (%num_threads) step (%c1) { scf.forall.in_parallel { } } {mapping = [#gpu.thread]} return } func.func @switch(%arg0: index) -> i32 { %0 = scf.index_switch %arg0 -> i32 case 2 { %c10_i32 = arith.constant 10 : i32 scf.yield %c10_i32 : i32 } case 5 { %c20_i32 = arith.constant 20 : i32 scf.yield %c20_i32 : i32 } default { %c30_i32 = arith.constant 30 : i32 scf.yield %c30_i32 : i32 } scf.index_switch %arg0 default { scf.yield } return %0 : i32 }", mlir-opt ,1 "func.func @std_for(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg0 to %arg1 step %arg2 { %min_cmp = arith.cmpi slt, %i0, %i1 : index %min = arith.select %min_cmp, %i0, %i1 : index %max_cmp = arith.cmpi sge, %i0, %i1 : index %max = arith.select %max_cmp, %i0, %i1 : index scf.for %i2 = %min to %max step %i1 { } } } return } func.func @std_for_i32(%arg0 : i32, %arg1 : i32, %arg2 : i32) { scf.for %i0 = %arg0 to %arg1 step %arg2 : i32 { scf.for %i1 = %arg0 to %arg1 step %arg2 : i32 { } } return } func.func @scf_for_i64_iter(%arg1: i64, %arg2: i64) { %c1_i64 = arith.constant 1 : i64 %c0_i64 = arith.constant 0 : i64 %0 = scf.for %arg3 = %arg1 to %arg2 step %c1_i64 iter_args(%arg4 = %c0_i64) -> (i64) : i64 { %1 = arith.addi %arg4, %arg3 : i64 scf.yield %1 : i64 } return } func.func @std_if(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = arith.addf %arg1, %arg1 : f32 } return } func.func @std_if_else(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = arith.addf %arg1, %arg1 : f32 } else { %1 = arith.addf %arg1, %arg1 : f32 } return } func.func @std_parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) { %min_cmp = arith.cmpi slt, %i0, %i1 : index %min = arith.select %min_cmp, %i0, %i1 : index %max_cmp = arith.cmpi sge, %i0, %i1 : index %max = arith.select %max_cmp, %i0, %i1 : index %zero = arith.constant 0.0 : f32 %int_zero = arith.constant 0 : i32 %red:2 = scf.parallel (%i2) = (%min) to (%max) step (%i1) init (%zero, %int_zero) -> (f32, i32) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32 } %int_one = arith.constant 1 : i32 scf.reduce(%int_one) : i32 { ^bb0(%lhs : i32, %rhs: i32): %res = arith.muli %lhs, %rhs : i32 scf.reduce.return %res : i32 } } } return } func.func @parallel_explicit_yield( %arg0: index, %arg1: index, %arg2: index) { scf.parallel (%i0) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @std_if_yield(%arg0: i1, %arg1: f32) { %x, %y = scf.if %arg0 -> (f32, f32) { %0 = arith.addf %arg1, %arg1 : f32 %1 = arith.subf %arg1, %arg1 : f32 scf.yield %0, %1 : f32, f32 } else { %0 = arith.subf %arg1, %arg1 : f32 %1 = arith.addf %arg1, %arg1 : f32 scf.yield %0, %1 : f32, f32 } return } func.func @std_for_yield(%arg0 : index, %arg1 : index, %arg2 : index) { %s0 = arith.constant 0.0 : f32 %result = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0) -> (f32) { %sn = arith.addf %si, %si : f32 scf.yield %sn : f32 } return } func.func @std_for_yield_multi(%arg0 : index, %arg1 : index, %arg2 : index) { %s0 = arith.constant 0.0 : f32 %t0 = arith.constant 1 : i32 %u0 = arith.constant 1.0 : f32 %result1:3 = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0, %ti = %t0, %ui = %u0) -> (f32, i32, f32) { %sn = arith.addf %si, %si : f32 %tn = arith.addi %ti, %ti : i32 %un = arith.subf %ui, %ui : f32 scf.yield %sn, %tn, %un : f32, i32, f32 } return } func.func @conditional_reduce(%buffer: memref<1024xf32>, %lb: index, %ub: index, %step: index) -> (f32) { %sum_0 = arith.constant 0.0 : f32 %c0 = arith.constant 0.0 : f32 %sum = scf.for %iv = %lb to %ub step %step iter_args(%sum_iter = %sum_0) -> (f32) { %t = memref.load %buffer[%iv] : memref<1024xf32> %cond = arith.cmpf ugt, %t, %c0 : f32 %sum_next = scf.if %cond -> (f32) { %new_sum = arith.addf %sum_iter, %t : f32 scf.yield %new_sum : f32 } else { scf.yield %sum_iter : f32 } scf.yield %sum_next : f32 } return %sum : f32 } func.func @while() { %0 = ""test.get_some_value""() : () -> i32 %1 = ""test.get_some_value""() : () -> f32 %2:2 = scf.while (%arg0 = %0, %arg1 = %1) : (i32, f32) -> (i64, f64) { %3:2 = ""test.some_operation""(%arg0, %arg1) : (i32, f32) -> (i64, f64) %4 = ""test.some_condition""(%arg0, %arg1) : (i32, f32) -> i1 scf.condition(%4) %3#0, %3#1 : i64, f64 } do { ^bb0(%arg2: i64, %arg3: f64): %5:2 = ""test.some_operation""(%arg2, %arg3): (i64, f64) -> (i32, f32) scf.yield %5#0, %5#1 : i32, f32 } attributes {foo=""bar""} return } func.func @infinite_while() { %true = arith.constant true scf.while : () -> () { scf.condition(%true) } do { scf.yield } return } func.func @execute_region() -> i64 { %res = scf.execute_region -> i64 { %c1 = arith.constant 1 : i64 scf.yield %c1 : i64 } %res2:2 = scf.execute_region -> (i64, i64) { %c1 = arith.constant 1 : i64 scf.yield %c1, %c1 : i64, i64 } ""scf.execute_region""() ({ ^bb0: cf.br ^bb1 ^bb1: scf.yield }) : () -> () return %res : i64 } func.func @normalized_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return } func.func @explicit_loop_bounds_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) = (%c0) to (%num_threads) step (%c1) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return } func.func @normalized_forall_elide_terminator() -> () { %num_threads = arith.constant 100 : index scf.forall (%thread_idx) in (%num_threads) { scf.forall.in_parallel { } } {mapping = [#gpu.thread]} return } func.func @explicit_loop_bounds_forall_elide_terminator() -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index scf.forall (%thread_idx) = (%c0) to (%num_threads) step (%c1) { scf.forall.in_parallel { } } {mapping = [#gpu.thread]} return } func.func @switch(%arg0: index) -> i32 { %0 = scf.index_switch %arg0 -> i32 case 2 { %c10_i32 = arith.constant 10 : i32 scf.yield %c10_i32 : i32 } case 5 { %c20_i32 = arith.constant 20 : i32 scf.yield %c20_i32 : i32 } default { %c30_i32 = arith.constant 30 : i32 scf.yield %c30_i32 : i32 } scf.index_switch %arg0 default { scf.yield } return %0 : i32 }", mlir-opt | mlir-opt ,1 "func.func @std_for(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { scf.for %i1 = %arg0 to %arg1 step %arg2 { %min_cmp = arith.cmpi slt, %i0, %i1 : index %min = arith.select %min_cmp, %i0, %i1 : index %max_cmp = arith.cmpi sge, %i0, %i1 : index %max = arith.select %max_cmp, %i0, %i1 : index scf.for %i2 = %min to %max step %i1 { } } } return } func.func @std_for_i32(%arg0 : i32, %arg1 : i32, %arg2 : i32) { scf.for %i0 = %arg0 to %arg1 step %arg2 : i32 { scf.for %i1 = %arg0 to %arg1 step %arg2 : i32 { } } return } func.func @scf_for_i64_iter(%arg1: i64, %arg2: i64) { %c1_i64 = arith.constant 1 : i64 %c0_i64 = arith.constant 0 : i64 %0 = scf.for %arg3 = %arg1 to %arg2 step %c1_i64 iter_args(%arg4 = %c0_i64) -> (i64) : i64 { %1 = arith.addi %arg4, %arg3 : i64 scf.yield %1 : i64 } return } func.func @std_if(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = arith.addf %arg1, %arg1 : f32 } return } func.func @std_if_else(%arg0: i1, %arg1: f32) { scf.if %arg0 { %0 = arith.addf %arg1, %arg1 : f32 } else { %1 = arith.addf %arg1, %arg1 : f32 } return } func.func @std_parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) { %min_cmp = arith.cmpi slt, %i0, %i1 : index %min = arith.select %min_cmp, %i0, %i1 : index %max_cmp = arith.cmpi sge, %i0, %i1 : index %max = arith.select %max_cmp, %i0, %i1 : index %zero = arith.constant 0.0 : f32 %int_zero = arith.constant 0 : i32 %red:2 = scf.parallel (%i2) = (%min) to (%max) step (%i1) init (%zero, %int_zero) -> (f32, i32) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32 } %int_one = arith.constant 1 : i32 scf.reduce(%int_one) : i32 { ^bb0(%lhs : i32, %rhs: i32): %res = arith.muli %lhs, %rhs : i32 scf.reduce.return %res : i32 } } } return } func.func @parallel_explicit_yield( %arg0: index, %arg1: index, %arg2: index) { scf.parallel (%i0) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @std_if_yield(%arg0: i1, %arg1: f32) { %x, %y = scf.if %arg0 -> (f32, f32) { %0 = arith.addf %arg1, %arg1 : f32 %1 = arith.subf %arg1, %arg1 : f32 scf.yield %0, %1 : f32, f32 } else { %0 = arith.subf %arg1, %arg1 : f32 %1 = arith.addf %arg1, %arg1 : f32 scf.yield %0, %1 : f32, f32 } return } func.func @std_for_yield(%arg0 : index, %arg1 : index, %arg2 : index) { %s0 = arith.constant 0.0 : f32 %result = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0) -> (f32) { %sn = arith.addf %si, %si : f32 scf.yield %sn : f32 } return } func.func @std_for_yield_multi(%arg0 : index, %arg1 : index, %arg2 : index) { %s0 = arith.constant 0.0 : f32 %t0 = arith.constant 1 : i32 %u0 = arith.constant 1.0 : f32 %result1:3 = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0, %ti = %t0, %ui = %u0) -> (f32, i32, f32) { %sn = arith.addf %si, %si : f32 %tn = arith.addi %ti, %ti : i32 %un = arith.subf %ui, %ui : f32 scf.yield %sn, %tn, %un : f32, i32, f32 } return } func.func @conditional_reduce(%buffer: memref<1024xf32>, %lb: index, %ub: index, %step: index) -> (f32) { %sum_0 = arith.constant 0.0 : f32 %c0 = arith.constant 0.0 : f32 %sum = scf.for %iv = %lb to %ub step %step iter_args(%sum_iter = %sum_0) -> (f32) { %t = memref.load %buffer[%iv] : memref<1024xf32> %cond = arith.cmpf ugt, %t, %c0 : f32 %sum_next = scf.if %cond -> (f32) { %new_sum = arith.addf %sum_iter, %t : f32 scf.yield %new_sum : f32 } else { scf.yield %sum_iter : f32 } scf.yield %sum_next : f32 } return %sum : f32 } func.func @while() { %0 = ""test.get_some_value""() : () -> i32 %1 = ""test.get_some_value""() : () -> f32 %2:2 = scf.while (%arg0 = %0, %arg1 = %1) : (i32, f32) -> (i64, f64) { %3:2 = ""test.some_operation""(%arg0, %arg1) : (i32, f32) -> (i64, f64) %4 = ""test.some_condition""(%arg0, %arg1) : (i32, f32) -> i1 scf.condition(%4) %3#0, %3#1 : i64, f64 } do { ^bb0(%arg2: i64, %arg3: f64): %5:2 = ""test.some_operation""(%arg2, %arg3): (i64, f64) -> (i32, f32) scf.yield %5#0, %5#1 : i32, f32 } attributes {foo=""bar""} return } func.func @infinite_while() { %true = arith.constant true scf.while : () -> () { scf.condition(%true) } do { scf.yield } return } func.func @execute_region() -> i64 { %res = scf.execute_region -> i64 { %c1 = arith.constant 1 : i64 scf.yield %c1 : i64 } %res2:2 = scf.execute_region -> (i64, i64) { %c1 = arith.constant 1 : i64 scf.yield %c1, %c1 : i64, i64 } ""scf.execute_region""() ({ ^bb0: cf.br ^bb1 ^bb1: scf.yield }) : () -> () return %res : i64 } func.func @normalized_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return } func.func @explicit_loop_bounds_forall(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) = (%c0) to (%num_threads) step (%c1) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return } func.func @normalized_forall_elide_terminator() -> () { %num_threads = arith.constant 100 : index scf.forall (%thread_idx) in (%num_threads) { scf.forall.in_parallel { } } {mapping = [#gpu.thread]} return } func.func @explicit_loop_bounds_forall_elide_terminator() -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index scf.forall (%thread_idx) = (%c0) to (%num_threads) step (%c1) { scf.forall.in_parallel { } } {mapping = [#gpu.thread]} return } func.func @switch(%arg0: index) -> i32 { %0 = scf.index_switch %arg0 -> i32 case 2 { %c10_i32 = arith.constant 10 : i32 scf.yield %c10_i32 : i32 } case 5 { %c20_i32 = arith.constant 20 : i32 scf.yield %c20_i32 : i32 } default { %c30_i32 = arith.constant 30 : i32 scf.yield %c30_i32 : i32 } scf.index_switch %arg0 default { scf.yield } return %0 : i32 }", mlir-opt -mlir-print-op-generic | mlir-opt ,1 "func.func @reduce() { %c2 = arith.constant 2 : index %cst_0 = arith.constant -0.000000e+00 : f32 %0 = memref.alloc() : memref<128x384xf32> linalg.fill ins(%cst_0 : f32) outs(%0 : memref<128x384xf32>) %2 = memref.alloc() : memref<128xf32> linalg.fill ins(%cst_0 : f32) outs(%2 : memref<128xf32>) scf.forall (%arg0) in (%c2) { %7 = affine.min affine_map<(d0) -> (d0 * -64 + 128, 64)>(%arg0) %8 = affine.max affine_map<(d0) -> (0, d0)>(%7) %9 = affine.apply affine_map<(d0) -> (d0 * 64)>(%arg0) %10 = affine.min affine_map<(d0, d1) -> (d1 * -64 + 128, d0)>(%8, %arg0) %11 = memref.subview %0[%9, 0] [%10, 384] [1, 1] : memref<128x384xf32> to memref (d0 * 384 + s0 + d1)>> %12 = memref.subview %2[%9] [%10] [1] : memref<128xf32> to memref (d0 + s0)>> linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%11 : memref (d0 * 384 + s0 + d1)>>) outs(%12 : memref (d0 + s0)>>) { ^bb0(%arg1: f32, %arg2: f32): %14 = arith.addf %arg1, %arg2 : f32 linalg.yield %14 : f32 } } return }", mlir-opt -scf-for-loop-canonicalization ,1 "func.func @scf_for_yield_only( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { scf.yield %t : tensor } %r1 = scf.for %i = %lb to %ub step %step iter_args(%t = %B) -> (tensor) { scf.yield %t : tensor } return %r0, %r1: tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_yield_only( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { scf.yield %t : tensor } %r1 = scf.for %i = %lb to %ub step %step iter_args(%t = %B) -> (tensor) { scf.yield %t : tensor } return %r0, %r1: tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_is_reading(%A : tensor, %B : tensor, %lb : index, %ub : index) -> (f32, f32) { %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %0 = scf.for %iv = %lb to %ub step %c1 iter_args(%1 = %A) -> tensor { %r = linalg.fill ins(%cst : f32) outs(%1 : tensor) -> tensor scf.yield %B : tensor } %1 = tensor.extract %0[%c1] : tensor %2 = tensor.extract %A[%c1] : tensor return %1, %2 : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_is_reading(%A : tensor, %B : tensor, %lb : index, %ub : index) -> (f32, f32) { %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %0 = scf.for %iv = %lb to %ub step %c1 iter_args(%1 = %A) -> tensor { %r = linalg.fill ins(%cst : f32) outs(%1 : tensor) -> tensor scf.yield %B : tensor } %1 = tensor.extract %0[%c1] : tensor %2 = tensor.extract %A[%c1] : tensor return %1, %2 : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @nested_scf_for(%A : tensor {bufferization.writable = true}, %v : vector<5xf32>) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %r1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%B = %A) -> tensor { %r2 = scf.for %j = %c0 to %c10 step %c1 iter_args(%C = %B) -> tensor { %w = vector.transfer_write %v, %C[%c0] : vector<5xf32>, tensor scf.yield %w : tensor } scf.yield %r2 : tensor } return %r1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @nested_scf_for(%A : tensor {bufferization.writable = true}, %v : vector<5xf32>) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %r1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%B = %A) -> tensor { %r2 = scf.for %j = %c0 to %c10 step %c1 iter_args(%C = %B) -> tensor { %w = vector.transfer_write %v, %C[%c0] : vector<5xf32>, tensor scf.yield %w : tensor } scf.yield %r2 : tensor } return %r1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_with_tensor.insert_slice( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = false}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttA, %ttB : tensor, tensor } return %r0#0, %r0#1: tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_with_tensor.insert_slice( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = false}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttA, %ttB : tensor, tensor } return %r0#0, %r0#1: tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @execute_region_with_conflict( %t1 : tensor {bufferization.writable = true}) -> (f32, tensor, f32) { %f1 = arith.constant 0.0 : f32 %idx = arith.constant 7 : index %0, %1, %2 = scf.execute_region -> (f32, tensor, f32) { %t2 = tensor.insert %f1 into %t1[%idx] : tensor scf.yield %f1, %t2, %f1 : f32, tensor, f32 } %3 = tensor.extract %t1[%idx] : tensor return %0, %1, %3 : f32, tensor, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @execute_region_with_conflict( %t1 : tensor {bufferization.writable = true}) -> (f32, tensor, f32) { %f1 = arith.constant 0.0 : f32 %idx = arith.constant 7 : index %0, %1, %2 = scf.execute_region -> (f32, tensor, f32) { %t2 = tensor.insert %f1 into %t1[%idx] : tensor scf.yield %f1, %t2, %f1 : f32, tensor, f32 } %3 = tensor.extract %t1[%idx] : tensor return %0, %1, %3 : f32, tensor, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_if_inplace(%cond: i1, %t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index) -> tensor { %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { %t2 = vector.transfer_write %v, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_if_inplace(%cond: i1, %t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index) -> tensor { %r = scf.if %cond -> (tensor) { scf.yield %t1 : tensor } else { %t2 = vector.transfer_write %v, %t1[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_if_inside_scf_for( %t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index, %cond: i1) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %r = scf.for %iv = %c0 to %c10 step %c1 iter_args(%bb = %t1) -> (tensor) { %r2 = scf.if %cond -> (tensor) { scf.yield %bb : tensor } else { %t2 = vector.transfer_write %v, %bb[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } scf.yield %r2 : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_if_inside_scf_for( %t1: tensor {bufferization.writable = true}, %v: vector<5xf32>, %idx: index, %cond: i1) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %r = scf.for %iv = %c0 to %c10 step %c1 iter_args(%bb = %t1) -> (tensor) { %r2 = scf.if %cond -> (tensor) { scf.yield %bb : tensor } else { %t2 = vector.transfer_write %v, %bb[%idx] : vector<5xf32>, tensor scf.yield %t2 : tensor } scf.yield %r2 : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_if_non_equiv_yields( %b : i1, %A : tensor<4xf32> {bufferization.writable = false}, %B : tensor<4xf32> {bufferization.writable = false}) -> tensor<4xf32> { %r = scf.if %b -> (tensor<4xf32>) { scf.yield %A : tensor<4xf32> } else { scf.yield %B : tensor<4xf32> } return %r: tensor<4xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_if_non_equiv_yields( %b : i1, %A : tensor<4xf32> {bufferization.writable = false}, %B : tensor<4xf32> {bufferization.writable = false}) -> tensor<4xf32> { %r = scf.if %b -> (tensor<4xf32>) { scf.yield %A : tensor<4xf32> } else { scf.yield %B : tensor<4xf32> } return %r: tensor<4xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_execute_region_yield_non_equivalent(%i: index, %j: index) -> f32 { %r = scf.execute_region -> (tensor) { %t2 = bufferization.alloc_tensor(%i) : tensor scf.yield %t2 : tensor } %f = tensor.extract %r[%j] : tensor return %f : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_execute_region_yield_non_equivalent(%i: index, %j: index) -> f32 { %r = scf.execute_region -> (tensor) { %t2 = bufferization.alloc_tensor(%i) : tensor scf.yield %t2 : tensor } %f = tensor.extract %r[%j] : tensor return %f : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_yield_non_equivalent( %t: tensor, %lb : index, %ub : index, %step : index) -> tensor { %r = scf.for %i = %lb to %ub step %step iter_args(%a = %t) -> tensor { scf.yield %t : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_yield_non_equivalent( %t: tensor, %lb : index, %ub : index, %step : index) -> tensor { %r = scf.for %i = %lb to %ub step %step iter_args(%a = %t) -> tensor { scf.yield %t : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_yield_allocation(%t: tensor, %lb : index, %ub : index, %step : index) -> tensor { %r = scf.for %i = %lb to %ub step %step iter_args(%a = %t) -> tensor { %t2 = bufferization.alloc_tensor(%i) : tensor scf.yield %t2 : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_yield_allocation(%t: tensor, %lb : index, %ub : index, %step : index) -> tensor { %r = scf.for %i = %lb to %ub step %step iter_args(%a = %t) -> tensor { %t2 = bufferization.alloc_tensor(%i) : tensor scf.yield %t2 : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_swapping_yields( %A : tensor, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (f32, f32) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttB, %ttA : tensor, tensor } %f0 = tensor.extract %r0#0[%step] : tensor %f1 = tensor.extract %r0#1[%step] : tensor return %f0, %f1: f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_swapping_yields( %A : tensor, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (f32, f32) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttB, %ttA : tensor, tensor } %f0 = tensor.extract %r0#0[%step] : tensor %f1 = tensor.extract %r0#1[%step] : tensor return %f0, %f1: f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_while(%arg0: tensor, %idx: index) -> tensor { %res:2 = scf.while (%arg1 = %arg0, %i = %idx) : (tensor, index) -> (tensor, index) { %condition = tensor.extract %arg1[%idx] : tensor scf.condition(%condition) %arg1, %idx : tensor, index } do { ^bb0(%arg2: tensor, %i: index): %pos = ""dummy.some_op""() : () -> (index) %val = ""dummy.another_op""() : () -> (i1) %1 = tensor.insert %val into %arg2[%pos] : tensor scf.yield %1, %i : tensor, index } return %res#0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_while(%arg0: tensor, %idx: index) -> tensor { %res:2 = scf.while (%arg1 = %arg0, %i = %idx) : (tensor, index) -> (tensor, index) { %condition = tensor.extract %arg1[%idx] : tensor scf.condition(%condition) %arg1, %idx : tensor, index } do { ^bb0(%arg2: tensor, %i: index): %pos = ""dummy.some_op""() : () -> (index) %val = ""dummy.another_op""() : () -> (i1) %1 = tensor.insert %val into %arg2[%pos] : tensor scf.yield %1, %i : tensor, index } return %res#0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_while_non_equiv_condition(%arg0: tensor<5xi1>, %arg1: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %arg0, %w1 = %arg1) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w1, %w0 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): %pos = ""dummy.some_op""() : () -> (index) %val = ""dummy.another_op""() : () -> (i1) %1 = tensor.insert %val into %b0[%pos] : tensor<5xi1> scf.yield %1, %b1 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_while_non_equiv_condition(%arg0: tensor<5xi1>, %arg1: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %arg0, %w1 = %arg1) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w1, %w0 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): %pos = ""dummy.some_op""() : () -> (index) %val = ""dummy.another_op""() : () -> (i1) %1 = tensor.insert %val into %b0[%pos] : tensor<5xi1> scf.yield %1, %b1 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_while_non_equiv_condition_and_body(%arg0: tensor<5xi1>, %arg1: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %arg0, %w1 = %arg1) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w1, %w0 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): %pos = ""dummy.some_op""() : () -> (index) %val = ""dummy.another_op""() : () -> (i1) %1 = tensor.insert %val into %b0[%pos] : tensor<5xi1> scf.yield %b1, %1 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_while_non_equiv_condition_and_body(%arg0: tensor<5xi1>, %arg1: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %arg0, %w1 = %arg1) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w1, %w0 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): %pos = ""dummy.some_op""() : () -> (index) %val = ""dummy.another_op""() : () -> (i1) %1 = tensor.insert %val into %b0[%pos] : tensor<5xi1> scf.yield %b1, %1 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_while_iter_arg_result_mismatch(%arg0: tensor<5xi1>, %arg1: tensor<5xi1>, %arg2: index) { scf.while (%arg3 = %arg1) : (tensor<5xi1>) -> () { %0 = tensor.extract %arg0[%arg2] : tensor<5xi1> %1 = tensor.extract %arg3[%arg2] : tensor<5xi1> ""dummy.use""(%1) : (i1) -> () scf.condition(%0) } do { %0 = ""dummy.some_op""() : () -> index %1 = ""dummy.another_op""() : () -> i1 %2 = tensor.insert %1 into %arg0[%0] : tensor<5xi1> scf.yield %2 : tensor<5xi1> } return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_while_iter_arg_result_mismatch(%arg0: tensor<5xi1>, %arg1: tensor<5xi1>, %arg2: index) { scf.while (%arg3 = %arg1) : (tensor<5xi1>) -> () { %0 = tensor.extract %arg0[%arg2] : tensor<5xi1> %1 = tensor.extract %arg3[%arg2] : tensor<5xi1> ""dummy.use""(%1) : (i1) -> () scf.condition(%0) } do { %0 = ""dummy.some_op""() : () -> index %1 = ""dummy.another_op""() : () -> i1 %2 = tensor.insert %1 into %arg0[%0] : tensor<5xi1> scf.yield %2 : tensor<5xi1> } return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @parallel_insert_slice_no_conflict( %idx: index, %idx2: index, %arg1: tensor {bufferization.writable = true}, %arg2: tensor {bufferization.writable = true}) -> (tensor, f32) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = scf.forall (%arg3) in (%idx2) shared_outs(%o = %arg2) -> (tensor) { %6 = tensor.extract_slice %o[5] [%idx] [%c1] : tensor to tensor %8 = linalg.fill ins(%cst : f32) outs(%6 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[5] [%idx] [%c1] : tensor into tensor } } %f = tensor.extract %2[%c0] : tensor return %2, %f : tensor, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @parallel_insert_slice_no_conflict( %idx: index, %idx2: index, %arg1: tensor {bufferization.writable = true}, %arg2: tensor {bufferization.writable = true}) -> (tensor, f32) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = scf.forall (%arg3) in (%idx2) shared_outs(%o = %arg2) -> (tensor) { %6 = tensor.extract_slice %o[5] [%idx] [%c1] : tensor to tensor %8 = linalg.fill ins(%cst : f32) outs(%6 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[5] [%idx] [%c1] : tensor into tensor } } %f = tensor.extract %2[%c0] : tensor return %2, %f : tensor, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @parallel_insert_slice_with_conflict( %idx: index, %idx2: index, %arg1: tensor {bufferization.writable = true}, %arg2: tensor {bufferization.writable = true}) -> (f32, f32) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = scf.forall (%arg3) in (%idx2) shared_outs(%o = %arg2) -> (tensor) { %6 = tensor.extract_slice %o[5] [%idx] [%c1] : tensor to tensor %8 = linalg.fill ins(%cst : f32) outs(%6 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[5] [%idx] [%c1] : tensor into tensor } } %f = tensor.extract %arg2[%c0] : tensor %f2 = tensor.extract %2[%c0] : tensor return %f2, %f : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @parallel_insert_slice_with_conflict( %idx: index, %idx2: index, %arg1: tensor {bufferization.writable = true}, %arg2: tensor {bufferization.writable = true}) -> (f32, f32) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = scf.forall (%arg3) in (%idx2) shared_outs(%o = %arg2) -> (tensor) { %6 = tensor.extract_slice %o[5] [%idx] [%c1] : tensor to tensor %8 = linalg.fill ins(%cst : f32) outs(%6 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[5] [%idx] [%c1] : tensor into tensor } } %f = tensor.extract %arg2[%c0] : tensor %f2 = tensor.extract %2[%c0] : tensor return %f2, %f : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "#map0 = affine_map<(d0) -> (d0 * 4)> #map1 = affine_map<(d0) -> (d0 * 2)> func.func @matmul(%arg0: tensor<8x8xf32>, %arg1: tensor<8x8xf32>, %arg2: tensor<8x8xf32> {bufferization.writable = true}) -> tensor<8x8xf32> { %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %0 = scf.forall (%arg3, %arg4) in (%c2, %c4) shared_outs(%o = %arg2) -> (tensor<8x8xf32>) { %1 = affine.apply #map0(%arg3) %3 = tensor.extract_slice %arg0[%1, 0] [4, 8] [1, 1] : tensor<8x8xf32> to tensor<4x8xf32> %4 = affine.apply #map1(%arg4) %6 = tensor.extract_slice %arg1[0, %4] [8, 4] [1, 1] : tensor<8x8xf32> to tensor<8x4xf32> %7 = tensor.extract_slice %o[%1, %4] [4, 4] [1, 1] : tensor<8x8xf32> to tensor<4x4xf32> %8 = linalg.matmul ins(%3, %6 : tensor<4x8xf32>, tensor<8x4xf32>) outs(%7 : tensor<4x4xf32>) -> tensor<4x4xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[%1, %4] [4, 4] [1, 1] : tensor<4x4xf32> into tensor<8x8xf32> } } return %0 : tensor<8x8xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "#map0 = affine_map<(d0) -> (d0 * 4)> #map1 = affine_map<(d0) -> (d0 * 2)> func.func @matmul(%arg0: tensor<8x8xf32>, %arg1: tensor<8x8xf32>, %arg2: tensor<8x8xf32> {bufferization.writable = true}) -> tensor<8x8xf32> { %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %0 = scf.forall (%arg3, %arg4) in (%c2, %c4) shared_outs(%o = %arg2) -> (tensor<8x8xf32>) { %1 = affine.apply #map0(%arg3) %3 = tensor.extract_slice %arg0[%1, 0] [4, 8] [1, 1] : tensor<8x8xf32> to tensor<4x8xf32> %4 = affine.apply #map1(%arg4) %6 = tensor.extract_slice %arg1[0, %4] [8, 4] [1, 1] : tensor<8x8xf32> to tensor<8x4xf32> %7 = tensor.extract_slice %o[%1, %4] [4, 4] [1, 1] : tensor<8x8xf32> to tensor<4x4xf32> %8 = linalg.matmul ins(%3, %6 : tensor<4x8xf32>, tensor<8x4xf32>) outs(%7 : tensor<4x4xf32>) -> tensor<4x4xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[%1, %4] [4, 4] [1, 1] : tensor<4x4xf32> into tensor<8x8xf32> } } return %0 : tensor<8x8xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_foreach_private_var(%t: tensor<10xf32>) -> f32 { %c2 = arith.constant 2 : index %c5 = arith.constant 5 : index %0 = scf.forall (%tid) in (%c2) shared_outs(%o = %t) -> tensor<10xf32> { %offset = arith.muli %c5, %tid : index %slice = tensor.extract_slice %o[%offset] [5] [1] : tensor<10xf32> to tensor<5xf32> %r2 = tensor.extract %t[%tid] : tensor<10xf32> %i = tensor.insert %r2 into %slice[%c2] : tensor<5xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %i into %o[%offset] [5] [1] : tensor<5xf32> into tensor<10xf32> } } %r = tensor.extract %0[%c2] : tensor<10xf32> return %r : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_foreach_private_var(%t: tensor<10xf32>) -> f32 { %c2 = arith.constant 2 : index %c5 = arith.constant 5 : index %0 = scf.forall (%tid) in (%c2) shared_outs(%o = %t) -> tensor<10xf32> { %offset = arith.muli %c5, %tid : index %slice = tensor.extract_slice %o[%offset] [5] [1] : tensor<10xf32> to tensor<5xf32> %r2 = tensor.extract %t[%tid] : tensor<10xf32> %i = tensor.insert %r2 into %slice[%c2] : tensor<5xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %i into %o[%offset] [5] [1] : tensor<5xf32> into tensor<10xf32> } } %r = tensor.extract %0[%c2] : tensor<10xf32> return %r : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_foreach_privatized_but_not_copied( %t0: tensor<10xf32>, %t1: tensor<10xf32>) -> f32 { %c2 = arith.constant 2 : index %c5 = arith.constant 5 : index %0 = scf.forall (%tid) in (%c2) shared_outs(%o = %t0) -> tensor<10xf32> { %offset = arith.muli %c5, %tid : index %slice = tensor.extract_slice %o[%offset] [5] [1] : tensor<10xf32> to tensor<5xf32> %r2 = tensor.extract %t1[%tid] : tensor<10xf32> %i = tensor.insert %r2 into %slice[%c2] : tensor<5xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %i into %o[%offset] [5] [1] : tensor<5xf32> into tensor<10xf32> } } %r = tensor.extract %0[%c2] : tensor<10xf32> return %r : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_foreach_privatized_but_not_copied( %t0: tensor<10xf32>, %t1: tensor<10xf32>) -> f32 { %c2 = arith.constant 2 : index %c5 = arith.constant 5 : index %0 = scf.forall (%tid) in (%c2) shared_outs(%o = %t0) -> tensor<10xf32> { %offset = arith.muli %c5, %tid : index %slice = tensor.extract_slice %o[%offset] [5] [1] : tensor<10xf32> to tensor<5xf32> %r2 = tensor.extract %t1[%tid] : tensor<10xf32> %i = tensor.insert %r2 into %slice[%c2] : tensor<5xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %i into %o[%offset] [5] [1] : tensor<5xf32> into tensor<10xf32> } } %r = tensor.extract %0[%c2] : tensor<10xf32> return %r : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_if_memory_space(%c: i1, %f: f32, %cst: f32) -> (f32, f32) { %c0 = arith.constant 0 : index %alloc = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> %filled = linalg.fill ins(%cst : f32) outs(%alloc : tensor<5xf32>) -> tensor<5xf32> %1 = scf.if %c -> tensor<5xf32> { scf.yield %filled : tensor<5xf32> } else { %2 = tensor.insert %f into %filled[%c0] : tensor<5xf32> scf.yield %2 : tensor<5xf32> } %r0 = tensor.extract %filled[%c0] : tensor<5xf32> %r1 = tensor.extract %1[%c0] : tensor<5xf32> return %r0, %r1 : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_if_memory_space(%c: i1, %f: f32, %cst: f32) -> (f32, f32) { %c0 = arith.constant 0 : index %alloc = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> %filled = linalg.fill ins(%cst : f32) outs(%alloc : tensor<5xf32>) -> tensor<5xf32> %1 = scf.if %c -> tensor<5xf32> { scf.yield %filled : tensor<5xf32> } else { %2 = tensor.insert %f into %filled[%c0] : tensor<5xf32> scf.yield %2 : tensor<5xf32> } %r0 = tensor.extract %filled[%c0] : tensor<5xf32> %r1 = tensor.extract %1[%c0] : tensor<5xf32> return %r0, %r1 : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_execute_region_memory_space(%f: f32) -> f32 { %c0 = arith.constant 0 : index %0 = scf.execute_region -> tensor<5xf32> { %1 = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> %2 = tensor.insert %f into %1[%c0] : tensor<5xf32> scf.yield %2 : tensor<5xf32> } %r = tensor.extract %0[%c0] : tensor<5xf32> return %r : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_execute_region_memory_space(%f: f32) -> f32 { %c0 = arith.constant 0 : index %0 = scf.execute_region -> tensor<5xf32> { %1 = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> %2 = tensor.insert %f into %1[%c0] : tensor<5xf32> scf.yield %2 : tensor<5xf32> } %r = tensor.extract %0[%c0] : tensor<5xf32> return %r : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_swapping_yields_memory_space( %sz: index, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (f32, f32) { %A = bufferization.alloc_tensor(%sz) {memory_space = 1 : i64} : tensor %B = bufferization.alloc_tensor(%sz) {memory_space = 1 : i64} : tensor %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttB, %ttA : tensor, tensor } %f0 = tensor.extract %r0#0[%step] : tensor %f1 = tensor.extract %r0#1[%step] : tensor return %f0, %f1: f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_swapping_yields_memory_space( %sz: index, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (f32, f32) { %A = bufferization.alloc_tensor(%sz) {memory_space = 1 : i64} : tensor %B = bufferization.alloc_tensor(%sz) {memory_space = 1 : i64} : tensor %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[0][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[0][4][1] : tensor<4xf32> into tensor scf.yield %ttB, %ttA : tensor, tensor } %f0 = tensor.extract %r0#0[%step] : tensor %f1 = tensor.extract %r0#1[%step] : tensor return %f0, %f1: f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_yield_alias_of_non_equivalent(%sz: index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 5.0 : f32 %0 = tensor.generate %sz { ^bb0(%i: index): tensor.yield %cst : f32 } : tensor %r = scf.for %iv = %c0 to %sz step %c1 iter_args(%t = %0) -> tensor { %iv_sub = arith.subi %iv, %c1 : index %ll = tensor.extract_slice %0[%iv_sub][%sz][1] : tensor to tensor %l = tensor.extract %ll[%c0] : tensor %double = arith.mulf %cst, %l : f32 %s = tensor.insert %double into %t[%iv] : tensor scf.yield %s : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_yield_alias_of_non_equivalent(%sz: index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 5.0 : f32 %0 = tensor.generate %sz { ^bb0(%i: index): tensor.yield %cst : f32 } : tensor %r = scf.for %iv = %c0 to %sz step %c1 iter_args(%t = %0) -> tensor { %iv_sub = arith.subi %iv, %c1 : index %ll = tensor.extract_slice %0[%iv_sub][%sz][1] : tensor to tensor %l = tensor.extract %ll[%c0] : tensor %double = arith.mulf %cst, %l : f32 %s = tensor.insert %double into %t[%iv] : tensor scf.yield %s : tensor } return %r : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_for_buffer_type_mismatch(%sz: index, %sz2: index) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0 = bufferization.alloc_tensor(%sz) : tensor %e2 = tensor.extract_slice %0[1][%sz2][1] : tensor to tensor %r = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t = %e2) -> tensor { %s = ""test.dummy""() : () -> (index) %e = tensor.extract_slice %t[1][%s][1] : tensor to tensor scf.yield %e : tensor } %x = tensor.extract %r[%c1] : tensor return %x : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_for_buffer_type_mismatch(%sz: index, %sz2: index) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0 = bufferization.alloc_tensor(%sz) : tensor %e2 = tensor.extract_slice %0[1][%sz2][1] : tensor to tensor %r = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t = %e2) -> tensor { %s = ""test.dummy""() : () -> (index) %e = tensor.extract_slice %t[1][%s][1] : tensor to tensor scf.yield %e : tensor } %x = tensor.extract %r[%c1] : tensor return %x : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @scf_while_buffer_type_mismatch(%sz: index, %sz2: index) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cst = arith.constant 5.5 : f32 %0 = bufferization.alloc_tensor(%sz) : tensor %e2 = tensor.extract_slice %0[1][%sz2][1] : tensor to tensor %r = scf.while (%t = %e2) : (tensor) -> (tensor) { %c = ""test.condition""() : () -> (i1) %s = ""test.dummy""() : () -> (index) %e = tensor.extract_slice %t[1][%s][1] : tensor to tensor scf.condition(%c) %e : tensor } do { ^bb0(%b0: tensor): %s2 = ""test.dummy""() : () -> (index) %n = tensor.insert %cst into %b0[%s2] : tensor scf.yield %n : tensor } %x = tensor.extract %r[%c1] : tensor return %x : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @scf_while_buffer_type_mismatch(%sz: index, %sz2: index) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cst = arith.constant 5.5 : f32 %0 = bufferization.alloc_tensor(%sz) : tensor %e2 = tensor.extract_slice %0[1][%sz2][1] : tensor to tensor %r = scf.while (%t = %e2) : (tensor) -> (tensor) { %c = ""test.condition""() : () -> (i1) %s = ""test.dummy""() : () -> (index) %e = tensor.extract_slice %t[1][%s][1] : tensor to tensor scf.condition(%c) %e : tensor } do { ^bb0(%b0: tensor): %s2 = ""test.dummy""() : () -> (index) %n = tensor.insert %cst into %b0[%s2] : tensor scf.yield %n : tensor } %x = tensor.extract %r[%c1] : tensor return %x : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @non_tensor_for_arg(%A : tensor {bufferization.writable = true}) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2.0 : f32 %c10 = arith.constant 10 : index %r1:2 = scf.for %i = %c0 to %c10 step %c1 iter_args(%idx = %c1, %t = %A) -> (index, tensor) { %t2 = tensor.insert %c2 into %t[%idx] : tensor scf.yield %idx, %t2 : index, tensor } return %r1#1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @non_tensor_for_arg(%A : tensor {bufferization.writable = true}) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2.0 : f32 %c10 = arith.constant 10 : index %r1:2 = scf.for %i = %c0 to %c10 step %c1 iter_args(%idx = %c1, %t = %A) -> (index, tensor) { %t2 = tensor.insert %c2 into %t[%idx] : tensor scf.yield %idx, %t2 : index, tensor } return %r1#1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @buffer_type_of_collapse_shape(%arg0: tensor) { %true = arith.constant true %0 = scf.while (%arg1 = %arg0) : (tensor) -> (tensor) { scf.condition(%true) %arg1 : tensor } do { ^bb0(%_: tensor): %3 = bufferization.alloc_tensor() : tensor<1xf64> %16 = tensor.collapse_shape %3 [] : tensor<1xf64> into tensor scf.yield %16 : tensor } return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @buffer_type_of_collapse_shape(%arg0: tensor) { %true = arith.constant true %0 = scf.while (%arg1 = %arg0) : (tensor) -> (tensor) { scf.condition(%true) %arg1 : tensor } do { ^bb0(%_: tensor): %3 = bufferization.alloc_tensor() : tensor<1xf64> %16 = tensor.collapse_shape %3 [] : tensor<1xf64> into tensor scf.yield %16 : tensor } return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @non_block_argument_yield() { %true = arith.constant true %0 = bufferization.alloc_tensor() : tensor %1 = scf.while (%arg0 = %0) : (tensor) -> (tensor) { scf.condition(%true) %arg0 : tensor } do { ^bb0(%arg0: tensor): %ret = scf.while (%arg1 = %0) : (tensor) -> (tensor) { scf.condition(%true) %arg1 : tensor } do { ^bb0(%arg7: tensor): scf.yield %0 : tensor } scf.yield %ret : tensor } return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @non_block_argument_yield() { %true = arith.constant true %0 = bufferization.alloc_tensor() : tensor %1 = scf.while (%arg0 = %0) : (tensor) -> (tensor) { scf.condition(%true) %arg0 : tensor } do { ^bb0(%arg0: tensor): %ret = scf.while (%arg1 = %0) : (tensor) -> (tensor) { scf.condition(%true) %arg1 : tensor } do { ^bb0(%arg7: tensor): scf.yield %0 : tensor } scf.yield %ret : tensor } return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @regression_cast_in_loop() -> tensor<2xindex> { %false = arith.constant false %c0 = arith.constant 0 : index %0 = bufferization.alloc_tensor() : tensor<2xindex> %1 = scf.while (%arg0 = %0) : (tensor<2xindex>) -> tensor<2xindex> { scf.condition(%false) %arg0 : tensor<2xindex> } do { ^bb0(%arg0: tensor<2xindex>): %cast = tensor.cast %0 : tensor<2xindex> to tensor %inserted = tensor.insert %c0 into %cast[%c0] : tensor %cast_0 = tensor.cast %inserted : tensor to tensor<2xindex> scf.yield %cast_0 : tensor<2xindex> } return %1 : tensor<2xindex> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @regression_cast_in_loop() -> tensor<2xindex> { %false = arith.constant false %c0 = arith.constant 0 : index %0 = bufferization.alloc_tensor() : tensor<2xindex> %1 = scf.while (%arg0 = %0) : (tensor<2xindex>) -> tensor<2xindex> { scf.condition(%false) %arg0 : tensor<2xindex> } do { ^bb0(%arg0: tensor<2xindex>): %cast = tensor.cast %0 : tensor<2xindex> to tensor %inserted = tensor.insert %c0 into %cast[%c0] : tensor %cast_0 = tensor.cast %inserted : tensor to tensor<2xindex> scf.yield %cast_0 : tensor<2xindex> } return %1 : tensor<2xindex> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @elide_copy_of_non_writing_scf_if(%c: i1, %p1: index, %p2: index, %f: f32) -> (tensor<10xf32>, f32) { %r = scf.if %c -> tensor<10xf32> { %t1 = bufferization.alloc_tensor() : tensor<10xf32> scf.yield %t1 : tensor<10xf32> } else { %t2 = bufferization.alloc_tensor() : tensor<10xf32> scf.yield %t2 : tensor<10xf32> } %r2 = tensor.insert %f into %r[%p1] : tensor<10xf32> %r3 = tensor.extract %r[%p2] : tensor<10xf32> return %r2, %r3 : tensor<10xf32>, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @elide_copy_of_non_writing_scf_if(%c: i1, %p1: index, %p2: index, %f: f32) -> (tensor<10xf32>, f32) { %r = scf.if %c -> tensor<10xf32> { %t1 = bufferization.alloc_tensor() : tensor<10xf32> scf.yield %t1 : tensor<10xf32> } else { %t2 = bufferization.alloc_tensor() : tensor<10xf32> scf.yield %t2 : tensor<10xf32> } %r2 = tensor.insert %f into %r[%p1] : tensor<10xf32> %r3 = tensor.extract %r[%p2] : tensor<10xf32> return %r2, %r3 : tensor<10xf32>, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @get_parent_for_op(%arg0: index, %arg1: index, %arg2: index) { scf.for %i = %arg0 to %arg1 step %arg2 { scf.for %j = %arg0 to %arg1 step %arg2 { scf.for %k = %arg0 to %arg1 step %arg2 { arith.addi %i, %j : index } } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.op<""scf.for""> %2 = transform.loop.get_parent_for %0 { num_loops = 2 } : (!transform.any_op) -> !transform.op<""scf.for""> %3 = transform.loop.get_parent_for %0 { num_loops = 3 } : (!transform.any_op) -> !transform.op<""scf.for""> transform.test_print_remark_at_operand %1, ""third loop"" : !transform.op<""scf.for""> transform.test_print_remark_at_operand %2, ""second loop"" : !transform.op<""scf.for""> transform.test_print_remark_at_operand %3, ""first loop"" : !transform.op<""scf.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @get_parent_for_op_no_loop(%arg0: index, %arg1: index) { arith.addi %arg0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.op<""scf.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @loop_outline_op(%arg0: index, %arg1: index, %arg2: index) { scf.for %i = %arg0 to %arg1 step %arg2 { scf.for %j = %arg0 to %arg1 step %arg2 { arith.addi %i, %j : index } } scf.for %j = %arg0 to %arg1 step %arg2 { arith.addi %j, %j : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.op<""scf.for""> transform.loop.outline %1 {func_name = ""foo""} : (!transform.op<""scf.for"">) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @loop_peel_op() { %0 = arith.constant 0 : index %1 = arith.constant 42 : index %2 = arith.constant 5 : index scf.for %i = %0 to %1 step %2 { arith.addi %i, %i : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.op<""scf.for""> transform.loop.peel %1 : (!transform.op<""scf.for"">) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @loop_pipeline_op(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] : memref %A1_elem = arith.addf %A_elem, %cf : f32 memref.store %A1_elem, %result[%i0] : memref } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.op<""scf.for""> %2 = transform.loop.pipeline %1 : (!transform.op<""scf.for"">) -> !transform.any_op transform.test_print_remark_at_operand %2, ""transformed"" : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @loop_unroll_op() { %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index %c5 = arith.constant 5 : index scf.for %i = %c0 to %c42 step %c5 { arith.addi %i, %i : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.op<""scf.for""> transform.loop.unroll %1 { factor = 4 } : !transform.op<""scf.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @get_parent_for_op(%arg0: index, %arg1: index, %arg2: index) { affine.for %i = %arg0 to %arg1 { affine.for %j = %arg0 to %arg1 { affine.for %k = %arg0 to %arg1 { arith.addi %i, %j : index } } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 { affine = true } : (!transform.any_op) -> !transform.op<""affine.for""> %2 = transform.loop.get_parent_for %0 { num_loops = 2, affine = true } : (!transform.any_op) -> !transform.op<""affine.for""> %3 = transform.loop.get_parent_for %0 { num_loops = 3, affine = true } : (!transform.any_op) -> !transform.op<""affine.for""> transform.test_print_remark_at_operand %1, ""third loop"" : !transform.op<""affine.for""> transform.test_print_remark_at_operand %2, ""second loop"" : !transform.op<""affine.for""> transform.test_print_remark_at_operand %3, ""first loop"" : !transform.op<""affine.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @get_parent_for_op_no_loop(%arg0: index, %arg1: index) { arith.addi %arg0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 { affine = true } : (!transform.any_op) -> !transform.op<""affine.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @loop_unroll_op() { %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index %c5 = arith.constant 5 : index affine.for %i = %c0 to %c42 { arith.addi %i, %i : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 { affine = true } : (!transform.any_op) -> !transform.op<""affine.for""> transform.test_print_remark_at_operand %1, ""affine for loop"" : !transform.op<""affine.for""> transform.loop.unroll %1 { factor = 4, affine = true } : !transform.op<""affine.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @test_mixed_loops() { %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index %c5 = arith.constant 5 : index scf.for %j = %c0 to %c42 step %c5 { affine.for %i = %c0 to %c42 { arith.addi %i, %i : index } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 { num_loops = 1, affine = true } : (!transform.any_op) -> !transform.op<""affine.for""> transform.test_print_remark_at_operand %1, ""affine for loop"" : !transform.op<""affine.for""> transform.loop.unroll %1 { factor = 4 } : !transform.op<""affine.for""> }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @test_scf_if_sink(%arg0: i1, %arg1: i32) -> i32 { %0 = arith.addi %arg1, %arg1 : i32 %1 = arith.muli %arg1, %arg1 : i32 %result = scf.if %arg0 -> i32 { scf.yield %0 : i32 } else { scf.yield %1 : i32 } return %result : i32 }", mlir-opt -split-input-file -control-flow-sink ,1 "func.func private @consume(i32) -> () func.func @test_scf_if_then_only_sink(%arg0: i1, %arg1: i32) { %0 = arith.addi %arg1, %arg1 : i32 scf.if %arg0 { func.call @consume(%0) : (i32) -> () scf.yield } return }", mlir-opt -split-input-file -control-flow-sink ,1 "func.func private @consume(i32) -> () func.func @test_scf_if_double_sink(%arg0: i1, %arg1: i32) { %0 = arith.addi %arg1, %arg1 : i32 scf.if %arg0 { scf.if %arg0 { func.call @consume(%0) : (i32) -> () scf.yield } } return }", mlir-opt -split-input-file -control-flow-sink ,1 "func.func @simple_pipeline(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @simple_pipeline(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @simple_pipeline(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @simple_pipeline_region(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = scf.execute_region -> f32 { %A_elem1 = memref.load %A[%i0] : memref scf.yield %A_elem1 : f32 } { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } %A1_elem = scf.execute_region -> f32 { %A1_elem1 = arith.addf %A_elem, %cf : f32 scf.yield %A1_elem1 : f32 } { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @simple_pipeline_region(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = scf.execute_region -> f32 { %A_elem1 = memref.load %A[%i0] : memref scf.yield %A_elem1 : f32 } { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } %A1_elem = scf.execute_region -> f32 { %A1_elem1 = arith.addf %A_elem, %cf : f32 scf.yield %A1_elem1 : f32 } { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @simple_pipeline_region(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = scf.execute_region -> f32 { %A_elem1 = memref.load %A[%i0] : memref scf.yield %A_elem1 : f32 } { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } %A1_elem = scf.execute_region -> f32 { %A1_elem1 = arith.addf %A_elem, %cf : f32 scf.yield %A1_elem1 : f32 } { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @simple_pipeline_step(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c11 = arith.constant 11 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c11 step %c3 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @simple_pipeline_step(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c11 = arith.constant 11 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c11 step %c3 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @simple_pipeline_step(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c11 = arith.constant 11 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c11 step %c3 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @three_stage(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @three_stage(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @three_stage(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c4 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @long_liverange(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 4, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 4, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @long_liverange(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 4, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 4, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @long_liverange(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 4, __test_pipelining_op_order__ = 0 } : f32 memref.store %A1_elem, %result[%i0] { __test_pipelining_stage__ = 4, __test_pipelining_op_order__ = 1 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @multiple_uses(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = arith.mulf %A1_elem, %A_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } : f32 memref.store %A2_elem, %result[%i0] { __test_pipelining_stage__ = 3, __test_pipelining_op_order__ = 2 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @multiple_uses(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = arith.mulf %A1_elem, %A_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } : f32 memref.store %A2_elem, %result[%i0] { __test_pipelining_stage__ = 3, __test_pipelining_op_order__ = 2 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @multiple_uses(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = arith.mulf %A1_elem, %A_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } : f32 memref.store %A2_elem, %result[%i0] { __test_pipelining_stage__ = 3, __test_pipelining_op_order__ = 2 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @region_multiple_uses(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = scf.execute_region -> f32 { %A2_elem1 = arith.mulf %A1_elem, %A_elem : f32 scf.yield %A2_elem1 : f32 } { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } memref.store %A2_elem, %result[%i0] { __test_pipelining_stage__ = 3, __test_pipelining_op_order__ = 2 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @region_multiple_uses(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = scf.execute_region -> f32 { %A2_elem1 = arith.mulf %A1_elem, %A_elem : f32 scf.yield %A2_elem1 : f32 } { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } memref.store %A2_elem, %result[%i0] { __test_pipelining_stage__ = 3, __test_pipelining_op_order__ = 2 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @region_multiple_uses(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %cf = arith.constant 1.0 : f32 scf.for %i0 = %c0 to %c10 step %c1 { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A1_elem = arith.addf %A_elem, %cf { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = scf.execute_region -> f32 { %A2_elem1 = arith.mulf %A1_elem, %A_elem : f32 scf.yield %A2_elem1 : f32 } { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 1 } memref.store %A2_elem, %result[%i0] { __test_pipelining_stage__ = 3, __test_pipelining_op_order__ = 2 } : memref } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @loop_carried(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 1 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A1_elem : f32 } { __test_pipelining_loop__ } memref.store %r, %result[%c0] : memref return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @loop_carried(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 1 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A1_elem : f32 } { __test_pipelining_loop__ } memref.store %r, %result[%c0] : memref return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @loop_carried(%A: memref, %result: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 1.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 1 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A1_elem : f32 } { __test_pipelining_loop__ } memref.store %r, %result[%c0] : memref return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @backedge_different_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @backedge_different_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @backedge_different_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @region_backedge_different_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = scf.execute_region -> f32 { %A_elem1 = memref.load %A[%i0] : memref scf.yield %A_elem1 : f32 } { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } %A1_elem = scf.execute_region -> f32 { %inner = arith.addf %A_elem, %arg0 : f32 scf.yield %inner : f32 } { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @region_backedge_different_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = scf.execute_region -> f32 { %A_elem1 = memref.load %A[%i0] : memref scf.yield %A_elem1 : f32 } { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } %A1_elem = scf.execute_region -> f32 { %inner = arith.addf %A_elem, %arg0 : f32 scf.yield %inner : f32 } { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @region_backedge_different_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = scf.execute_region -> f32 { %A_elem1 = memref.load %A[%i0] : memref scf.yield %A_elem1 : f32 } { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } %A1_elem = scf.execute_region -> f32 { %inner = arith.addf %A_elem, %arg0 : f32 scf.yield %inner : f32 } { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 2, __test_pipelining_op_order__ = 0 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @backedge_same_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @backedge_same_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @backedge_same_stage(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : memref %A1_elem = arith.addf %A_elem, %arg0 { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : f32 %A2_elem = arith.mulf %cf, %A1_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 scf.yield %A2_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "#map = affine_map<(d0)[s0]->(d0 + s0)> #map1 = affine_map<(d0)->(d0)> #map2 = affine_map<(d0)->()> #linalg_attrs = { indexing_maps = [ #map1, #map1, #map2, #map1 ], iterator_types = [""parallel""], __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 2 } func.func @pipeline_op_with_region(%A: memref, %B: memref, %result: memref, %cf: f32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %a_buf = memref.alloc() : memref<2x8xf32> %b_buf = memref.alloc() : memref<2x8xf32> scf.for %i0 = %c0 to %c4 step %c1 { %A_view = memref.subview %A[%i0][8][1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref to memref<8xf32, #map> %B_view = memref.subview %B[%i0][8][1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 4 } : memref to memref<8xf32, #map> %buf_idx = affine.apply affine_map<(d0)->(d0 mod 2)> (%i0)[] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 5 } %a_buf_view = memref.subview %a_buf[%buf_idx,0][1,8][1,1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 6 } : memref<2x8xf32> to memref<8xf32, #map> %b_buf_view = memref.subview %b_buf[%buf_idx,0][1,8][1,1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 7 } : memref<2x8xf32> to memref<8xf32, #map> memref.copy %A_view , %a_buf_view {__test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 8} : memref<8xf32, #map> to memref<8xf32, #map> memref.copy %B_view , %b_buf_view {__test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 9} : memref<8xf32, #map> to memref<8xf32, #map> %C_view = memref.subview %result[%i0][8][1] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : memref to memref<8xf32, #map> %scalar = arith.addf %cf, %cf {__test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1} : f32 linalg.generic #linalg_attrs ins(%a_buf_view, %b_buf_view, %scalar : memref<8xf32, #map>, memref<8xf32, #map>, f32) outs(%C_view: memref<8xf32, #map>) { ^bb0(%a: f32, %b: f32, %s: f32, %c: f32): %add = arith.addf %a, %b : f32 %accum = arith.addf %add, %c : f32 %accum1 = arith.addf %scalar, %accum : f32 %accum2 = arith.addf %s, %accum1 : f32 linalg.yield %accum2 : f32 } scf.yield } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining -split-input-file ,1 "#map = affine_map<(d0)[s0]->(d0 + s0)> #map1 = affine_map<(d0)->(d0)> #map2 = affine_map<(d0)->()> #linalg_attrs = { indexing_maps = [ #map1, #map1, #map2, #map1 ], iterator_types = [""parallel""], __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 2 } func.func @pipeline_op_with_region(%A: memref, %B: memref, %result: memref, %cf: f32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %a_buf = memref.alloc() : memref<2x8xf32> %b_buf = memref.alloc() : memref<2x8xf32> scf.for %i0 = %c0 to %c4 step %c1 { %A_view = memref.subview %A[%i0][8][1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref to memref<8xf32, #map> %B_view = memref.subview %B[%i0][8][1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 4 } : memref to memref<8xf32, #map> %buf_idx = affine.apply affine_map<(d0)->(d0 mod 2)> (%i0)[] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 5 } %a_buf_view = memref.subview %a_buf[%buf_idx,0][1,8][1,1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 6 } : memref<2x8xf32> to memref<8xf32, #map> %b_buf_view = memref.subview %b_buf[%buf_idx,0][1,8][1,1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 7 } : memref<2x8xf32> to memref<8xf32, #map> memref.copy %A_view , %a_buf_view {__test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 8} : memref<8xf32, #map> to memref<8xf32, #map> memref.copy %B_view , %b_buf_view {__test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 9} : memref<8xf32, #map> to memref<8xf32, #map> %C_view = memref.subview %result[%i0][8][1] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : memref to memref<8xf32, #map> %scalar = arith.addf %cf, %cf {__test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1} : f32 linalg.generic #linalg_attrs ins(%a_buf_view, %b_buf_view, %scalar : memref<8xf32, #map>, memref<8xf32, #map>, f32) outs(%C_view: memref<8xf32, #map>) { ^bb0(%a: f32, %b: f32, %s: f32, %c: f32): %add = arith.addf %a, %b : f32 %accum = arith.addf %add, %c : f32 %accum1 = arith.addf %scalar, %accum : f32 %accum2 = arith.addf %s, %accum1 : f32 linalg.yield %accum2 : f32 } scf.yield } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "#map = affine_map<(d0)[s0]->(d0 + s0)> #map1 = affine_map<(d0)->(d0)> #map2 = affine_map<(d0)->()> #linalg_attrs = { indexing_maps = [ #map1, #map1, #map2, #map1 ], iterator_types = [""parallel""], __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 2 } func.func @pipeline_op_with_region(%A: memref, %B: memref, %result: memref, %cf: f32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %a_buf = memref.alloc() : memref<2x8xf32> %b_buf = memref.alloc() : memref<2x8xf32> scf.for %i0 = %c0 to %c4 step %c1 { %A_view = memref.subview %A[%i0][8][1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref to memref<8xf32, #map> %B_view = memref.subview %B[%i0][8][1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 4 } : memref to memref<8xf32, #map> %buf_idx = affine.apply affine_map<(d0)->(d0 mod 2)> (%i0)[] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 5 } %a_buf_view = memref.subview %a_buf[%buf_idx,0][1,8][1,1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 6 } : memref<2x8xf32> to memref<8xf32, #map> %b_buf_view = memref.subview %b_buf[%buf_idx,0][1,8][1,1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 7 } : memref<2x8xf32> to memref<8xf32, #map> memref.copy %A_view , %a_buf_view {__test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 8} : memref<8xf32, #map> to memref<8xf32, #map> memref.copy %B_view , %b_buf_view {__test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 9} : memref<8xf32, #map> to memref<8xf32, #map> %C_view = memref.subview %result[%i0][8][1] { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 0 } : memref to memref<8xf32, #map> %scalar = arith.addf %cf, %cf {__test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1} : f32 linalg.generic #linalg_attrs ins(%a_buf_view, %b_buf_view, %scalar : memref<8xf32, #map>, memref<8xf32, #map>, f32) outs(%C_view: memref<8xf32, #map>) { ^bb0(%a: f32, %b: f32, %s: f32, %c: f32): %add = arith.addf %a, %b : f32 %accum = arith.addf %add, %c : f32 %accum1 = arith.addf %scalar, %accum : f32 %accum2 = arith.addf %s, %accum1 : f32 linalg.yield %accum2 : f32 } scf.yield } { __test_pipelining_loop__ } return }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "func.func @backedge_mix_order(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 0 } : memref %A2_elem = arith.mulf %arg0, %A_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 %i1 = arith.addi %i0, %c1 { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : index %A1_elem = memref.load %A[%i1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A3_elem = arith.mulf %A1_elem, %A2_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 4 } : f32 scf.yield %A3_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining -split-input-file ,1 "func.func @backedge_mix_order(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 0 } : memref %A2_elem = arith.mulf %arg0, %A_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 %i1 = arith.addi %i0, %c1 { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : index %A1_elem = memref.load %A[%i1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A3_elem = arith.mulf %A1_elem, %A2_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 4 } : f32 scf.yield %A3_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=annotate -split-input-file ,1 "func.func @backedge_mix_order(%A: memref) -> f32 { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf = arith.constant 2.0 : f32 %r = scf.for %i0 = %c0 to %c4 step %c1 iter_args(%arg0 = %cf) -> (f32) { %A_elem = memref.load %A[%i0] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 0 } : memref %A2_elem = arith.mulf %arg0, %A_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 1 } : f32 %i1 = arith.addi %i0, %c1 { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 2 } : index %A1_elem = memref.load %A[%i1] { __test_pipelining_stage__ = 0, __test_pipelining_op_order__ = 3 } : memref %A3_elem = arith.mulf %A1_elem, %A2_elem { __test_pipelining_stage__ = 1, __test_pipelining_op_order__ = 4 } : f32 scf.yield %A3_elem : f32 } { __test_pipelining_loop__ } return %r : f32 }", mlir-opt -test-scf-pipelining=no-epilogue-peeling -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @fully_dynamic_bounds(%lb : index, %ub: index, %step: index) -> i32 { %c0 = arith.constant 0 : i32 %r = scf.for %iv = %lb to %ub step %step iter_args(%arg = %c0) -> i32 { %s = affine.min #map(%ub, %iv)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg, %casted : i32 scf.yield %0 : i32 } return %r : i32 }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @fully_dynamic_bounds(%lb : index, %ub: index, %step: index) -> i32 { %c0 = arith.constant 0 : i32 %r = scf.for %iv = %lb to %ub step %step iter_args(%arg = %c0) -> i32 { %s = affine.min #map(%ub, %iv)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg, %casted : i32 scf.yield %0 : i32 } return %r : i32 }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @fully_static_bounds() -> i32 { %c0_i32 = arith.constant 0 : i32 %lb = arith.constant 0 : index %step = arith.constant 4 : index %ub = arith.constant 17 : index %r = scf.for %iv = %lb to %ub step %step iter_args(%arg = %c0_i32) -> i32 { %s = affine.min #map(%ub, %iv)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg, %casted : i32 scf.yield %0 : i32 } return %r : i32 }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @fully_static_bounds() -> i32 { %c0_i32 = arith.constant 0 : i32 %lb = arith.constant 0 : index %step = arith.constant 4 : index %ub = arith.constant 17 : index %r = scf.for %iv = %lb to %ub step %step iter_args(%arg = %c0_i32) -> i32 { %s = affine.min #map(%ub, %iv)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg, %casted : i32 scf.yield %0 : i32 } return %r : i32 }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @dynamic_upper_bound(%ub : index) -> i32 { %c0_i32 = arith.constant 0 : i32 %lb = arith.constant 0 : index %step = arith.constant 4 : index %r = scf.for %iv = %lb to %ub step %step iter_args(%arg = %c0_i32) -> i32 { %s = affine.min #map(%ub, %iv)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg, %casted : i32 scf.yield %0 : i32 } return %r : i32 }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @dynamic_upper_bound(%ub : index) -> i32 { %c0_i32 = arith.constant 0 : i32 %lb = arith.constant 0 : index %step = arith.constant 4 : index %r = scf.for %iv = %lb to %ub step %step iter_args(%arg = %c0_i32) -> i32 { %s = affine.min #map(%ub, %iv)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg, %casted : i32 scf.yield %0 : i32 } return %r : i32 }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @no_loop_results(%ub : index, %d : memref) { %c0_i32 = arith.constant 0 : i32 %lb = arith.constant 0 : index %step = arith.constant 4 : index scf.for %iv = %lb to %ub step %step { %s = affine.min #map(%ub, %iv)[%step] %r = memref.load %d[] : memref %casted = arith.index_cast %s : index to i32 %0 = arith.addi %r, %casted : i32 memref.store %0, %d[] : memref } return }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @no_loop_results(%ub : index, %d : memref) { %c0_i32 = arith.constant 0 : i32 %lb = arith.constant 0 : index %step = arith.constant 4 : index scf.for %iv = %lb to %ub step %step { %s = affine.min #map(%ub, %iv)[%step] %r = memref.load %d[] : memref %casted = arith.index_cast %s : index to i32 %0 = arith.addi %r, %casted : i32 memref.store %0, %d[] : memref } return }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "#map0 = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> #map1 = affine_map<(d0, d1)[s0] -> (d0 - d1 + 1, s0)> #map2 = affine_map<(d0, d1)[s0] -> (s0 + 1, d0 - d1 + 1)> #map3 = affine_map<(d0, d1)[s0] -> (s0, d0 - d1 - 1)> #map4 = affine_map<(d0, d1, d2)[s0] -> (s0, d0 - d1, d2)> #map5 = affine_map<(d0, d1)[s0] -> (-s0, -d0 + d1)> func.func @test_affine_op_rewrite(%lb : index, %ub: index, %step: index, %d : memref, %some_val: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index scf.for %iv = %lb to %ub step %step { %m0 = affine.min #map0(%ub, %iv)[%step] memref.store %m0, %d[%c0] : memref %m1 = affine.min #map1(%ub, %iv)[%step] memref.store %m1, %d[%c1] : memref %m2 = affine.min #map2(%ub, %iv)[%step] memref.store %m2, %d[%c2] : memref %m3 = affine.min #map3(%ub, %iv)[%step] memref.store %m3, %d[%c3] : memref %m4 = affine.min #map4(%ub, %iv, %some_val)[%step] memref.store %m4, %d[%c4] : memref %m5 = affine.max #map5(%ub, %iv)[%step] memref.store %m5, %d[%c5] : memref } return }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "#map0 = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> #map1 = affine_map<(d0, d1)[s0] -> (d0 - d1 + 1, s0)> #map2 = affine_map<(d0, d1)[s0] -> (s0 + 1, d0 - d1 + 1)> #map3 = affine_map<(d0, d1)[s0] -> (s0, d0 - d1 - 1)> #map4 = affine_map<(d0, d1, d2)[s0] -> (s0, d0 - d1, d2)> #map5 = affine_map<(d0, d1)[s0] -> (-s0, -d0 + d1)> func.func @test_affine_op_rewrite(%lb : index, %ub: index, %step: index, %d : memref, %some_val: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index scf.for %iv = %lb to %ub step %step { %m0 = affine.min #map0(%ub, %iv)[%step] memref.store %m0, %d[%c0] : memref %m1 = affine.min #map1(%ub, %iv)[%step] memref.store %m1, %d[%c1] : memref %m2 = affine.min #map2(%ub, %iv)[%step] memref.store %m2, %d[%c2] : memref %m3 = affine.min #map3(%ub, %iv)[%step] memref.store %m3, %d[%c3] : memref %m4 = affine.min #map4(%ub, %iv, %some_val)[%step] memref.store %m4, %d[%c4] : memref %m5 = affine.max #map5(%ub, %iv)[%step] memref.store %m5, %d[%c5] : memref } return }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @nested_loops(%lb0: index, %lb1 : index, %ub0: index, %ub1: index, %step: index) -> i32 { %c0 = arith.constant 0 : i32 %r0 = scf.for %iv0 = %lb0 to %ub0 step %step iter_args(%arg0 = %c0) -> i32 { %r1 = scf.for %iv1 = %lb1 to %ub1 step %step iter_args(%arg1 = %arg0) -> i32 { %s = affine.min #map(%ub1, %iv1)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg1, %casted : i32 scf.yield %0 : i32 } %1 = arith.addi %arg0, %r1 : i32 scf.yield %1 : i32 } return %r0 : i32 }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "#map = affine_map<(d0, d1)[s0] -> (s0, d0 - d1)> func.func @nested_loops(%lb0: index, %lb1 : index, %ub0: index, %ub1: index, %step: index) -> i32 { %c0 = arith.constant 0 : i32 %r0 = scf.for %iv0 = %lb0 to %ub0 step %step iter_args(%arg0 = %c0) -> i32 { %r1 = scf.for %iv1 = %lb1 to %ub1 step %step iter_args(%arg1 = %arg0) -> i32 { %s = affine.min #map(%ub1, %iv1)[%step] %casted = arith.index_cast %s : index to i32 %0 = arith.addi %arg1, %casted : i32 scf.yield %0 : i32 } %1 = arith.addi %arg0, %r1 : i32 scf.yield %1 : i32 } return %r0 : i32 }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "func.func @regression(%arg0: memref, %arg1: index) { %c0 = arith.constant 0 : index %0 = affine.apply affine_map<()[s0] -> (s0 * s0)>()[%arg1] scf.for %arg2 = %c0 to %0 step %arg1 { %1 = affine.min affine_map<(d0)[s0] -> (s0, -d0 + s0 * s0)>(%arg2)[%arg1] %2 = arith.index_cast %0 : index to i64 memref.store %2, %arg0[] : memref } return }", mlir-opt -scf-for-loop-peeling -canonicalize -split-input-file ,1 "func.func @regression(%arg0: memref, %arg1: index) { %c0 = arith.constant 0 : index %0 = affine.apply affine_map<()[s0] -> (s0 * s0)>()[%arg1] scf.for %arg2 = %c0 to %0 step %arg1 { %1 = affine.min affine_map<(d0)[s0] -> (s0, -d0 + s0 * s0)>(%arg2)[%arg1] %2 = arith.index_cast %0 : index to i64 memref.store %2, %arg0[] : memref } return }", mlir-opt -scf-for-loop-peeling=skip-partial=false -canonicalize -split-input-file ,1 "func.func @scf_for(%A : tensor, %B : tensor, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { scf.yield %tA, %tB : tensor, tensor } return %r0#0, %r0#1 : tensor, tensor }"," mlir-opt -test-tensor-copy-insertion=""allow-return-allocs"" -allow-unregistered-dialect -split-input-file ",1 "func.func @scf_for(%A : tensor, %B : tensor, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { scf.yield %tA, %tB : tensor, tensor } return %r0#0, %r0#1 : tensor, tensor }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @scf_for_swapping_yields(%A : tensor, %B : tensor, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { scf.yield %tB, %tA : tensor, tensor } return %r0#0, %r0#1 : tensor, tensor }"," mlir-opt -test-tensor-copy-insertion=""allow-return-allocs"" -allow-unregistered-dialect -split-input-file ",1 "func.func @scf_for_swapping_yields(%A : tensor, %B : tensor, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { scf.yield %tB, %tA : tensor, tensor } return %r0#0, %r0#1 : tensor, tensor }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @scf_while(%A: tensor<5xi1>, %B: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %A, %w1 = %B) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w0, %w1 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): scf.yield %b0, %b1 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -test-tensor-copy-insertion=""allow-return-allocs"" -allow-unregistered-dialect -split-input-file ",1 "func.func @scf_while(%A: tensor<5xi1>, %B: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %A, %w1 = %B) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w0, %w1 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): scf.yield %b0, %b1 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @scf_while_non_equiv_condition_and_body(%A: tensor<5xi1>, %B: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %A, %w1 = %B) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w1, %w0 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): scf.yield %b1, %b0 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -test-tensor-copy-insertion=""allow-return-allocs"" -allow-unregistered-dialect -split-input-file ",1 "func.func @scf_while_non_equiv_condition_and_body(%A: tensor<5xi1>, %B: tensor<5xi1>, %idx: index) -> (tensor<5xi1>, tensor<5xi1>) { %r0, %r1 = scf.while (%w0 = %A, %w1 = %B) : (tensor<5xi1>, tensor<5xi1>) -> (tensor<5xi1>, tensor<5xi1>) { %condition = tensor.extract %w0[%idx] : tensor<5xi1> scf.condition(%condition) %w1, %w0 : tensor<5xi1>, tensor<5xi1> } do { ^bb0(%b0: tensor<5xi1>, %b1: tensor<5xi1>): scf.yield %b1, %b0 : tensor<5xi1>, tensor<5xi1> } return %r0, %r1 : tensor<5xi1>, tensor<5xi1> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @scf_forall_out_of_place(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } {mapping = [#gpu.thread]} return }"," mlir-opt -test-tensor-copy-insertion=""allow-return-allocs"" -allow-unregistered-dialect -split-input-file ",1 "func.func @scf_forall_out_of_place(%in: tensor<100xf32>, %out: tensor<100xf32>) { %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs(%o = %out) -> tensor<100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } {mapping = [#gpu.thread]} return }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @scf_for_canonicalize_min(%A : memref) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index scf.for %i = %c0 to %c4 step %c2 { %1 = affine.min affine_map<(d0, d1)[] -> (2, d1 - d0)> (%i, %c4) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_canonicalize_max(%A : memref) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index scf.for %i = %c0 to %c4 step %c2 { %1 = affine.max affine_map<(d0, d1)[] -> (-2, -(d1 - d0))> (%i, %c4) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_max_not_canonicalizable(%A : memref) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index scf.for %i = %c0 to %c4 step %c2 { %1 = affine.max affine_map<(d0, d1)[] -> (-2, -(d1 - d0))> (%i, %c3) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_loop_nest_canonicalize_min(%A : memref) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c6 = arith.constant 6 : index scf.for %i = %c0 to %c4 step %c2 { scf.for %j = %c0 to %c6 step %c3 { %1 = affine.min affine_map<(d0, d1, d2, d3)[] -> (5, d1 + d3 - d0 - d2)> (%i, %c4, %j, %c6) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_not_canonicalizable_1(%A : memref) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index scf.for %i = %c1 to %c4 step %c2 { %1 = affine.min affine_map<(d0)[s0] -> (2, s0 - d0)> (%i)[%c4] %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_canonicalize_partly(%A : memref) { %c1 = arith.constant 1 : index %c16 = arith.constant 16 : index %c256 = arith.constant 256 : index scf.for %i = %c1 to %c256 step %c16 { %1 = affine.min affine_map<(d0) -> (256, 256 - d0)> (%i) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_not_canonicalizable_2(%A : memref, %step : index) { %c0 = arith.constant 0 : index %ub = affine.apply affine_map<(d0) -> (42 * d0)> (%step) scf.for %i = %c0 to %ub step %step { %1 = affine.min affine_map<(d0, d1, d2) -> (d0, d1 - d2)> (%step, %ub, %i) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_not_canonicalizable_3(%A : memref, %step : index) { %c0 = arith.constant 0 : index %ub2 = affine.apply affine_map<(d0)[s0] -> (s0 * d0)> (%step)[%step] scf.for %i = %c0 to %ub2 step %step { %1 = affine.min affine_map<(d0, d1, d2) -> (d0, d2 - d1)> (%step, %i, %ub2) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_for_invalid_loop(%A : memref, %step : index) { %c1 = arith.constant 1 : index %c7 = arith.constant 7 : index %c256 = arith.constant 256 : index scf.for %i = %c256 to %c1 step %c1 { %1 = affine.min affine_map<(d0)[s0] -> (s0 + d0, 0)> (%i)[%c7] %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_parallel_canonicalize_min_1(%A : memref) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index scf.parallel (%i) = (%c0) to (%c4) step (%c2) { %1 = affine.min affine_map<(d0, d1)[] -> (2, d1 - d0)> (%i, %c4) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @scf_parallel_canonicalize_min_2(%A : memref) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c7 = arith.constant 7 : index scf.parallel (%i) = (%c1) to (%c7) step (%c2) { %1 = affine.min affine_map<(d0)[s0] -> (2, s0 - d0)> (%i)[%c7] %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @tensor_dim_of_iter_arg(%t : tensor) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0, %1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg0 = %t, %arg1 = %c0) -> (tensor, index) { %dim = tensor.dim %arg0, %c0 : tensor scf.yield %arg0, %dim : tensor, index } return %1 : index }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @tensor_dim_of_iter_arg_insertslice(%t : tensor, %t2 : tensor<10x10xf32>) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0, %1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg0 = %t, %arg1 = %c0) -> (tensor, index) { %dim = tensor.dim %arg0, %c0 : tensor %2 = tensor.insert_slice %t2 into %arg0[0, 0] [10, 10] [1, 1] : tensor<10x10xf32> into tensor %3 = tensor.insert_slice %t2 into %2[1, 1] [10, 10] [1, 1] : tensor<10x10xf32> into tensor scf.yield %3, %dim : tensor, index } return %1 : index }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @tensor_dim_of_iter_arg_nested_for(%t : tensor, %t2 : tensor<10x10xf32>) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0, %1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg0 = %t, %arg1 = %c0) -> (tensor, index) { %2, %3 = scf.for %j = %c0 to %c10 step %c1 iter_args(%arg2 = %arg0, %arg3 = %arg1) -> (tensor, index) { %dim = tensor.dim %arg2, %c0 : tensor %4 = tensor.insert_slice %t2 into %arg2[0, 0] [10, 10] [1, 1] : tensor<10x10xf32> into tensor scf.yield %4, %dim : tensor, index } scf.yield %2, %3 : tensor, index } return %1 : index }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @tensor_dim_of_iter_arg_no_canonicalize(%t : tensor, %t2 : tensor) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0, %1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg0 = %t, %arg1 = %c0) -> (tensor, index) { %dim = tensor.dim %arg0, %c0 : tensor scf.yield %t2, %dim : tensor, index } return %1 : index }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @tensor_dim_of_loop_result(%t : tensor) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0 = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg0 = %t) -> (tensor) { scf.yield %arg0 : tensor } %dim = tensor.dim %0, %c0 : tensor return %dim : index }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @tensor_dim_of_loop_result_no_canonicalize(%t : tensor, %u : tensor) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %0, %1 = scf.for %i = %c0 to %c10 step %c1 iter_args(%arg0 = %t, %arg1 = %u) -> (tensor, tensor) { scf.yield %arg0, %u : tensor, tensor } %dim = tensor.dim %1, %c0 : tensor return %dim : index }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @one_trip_scf_for_canonicalize_min(%A : memref) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index scf.for %i = %c0 to %c4 step %c4 { %1 = affine.min affine_map<(d0, d1)[] -> (4, d1 - d0)> (%i, %c4) %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @regression_multiplication_with_sym(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %ub = ""test.dummy""() : () -> (index) scf.for %i = %c0 to %ub step %c1 { %1 = affine.min affine_map<(d0)[s0] -> (-(d0 * (5 ceildiv s0)) + 5, 3)>(%i)[%ub] %2 = arith.index_cast %1: index to i64 memref.store %2, %A[]: memref } return }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "#map6 = affine_map<(d0, d1, d2) -> (d0 floordiv 64)> #map29 = affine_map<(d0, d1, d2) -> (d2 * 64 - 2, 5, (d1 mod 4) floordiv 8)> module { func.func @func1() { %true = arith.constant true %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %c11 = arith.constant 11 : index %c14 = arith.constant 14 : index %c15 = arith.constant 15 : index %alloc_249 = memref.alloc() : memref<7xf32> %135 = affine.apply #map6(%c15, %c0, %c14) %163 = affine.min #map29(%c5, %135, %c11) %196 = scf.index_switch %163 -> i1 default { memref.assume_alignment %alloc_249, 1 : memref<7xf32> scf.yield %true : i1 } return } }", mlir-opt -scf-for-loop-canonicalization -split-input-file ,1 "func.func @fold_one_loop(%arg0: memref, %arg1: index, %arg2: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index scf.for %i = %c0 to %arg1 step %c1 { %0 = arith.addi %arg2, %i : index %1 = arith.muli %0, %c4 : index %2 = memref.load %arg0[%1] : memref %3 = arith.muli %2, %2 : i32 memref.store %3, %arg0[%1] : memref } return } func.func @fold_one_loop2(%arg0: memref, %arg1: index, %arg2: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c10 = arith.constant 10 : index scf.for %j = %c0 to %c10 step %c1 { scf.for %i = %c0 to %arg1 step %c1 { %0 = arith.addi %arg2, %i : index %1 = arith.muli %0, %c4 : index %2 = memref.load %arg0[%1] : memref %3 = arith.muli %2, %2 : i32 memref.store %3, %arg0[%1] : memref } } return } func.func @fold_two_loops(%arg0: memref, %arg1: index, %arg2: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %c10 = arith.constant 10 : index scf.for %j = %c0 to %c10 step %c1 { scf.for %i = %j to %arg1 step %c1 { %0 = arith.addi %arg2, %i : index %1 = arith.muli %0, %c4 : index %2 = memref.load %arg0[%1] : memref %3 = arith.muli %2, %2 : i32 memref.store %3, %arg0[%1] : memref } } return } func.func @fold_only_first_add(%arg0: memref, %arg1: index, %arg2: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index scf.for %i = %c0 to %arg1 step %c1 { %0 = arith.addi %arg2, %i : index %1 = arith.addi %arg2, %c4 : index %2 = arith.muli %0, %1 : index %3 = memref.load %arg0[%2] : memref %4 = arith.muli %3, %3 : i32 memref.store %4, %arg0[%2] : memref } return }", mlir-opt -pass-pipeline='builtin.module(func.func(scf-for-loop-range-folding))' -split-input-file ,1 "func.func @fuse_empty_loops() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @fuse_two(%A: memref<2x2xf32>, %B: memref<2x2xf32>, %C: memref<2x2xf32>, %result: memref<2x2xf32>) { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %sum = memref.alloc() : memref<2x2xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %B_elem = memref.load %B[%i, %j] : memref<2x2xf32> %C_elem = memref.load %C[%i, %j] : memref<2x2xf32> %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %sum[%i, %j] : memref<2x2xf32> scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %sum_elem = memref.load %sum[%i, %j] : memref<2x2xf32> %A_elem = memref.load %A[%i, %j] : memref<2x2xf32> %product_elem = arith.mulf %sum_elem, %A_elem : f32 memref.store %product_elem, %result[%i, %j] : memref<2x2xf32> scf.yield } memref.dealloc %sum : memref<2x2xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @fuse_three(%lhs: memref<100x10xf32>, %rhs: memref<100xf32>, %result: memref<100x10xf32>) { %c100 = arith.constant 100 : index %c10 = arith.constant 10 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %broadcast_rhs = memref.alloc() : memref<100x10xf32> %diff = memref.alloc() : memref<100x10xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%c100, %c10) step (%c1, %c1) { %rhs_elem = memref.load %rhs[%i] : memref<100xf32> memref.store %rhs_elem, %broadcast_rhs[%i, %j] : memref<100x10xf32> scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c100, %c10) step (%c1, %c1) { %lhs_elem = memref.load %lhs[%i, %j] : memref<100x10xf32> %broadcast_rhs_elem = memref.load %broadcast_rhs[%i, %j] : memref<100x10xf32> %diff_elem = arith.subf %lhs_elem, %broadcast_rhs_elem : f32 memref.store %diff_elem, %diff[%i, %j] : memref<100x10xf32> scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c100, %c10) step (%c1, %c1) { %diff_elem = memref.load %diff[%i, %j] : memref<100x10xf32> %exp_elem = math.exp %diff_elem : f32 memref.store %exp_elem, %result[%i, %j] : memref<100x10xf32> scf.yield } memref.dealloc %broadcast_rhs : memref<100x10xf32> memref.dealloc %diff : memref<100x10xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_nested_ploop1() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_nested_ploop2() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_loops_unmatching_num_loops() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } scf.parallel (%i) = (%c0) to (%c2) step (%c1) { scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_loops_with_side_effecting_ops_in_between() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } %buffer = memref.alloc() : memref<2x2xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_loops_unmatching_iteration_space() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index scf.parallel (%i, %j) = (%c0, %c0) to (%c4, %c4) step (%c2, %c2) { scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_unmatching_write_read_patterns( %A: memref<2x2xf32>, %B: memref<2x2xf32>, %C: memref<2x2xf32>, %result: memref<2x2xf32>) { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %common_buf = memref.alloc() : memref<2x2xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %B_elem = memref.load %B[%i, %j] : memref<2x2xf32> %C_elem = memref.load %C[%i, %j] : memref<2x2xf32> %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %common_buf[%i, %j] : memref<2x2xf32> scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %k = arith.addi %i, %c1 : index %sum_elem = memref.load %common_buf[%k, %j] : memref<2x2xf32> %A_elem = memref.load %A[%i, %j] : memref<2x2xf32> %product_elem = arith.mulf %sum_elem, %A_elem : f32 memref.store %product_elem, %result[%i, %j] : memref<2x2xf32> scf.yield } memref.dealloc %common_buf : memref<2x2xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_unmatching_read_write_patterns( %A: memref<2x2xf32>, %B: memref<2x2xf32>, %common_buf: memref<2x2xf32>) { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %sum = memref.alloc() : memref<2x2xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %B_elem = memref.load %B[%i, %j] : memref<2x2xf32> %C_elem = memref.load %common_buf[%i, %j] : memref<2x2xf32> %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %sum[%i, %j] : memref<2x2xf32> scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %k = arith.addi %i, %c1 : index %sum_elem = memref.load %sum[%k, %j] : memref<2x2xf32> %A_elem = memref.load %A[%i, %j] : memref<2x2xf32> %product_elem = arith.mulf %sum_elem, %A_elem : f32 memref.store %product_elem, %common_buf[%j, %i] : memref<2x2xf32> scf.yield } memref.dealloc %sum : memref<2x2xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @do_not_fuse_loops_with_memref_defined_in_loop_bodies() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %buffer = memref.alloc() : memref<2x2xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %A = memref.subview %buffer[%c0, %c0][%c2, %c2][%c1, %c1] : memref<2x2xf32> to memref> %A_elem = memref.load %A[%i, %j] : memref> scf.yield } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @nested_fuse(%A: memref<2x2xf32>, %B: memref<2x2xf32>, %C: memref<2x2xf32>, %result: memref<2x2xf32>) { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %sum = memref.alloc() : memref<2x2xf32> scf.parallel (%k) = (%c0) to (%c2) step (%c1) { scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %B_elem = memref.load %B[%i, %j] : memref<2x2xf32> %C_elem = memref.load %C[%i, %j] : memref<2x2xf32> %sum_elem = arith.addf %B_elem, %C_elem : f32 memref.store %sum_elem, %sum[%i, %j] : memref<2x2xf32> scf.yield } scf.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) { %sum_elem = memref.load %sum[%i, %j] : memref<2x2xf32> %A_elem = memref.load %A[%i, %j] : memref<2x2xf32> %product_elem = arith.mulf %sum_elem, %A_elem : f32 memref.store %product_elem, %result[%i, %j] : memref<2x2xf32> scf.yield } } memref.dealloc %sum : memref<2x2xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(scf-parallel-loop-fusion))' -split-input-file ,1 "func.func @single_loop(%arg0: memref, %arg1: index, %arg2: i32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.for %i = %c0 to %arg1 step %c1 { %0 = arith.addi %arg2, %arg2 : i32 memref.store %0, %arg0[%i] : memref } return }", mlir-opt -pass-pipeline='builtin.module(func.func(scf-for-to-while))' -split-input-file ,1 "func.func @nested_loop(%arg0: memref, %arg1: index, %arg2: i32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.for %i = %c0 to %arg1 step %c1 { scf.for %j = %c0 to %arg1 step %c1 { %0 = arith.addi %arg2, %arg2 : i32 memref.store %0, %arg0[%i] : memref memref.store %0, %arg0[%j] : memref } } return }", mlir-opt -pass-pipeline='builtin.module(func.func(scf-for-to-while))' -split-input-file ,1 "func.func @for_iter_args(%arg0 : index, %arg1: index, %arg2: index) -> f32 { %s0 = arith.constant 0.0 : f32 %result:2 = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%iarg0 = %s0, %iarg1 = %s0) -> (f32, f32) { %sn = arith.addf %iarg0, %iarg1 : f32 scf.yield %sn, %sn : f32, f32 } return %result#1 : f32 }", mlir-opt -pass-pipeline='builtin.module(func.func(scf-for-to-while))' -split-input-file ,1 "func.func @exec_region_multiple_yields(%arg0: i32, %arg1: index, %arg2: i32) -> i32 { %c1_i32 = arith.constant 1 : i32 %c2_i32 = arith.constant 2 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c5 = arith.constant 5 : index %0 = scf.for %i = %c0 to %arg1 step %c1 iter_args(%iarg0 = %arg0) -> i32 { %2 = scf.execute_region -> i32 { %1 = arith.cmpi slt, %i, %c1 : index cf.cond_br %1, ^bb1, ^bb2 ^bb1: %2 = arith.subi %iarg0, %arg0 : i32 scf.yield %2 : i32 ^bb2: %3 = arith.muli %iarg0, %arg2 : i32 scf.yield %3 : i32 } scf.yield %2 : i32 } return %0 : i32 }", mlir-opt -pass-pipeline='builtin.module(func.func(scf-for-to-while))' -split-input-file ,1 "func.func @optimize_128x32xf16_32x128xf16(%arg0: memref<128x128xf16>, %ldRow: index, %ldCol: index, %stRow: index, %stCol: index, %fragRow: index, %fragCol :index) -> (vector<4x2xf16>, vector<4x2xf16>) { %shm = memref.alloc() : memref<128x32xf16, 3> %shmB = memref.alloc() : memref<32x128xf16, 3> %0 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shm[%stRow, %stCol], 8 : memref<128x128xf16> to memref<128x32xf16, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %mat = nvgpu.ldmatrix %shm[%fragRow, %fragCol] {numTiles = 4 : i32, transpose = false} : memref<128x32xf16, 3> -> vector<4x2xf16> %2 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shmB[%stRow, %stCol], 8 : memref<128x128xf16> to memref<32x128xf16, 3> %3 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %matB = nvgpu.ldmatrix %shmB[%fragRow, %fragCol] {numTiles = 4 : i32, transpose = false} : memref<32x128xf16, 3> -> vector<4x2xf16> return %mat, %matB: vector<4x2xf16>, vector<4x2xf16> }", mlir-opt -split-input-file --pass-pipeline='builtin.module(func.func(nvgpu-optimize-shared-memory))' ,1 "func.func @optimize_64x16xf32_16x64xf32(%arg0: memref<128x128xf32>, %ldRow: index, %ldCol: index, %stRow: index, %stCol: index, %fragRow: index, %fragCol :index) -> (vector<4x1xf32>, vector<4x1xf32>, f32, vector<4xf32>, f32) { %shm = memref.alloc() : memref<64x16xf32, 3> %shmB = memref.alloc() : memref<16x64xf32, 3> %0 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shm[%stRow, %stCol], 8 : memref<128x128xf32> to memref<64x16xf32, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %mat = nvgpu.ldmatrix %shm[%fragRow, %fragCol] {numTiles = 4 : i32, transpose = false} : memref<64x16xf32, 3> -> vector<4x1xf32> %elem = memref.load %shm[%fragRow, %fragCol] : memref<64x16xf32, 3> %elem2 = vector.load %shm[%fragRow, %fragCol] : memref<64x16xf32, 3>, vector<4xf32> vector.store %elem2, %shm[%fragRow, %fragCol] : memref<64x16xf32, 3>, vector<4xf32> memref.store %elem, %shm[%fragRow, %fragCol] : memref<64x16xf32, 3> %2 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shmB[%stRow, %stCol], 8 : memref<128x128xf32> to memref<16x64xf32, 3> %3 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %matB = nvgpu.ldmatrix %shmB[%fragRow, %fragCol] {numTiles = 4 : i32, transpose = false} : memref<16x64xf32, 3> -> vector<4x1xf32> %elemB = memref.load %shmB[%fragRow, %fragCol] : memref<16x64xf32, 3> return %mat, %matB, %elem, %elem2, %elemB: vector<4x1xf32>, vector<4x1xf32>, f32, vector<4xf32>, f32 }", mlir-opt -split-input-file --pass-pipeline='builtin.module(func.func(nvgpu-optimize-shared-memory))' ,1 "func.func @small_column_size_f64(%arg0: memref<32x32xf64>, %ldRow: index, %ldCol: index, %stRow: index, %stCol: index, %fragRow: index, %fragCol :index) -> f64 { %shm = memref.alloc() : memref<32x4xf64, 3> %0 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shm[%stRow, %stCol], 8 : memref<32x32xf64> to memref<32x4xf64, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %el = memref.load %shm[%fragRow, %fragCol] : memref<32x4xf64, 3> return %el: f64 } func.func @too_small_column_size_f16(%arg0: memref<128x128xf16>, %ldRow: index, %ldCol: index, %stRow: index, %stCol: index, %fragRow: index, %fragCol :index) -> vector<1x2xf16> { %shm = memref.alloc() : memref<128x8xf16, 3> %0 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shm[%stRow, %stCol], 8 : memref<128x128xf16> to memref<128x8xf16, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %mat = nvgpu.ldmatrix %shm[%fragRow, %fragCol] {numTiles = 1 : i32, transpose = false} : memref<128x8xf16, 3> -> vector<1x2xf16> return %mat: vector<1x2xf16> }", mlir-opt -split-input-file --pass-pipeline='builtin.module(func.func(nvgpu-optimize-shared-memory))' ,1 "func.func @abort_if_subview(%arg0: memref<128x128xf16>, %ldRow: index, %ldCol: index, %stRow: index, %stCol: index, %fragRow: index, %fragCol :index) -> vector<1x2xf16> { %shm = memref.alloc() : memref<128x32xf16, 3> %shmView = memref.subview %shm[0, 0][64, 32][1, 1] : memref<128x32xf16, 3> to memref<64x32xf16, 3> %0 = nvgpu.device_async_copy %arg0[%ldRow, %ldCol], %shm[%stRow, %stCol], 8 : memref<128x128xf16> to memref<128x32xf16, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32} %mat = nvgpu.ldmatrix %shmView[%fragRow, %fragCol] {numTiles = 1 : i32, transpose = false} : memref<64x32xf16, 3> -> vector<1x2xf16> return %mat: vector<1x2xf16> }", mlir-opt -split-input-file --pass-pipeline='builtin.module(func.func(nvgpu-optimize-shared-memory))' ,1 "func.func @m16n8k4_tf32(%arg0: vector<2x1xf32>, %arg1: vector<1x1xf32>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 4]} : (vector<2x1xf32>, vector<1x1xf32>, vector<2x2xf32>) -> vector<2x2xf32> return %d : vector<2x2xf32> }"," mlir-opt -test-nvgpu-mmasync-f32-to-tf32-patterns=""precision=tf32x3"" -split-input-file ",1 "func.func @m16n8k8_tf32(%arg0: vector<4x1xf32>, %arg1: vector<2x1xf32>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 8]} : (vector<4x1xf32>, vector<2x1xf32>, vector<2x2xf32>) -> vector<2x2xf32> return %d : vector<2x2xf32> }"," mlir-opt -test-nvgpu-mmasync-f32-to-tf32-patterns=""precision=tf32x3"" -split-input-file ",1 "func.func @m16n8k4_tf32(%arg0: vector<2x1xf32>, %arg1: vector<1x1xf32>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 4]} : (vector<2x1xf32>, vector<1x1xf32>, vector<2x2xf32>) -> vector<2x2xf32> return %d : vector<2x2xf32> }"," mlir-opt -test-nvgpu-mmasync-f32-to-tf32-patterns=""precision=tf32"" -split-input-file ",1 "func.func @m16n8k8_tf32(%arg0: vector<4x1xf32>, %arg1: vector<2x1xf32>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 8]} : (vector<4x1xf32>, vector<2x1xf32>, vector<2x2xf32>) -> vector<2x2xf32> return %d : vector<2x2xf32> }"," mlir-opt -test-nvgpu-mmasync-f32-to-tf32-patterns=""precision=tf32"" -split-input-file ",1 "func.func @mma_sync_f16(%arg0: vector<4x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf16>) -> vector<2x2xf16> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 16]} : (vector<4x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> }"," mlir-opt -test-nvgpu-mmasync-f32-to-tf32-patterns=""precision=tf32"" -split-input-file ",1 "func.func @ldmatrix(%arg0: memref, %x: index, %y: index) { %l = nvgpu.ldmatrix %arg0[%x, %y] {numTiles = 4 : i32, transpose = false} : memref -> vector<4x2xf16> return } func.func @mma_sync(%arg0: vector<4x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf16>) -> vector<2x2xf16> { %d = nvgpu.mma.sync(%arg0, %arg1, %arg2) {mmaShape = [16, 8, 16]} : (vector<4x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> } func.func @mma_sp_sync_f16_16832(%arg0: vector<4x2xf16>, %arg1: vector<4x2xf16>, %arg2: vector<2x2xf16>, %arg3: vector<2xi16>) -> vector<2x2xf16> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 32]} : (vector<4x2xf16>, vector<4x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> } func.func @mma_sp_sync_f16_16816(%arg0: vector<2x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf16>, %arg3: vector<2xi16>) -> vector<2x2xf16> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 16]} : (vector<2x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> } func.func @mma_sp_sync_i8_16864(%arg0: vector<4x4xi8>, %arg1: vector<4x4xi8>, %arg2: vector<2x2xi32>, %arg3: vector<2xi16>) -> vector<2x2xi32> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 64]} : (vector<4x4xi8>, vector<4x4xi8>, vector<2x2xi32>) -> vector<2x2xi32> return %d : vector<2x2xi32> } func.func @async_cp(%dst : memref<2x7x5xf32, 3>, %src : memref<4x5xf32>){ %c0 = arith.constant 0 : index %0 = nvgpu.device_async_copy %src[%c0, %c0], %dst[%c0, %c0, %c0], 4 : memref<4x5xf32> to memref<2x7x5xf32, 3> %token = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %token {numGroups = 1 : i32} return }", mlir-opt | mlir-opt ,1 """test.unknown_op""() { test.unknown_attr_1 = #dlti.dl_entry<""test.identifier"", 42 : i64>, test.unknown_attr_2 = #dlti.dl_entry<""test.identifier"", affine_map<(d0) -> (d0)>>, test.unknown_attr_3 = #dlti.dl_entry, test.unknown_attr_4 = #dlti.dl_entry, [""string"", 10]>, test.unknown_attr_5 = #dlti.dl_spec<>, test.unknown_attr_6 = #dlti.dl_spec<#dlti.dl_entry<""test.id"", 42 : i32>>, test.unknown_attr_7 = #dlti.dl_spec< #dlti.dl_entry<""test.id1"", 43 : index>, #dlti.dl_entry<""test.id2"", 44 : index>, #dlti.dl_entry<""test.id3"", 45 : index>> } : () -> () ""test.op_with_data_layout""() : () -> () ""test.op_with_data_layout""() { dlti.dl_spec = #dlti.dl_spec<> }: () -> () ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""unknown.unknown"", 32>> } : () -> () ""test.maybe_terminator_op""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""unknown.unknown"", 32>> } : () -> () ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""unknown.unknown"", 32>> } : () -> () ""test.maybe_terminator_op""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""unknown.unknown"", 32>> } : () -> () ""test.maybe_terminator_op""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<""unknown.unknown"", 32>> } : () -> ()", mlir-opt | mlir-opt ,1 "func.func @test0(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2> %2 = memref.alloc() : memref<1xi32> %c0 = arith.constant 0 : index %c64 = arith.constant 64 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.dma_start %0[%i0, %i1], %1[%i0, %i1], %2[%c0], %c64 : memref<100x100xf32>, memref<100x100xf32, 2>, memref<1xi32> affine.dma_wait %2[%c0], %c64 : memref<1xi32> } } return }", mlir-opt -split-input-file ,1 "func.func @test1(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2> %2 = memref.alloc() : memref<1xi32> %c0 = arith.constant 0 : index %c64 = arith.constant 64 : index %c128 = arith.constant 128 : index %c256 = arith.constant 256 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.dma_start %0[%i0, %i1], %1[%i0, %i1], %2[%c0], %c64, %c128, %c256 : memref<100x100xf32>, memref<100x100xf32, 2>, memref<1xi32> affine.dma_wait %2[%c0], %c64 : memref<1xi32> } } return }", mlir-opt -split-input-file ,1 "func.func @test2(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2> %2 = memref.alloc() : memref<1xi32> %c0 = arith.constant 0 : index %c64 = arith.constant 64 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.dma_start %0[%i0 + %arg0, %i1], %1[%i0, %i1 + %arg1 + 5], %2[%c0], %c64 : memref<100x100xf32>, memref<100x100xf32, 2>, memref<1xi32> affine.dma_wait %2[%c0], %c64 : memref<1xi32> } } return }", mlir-opt -split-input-file ,1 "func.func @test3(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> %1 = memref.alloc() : memref<100x100xf32, affine_map<(d0, d1) -> (d0, d1)>, 2> %2 = memref.alloc() : memref<1xi32> %c0 = arith.constant 0 : index %c64 = arith.constant 64 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.dma_start %0[%i0 + symbol(%arg0), %i1], %1[%i0, %i1 + symbol(%arg1) + 7], %2[%i0 + %i1 + 11], %c64 : memref<100x100xf32>, memref<100x100xf32, 2>, memref<1xi32> affine.dma_wait %2[%c0], %c64 : memref<1xi32> } } return }", mlir-opt -split-input-file ,1 "func.func @test4(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> %1 = memref.alloc() : memref<100x100xf32, 2> %2 = memref.alloc() : memref<1xi32> %c64 = arith.constant 64 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.dma_start %0[(%i0 + symbol(%arg0)) floordiv 3, %i1], %1[%i0, (%i1 + symbol(%arg1)) mod 9 + 7], %2[%i0 + %i1 + 11], %c64 : memref<100x100xf32>, memref<100x100xf32, 2>, memref<1xi32> affine.dma_wait %2[%i0 + %i1 + 11], %c64 : memref<1xi32> } } return }", mlir-opt -split-input-file ,1 "func.func @reify_through_chain(%sz0: index, %sz2: index) -> (index, index, index) { %c2 = arith.constant 2 : index %0 = tensor.empty(%sz0, %sz2) : tensor %1 = tensor.cast %0 : tensor to tensor %pos = arith.constant 0 : index %f = arith.constant 0.0 : f32 %2 = tensor.insert %f into %1[%pos, %pos, %pos] : tensor %3 = tensor.dim %2, %c2 : tensor %4 = ""test.reify_bound""(%2) {dim = 0} : (tensor) -> (index) %5 = ""test.reify_bound""(%2) {dim = 1} : (tensor) -> (index) %6 = ""test.reify_bound""(%3) : (index) -> (index) return %4, %5, %6 : index, index, index }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args"" -verify-diagnostics -split-input-file ",1 "func.func @reify_through_chain(%sz0: index, %sz2: index) -> (index, index, index) { %c2 = arith.constant 2 : index %0 = tensor.empty(%sz0, %sz2) : tensor %1 = tensor.cast %0 : tensor to tensor %pos = arith.constant 0 : index %f = arith.constant 0.0 : f32 %2 = tensor.insert %f into %1[%pos, %pos, %pos] : tensor %3 = tensor.dim %2, %c2 : tensor %4 = ""test.reify_bound""(%2) {dim = 0} : (tensor) -> (index) %5 = ""test.reify_bound""(%2) {dim = 1} : (tensor) -> (index) %6 = ""test.reify_bound""(%3) : (index) -> (index) return %4, %5, %6 : index, index, index }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args use-arith-ops"" -verify-diagnostics -split-input-file ",1 "func.func @reify_slice_bound(%t: tensor, %idx: index, %ub: index, %f: f32) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index scf.for %iv = %c0 to %ub step %c4 { %sz = affine.min affine_map<(d0)[s0] -> (-d0 + s0, 4)>(%iv)[%ub] %slice = tensor.extract_slice %t[%idx, %iv] [1, %sz] [1, 1] : tensor to tensor<1x?xi32> %filled = linalg.fill ins(%f : f32) outs(%slice : tensor<1x?xi32>) -> tensor<1x?xi32> %bound = ""test.reify_bound""(%filled) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%bound) : (index) -> () %bound_const = ""test.reify_constant_bound""(%filled) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%bound_const) : (index) -> () } return }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args"" -verify-diagnostics -split-input-file ",1 "func.func @reify_slice_bound(%t: tensor, %idx: index, %ub: index, %f: f32) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index scf.for %iv = %c0 to %ub step %c4 { %sz = affine.min affine_map<(d0)[s0] -> (-d0 + s0, 4)>(%iv)[%ub] %slice = tensor.extract_slice %t[%idx, %iv] [1, %sz] [1, 1] : tensor to tensor<1x?xi32> %filled = linalg.fill ins(%f : f32) outs(%slice : tensor<1x?xi32>) -> tensor<1x?xi32> %bound = ""test.reify_bound""(%filled) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%bound) : (index) -> () %bound_const = ""test.reify_constant_bound""(%filled) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%bound_const) : (index) -> () } return }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args use-arith-ops"" -verify-diagnostics -split-input-file ",1 "func.func @scf_for(%lb: index, %ub: index, %step: index) { scf.for %iv = %lb to %ub step %step { %0 = affine.apply affine_map<(d0)[s0] -> (-d0 + s0)>(%iv)[%ub] %bound = ""test.reify_bound""(%0) {type = ""UB""} : (index) -> (index) ""test.some_use""(%bound) : (index) -> () } return }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args"" -verify-diagnostics -split-input-file ",1 "func.func @scf_for(%lb: index, %ub: index, %step: index) { scf.for %iv = %lb to %ub step %step { %0 = affine.apply affine_map<(d0)[s0] -> (-d0 + s0)>(%iv)[%ub] %bound = ""test.reify_bound""(%0) {type = ""UB""} : (index) -> (index) ""test.some_use""(%bound) : (index) -> () } return }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args use-arith-ops"" -verify-diagnostics -split-input-file ",1 "func.func @reify_slice_bound2(%lb0: index, %ub0: index, %step0: index, %ub2: index, %t1: tensor<1x?xi8>, %t2: tensor, %t3: tensor<1x?xi32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c32 = arith.constant 32 : index scf.for %iv0 = %lb0 to %ub0 step %step0 { %ub1 = affine.min affine_map<(d0)[s0] -> (-d0 + s0, 128)>(%iv0)[%ub0] %ub1_ub = ""test.reify_bound""(%ub1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%ub1_ub) : (index) -> () %lb1 = affine.apply affine_map<()[s0] -> ((s0 floordiv 32) * 32)>()[%ub1] %lb1_ub = ""test.reify_bound""(%lb1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%lb1_ub) : (index) -> () %lb1_ub_const = ""test.reify_constant_bound""(%lb1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%lb1_ub_const) : (index) -> () scf.for %iv1 = %lb1 to %ub1 step %c32 { %sz = affine.apply affine_map<(d0)[s0] -> (-d0 + s0)>(%iv1)[%ub1] %sz_ub = ""test.reify_bound""(%sz) {type = ""UB""} : (index) -> (index) ""test.some_use""(%sz_ub) : (index) -> () scf.for %iv2 = %c0 to %ub2 step %c1 { %slice1 = tensor.extract_slice %t1[0, %iv2] [1, 1] [1, 1] : tensor<1x?xi8> to tensor<1x1xi8> %slice2 = tensor.extract_slice %t2[%iv2, 0] [1, %sz] [1, 1] : tensor to tensor<1x?xi8> %slice3 = tensor.extract_slice %t3[0, 0] [1, %sz] [1, 1] : tensor<1x?xi32> to tensor<1x?xi32> %matmul = linalg.matmul ins(%slice1, %slice2 : tensor<1x1xi8>, tensor<1x?xi8>) outs(%slice3 : tensor<1x?xi32>) -> tensor<1x?xi32> %matmul_ub = ""test.reify_bound""(%matmul) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%matmul_ub) : (index) -> () %matmul_ub_const = ""test.reify_constant_bound""(%matmul) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%matmul_ub_const) : (index) -> () } } } return }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args"" -verify-diagnostics -split-input-file ",1 "func.func @reify_slice_bound2(%lb0: index, %ub0: index, %step0: index, %ub2: index, %t1: tensor<1x?xi8>, %t2: tensor, %t3: tensor<1x?xi32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c32 = arith.constant 32 : index scf.for %iv0 = %lb0 to %ub0 step %step0 { %ub1 = affine.min affine_map<(d0)[s0] -> (-d0 + s0, 128)>(%iv0)[%ub0] %ub1_ub = ""test.reify_bound""(%ub1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%ub1_ub) : (index) -> () %lb1 = affine.apply affine_map<()[s0] -> ((s0 floordiv 32) * 32)>()[%ub1] %lb1_ub = ""test.reify_bound""(%lb1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%lb1_ub) : (index) -> () %lb1_ub_const = ""test.reify_constant_bound""(%lb1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%lb1_ub_const) : (index) -> () scf.for %iv1 = %lb1 to %ub1 step %c32 { %sz = affine.apply affine_map<(d0)[s0] -> (-d0 + s0)>(%iv1)[%ub1] %sz_ub = ""test.reify_bound""(%sz) {type = ""UB""} : (index) -> (index) ""test.some_use""(%sz_ub) : (index) -> () scf.for %iv2 = %c0 to %ub2 step %c1 { %slice1 = tensor.extract_slice %t1[0, %iv2] [1, 1] [1, 1] : tensor<1x?xi8> to tensor<1x1xi8> %slice2 = tensor.extract_slice %t2[%iv2, 0] [1, %sz] [1, 1] : tensor to tensor<1x?xi8> %slice3 = tensor.extract_slice %t3[0, 0] [1, %sz] [1, 1] : tensor<1x?xi32> to tensor<1x?xi32> %matmul = linalg.matmul ins(%slice1, %slice2 : tensor<1x1xi8>, tensor<1x?xi8>) outs(%slice3 : tensor<1x?xi32>) -> tensor<1x?xi32> %matmul_ub = ""test.reify_bound""(%matmul) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%matmul_ub) : (index) -> () %matmul_ub_const = ""test.reify_constant_bound""(%matmul) {dim = 1, type = ""UB""} : (tensor<1x?xi32>) -> (index) ""test.some_use""(%matmul_ub_const) : (index) -> () } } } return }"," mlir-opt -test-affine-reify-value-bounds=""reify-to-func-args use-arith-ops"" -verify-diagnostics -split-input-file ",1 "func.func @affine_apply(%a: index, %b: index) -> index { %0 = affine.apply affine_map<()[s0, s1] -> (s0 + s1)>()[%a, %b] %1 = ""test.reify_bound""(%0) : (index) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @affine_max_lb(%a: index) -> (index) { %1 = affine.max affine_map<()[s0] -> (s0, 2)>()[%a] %2 = ""test.reify_bound""(%1) {type = ""LB""}: (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @affine_max_ub(%a: index) -> (index) { %1 = affine.max affine_map<()[s0] -> (s0, 2)>()[%a] %2 = ""test.reify_bound""(%1) {type = ""UB""}: (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @affine_min_ub(%a: index) -> (index) { %1 = affine.min affine_map<()[s0] -> (s0, 2)>()[%a] %2 = ""test.reify_bound""(%1) {type = ""UB""}: (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @affine_min_lb(%a: index) -> (index) { %1 = affine.min affine_map<()[s0] -> (s0, 2)>()[%a] %2 = ""test.reify_bound""(%1) {type = ""LB""}: (index) -> (index) return %2 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @loop_tiling() { affine.for %i = 0 to 256 { affine.for %j = 0 to 512 { affine.for %k = 0 to 1024 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } affine.for %x = 0 to 50 { ""test.bar""(%x, %x) : (index, index) -> () } affine.for %y = 0 to 21 { ""test.foobar""(%y) : (index) -> () } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @loop_tiling() { affine.for %i = 0 to 256 { affine.for %j = 0 to 512 { affine.for %k = 0 to 1024 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } affine.for %x = 0 to 50 { ""test.bar""(%x, %x) : (index, index) -> () } affine.for %y = 0 to 21 { ""test.foobar""(%y) : (index) -> () } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @loop_tiling() { affine.for %i = 0 to 256 { affine.for %j = 0 to 512 { affine.for %k = 0 to 1024 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } affine.for %x = 0 to 50 { ""test.bar""(%x, %x) : (index, index) -> () } affine.for %y = 0 to 21 { ""test.foobar""(%y) : (index) -> () } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "#lb = affine_map<()[s0] -> (0, s0)> #ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)> func.func @loop_max_min_bound(%A : memref, %L : index, %U : index) { %c0 = arith.constant 0 : index %M = memref.dim %A, %c0 : memref affine.for %i = max #lb()[%L] to min #ub()[%M, %U] { arith.addi %i, %i : index } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "#lb = affine_map<()[s0] -> (0, s0)> #ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)> func.func @loop_max_min_bound(%A : memref, %L : index, %U : index) { %c0 = arith.constant 0 : index %M = memref.dim %A, %c0 : memref affine.for %i = max #lb()[%L] to min #ub()[%M, %U] { arith.addi %i, %i : index } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "#lb = affine_map<()[s0] -> (0, s0)> #ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)> func.func @loop_max_min_bound(%A : memref, %L : index, %U : index) { %c0 = arith.constant 0 : index %M = memref.dim %A, %c0 : memref affine.for %i = max #lb()[%L] to min #ub()[%M, %U] { arith.addi %i, %i : index } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @simple_matmul(%arg0: memref<256x256xvector<64xf32>>, %arg1: memref<256x256xvector<64xf32>>, %arg2: memref<256x256xvector<64xf32>>) -> memref<256x256xvector<64xf32>> { affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { affine.for %k = 0 to 250 { %l = affine.load %arg0[%i, %k] : memref<256x256xvector<64xf32>> %r = affine.load %arg1[%k, %j] : memref<256x256xvector<64xf32>> %o = affine.load %arg2[%i, %j] : memref<256x256xvector<64xf32>> %m = arith.mulf %l, %r : vector<64xf32> %a = arith.addf %o, %m : vector<64xf32> affine.store %a, %arg2[%i, %j] : memref<256x256xvector<64xf32>> } } } return %arg2 : memref<256x256xvector<64xf32>> }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @simple_matmul(%arg0: memref<256x256xvector<64xf32>>, %arg1: memref<256x256xvector<64xf32>>, %arg2: memref<256x256xvector<64xf32>>) -> memref<256x256xvector<64xf32>> { affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { affine.for %k = 0 to 250 { %l = affine.load %arg0[%i, %k] : memref<256x256xvector<64xf32>> %r = affine.load %arg1[%k, %j] : memref<256x256xvector<64xf32>> %o = affine.load %arg2[%i, %j] : memref<256x256xvector<64xf32>> %m = arith.mulf %l, %r : vector<64xf32> %a = arith.addf %o, %m : vector<64xf32> affine.store %a, %arg2[%i, %j] : memref<256x256xvector<64xf32>> } } } return %arg2 : memref<256x256xvector<64xf32>> }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @simple_matmul(%arg0: memref<256x256xvector<64xf32>>, %arg1: memref<256x256xvector<64xf32>>, %arg2: memref<256x256xvector<64xf32>>) -> memref<256x256xvector<64xf32>> { affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { affine.for %k = 0 to 250 { %l = affine.load %arg0[%i, %k] : memref<256x256xvector<64xf32>> %r = affine.load %arg1[%k, %j] : memref<256x256xvector<64xf32>> %o = affine.load %arg2[%i, %j] : memref<256x256xvector<64xf32>> %m = arith.mulf %l, %r : vector<64xf32> %a = arith.addf %o, %m : vector<64xf32> affine.store %a, %arg2[%i, %j] : memref<256x256xvector<64xf32>> } } } return %arg2 : memref<256x256xvector<64xf32>> }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @tile_with_symbolic_loop_upper_bounds(%arg0: memref, %arg1: memref, %arg2: memref) { %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %0 { affine.store %cst, %arg2[%i0, %i1] : memref affine.for %i2 = 0 to %0 { %1 = affine.load %arg0[%i0, %i2] : memref %2 = affine.load %arg1[%i2, %i1] : memref %3 = arith.mulf %1, %2 : f32 %4 = affine.load %arg2[%i0, %i1] : memref %5 = arith.addf %4, %3 : f32 affine.store %5, %arg2[%i0, %i1] : memref } } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @tile_with_symbolic_loop_upper_bounds(%arg0: memref, %arg1: memref, %arg2: memref) { %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %0 { affine.store %cst, %arg2[%i0, %i1] : memref affine.for %i2 = 0 to %0 { %1 = affine.load %arg0[%i0, %i2] : memref %2 = affine.load %arg1[%i2, %i1] : memref %3 = arith.mulf %1, %2 : f32 %4 = affine.load %arg2[%i0, %i1] : memref %5 = arith.addf %4, %3 : f32 affine.store %5, %arg2[%i0, %i1] : memref } } } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @tile_with_symbolic_loop_upper_bounds(%arg0: memref, %arg1: memref, %arg2: memref) { %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %0 { affine.store %cst, %arg2[%i0, %i1] : memref affine.for %i2 = 0 to %0 { %1 = affine.load %arg0[%i0, %i2] : memref %2 = affine.load %arg1[%i2, %i1] : memref %3 = arith.mulf %1, %2 : f32 %4 = affine.load %arg2[%i0, %i1] : memref %5 = arith.addf %4, %3 : f32 affine.store %5, %arg2[%i0, %i1] : memref } } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @tile_with_loop_upper_bounds_in_two_symbols(%arg0: memref, %limit: index) { %c0 = arith.constant 0 : index %dim0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to affine_map<()[s0, s1] -> (s0 + s1)> ()[%dim0, %limit] { %v0 = affine.load %arg0[%i0] : memref } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @tile_with_loop_upper_bounds_in_two_symbols(%arg0: memref, %limit: index) { %c0 = arith.constant 0 : index %dim0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to affine_map<()[s0, s1] -> (s0 + s1)> ()[%dim0, %limit] { %v0 = affine.load %arg0[%i0] : memref } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @tile_with_loop_upper_bounds_in_two_symbols(%arg0: memref, %limit: index) { %c0 = arith.constant 0 : index %dim0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to affine_map<()[s0, s1] -> (s0 + s1)> ()[%dim0, %limit] { %v0 = affine.load %arg0[%i0] : memref } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @tile_loop_with_non_unit_step(%arg0 : memref<50xf32>, %arg1 : index) { affine.for %i = 0 to %arg1 step 5 { affine.load %arg0[%i] : memref<50xf32> } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @tile_loop_with_non_unit_step(%arg0 : memref<50xf32>, %arg1 : index) { affine.for %i = 0 to %arg1 step 5 { affine.load %arg0[%i] : memref<50xf32> } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @tile_loop_with_non_unit_step(%arg0 : memref<50xf32>, %arg1 : index) { affine.for %i = 0 to %arg1 step 5 { affine.load %arg0[%i] : memref<50xf32> } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @tile_size_larger_than_trip_count_symbolic_bound(%M: index, %N : index) { affine.for %i = affine_map<(d0) -> (d0)>(%M) to affine_map<(d0) -> (d0 + 2)>(%M) { affine.for %j = affine_map<(d0) -> (d0)>(%N) to affine_map<(d0) -> (d0 + 4)>(%N) { ""test.foo"" () : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @tile_size_larger_than_trip_count_symbolic_bound(%M: index, %N : index) { affine.for %i = affine_map<(d0) -> (d0)>(%M) to affine_map<(d0) -> (d0 + 2)>(%M) { affine.for %j = affine_map<(d0) -> (d0)>(%N) to affine_map<(d0) -> (d0 + 4)>(%N) { ""test.foo"" () : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @tile_size_larger_than_trip_count_symbolic_bound(%M: index, %N : index) { affine.for %i = affine_map<(d0) -> (d0)>(%M) to affine_map<(d0) -> (d0 + 2)>(%M) { affine.for %j = affine_map<(d0) -> (d0)>(%N) to affine_map<(d0) -> (d0 + 4)>(%N) { ""test.foo"" () : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @trip_count_one(%arg0: memref<196608x1xf32>, %arg1: memref<196608x1xf32>) -> memref<196608x1xf32> { affine.for %i1 = 0 to 196608 { affine.for %i3 = 0 to 1 { %4 = affine.load %arg0[%i1, %i3] : memref<196608x1xf32> affine.store %4, %arg1[%i1, %i3] : memref<196608x1xf32> } } return %arg1 : memref<196608x1xf32> }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @trip_count_one(%arg0: memref<196608x1xf32>, %arg1: memref<196608x1xf32>) -> memref<196608x1xf32> { affine.for %i1 = 0 to 196608 { affine.for %i3 = 0 to 1 { %4 = affine.load %arg0[%i1, %i3] : memref<196608x1xf32> affine.store %4, %arg1[%i1, %i3] : memref<196608x1xf32> } } return %arg1 : memref<196608x1xf32> }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @trip_count_one(%arg0: memref<196608x1xf32>, %arg1: memref<196608x1xf32>) -> memref<196608x1xf32> { affine.for %i1 = 0 to 196608 { affine.for %i3 = 0 to 1 { %4 = affine.load %arg0[%i1, %i3] : memref<196608x1xf32> affine.store %4, %arg1[%i1, %i3] : memref<196608x1xf32> } } return %arg1 : memref<196608x1xf32> }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @separate_full_tile_2d(%M : index, %N : index) { affine.for %i = 0 to %M { affine.for %j = 0 to %N { ""test.foo""() : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @separate_full_tile_2d(%M : index, %N : index) { affine.for %i = 0 to %M { affine.for %j = 0 to %N { ""test.foo""() : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @separate_full_tile_2d(%M : index, %N : index) { affine.for %i = 0 to %M { affine.for %j = 0 to %N { ""test.foo""() : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "#ub = affine_map<(d0)[s0] -> (d0, s0)> func.func @non_hyperrectangular_loop() { %N = arith.constant 128 : index affine.for %i = 0 to %N { affine.for %j = 0 to min #ub(%i)[%N] { ""test.foo""() : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "#ub = affine_map<(d0)[s0] -> (d0, s0)> func.func @non_hyperrectangular_loop() { %N = arith.constant 128 : index affine.for %i = 0 to %N { affine.for %j = 0 to min #ub(%i)[%N] { ""test.foo""() : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "#ub = affine_map<(d0)[s0] -> (d0, s0)> func.func @non_hyperrectangular_loop() { %N = arith.constant 128 : index affine.for %i = 0 to %N { affine.for %j = 0 to min #ub(%i)[%N] { ""test.foo""() : () -> () } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @yield_values(%init : index) { %r = affine.for %i = 0 to 10 iter_args(%s = %init) -> index { ""test.foo""() : () -> () affine.yield %s : index } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @yield_values(%init : index) { %r = affine.for %i = 0 to 10 iter_args(%s = %init) -> index { ""test.foo""() : () -> () affine.yield %s : index } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @yield_values(%init : index) { %r = affine.for %i = 0 to 10 iter_args(%s = %init) -> index { ""test.foo""() : () -> () affine.yield %s : index } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @separate_full_tile_1d_max_min(%M : index, %N : index, %P : index, %Q : index) { affine.for %i0 = max affine_map<(d0, d1) -> (d0, d1)> (%M, %N) to min affine_map< (d0, d1) -> (d0, d1)> (%P, %Q) { } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" ",1 "func.func @separate_full_tile_1d_max_min(%M : index, %N : index, %P : index, %Q : index) { affine.for %i0 = max affine_map<(d0, d1) -> (d0, d1)> (%M, %N) to min affine_map< (d0, d1) -> (d0, d1)> (%P, %Q) { } return }"," mlir-opt -split-input-file -affine-loop-tile=""cache-size=512"" ",1 "func.func @separate_full_tile_1d_max_min(%M : index, %N : index, %P : index, %Q : index) { affine.for %i0 = max affine_map<(d0, d1) -> (d0, d1)> (%M, %N) to min affine_map< (d0, d1) -> (d0, d1)> (%P, %Q) { } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32 separate"" ",1 "func.func @simplify_min_max() -> (index, index) { %0 = ""test.some_op""() : () -> (index) %1 = affine.min affine_map<()[s0] -> (50, 100 - s0)>()[%0] %2 = affine.max affine_map<()[s0] -> (100, 80 + s0)>()[%0] return %1, %2 : index, index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""affine.min"", ""affine.max""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.some_op""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.affine.simplify_bounded_affine_ops %0 with [%1 : !transform.any_op] within [0] and [20] : !transform.any_op }", mlir-opt -allow-unregistered-dialect --test-transform-dialect-interpreter -verify-diagnostics --split-input-file ,1 "func.func @simplify_min_sequence() -> index { %1 = ""test.workgroup_id""() : () -> (index) %2 = affine.min affine_map<()[s0] -> (s0 * -32 + 1023, 32)>()[%1] %3 = ""test.thread_id""() : () -> (index) %4 = affine.min affine_map<()[s0, s1] -> (s0 - s1 * (s0 ceildiv 32), s0 ceildiv 32)>()[%2, %3] return %4 : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""affine.min""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.workgroup_id""]} in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.match ops{[""test.thread_id""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.affine.simplify_bounded_affine_ops %0 with [%1, %2 : !transform.any_op, !transform.any_op] within [0, 0] and [31, 31] : !transform.any_op }", mlir-opt -allow-unregistered-dialect --test-transform-dialect-interpreter -verify-diagnostics --split-input-file ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""affine.min""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.affine.simplify_bounded_affine_ops %0 with [] within [0] and [] : !transform.any_op }", mlir-opt -allow-unregistered-dialect --test-transform-dialect-interpreter -verify-diagnostics --split-input-file ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""affine.min""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.affine.simplify_bounded_affine_ops %0 with [] within [] and [5] : !transform.any_op }", mlir-opt -allow-unregistered-dialect --test-transform-dialect-interpreter -verify-diagnostics --split-input-file ,1 "func.func @compose_affine_maps_1dto2d_no_symbols() { %0 = memref.alloc() : memref<4x4xf32> affine.for %i0 = 0 to 15 { %x0 = affine.apply affine_map<(d0) -> (d0 - 1)> (%i0) %x1_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%x0, %x0) %x1_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%x0, %x0) %v0 = memref.load %0[%x1_0, %x1_1] : memref<4x4xf32> %y0 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0) %y1_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%y0, %y0) %y1_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%y0, %y0) memref.store %v0, %0[%y1_0, %y1_1] : memref<4x4xf32> %xy_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%x0, %y0) %xy_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%x0, %y0) memref.store %v0, %0[%xy_0, %xy_1] : memref<4x4xf32> %yx_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%y0, %x0) %yx_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%y0, %x0) memref.store %v0, %0[%yx_0, %yx_1] : memref<4x4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_1dto2d_no_symbols() { %0 = memref.alloc() : memref<4x4xf32> affine.for %i0 = 0 to 15 { %x0 = affine.apply affine_map<(d0) -> (d0 - 1)> (%i0) %x1_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%x0, %x0) %x1_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%x0, %x0) %v0 = memref.load %0[%x1_0, %x1_1] : memref<4x4xf32> %y0 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0) %y1_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%y0, %y0) %y1_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%y0, %y0) memref.store %v0, %0[%y1_0, %y1_1] : memref<4x4xf32> %xy_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%x0, %y0) %xy_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%x0, %y0) memref.store %v0, %0[%xy_0, %xy_1] : memref<4x4xf32> %yx_0 = affine.apply affine_map<(d0, d1) -> (d0)> (%y0, %x0) %yx_1 = affine.apply affine_map<(d0, d1) -> (d1)> (%y0, %x0) memref.store %v0, %0[%yx_0, %yx_1] : memref<4x4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_maps_1dto2d_with_symbols() { %0 = memref.alloc() : memref<4x4xf32> affine.for %i0 = 0 to 15 { %c4 = arith.constant 4 : index %x0 = affine.apply affine_map<(d0)[s0] -> (d0 - s0)> (%i0)[%c4] %v0 = memref.load %0[%x0, %x0] : memref<4x4xf32> %x1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0) %y1 = affine.apply affine_map<(d0, d1) -> (d0+d1)> (%x0, %x1) memref.store %v0, %0[%y1, %y1] : memref<4x4xf32> %y2 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%x1, %x0) memref.store %v0, %0[%y2, %y2] : memref<4x4xf32> %c5 = arith.constant 5 : index %x2 = affine.apply affine_map<(d0)[s0] -> (d0 + s0)> (%i0)[%c5] %y3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%x2, %x0) memref.store %v0, %0[%y3, %y3] : memref<4x4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_1dto2d_with_symbols() { %0 = memref.alloc() : memref<4x4xf32> affine.for %i0 = 0 to 15 { %c4 = arith.constant 4 : index %x0 = affine.apply affine_map<(d0)[s0] -> (d0 - s0)> (%i0)[%c4] %v0 = memref.load %0[%x0, %x0] : memref<4x4xf32> %x1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0) %y1 = affine.apply affine_map<(d0, d1) -> (d0+d1)> (%x0, %x1) memref.store %v0, %0[%y1, %y1] : memref<4x4xf32> %y2 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%x1, %x0) memref.store %v0, %0[%y2, %y2] : memref<4x4xf32> %c5 = arith.constant 5 : index %x2 = affine.apply affine_map<(d0)[s0] -> (d0 + s0)> (%i0)[%c5] %y3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%x2, %x0) memref.store %v0, %0[%y3, %y3] : memref<4x4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_maps_2d_tile(%0: memref<16x32xf32>, %1: memref<16x32xf32>) { %c4 = arith.constant 4 : index %c8 = arith.constant 8 : index affine.for %i0 = 0 to 16 { %x0 = affine.apply affine_map<(d0)[s0] -> (d0 ceildiv s0)> (%i0)[%c4] affine.for %i1 = 0 to 16 { %x1 = affine.apply affine_map<(d0)[s0] -> (d0 ceildiv s0)> (%i1)[%c8] affine.for %i2 = 0 to 16 { %x2 = affine.apply affine_map<(d0)[s0] -> (d0 mod s0)> (%i2)[%c4] affine.for %i3 = 0 to 16 { %x3 = affine.apply affine_map<(d0)[s0] -> (d0 mod s0)> (%i3)[%c8] %x40 = affine.apply affine_map<(d0, d1, d2, d3)[s0, s1] -> ((d0 * s0) + d2)> (%x0, %x1, %x2, %x3)[%c4, %c8] %x41 = affine.apply affine_map<(d0, d1, d2, d3)[s0, s1] -> ((d1 * s1) + d3)> (%x0, %x1, %x2, %x3)[%c4, %c8] %v0 = memref.load %0[%x40, %x41] : memref<16x32xf32> memref.store %v0, %1[%x40, %x41] : memref<16x32xf32> } } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_2d_tile(%0: memref<16x32xf32>, %1: memref<16x32xf32>) { %c4 = arith.constant 4 : index %c8 = arith.constant 8 : index affine.for %i0 = 0 to 16 { %x0 = affine.apply affine_map<(d0)[s0] -> (d0 ceildiv s0)> (%i0)[%c4] affine.for %i1 = 0 to 16 { %x1 = affine.apply affine_map<(d0)[s0] -> (d0 ceildiv s0)> (%i1)[%c8] affine.for %i2 = 0 to 16 { %x2 = affine.apply affine_map<(d0)[s0] -> (d0 mod s0)> (%i2)[%c4] affine.for %i3 = 0 to 16 { %x3 = affine.apply affine_map<(d0)[s0] -> (d0 mod s0)> (%i3)[%c8] %x40 = affine.apply affine_map<(d0, d1, d2, d3)[s0, s1] -> ((d0 * s0) + d2)> (%x0, %x1, %x2, %x3)[%c4, %c8] %x41 = affine.apply affine_map<(d0, d1, d2, d3)[s0, s1] -> ((d1 * s1) + d3)> (%x0, %x1, %x2, %x3)[%c4, %c8] %v0 = memref.load %0[%x40, %x41] : memref<16x32xf32> memref.store %v0, %1[%x40, %x41] : memref<16x32xf32> } } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_maps_dependent_loads() { %0 = memref.alloc() : memref<16x32xf32> %1 = memref.alloc() : memref<16x32xf32> affine.for %i0 = 0 to 3 { affine.for %i1 = 0 to 3 { affine.for %i2 = 0 to 3 { %c3 = arith.constant 3 : index %c7 = arith.constant 7 : index %x00 = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d0 + s0)> (%i0, %i1, %i2)[%c3, %c7] %x01 = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d1 - s1)> (%i0, %i1, %i2)[%c3, %c7] %x02 = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d2 * s0)> (%i0, %i1, %i2)[%c3, %c7] %v0 = memref.load %0[%x00, %x01] : memref<16x32xf32> memref.store %v0, %0[%x00, %x02] : memref<16x32xf32> memref.store %v0, %0[%x01, %x00] : memref<16x32xf32> %x10 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d0 * s1)> (%x01, %x00)[%c3, %c7] %x11 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d1 ceildiv s0)> (%x01, %x00)[%c3, %c7] memref.store %v0, %0[%x10, %x11] : memref<16x32xf32> } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_dependent_loads() { %0 = memref.alloc() : memref<16x32xf32> %1 = memref.alloc() : memref<16x32xf32> affine.for %i0 = 0 to 3 { affine.for %i1 = 0 to 3 { affine.for %i2 = 0 to 3 { %c3 = arith.constant 3 : index %c7 = arith.constant 7 : index %x00 = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d0 + s0)> (%i0, %i1, %i2)[%c3, %c7] %x01 = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d1 - s1)> (%i0, %i1, %i2)[%c3, %c7] %x02 = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d2 * s0)> (%i0, %i1, %i2)[%c3, %c7] %v0 = memref.load %0[%x00, %x01] : memref<16x32xf32> memref.store %v0, %0[%x00, %x02] : memref<16x32xf32> memref.store %v0, %0[%x01, %x00] : memref<16x32xf32> %x10 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d0 * s1)> (%x01, %x00)[%c3, %c7] %x11 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d1 ceildiv s0)> (%x01, %x00)[%c3, %c7] memref.store %v0, %0[%x10, %x11] : memref<16x32xf32> } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_maps_diamond_dependency(%arg0: f32, %arg1: memref<4x4xf32>) { affine.for %i0 = 0 to 15 { %a = affine.apply affine_map<(d0) -> (d0 - 1)> (%i0) %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d0 = affine.apply affine_map<(d0, d1) -> (d0 ceildiv 8)> (%b, %c) %d1 = affine.apply affine_map<(d0, d1) -> (d1 floordiv 3)> (%b, %c) memref.store %arg0, %arg1[%d0, %d1] : memref<4x4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_diamond_dependency(%arg0: f32, %arg1: memref<4x4xf32>) { affine.for %i0 = 0 to 15 { %a = affine.apply affine_map<(d0) -> (d0 - 1)> (%i0) %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d0 = affine.apply affine_map<(d0, d1) -> (d0 ceildiv 8)> (%b, %c) %d1 = affine.apply affine_map<(d0, d1) -> (d1 floordiv 3)> (%b, %c) memref.store %arg0, %arg1[%d0, %d1] : memref<4x4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_maps_multiple_symbols(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (s0 + d0)> (%arg0)[%arg1] %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %e = affine.apply affine_map<(d0)[s0] -> (d0 floordiv s0)> (%c)[%arg1] return %e : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_multiple_symbols(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (s0 + d0)> (%arg0)[%arg1] %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %e = affine.apply affine_map<(d0)[s0] -> (d0 floordiv s0)> (%c)[%arg1] return %e : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index, %arg2: f32) -> (memref<100x100xf32, 1>, memref<1xi32>) { %c9 = arith.constant 9 : index %1 = memref.alloc() : memref<100x100xf32, 1> %2 = memref.alloc() : memref<1xi32> affine.for %i0 = 0 to 100 { affine.for %i1 = 0 to 100 { %3 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d1 + s0 + s1)> (%i0, %i1)[%arg1, %c9] %4 = affine.apply affine_map<(d0, d1, d3) -> (d3 - (d0 + d1))> (%arg1, %c9, %3) memref.store %arg2, %1[%4, %arg1] : memref<100x100xf32, 1> } } return %1, %2 : memref<100x100xf32, 1>, memref<1xi32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index, %arg2: f32) -> (memref<100x100xf32, 1>, memref<1xi32>) { %c9 = arith.constant 9 : index %1 = memref.alloc() : memref<100x100xf32, 1> %2 = memref.alloc() : memref<1xi32> affine.for %i0 = 0 to 100 { affine.for %i1 = 0 to 100 { %3 = affine.apply affine_map<(d0, d1)[s0, s1] -> (d1 + s0 + s1)> (%i0, %i1)[%arg1, %c9] %4 = affine.apply affine_map<(d0, d1, d3) -> (d3 - (d0 + d1))> (%arg1, %c9, %3) memref.store %arg2, %1[%4, %arg1] : memref<100x100xf32, 1> } } return %1, %2 : memref<100x100xf32, 1>, memref<1xi32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @trivial_maps() { %0 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 affine.for %i1 = 0 to 10 { %1 = affine.apply affine_map<()[s0] -> (s0)>()[%c0] memref.store %cst, %0[%1] : memref<10xf32> %2 = memref.load %0[%c0] : memref<10xf32> %3 = affine.apply affine_map<()[] -> (0)>()[] memref.store %cst, %0[%3] : memref<10xf32> memref.store %2, %0[%c0] : memref<10xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @trivial_maps() { %0 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 affine.for %i1 = 0 to 10 { %1 = affine.apply affine_map<()[s0] -> (s0)>()[%c0] memref.store %cst, %0[%1] : memref<10xf32> %2 = memref.load %0[%c0] : memref<10xf32> %3 = affine.apply affine_map<()[] -> (0)>()[] memref.store %cst, %0[%3] : memref<10xf32> memref.store %2, %0[%c0] : memref<10xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @partial_fold_map(%arg1: index, %arg2: index) -> index { %c42 = arith.constant 42 : index %2 = affine.apply affine_map<(d0, d1) -> (d0 - d1)> (%arg1, %c42) return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @partial_fold_map(%arg1: index, %arg2: index) -> index { %c42 = arith.constant 42 : index %2 = affine.apply affine_map<(d0, d1) -> (d0 - d1)> (%arg1, %c42) return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @symbolic_composition_a(%arg0: index, %arg1: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0 * 4)>(%arg0) %1 = affine.apply affine_map<()[s0, s1] -> (8 * s0)>()[%0, %arg0] %2 = affine.apply affine_map<()[s0, s1] -> (16 * s1)>()[%arg1, %1] return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @symbolic_composition_a(%arg0: index, %arg1: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0 * 4)>(%arg0) %1 = affine.apply affine_map<()[s0, s1] -> (8 * s0)>()[%0, %arg0] %2 = affine.apply affine_map<()[s0, s1] -> (16 * s1)>()[%arg1, %1] return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @symbolic_composition_b(%arg0: index, %arg1: index, %arg2: index, %arg3: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0)>(%arg0) %1 = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s1 + s2 + s3)>()[%0, %0, %0, %0] return %1 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @symbolic_composition_b(%arg0: index, %arg1: index, %arg2: index, %arg3: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0)>(%arg0) %1 = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s1 + s2 + s3)>()[%0, %0, %0, %0] return %1 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @symbolic_composition_c(%arg0: index, %arg1: index, %arg2: index, %arg3: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0)>(%arg0) %1 = affine.apply affine_map<(d0) -> (d0)>(%arg1) %2 = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s1 + s2 + s3)>()[%0, %0, %0, %1] return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @symbolic_composition_c(%arg0: index, %arg1: index, %arg2: index, %arg3: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0)>(%arg0) %1 = affine.apply affine_map<(d0) -> (d0)>(%arg1) %2 = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s1 + s2 + s3)>()[%0, %0, %0, %1] return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @symbolic_composition_d(%arg0: index, %arg1: index, %arg2: index, %arg3: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0)>(%arg0) %1 = affine.apply affine_map<()[s0] -> (s0)>()[%arg1] %2 = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s1 + s2 + s3)>()[%0, %0, %0, %1] return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @symbolic_composition_d(%arg0: index, %arg1: index, %arg2: index, %arg3: index) -> index { %0 = affine.apply affine_map<(d0) -> (d0)>(%arg0) %1 = affine.apply affine_map<()[s0] -> (s0)>()[%arg1] %2 = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s1 + s2 + s3)>()[%0, %0, %0, %1] return %2 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @mix_dims_and_symbols_b(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) return %b : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @mix_dims_and_symbols_b(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) return %b : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @mix_dims_and_symbols_c(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) return %c : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @mix_dims_and_symbols_c(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) return %c : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @mix_dims_and_symbols_d(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d = affine.apply affine_map<()[s0] -> (s0 ceildiv 8)> ()[%b] return %d : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @mix_dims_and_symbols_d(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d = affine.apply affine_map<()[s0] -> (s0 ceildiv 8)> ()[%b] return %d : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @mix_dims_and_symbols_e(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d = affine.apply affine_map<()[s0] -> (s0 ceildiv 8)> ()[%b] %e = affine.apply affine_map<(d0) -> (d0 floordiv 3)> (%c) return %e : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @mix_dims_and_symbols_e(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d = affine.apply affine_map<()[s0] -> (s0 ceildiv 8)> ()[%b] %e = affine.apply affine_map<(d0) -> (d0 floordiv 3)> (%c) return %e : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @mix_dims_and_symbols_f(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d = affine.apply affine_map<()[s0] -> (s0 ceildiv 8)> ()[%b] %e = affine.apply affine_map<(d0) -> (d0 floordiv 3)> (%c) %f = affine.apply affine_map<(d0, d1)[s0, s1] -> (d0 - s1 + d1 - s0)> (%d, %e)[%e, %d] return %f : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @mix_dims_and_symbols_f(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] -> (d0 - 1 + 42 * s0)> (%arg0)[%arg1] %b = affine.apply affine_map<(d0) -> (d0 + 7)> (%a) %c = affine.apply affine_map<(d0) -> (d0 * 4)> (%a) %d = affine.apply affine_map<()[s0] -> (s0 ceildiv 8)> ()[%b] %e = affine.apply affine_map<(d0) -> (d0 floordiv 3)> (%c) %f = affine.apply affine_map<(d0, d1)[s0, s1] -> (d0 - s1 + d1 - s0)> (%d, %e)[%e, %d] return %f : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @mix_dims_and_symbols_g(%M: index, %N: index) -> (index, index, index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) %res1 = affine.apply affine_map<()[s0, s1] -> (4 * s0)>()[%N, %K] %res2 = affine.apply affine_map<()[s0, s1] -> (s1)>()[%N, %K] %res3 = affine.apply affine_map<()[s0, s1] -> (1024)>()[%N, %K] return %res1, %res2, %res3 : index, index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @mix_dims_and_symbols_g(%M: index, %N: index) -> (index, index, index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) %res1 = affine.apply affine_map<()[s0, s1] -> (4 * s0)>()[%N, %K] %res2 = affine.apply affine_map<()[s0, s1] -> (s1)>()[%N, %K] %res3 = affine.apply affine_map<()[s0, s1] -> (1024)>()[%N, %K] return %res1, %res2, %res3 : index, index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @symbolic_semi_affine(%M: index, %N: index, %A: memref) { %f1 = arith.constant 1.0 : f32 affine.for %i0 = 1 to 100 { %1 = affine.apply affine_map<()[s0] -> (s0 + 1)> ()[%M] %2 = affine.apply affine_map<(d0)[s0] -> (d0 floordiv s0)> (%i0)[%1] memref.store %f1, %A[%2] : memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @symbolic_semi_affine(%M: index, %N: index, %A: memref) { %f1 = arith.constant 1.0 : f32 affine.for %i0 = 1 to 100 { %1 = affine.apply affine_map<()[s0] -> (s0 + 1)> ()[%M] %2 = affine.apply affine_map<(d0)[s0] -> (d0 floordiv s0)> (%i0)[%1] memref.store %f1, %A[%2] : memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @constant_fold_bounds(%N : index) { %c9 = arith.constant 9 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%c1, %c2) %l = ""foo""() : () -> index affine.for %i = max affine_map<(d0, d1) -> (0, d0 + d1)> (%c2, %c3) to min affine_map<(d0, d1) -> (d0 - 2, 32*d1)> (%c9, %c1) { ""foo""(%i, %c3) : (index, index) -> () } affine.for %j = max affine_map<(d0) -> (0, 1)> (%N) to min affine_map<(d0, d1) -> (7, 9)> (%N, %l) { ""foo""(%j, %c3) : (index, index) -> () } affine.for %k = max affine_map<()[s0] -> (0, s0)> ()[%l] to min affine_map<()[s0] -> (100, s0)> ()[%N] { ""foo""(%k, %c3) : (index, index) -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @constant_fold_bounds(%N : index) { %c9 = arith.constant 9 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)> (%c1, %c2) %l = ""foo""() : () -> index affine.for %i = max affine_map<(d0, d1) -> (0, d0 + d1)> (%c2, %c3) to min affine_map<(d0, d1) -> (d0 - 2, 32*d1)> (%c9, %c1) { ""foo""(%i, %c3) : (index, index) -> () } affine.for %j = max affine_map<(d0) -> (0, 1)> (%N) to min affine_map<(d0, d1) -> (7, 9)> (%N, %l) { ""foo""(%j, %c3) : (index, index) -> () } affine.for %k = max affine_map<()[s0] -> (0, s0)> ()[%l] to min affine_map<()[s0] -> (100, s0)> ()[%N] { ""foo""(%k, %c3) : (index, index) -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @fold_empty_loops() -> index { %c0 = arith.constant 0 : index affine.for %i = 0 to 10 { } %res = affine.for %i = 0 to 10 iter_args(%arg = %c0) -> index { affine.yield %arg : index } return %res : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_empty_loops() -> index { %c0 = arith.constant 0 : index affine.for %i = 0 to 10 { } %res = affine.for %i = 0 to 10 iter_args(%arg = %c0) -> index { affine.yield %arg : index } return %res : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @fold_empty_loop() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %res:2 = affine.for %i = 0 to 10 iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %c2, %arg1 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_empty_loop() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %res:2 = affine.for %i = 0 to 10 iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %c2, %arg1 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @fold_empty_loops_trip_count_1() -> (index, index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %res1:2 = affine.for %i = 0 to 1 iter_args(%arg0 = %c2, %arg1 = %c0) -> (index, index) { affine.yield %c1, %arg0 : index, index } %res2:2 = affine.for %i = 0 to 2 step 3 iter_args(%arg0 = %c2, %arg1 = %c0) -> (index, index) { affine.yield %arg1, %arg0 : index, index } return %res1#0, %res1#1, %res2#0, %res2#1 : index, index, index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_empty_loops_trip_count_1() -> (index, index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %res1:2 = affine.for %i = 0 to 1 iter_args(%arg0 = %c2, %arg1 = %c0) -> (index, index) { affine.yield %c1, %arg0 : index, index } %res2:2 = affine.for %i = 0 to 2 step 3 iter_args(%arg0 = %c2, %arg1 = %c0) -> (index, index) { affine.yield %arg1, %arg0 : index, index } return %res1#0, %res1#1, %res2#0, %res2#1 : index, index, index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @fold_empty_loop_trip_count_0() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %res:2 = affine.for %i = 0 to 0 iter_args(%arg0 = %c2, %arg1 = %c0) -> (index, index) { affine.yield %c1, %arg0 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_empty_loop_trip_count_0() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %res:2 = affine.for %i = 0 to 0 iter_args(%arg0 = %c2, %arg1 = %c0) -> (index, index) { affine.yield %c1, %arg0 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @fold_empty_loop_trip_count_unknown(%in : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res:2 = affine.for %i = 0 to %in iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %arg0, %arg1 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_empty_loop_trip_count_unknown(%in : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res:2 = affine.for %i = 0 to %in iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %arg0, %arg1 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @empty_loops_not_folded_1(%in : index) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res = affine.for %i = 0 to %in iter_args(%arg = %c0) -> index { affine.yield %c1 : index } return %res : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @empty_loops_not_folded_1(%in : index) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res = affine.for %i = 0 to %in iter_args(%arg = %c0) -> index { affine.yield %c1 : index } return %res : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @empty_loops_not_folded_2(%in : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res:2 = affine.for %i = 0 to %in iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %arg1, %arg0 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @empty_loops_not_folded_2(%in : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res:2 = affine.for %i = 0 to %in iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %arg1, %arg0 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @empty_loops_not_folded_3() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res:2 = affine.for %i = 0 to 10 iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %arg1, %arg0 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @empty_loops_not_folded_3() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %res:2 = affine.for %i = 0 to 10 iter_args(%arg0 = %c0, %arg1 = %c1) -> (index, index) { affine.yield %arg1, %arg0 : index, index } return %res#0, %res#1 : index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @zero_iter_loop_not_folded() { %A = memref.alloc() : memref<4xf32> affine.for %i = 0 to 0 { %load = affine.load %A[%i] : memref<4xf32> affine.store %load, %A[%i] : memref<4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @zero_iter_loop_not_folded() { %A = memref.alloc() : memref<4xf32> affine.for %i = 0 to 0 { %load = affine.load %A[%i] : memref<4xf32> affine.store %load, %A[%i] : memref<4xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @fold_zero_iter_loops(%in : index) -> index { %c1 = arith.constant 1 : index %res = affine.for %i = 0 to 0 iter_args(%loop_arg = %in) -> index { %yield = arith.addi %loop_arg, %c1 : index affine.yield %yield : index } return %res : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_zero_iter_loops(%in : index) -> index { %c1 = arith.constant 1 : index %res = affine.for %i = 0 to 0 iter_args(%loop_arg = %in) -> index { %yield = arith.addi %loop_arg, %c1 : index affine.yield %yield : index } return %res : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @canonicalize_affine_if(%M : index, %N : index) { %c1022 = arith.constant 1022 : index affine.for %i = 0 to 1024 { affine.for %j = 0 to %N { affine.if affine_set<(d0, d1, d2, d3)[s0] : (d1 >= 0, d0 - d1 >= 0, d2 >= 0, d3 - d2 - 2 >= 0)> (%c1022, %i, %j, %N)[%M] { ""foo""() : () -> () } ""bar""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_affine_if(%M : index, %N : index) { %c1022 = arith.constant 1022 : index affine.for %i = 0 to 1024 { affine.for %j = 0 to %N { affine.if affine_set<(d0, d1, d2, d3)[s0] : (d1 >= 0, d0 - d1 >= 0, d2 >= 0, d3 - d2 - 2 >= 0)> (%c1022, %i, %j, %N)[%M] { ""foo""() : () -> () } ""bar""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @canonicalize_affine_if_compose_apply(%N: index) { %M = affine.apply affine_map<()[s0] -> (s0 + 10)> ()[%N] affine.for %i = 0 to 1024 { affine.for %j = 0 to 100 { %j_ = affine.apply affine_map<(d0)[] -> (d0 + 1)> (%j) affine.if affine_set<(d0, d1)[s0] : (d0 - 1 >= 0, d1 - 2 == 0, -d0 + s0 >= 0)>(%i, %j_)[%M] { ""test.foo""() : ()->() } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_affine_if_compose_apply(%N: index) { %M = affine.apply affine_map<()[s0] -> (s0 + 10)> ()[%N] affine.for %i = 0 to 1024 { affine.for %j = 0 to 100 { %j_ = affine.apply affine_map<(d0)[] -> (d0 + 1)> (%j) affine.if affine_set<(d0, d1)[s0] : (d0 - 1 >= 0, d1 - 2 == 0, -d0 + s0 >= 0)>(%i, %j_)[%M] { ""test.foo""() : ()->() } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @canonicalize_bounds(%M : index, %N : index) { %c0 = arith.constant 0 : index %c1024 = arith.constant 1024 : index affine.for %i = 0 to min affine_map<(d0, d1, d2, d3) -> (d0, d1 + d2)> (%c1024, %M, %M, %N) { ""foo""() : () -> () } affine.for %i = 0 to affine_map<(d0) -> (4 * d0)> (%M) { ""foo""() : () -> () } affine.for %i = max affine_map<(d0, d1) -> (d0, d1)> (%c0, %N) to %M { ""foo""() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_bounds(%M : index, %N : index) { %c0 = arith.constant 0 : index %c1024 = arith.constant 1024 : index affine.for %i = 0 to min affine_map<(d0, d1, d2, d3) -> (d0, d1 + d2)> (%c1024, %M, %M, %N) { ""foo""() : () -> () } affine.for %i = 0 to affine_map<(d0) -> (4 * d0)> (%M) { ""foo""() : () -> () } affine.for %i = max affine_map<(d0, d1) -> (d0, d1)> (%c0, %N) to %M { ""foo""() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_into_affine_load_store(%A : memref<1024xf32>, %u : index) { affine.for %i = 0 to 1024 { %idx = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %u) %0 = affine.load %A[%idx] : memref<1024xf32> affine.store %0, %A[%idx] : memref<1024xf32> %copy = affine.apply affine_map<(d0) -> (d0)> (%i) %1 = affine.load %A[%copy] : memref<1024xf32> ""prevent.dce""(%1) : (f32) -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_into_affine_load_store(%A : memref<1024xf32>, %u : index) { affine.for %i = 0 to 1024 { %idx = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %u) %0 = affine.load %A[%idx] : memref<1024xf32> affine.store %0, %A[%idx] : memref<1024xf32> %copy = affine.apply affine_map<(d0) -> (d0)> (%i) %1 = affine.load %A[%copy] : memref<1024xf32> ""prevent.dce""(%1) : (f32) -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { %c511 = arith.constant 511 : index %c1 = arith.constant 0 : index %0 = affine.min affine_map<(d0)[s0] -> (1000, d0 + 512, s0 + 1)> (%c1)[%c511] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { %c511 = arith.constant 511 : index %c1 = arith.constant 0 : index %0 = affine.min affine_map<(d0)[s0] -> (1000, d0 + 512, s0 + 1)> (%c1)[%c511] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { %c3 = arith.constant 3 : index %c20 = arith.constant 20 : index %0 = affine.min affine_map<(d0)[s0] -> (1000, d0 floordiv 4, (s0 mod 5) + 1)> (%c20)[%c3] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { %c3 = arith.constant 3 : index %c20 = arith.constant 20 : index %0 = affine.min affine_map<(d0)[s0] -> (1000, d0 floordiv 4, (s0 mod 5) + 1)> (%c20)[%c3] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) { %c511 = arith.constant 511 : index %c1 = arith.constant 0 : index %0 = affine.max affine_map<(d0)[s0] -> (1000, d0 + 512, s0 + 1)> (%c1)[%c511] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) { %c511 = arith.constant 511 : index %c1 = arith.constant 0 : index %0 = affine.max affine_map<(d0)[s0] -> (1000, d0 + 512, s0 + 1)> (%c1)[%c511] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) { %c3 = arith.constant 3 : index %c20 = arith.constant 20 : index %0 = affine.max affine_map<(d0)[s0] -> (1000, d0 floordiv 4, (s0 mod 5) + 1)> (%c20)[%c3] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) { %c3 = arith.constant 3 : index %c20 = arith.constant 20 : index %0 = affine.max affine_map<(d0)[s0] -> (1000, d0 floordiv 4, (s0 mod 5) + 1)> (%c20)[%c3] ""op0""(%0) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @affine_min(%arg0: index) { affine.for %i = 0 to %arg0 { affine.for %j = 0 to %arg0 { %c2 = arith.constant 2 : index %0 = affine.min affine_map<(d0,d1,d2)->(d0, d1 - d2)>(%i, %j, %c2) ""consumer""(%0) : (index) -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @affine_min(%arg0: index) { affine.for %i = 0 to %arg0 { affine.for %j = 0 to %arg0 { %c2 = arith.constant 2 : index %0 = affine.min affine_map<(d0,d1,d2)->(d0, d1 - d2)>(%i, %j, %c2) ""consumer""(%0) : (index) -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "#map1 = affine_map<(d0)[s0, s1] -> (d0 * s0 + s1)> #map2 = affine_map<(d0)[s0] -> (1024, -d0 + s0)> func.func @rep(%arg0 : index, %arg1 : index) -> index { %c0 = arith.constant 0 : index %c1024 = arith.constant 1024 : index %0 = affine.apply #map1(%arg0)[%c1024, %c0] %1 = affine.min #map2(%0)[%arg1] return %1 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "#map1 = affine_map<(d0)[s0, s1] -> (d0 * s0 + s1)> #map2 = affine_map<(d0)[s0] -> (1024, -d0 + s0)> func.func @rep(%arg0 : index, %arg1 : index) -> index { %c0 = arith.constant 0 : index %c1024 = arith.constant 1024 : index %0 = affine.apply #map1(%arg0)[%c1024, %c0] %1 = affine.min #map2(%0)[%arg1] return %1 : index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @drop_duplicate_bounds(%N : index) { affine.for %i = max affine_map<(d0) -> (d0, d0)>(%N) to min affine_map<(d0) -> (d0 + 2, d0 + 2)>(%N) { ""foo""() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @drop_duplicate_bounds(%N : index) { affine.for %i = max affine_map<(d0) -> (d0, d0)>(%N) to min affine_map<(d0) -> (d0 + 2, d0 + 2)>(%N) { ""foo""() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "#map3 = affine_map<(d0) -> (d0 * 5)> func.func @affine_parallel_const_bounds() { %cst = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = memref.alloc() : memref<4xf32> affine.parallel (%i) = (%c0) to (%c0 + %c4) { %1 = affine.apply #map3(%i) affine.parallel (%j) = (%c0) to (%1) { affine.store %cst, %0[%j] : memref<4xf32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "#map3 = affine_map<(d0) -> (d0 * 5)> func.func @affine_parallel_const_bounds() { %cst = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %0 = memref.alloc() : memref<4xf32> affine.parallel (%i) = (%c0) to (%c0 + %c4) { %1 = affine.apply #map3(%i) affine.parallel (%j) = (%c0) to (%1) { affine.store %cst, %0[%j] : memref<4xf32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_maps_div_symbol(%A : memref, %i0 : index, %i1 : index) { %0 = affine.apply affine_map<()[s0] -> (2 * s0)> ()[%i0] %1 = affine.apply affine_map<()[s0] -> (3 * s0)> ()[%i0] %2 = affine.apply affine_map<(d0)[s0, s1] -> (d0 mod s1 + s0 * s1 + s0 * 4)> (%i1)[%0, %1] %3 = arith.index_cast %2: index to i64 memref.store %3, %A[]: memref affine.for %i2 = 0 to 3 { %4 = affine.apply affine_map<(d0)[s0, s1] -> (d0 ceildiv s1 + s0 + s0 * 3)> (%i2)[%0, %1] %5 = arith.index_cast %4: index to i64 memref.store %5, %A[]: memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_maps_div_symbol(%A : memref, %i0 : index, %i1 : index) { %0 = affine.apply affine_map<()[s0] -> (2 * s0)> ()[%i0] %1 = affine.apply affine_map<()[s0] -> (3 * s0)> ()[%i0] %2 = affine.apply affine_map<(d0)[s0, s1] -> (d0 mod s1 + s0 * s1 + s0 * 4)> (%i1)[%0, %1] %3 = arith.index_cast %2: index to i64 memref.store %3, %A[]: memref affine.for %i2 = 0 to 3 { %4 = affine.apply affine_map<(d0)[s0, s1] -> (d0 ceildiv s1 + s0 + s0 * 3)> (%i2)[%0, %1] %5 = arith.index_cast %4: index to i64 memref.store %5, %A[]: memref } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @deduplicate_affine_min_expressions(%i0: index, %i1: index) -> index { %0 = affine.min affine_map<()[s0, s1] -> (s0 + s1, s0 * s1, s1 + s0, s0 * s1)> ()[%i0, %i1] return %0: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @deduplicate_affine_min_expressions(%i0: index, %i1: index) -> index { %0 = affine.min affine_map<()[s0, s1] -> (s0 + s1, s0 * s1, s1 + s0, s0 * s1)> ()[%i0, %i1] return %0: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @deduplicate_affine_max_expressions(%i0: index, %i1: index) -> index { %0 = affine.max affine_map<()[s0, s1] -> (s0 + s1, s0 * s1, s1 + s0, s0 * s1)> ()[%i0, %i1] return %0: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @deduplicate_affine_max_expressions(%i0: index, %i1: index) -> index { %0 = affine.max affine_map<()[s0, s1] -> (s0 + s1, s0 * s1, s1 + s0, s0 * s1)> ()[%i0, %i1] return %0: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_affine_min_ops(%i0: index, %i1: index, %i2: index, %i3: index) -> (index, index) { %0 = affine.min affine_map<(d0)[s0] -> (16, d0 - s0)> (%i0)[%i1] %1 = affine.min affine_map<(d0)[s0] -> (3 * s0, d0)> (%0)[%i2] %2 = affine.min affine_map<(d0)[s0] -> (s0, 5 - d0)> (%i3)[%0] return %1, %2: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_affine_min_ops(%i0: index, %i1: index, %i2: index, %i3: index) -> (index, index) { %0 = affine.min affine_map<(d0)[s0] -> (16, d0 - s0)> (%i0)[%i1] %1 = affine.min affine_map<(d0)[s0] -> (3 * s0, d0)> (%0)[%i2] %2 = affine.min affine_map<(d0)[s0] -> (s0, 5 - d0)> (%i3)[%0] return %1, %2: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_multiple_affine_min_ops(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.min affine_map<()[s0] -> (s0 + 8, s0 * 4)> ()[%i1] %2 = affine.min affine_map<()[s0, s1, s2] -> (s0, 7 + s1, s2)> ()[%0, %i2, %1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_multiple_affine_min_ops(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.min affine_map<()[s0] -> (s0 + 8, s0 * 4)> ()[%i1] %2 = affine.min affine_map<()[s0, s1, s2] -> (s0, 7 + s1, s2)> ()[%0, %i2, %1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_multiple_uses_of_affine_min_ops(%i0: index, %i1: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.min affine_map<()[s0, s1, s2] -> (s0, s1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_multiple_uses_of_affine_min_ops(%i0: index, %i1: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.min affine_map<()[s0, s1, s2] -> (s0, s1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_mixed_uses_of_affine_min_ops(%i0: index, %i1: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.min affine_map<()[s0, s1, s2] -> (s0, s1 + 1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_mixed_uses_of_affine_min_ops(%i0: index, %i1: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.min affine_map<()[s0, s1, s2] -> (s0, s1 + 1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @dont_merge_affine_min_if_not_single_dim(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.min affine_map<(d0)[s0] -> (s0 + 4, 7 + d0)> (%0)[%i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_merge_affine_min_if_not_single_dim(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.min affine_map<(d0)[s0] -> (s0 + 4, 7 + d0)> (%0)[%i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @dont_merge_affine_min_if_not_single_sym(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.min affine_map<()[s0, s1] -> (s0 + 4, 7 + s1)> ()[%0, %i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_merge_affine_min_if_not_single_sym(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.min affine_map<()[s0, s1] -> (s0 + 4, 7 + s1)> ()[%0, %i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_affine_max_ops(%i0: index, %i1: index, %i2: index, %i3: index) -> (index, index) { %0 = affine.max affine_map<(d0)[s0] -> (16, d0 - s0)> (%i0)[%i1] %1 = affine.max affine_map<(d0)[s0] -> (3 * s0, d0)> (%0)[%i2] %2 = affine.max affine_map<(d0)[s0] -> (s0, 5 - d0)> (%i3)[%0] return %1, %2: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_affine_max_ops(%i0: index, %i1: index, %i2: index, %i3: index) -> (index, index) { %0 = affine.max affine_map<(d0)[s0] -> (16, d0 - s0)> (%i0)[%i1] %1 = affine.max affine_map<(d0)[s0] -> (3 * s0, d0)> (%0)[%i2] %2 = affine.max affine_map<(d0)[s0] -> (s0, 5 - d0)> (%i3)[%0] return %1, %2: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_multiple_affine_max_ops(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.max affine_map<()[s0] -> (s0 + 8, s0 * 4)> ()[%i1] %2 = affine.max affine_map<()[s0, s1, s2] -> (s0, 7 + s1, s2)> ()[%0, %i2, %1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_multiple_affine_max_ops(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.max affine_map<()[s0] -> (s0 + 8, s0 * 4)> ()[%i1] %2 = affine.max affine_map<()[s0, s1, s2] -> (s0, 7 + s1, s2)> ()[%0, %i2, %1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_multiple_uses_of_affine_max_ops(%i0: index, %i1: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.max affine_map<()[s0, s1, s2] -> (s0, s1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_multiple_uses_of_affine_max_ops(%i0: index, %i1: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.max affine_map<()[s0, s1, s2] -> (s0, s1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @merge_mixed_uses_of_affine_max_ops(%i0: index, %i1: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.max affine_map<()[s0, s1, s2] -> (s0, s1 + 1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @merge_mixed_uses_of_affine_max_ops(%i0: index, %i1: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %2 = affine.max affine_map<()[s0, s1, s2] -> (s0, s1 + 1, s2 * 2)> ()[%0, %0, %i1] return %2: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @dont_merge_affine_max_if_not_single_dim(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.max affine_map<(d0)[s0] -> (s0 + 4, 7 + d0)> (%0)[%i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_merge_affine_max_if_not_single_dim(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.max affine_map<(d0)[s0] -> (s0 + 4, 7 + d0)> (%0)[%i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @dont_merge_affine_max_if_not_single_sym(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.max affine_map<()[s0, s1] -> (s0 + 4, 7 + s1)> ()[%0, %i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_merge_affine_max_if_not_single_sym(%i0: index, %i1: index, %i2: index) -> index { %0 = affine.max affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%i0] %1 = affine.max affine_map<()[s0, s1] -> (s0 + 4, 7 + s1)> ()[%0, %i2] return %1: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_affine_for_bounds(%N: index) { %u = affine.apply affine_map<(d0) -> (d0 + 2)>(%N) %l = affine.apply affine_map<(d0) -> (d0 - 2)>(%N) affine.for %i = %l to %u { ""foo""() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_affine_for_bounds(%N: index) { %u = affine.apply affine_map<(d0) -> (d0 + 2)>(%N) %l = affine.apply affine_map<(d0) -> (d0 - 2)>(%N) affine.for %i = %l to %u { ""foo""() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @compose_into_affine_vector_load_vector_store(%A : memref<1024xf32>, %u : index) { affine.for %i = 0 to 1024 { %idx = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %u) %0 = affine.vector_load %A[%idx] : memref<1024xf32>, vector<8xf32> affine.vector_store %0, %A[%idx] : memref<1024xf32>, vector<8xf32> %copy = affine.apply affine_map<(d0) -> (d0)> (%i) %1 = affine.vector_load %A[%copy] : memref<1024xf32>, vector<8xf32> ""prevent.dce""(%1) : (vector<8xf32>) -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_into_affine_vector_load_vector_store(%A : memref<1024xf32>, %u : index) { affine.for %i = 0 to 1024 { %idx = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %u) %0 = affine.vector_load %A[%idx] : memref<1024xf32>, vector<8xf32> affine.vector_store %0, %A[%idx] : memref<1024xf32>, vector<8xf32> %copy = affine.apply affine_map<(d0) -> (d0)> (%i) %1 = affine.vector_load %A[%copy] : memref<1024xf32>, vector<8xf32> ""prevent.dce""(%1) : (vector<8xf32>) -> () } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @no_fold_of_store(%arg : memref<32xi8>, %holder: memref>) { %0 = memref.cast %arg : memref<32xi8> to memref affine.store %0, %holder[] : memref> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @no_fold_of_store(%arg : memref<32xi8>, %holder: memref>) { %0 = memref.cast %arg : memref<32xi8> to memref affine.store %0, %holder[] : memref> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @canonicalize_single_min_max(%i0: index, %i1: index) -> (index, index) { %0 = affine.min affine_map<()[s0] -> (s0 + 16)> ()[%i0] %1 = affine.min affine_map<()[s0] -> (s0 * 4)> ()[%i1] return %0, %1: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_single_min_max(%i0: index, %i1: index) -> (index, index) { %0 = affine.min affine_map<()[s0] -> (s0 + 16)> ()[%i0] %1 = affine.min affine_map<()[s0] -> (s0 * 4)> ()[%i1] return %0, %1: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @canonicalize_multi_min_max(%i0: index, %i1: index) -> (index, index) { %0 = affine.min affine_map<()[s0, s1] -> (s0 + s1, s1 + 16, 32)> ()[%i0, %i1] %1 = affine.max affine_map<()[s0, s1] -> (s0 + s1, 32, s1 + 16)> ()[%i0, %i1] return %0, %1: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_multi_min_max(%i0: index, %i1: index) -> (index, index) { %0 = affine.min affine_map<()[s0, s1] -> (s0 + s1, s1 + 16, 32)> ()[%i0, %i1] %1 = affine.max affine_map<()[s0, s1] -> (s0 + s1, 32, s1 + 16)> ()[%i0, %i1] return %0, %1: index, index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "module { memref.global ""private"" constant @__constant_1x5x1xf32 : memref<1x5x1xf32> = dense<[[[6.250000e-02], [2.500000e-01], [3.750000e-01], [2.500000e-01], [6.250000e-02]]]> memref.global ""private"" constant @__constant_32x64xf32 : memref<32x64xf32> = dense<0.000000e+00> func.func @fold_const_init_global_memref() -> (f32, f32) { %m = memref.get_global @__constant_1x5x1xf32 : memref<1x5x1xf32> %v0 = affine.load %m[0, 0, 0] : memref<1x5x1xf32> %v1 = affine.load %m[0, 1, 0] : memref<1x5x1xf32> return %v0, %v1 : f32, f32 } func.func @fold_const_splat_global() -> memref<32x64xf32> { %m = memref.get_global @__constant_32x64xf32 : memref<32x64xf32> %s = memref.alloc() : memref<32x64xf32> affine.for %i = 0 to 32 { affine.for %j = 0 to 64 { %v = affine.load %m[%i, %j] : memref<32x64xf32> affine.store %v, %s[%i, %j] : memref<32x64xf32> } } return %s: memref<32x64xf32> } }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "module { memref.global ""private"" constant @__constant_1x5x1xf32 : memref<1x5x1xf32> = dense<[[[6.250000e-02], [2.500000e-01], [3.750000e-01], [2.500000e-01], [6.250000e-02]]]> memref.global ""private"" constant @__constant_32x64xf32 : memref<32x64xf32> = dense<0.000000e+00> func.func @fold_const_init_global_memref() -> (f32, f32) { %m = memref.get_global @__constant_1x5x1xf32 : memref<1x5x1xf32> %v0 = affine.load %m[0, 0, 0] : memref<1x5x1xf32> %v1 = affine.load %m[0, 1, 0] : memref<1x5x1xf32> return %v0, %v1 : f32, f32 } func.func @fold_const_splat_global() -> memref<32x64xf32> { %m = memref.get_global @__constant_32x64xf32 : memref<32x64xf32> %s = memref.alloc() : memref<32x64xf32> affine.for %i = 0 to 32 { affine.for %j = 0 to 64 { %v = affine.load %m[%i, %j] : memref<32x64xf32> affine.store %v, %s[%i, %j] : memref<32x64xf32> } } return %s: memref<32x64xf32> } }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @simplify_with_operands(%N: index, %A: memref) { affine.for %i = 0 to %N step 32 { affine.for %ii = 0 to 32 { %x = affine.load %A[%ii floordiv 32, %i mod 32] : memref ""test.foo""(%x) : (f32) -> () %a = affine.load %A[(%i + %ii) floordiv 32, (%i + %ii) mod 16] : memref ""test.foo""(%a) : (f32) -> () %b = affine.load %A[(%i + %ii) floordiv 64, (%i + %ii) mod 64] : memref ""test.foo""(%b) : (f32) -> () %c = affine.load %A[(%i + %ii) floordiv 16, (%i + %ii) mod 16] : memref ""test.foo""(%c) : (f32) -> () } } affine.for %i = -1 to 32 { %x = affine.load %A[%i floordiv 32, %i mod 32] : memref ""test.foo""(%x) : (f32) -> () } affine.for %arg0 = 0 to %N step 128 { affine.for %arg4 = 0 to 32 step 32 { affine.for %arg5 = 0 to 128 { %x = affine.apply affine_map<(d0, d1, d2) -> (((d0 + d2) mod 458313) floordiv 227 + d1 floordiv 256)>(%arg0, %arg4, %arg5) ""test.foo""(%x) : (index) -> () } } } return } func.func @simplify_div_mod_with_operands(%N: index, %A: memref<64xf32>, %unknown: index) { %cst = arith.constant 1.0 : f32 affine.for %i = 0 to 32 { affine.store %cst, %A[%i floordiv 32] : memref<64xf32> affine.store %cst, %A[(%i + 1) ceildiv 32] : memref<64xf32> affine.store %cst, %A[%i mod 32] : memref<64xf32> affine.store %cst, %A[2 * %i floordiv 64] : memref<64xf32> affine.store %cst, %A[(%i mod 16) floordiv 16] : memref<64xf32> affine.store %cst, %A[%i floordiv 16] : memref<64xf32> affine.store %cst, %A[%i mod 16] : memref<64xf32> affine.store %cst, %A[(%i mod 16) floordiv 15] : memref<64xf32> affine.store %cst, %A[%i mod 31] : memref<64xf32> } affine.for %i = -8 to 32 { affine.store %cst, %A[%i floordiv 32] : memref<64xf32> affine.store %cst, %A[%i mod 32] : memref<64xf32> affine.store %cst, %A[2 + (%i - 96) floordiv 64] : memref<64xf32> } affine.for %i = 8 to 16 { affine.store %cst, %A[%i floordiv 8] : memref<64xf32> affine.store %cst, %A[(%i + 1) ceildiv 8] : memref<64xf32> affine.store %cst, %A[%i mod 8] : memref<64xf32> affine.store %cst, %A[%i mod 32] : memref<64xf32> affine.store %cst, %A[(%i mod 32) floordiv 16] : memref<64xf32> affine.store %cst, %A[(%i mod 16) floordiv 8] : memref<64xf32> affine.store %cst, %A[(%unknown mod 16) floordiv 16] : memref<64xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @simplify_with_operands(%N: index, %A: memref) { affine.for %i = 0 to %N step 32 { affine.for %ii = 0 to 32 { %x = affine.load %A[%ii floordiv 32, %i mod 32] : memref ""test.foo""(%x) : (f32) -> () %a = affine.load %A[(%i + %ii) floordiv 32, (%i + %ii) mod 16] : memref ""test.foo""(%a) : (f32) -> () %b = affine.load %A[(%i + %ii) floordiv 64, (%i + %ii) mod 64] : memref ""test.foo""(%b) : (f32) -> () %c = affine.load %A[(%i + %ii) floordiv 16, (%i + %ii) mod 16] : memref ""test.foo""(%c) : (f32) -> () } } affine.for %i = -1 to 32 { %x = affine.load %A[%i floordiv 32, %i mod 32] : memref ""test.foo""(%x) : (f32) -> () } affine.for %arg0 = 0 to %N step 128 { affine.for %arg4 = 0 to 32 step 32 { affine.for %arg5 = 0 to 128 { %x = affine.apply affine_map<(d0, d1, d2) -> (((d0 + d2) mod 458313) floordiv 227 + d1 floordiv 256)>(%arg0, %arg4, %arg5) ""test.foo""(%x) : (index) -> () } } } return } func.func @simplify_div_mod_with_operands(%N: index, %A: memref<64xf32>, %unknown: index) { %cst = arith.constant 1.0 : f32 affine.for %i = 0 to 32 { affine.store %cst, %A[%i floordiv 32] : memref<64xf32> affine.store %cst, %A[(%i + 1) ceildiv 32] : memref<64xf32> affine.store %cst, %A[%i mod 32] : memref<64xf32> affine.store %cst, %A[2 * %i floordiv 64] : memref<64xf32> affine.store %cst, %A[(%i mod 16) floordiv 16] : memref<64xf32> affine.store %cst, %A[%i floordiv 16] : memref<64xf32> affine.store %cst, %A[%i mod 16] : memref<64xf32> affine.store %cst, %A[(%i mod 16) floordiv 15] : memref<64xf32> affine.store %cst, %A[%i mod 31] : memref<64xf32> } affine.for %i = -8 to 32 { affine.store %cst, %A[%i floordiv 32] : memref<64xf32> affine.store %cst, %A[%i mod 32] : memref<64xf32> affine.store %cst, %A[2 + (%i - 96) floordiv 64] : memref<64xf32> } affine.for %i = 8 to 16 { affine.store %cst, %A[%i floordiv 8] : memref<64xf32> affine.store %cst, %A[(%i + 1) ceildiv 8] : memref<64xf32> affine.store %cst, %A[%i mod 8] : memref<64xf32> affine.store %cst, %A[%i mod 32] : memref<64xf32> affine.store %cst, %A[(%i mod 32) floordiv 16] : memref<64xf32> affine.store %cst, %A[(%i mod 16) floordiv 8] : memref<64xf32> affine.store %cst, %A[(%unknown mod 16) floordiv 16] : memref<64xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "#map0 = affine_map<(d0) -> (32, d0 * -32 + 32)> #map1 = affine_map<(d0) -> (32, d0 * -32 + 64)> #map3 = affine_map<(d0) -> (16, d0 * -16 + 32)> func.func @simplify_min_max_bounds_simple(%M: index) { affine.for %i = 0 to min affine_map<(d0) -> (3, 5, d0)>(%M) { ""test.foo""() : () -> () } affine.for %i = 0 to min affine_map<(d0) -> (3, 3, d0)>(%M) { ""test.foo""() : () -> () } affine.for %i = max affine_map<(d0) -> (3, 5, d0)>(%M) to 10 { ""test.foo""() : () -> () } affine.for %i = max affine_map<(d0) -> (5, 5, d0)>(%M) to 10 { ""test.foo""() : () -> () } return } func.func @simplify_bounds_tiled() { affine.for %arg5 = 0 to 1 { affine.for %arg6 = 0 to 2 { affine.for %arg8 = 0 to min #map0(%arg5) step 16 { affine.for %arg9 = 0 to min #map1(%arg6) step 16 { affine.for %arg10 = 0 to 2 { affine.for %arg12 = 0 to min #map3(%arg10) step 16 { ""test.foo""() : () -> () } } } } } } return } func.func @simplify_min_max_multi_expr() { affine.for %i = 0 to 2 { affine.for %j = max affine_map<(d0) -> (5, 4 * d0)> (%i) to affine_map<(d0) -> (4 * d0 + 3)>(%i) { ""test.foo""() : () -> () } } affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { affine.for %k = -10 to min affine_map<(d0, d1) -> (4 * d0 - 3 * d1, -9)>(%i, %j) { ""test.foo""() : () -> () } } } affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { affine.for %k = -10 to min affine_map<(d0, d1) -> (4 * d0 - 3 * d1, -9, 4 * d0 - 4 * d1)>(%i, %j) { ""test.foo""() : () -> () } } } affine.for %i = 0 to 2 { affine.for %j = max affine_map<(d0) -> (d0 floordiv 2, 0)>(%i) to 1 { ""test.foo""() : () -> () } } affine.for %i = 0 to 8 { affine.for %j = max affine_map<(d0) -> (d0 floordiv 2, 0)>(%i) to 10 { ""test.foo""() : () -> () } } return } func.func @no_simplify_min_max(%M: index) { affine.for %i = 0 to 4 { affine.for %j = 0 to min affine_map<(d0) -> (2 * d0, 2)>(%i) { ""test.foo""() : () -> () } affine.for %j = 0 to min affine_map<(d0)[s0] -> (d0, s0)>(%i)[%M] { ""test.foo""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "#map0 = affine_map<(d0) -> (32, d0 * -32 + 32)> #map1 = affine_map<(d0) -> (32, d0 * -32 + 64)> #map3 = affine_map<(d0) -> (16, d0 * -16 + 32)> func.func @simplify_min_max_bounds_simple(%M: index) { affine.for %i = 0 to min affine_map<(d0) -> (3, 5, d0)>(%M) { ""test.foo""() : () -> () } affine.for %i = 0 to min affine_map<(d0) -> (3, 3, d0)>(%M) { ""test.foo""() : () -> () } affine.for %i = max affine_map<(d0) -> (3, 5, d0)>(%M) to 10 { ""test.foo""() : () -> () } affine.for %i = max affine_map<(d0) -> (5, 5, d0)>(%M) to 10 { ""test.foo""() : () -> () } return } func.func @simplify_bounds_tiled() { affine.for %arg5 = 0 to 1 { affine.for %arg6 = 0 to 2 { affine.for %arg8 = 0 to min #map0(%arg5) step 16 { affine.for %arg9 = 0 to min #map1(%arg6) step 16 { affine.for %arg10 = 0 to 2 { affine.for %arg12 = 0 to min #map3(%arg10) step 16 { ""test.foo""() : () -> () } } } } } } return } func.func @simplify_min_max_multi_expr() { affine.for %i = 0 to 2 { affine.for %j = max affine_map<(d0) -> (5, 4 * d0)> (%i) to affine_map<(d0) -> (4 * d0 + 3)>(%i) { ""test.foo""() : () -> () } } affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { affine.for %k = -10 to min affine_map<(d0, d1) -> (4 * d0 - 3 * d1, -9)>(%i, %j) { ""test.foo""() : () -> () } } } affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { affine.for %k = -10 to min affine_map<(d0, d1) -> (4 * d0 - 3 * d1, -9, 4 * d0 - 4 * d1)>(%i, %j) { ""test.foo""() : () -> () } } } affine.for %i = 0 to 2 { affine.for %j = max affine_map<(d0) -> (d0 floordiv 2, 0)>(%i) to 1 { ""test.foo""() : () -> () } } affine.for %i = 0 to 8 { affine.for %j = max affine_map<(d0) -> (d0 floordiv 2, 0)>(%i) to 10 { ""test.foo""() : () -> () } } return } func.func @no_simplify_min_max(%M: index) { affine.for %i = 0 to 4 { affine.for %j = 0 to min affine_map<(d0) -> (2 * d0, 2)>(%i) { ""test.foo""() : () -> () } affine.for %j = 0 to min affine_map<(d0)[s0] -> (d0, s0)>(%i)[%M] { ""test.foo""() : () -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @regression_do_not_perform_invalid_replacements(%arg0: index) { %0 = affine.apply affine_map<(d0) -> (-d0 + 40961)>(%arg0) %1 = affine.apply affine_map<(d0)[s0] -> (d0 * (s0 ceildiv 512))>(%arg0)[%0] ""test.foo""(%1) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @regression_do_not_perform_invalid_replacements(%arg0: index) { %0 = affine.apply affine_map<(d0) -> (-d0 + 40961)>(%arg0) %1 = affine.apply affine_map<(d0)[s0] -> (d0 * (s0 ceildiv 512))>(%arg0)[%0] ""test.foo""(%1) : (index) -> () return }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @min.oneval(%arg0: index) -> index { %min = affine.min affine_map<()[s0] -> (s0)> ()[%arg0] return %min: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @min.oneval(%arg0: index) -> index { %min = affine.min affine_map<()[s0] -> (s0)> ()[%arg0] return %min: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @max.oneval(%arg0: index) -> index { %max = affine.max affine_map<()[s0] -> (s0)> ()[%arg0] return %max: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @max.oneval(%arg0: index) -> index { %max = affine.max affine_map<()[s0] -> (s0)> ()[%arg0] return %max: index }"," mlir-opt -allow-unregistered-dialect -split-input-file -canonicalize=""test-convergence top-down=0"" ",1 "func.func @static_basis(%linear_index: index) -> (index, index, index) { %b0 = arith.constant 16 : index %b1 = arith.constant 224 : index %b2 = arith.constant 224 : index %1:3 = affine.delinearize_index %linear_index into (%b0, %b1, %b2) : index, index, index return %1#0, %1#1, %1#2 : index, index, index }", mlir-opt -affine-expand-index-ops -split-input-file ,1 "func.func @dynamic_basis(%linear_index: index, %src: memref) -> (index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %b0 = memref.dim %src, %c0 : memref %b1 = memref.dim %src, %c1 : memref %b2 = memref.dim %src, %c2 : memref %1:3 = affine.delinearize_index %linear_index into (%b0, %b1, %b2) : index, index, index return %1#0, %1#1, %1#2 : index, index, index }", mlir-opt -affine-expand-index-ops -split-input-file ,1 "func.func @if_else_imperfect(%A : memref<100xi32>, %B : memref<100xi32>, %v : i32) { affine.for %i = 0 to 100 { affine.store %v, %A[%i] : memref<100xi32> affine.for %j = 0 to 100 { affine.store %v, %A[%j] : memref<100xi32> affine.if affine_set<(d0) : (d0 - 2 >= 0)>(%i) { affine.store %v, %B[%j] : memref<100xi32> } func.call @external() : () -> () } affine.store %v, %A[%i] : memref<100xi32> } return } func.func private @external()"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(test-affine-loop-unswitch))"" ",1 "func.func private @foo() func.func private @bar() func.func private @abc() func.func private @xyz() func.func @if_then_perfect(%A : memref<100xi32>, %v : i32) { affine.for %i = 0 to 100 { affine.for %j = 0 to 100 { affine.for %k = 0 to 100 { affine.if affine_set<(d0) : (d0 - 2 >= 0)>(%i) { affine.store %v, %A[%i] : memref<100xi32> } } } } return } func.func @if_else_perfect(%A : memref<100xi32>, %v : i32) { affine.for %i = 0 to 99 { affine.for %j = 0 to 100 { affine.for %k = 0 to 100 { func.call @foo() : () -> () affine.if affine_set<(d0, d1) : (d0 - 2 >= 0, -d1 + 80 >= 0)>(%i, %j) { affine.store %v, %A[%i] : memref<100xi32> func.call @abc() : () -> () } else { affine.store %v, %A[%i + 1] : memref<100xi32> func.call @xyz() : () -> () } func.call @bar() : () -> () } } } return } func.func @if_then_imperfect(%A : memref<100xi32>, %N : index, %v: i32) { affine.for %i = 0 to 100 { affine.store %v, %A[0] : memref<100xi32> affine.if affine_set<(d0) : (d0 - 2 >= 0)>(%N) { affine.store %v, %A[%i] : memref<100xi32> } } return } func.func @hoist_after_canonicalize() { affine.for %i = 0 to 100 { affine.for %j = 0 to 100 { affine.if affine_set<(d0) : (d0 - 2 >= 0)>(%j) { affine.if affine_set<(d0, d1) : (d0 - 1 >= 0, -d0 + 99 >= 0)>(%i, %j) { func.call @foo() : () -> () } } } } return } func.func @handle_dead_if(%N : index) { affine.for %i = 0 to 100 { affine.if affine_set<(d0) : (d0 - 1 >= 0, -d0 + 99 >= 0)>(%N) { } } return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(test-affine-loop-unswitch))"" ",1 "#flb1 = affine_map<(d0) -> (d0 * 3)> #fub1 = affine_map<(d0) -> (d0 * 3 + 3)> #flb0 = affine_map<(d0) -> (d0 * 16)> #fub0 = affine_map<(d0) -> (d0 * 16 + 16)> #pub1 = affine_map<(d0)[s0] -> (s0, d0 * 3 + 3)> #pub0 = affine_map<(d0)[s0] -> (s0, d0 * 16 + 16)> #lb1 = affine_map<(d0) -> (d0 * 480)> #ub1 = affine_map<(d0)[s0] -> (s0, d0 * 480 + 480)> #lb0 = affine_map<(d0) -> (d0 * 110)> #ub0 = affine_map<(d0)[s0] -> (d0 * 110 + 110, s0 floordiv 3)> #set0 = affine_set<(d0, d1)[s0, s1] : (d0 * -16 + s0 - 16 >= 0, d1 * -3 + s1 - 3 >= 0)> func.func @perfect_if_else(%arg0 : memref, %arg1 : memref, %v : f64, %arg4 : index, %arg5 : index, %arg6 : index, %sym : index) { affine.for %arg7 = #lb0(%arg5) to min #ub0(%arg5)[%sym] { affine.parallel (%i0, %j0) = (0, 0) to (symbol(%sym), 100) step (10, 10) { affine.for %arg8 = #lb1(%arg4) to min #ub1(%arg4)[%sym] { affine.if #set0(%arg6, %arg7)[%sym, %sym] { affine.for %arg9 = #flb0(%arg6) to #fub0(%arg6) { affine.for %arg10 = #flb1(%arg7) to #fub1(%arg7) { affine.store %v, %arg0[0, 0] : memref } } } else { affine.for %arg9 = #lb0(%arg6) to min #pub0(%arg6)[%sym] { affine.for %arg10 = #lb1(%arg7) to min #pub1(%arg7)[%sym] { affine.store %v, %arg0[0, 0] : memref } } } } } } return } func.func @multiple_if(%N : index) { affine.if affine_set<() : (0 == 0)>() { func.call @external() : () -> () } affine.for %i = 0 to 100 { affine.if affine_set<()[s0] : (s0 >= 0)>()[%N] { func.call @external() : () -> () } } return } func.func private @external()"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(test-affine-loop-unswitch))"" ",1 "func.func @empty() { affine.for %i = 0 to 10 { } {some_attr = true} affine.if affine_set<() : ()> () { } {some_attr = true} affine.if affine_set<() : ()> () { } else { ""foo""() : () -> () } {some_attr = true} return } func.func @affine.yield() { affine.for %i = 0 to 10 { ""affine.yield""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @empty() { affine.for %i = 0 to 10 { } {some_attr = true} affine.if affine_set<() : ()> () { } {some_attr = true} affine.if affine_set<() : ()> () { } else { ""foo""() : () -> () } {some_attr = true} return } func.func @affine.yield() { affine.for %i = 0 to 10 { ""affine.yield""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = affine.min affine_map<(d0)[s0] -> (1000, d0 + 512, s0)> (%arg0)[%arg1] %1 = affine.min affine_map<(d0, d1)[s0] -> (d0 - d1, s0 + 512)> (%arg0, %arg1)[%arg2] %2 = affine.min affine_map<()[s0, s1] -> (s0 - s1, 11)> ()[%arg1, %arg2] %3 = affine.min affine_map<()[] -> (77, 78, 79)> ()[] return } func.func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = affine.max affine_map<(d0)[s0] -> (1000, d0 + 512, s0)> (%arg0)[%arg1] %1 = affine.max affine_map<(d0, d1)[s0] -> (d0 - d1, s0 + 512)> (%arg0, %arg1)[%arg2] %2 = affine.max affine_map<()[s0, s1] -> (s0 - s1, 11)> ()[%arg1, %arg2] %3 = affine.max affine_map<()[] -> (77, 78, 79)> ()[] return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = affine.min affine_map<(d0)[s0] -> (1000, d0 + 512, s0)> (%arg0)[%arg1] %1 = affine.min affine_map<(d0, d1)[s0] -> (d0 - d1, s0 + 512)> (%arg0, %arg1)[%arg2] %2 = affine.min affine_map<()[s0, s1] -> (s0 - s1, 11)> ()[%arg1, %arg2] %3 = affine.min affine_map<()[] -> (77, 78, 79)> ()[] return } func.func @affine_max(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = affine.max affine_map<(d0)[s0] -> (1000, d0 + 512, s0)> (%arg0)[%arg1] %1 = affine.max affine_map<(d0, d1)[s0] -> (d0 - d1, s0 + 512)> (%arg0, %arg1)[%arg2] %2 = affine.max affine_map<()[s0, s1] -> (s0 - s1, 11)> ()[%arg1, %arg2] %3 = affine.max affine_map<()[] -> (77, 78, 79)> ()[] return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @valid_symbols(%arg0: index, %arg1: index, %arg2: index) { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = memref.alloc(%arg0, %arg1) : memref affine.for %arg3 = 0 to %arg2 step 768 { %13 = memref.dim %0, %c1 : memref affine.for %arg4 = 0 to %13 step 264 { %18 = memref.dim %0, %c0 : memref %20 = memref.subview %0[%c0, %c0][%18,%arg4][%c1,%c1] : memref to memref> %24 = memref.dim %20, %c0 : memref> affine.for %arg5 = 0 to %24 step 768 { ""foo""() : () -> () } } } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @valid_symbols(%arg0: index, %arg1: index, %arg2: index) { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %0 = memref.alloc(%arg0, %arg1) : memref affine.for %arg3 = 0 to %arg2 step 768 { %13 = memref.dim %0, %c1 : memref affine.for %arg4 = 0 to %13 step 264 { %18 = memref.dim %0, %c0 : memref %20 = memref.subview %0[%c0, %c0][%18,%arg4][%c1,%c1] : memref to memref> %24 = memref.dim %20, %c0 : memref> affine.for %arg5 = 0 to %24 step 768 { ""foo""() : () -> () } } } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @valid_symbol_affine_scope(%n : index, %A : memref) { test.affine_scope { %c1 = arith.constant 1 : index %l = arith.subi %n, %c1 : index affine.for %i = %l to %n { %m = arith.subi %l, %i : index test.affine_scope { affine.for %j = %m to %n { %v = affine.load %A[%n - 1] : memref affine.store %v, %A[%n - 1] : memref } ""terminate""() : () -> () } } ""terminate""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @valid_symbol_affine_scope(%n : index, %A : memref) { test.affine_scope { %c1 = arith.constant 1 : index %l = arith.subi %n, %c1 : index affine.for %i = %l to %n { %m = arith.subi %l, %i : index test.affine_scope { affine.for %j = %m to %n { %v = affine.load %A[%n - 1] : memref affine.store %v, %A[%n - 1] : memref } ""terminate""() : () -> () } } ""terminate""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "%idx = ""test.foo""() : () -> (index) ""test.func""() ({ ^bb0(%A : memref): affine.load %A[%idx] : memref ""terminate""() : () -> () }) : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "%idx = ""test.foo""() : () -> (index) ""test.func""() ({ ^bb0(%A : memref): affine.load %A[%idx] : memref ""terminate""() : () -> () }) : () -> ()", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @parallel(%A : memref<100x100xf32>, %N : index) { affine.parallel (%i0, %j0) = (0, 0) to (symbol(%N), 100) step (10, 10) { %0:2 = affine.parallel (%i1, %j1) = (%i0, %j0) to (%i0 + 10, %j0 + 10) reduce (""minf"", ""maxf"") -> (f32, f32) { %2 = affine.load %A[%i0 + %i0, %j0 + %j1] : memref<100x100xf32> affine.yield %2, %2 : f32, f32 } } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @parallel(%A : memref<100x100xf32>, %N : index) { affine.parallel (%i0, %j0) = (0, 0) to (symbol(%N), 100) step (10, 10) { %0:2 = affine.parallel (%i1, %j1) = (%i0, %j0) to (%i0 + 10, %j0 + 10) reduce (""minf"", ""maxf"") -> (f32, f32) { %2 = affine.load %A[%i0 + %i0, %j0 + %j1] : memref<100x100xf32> affine.yield %2, %2 : f32, f32 } } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @parallel_min_max(%a: index, %b: index, %c: index, %d: index) { affine.parallel (%i, %j, %k) = (max(%a, %b), %b, max(%a, %c)) to (%c, min(%c, %d), %b) { affine.yield } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @parallel_min_max(%a: index, %b: index, %c: index, %d: index) { affine.parallel (%i, %j, %k) = (max(%a, %b), %b, max(%a, %c)) to (%c, min(%c, %d), %b) { affine.yield } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @parallel_no_ivs() { affine.parallel () = () to () { affine.yield } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @parallel_no_ivs() { affine.parallel () = () to () { affine.yield } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @affine_if() -> f32 { %zero = arith.constant 0.0 : f32 %0 = affine.if affine_set<() : ()> () -> f32 { affine.yield %zero : f32 } else { affine.yield %zero : f32 } return %0 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @affine_if() -> f32 { %zero = arith.constant 0.0 : f32 %0 = affine.if affine_set<() : ()> () -> f32 { affine.yield %zero : f32 } else { affine.yield %zero : f32 } return %0 : f32 }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "#set = affine_set<(d0): (d0 - 10 >= 0)> func.func @yield_loop(%buffer: memref<1024xf32>) -> f32 { %sum_init_0 = arith.constant 0.0 : f32 %res = affine.for %i = 0 to 10 step 2 iter_args(%sum_iter = %sum_init_0) -> f32 { %t = affine.load %buffer[%i] : memref<1024xf32> %sum_next = affine.if #set(%i) -> (f32) { %new_sum = arith.addf %sum_iter, %t : f32 affine.yield %new_sum : f32 } else { affine.yield %sum_iter : f32 } affine.yield %sum_next : f32 } return %res : f32 } func.func @affine_for_multiple_yield(%buffer: memref<1024xf32>) -> (f32, f32) { %init_0 = arith.constant 0.0 : f32 %res1, %res2 = affine.for %i = 0 to 10 step 2 iter_args(%iter_arg1 = %init_0, %iter_arg2 = %init_0) -> (f32, f32) { %t = affine.load %buffer[%i] : memref<1024xf32> %ret1 = arith.addf %t, %iter_arg1 : f32 %ret2 = arith.addf %t, %iter_arg2 : f32 affine.yield %ret1, %ret2 : f32, f32 } return %res1, %res2 : f32, f32 }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "#set = affine_set<(d0): (d0 - 10 >= 0)> func.func @yield_loop(%buffer: memref<1024xf32>) -> f32 { %sum_init_0 = arith.constant 0.0 : f32 %res = affine.for %i = 0 to 10 step 2 iter_args(%sum_iter = %sum_init_0) -> f32 { %t = affine.load %buffer[%i] : memref<1024xf32> %sum_next = affine.if #set(%i) -> (f32) { %new_sum = arith.addf %sum_iter, %t : f32 affine.yield %new_sum : f32 } else { affine.yield %sum_iter : f32 } affine.yield %sum_next : f32 } return %res : f32 } func.func @affine_for_multiple_yield(%buffer: memref<1024xf32>) -> (f32, f32) { %init_0 = arith.constant 0.0 : f32 %res1, %res2 = affine.for %i = 0 to 10 step 2 iter_args(%iter_arg1 = %init_0, %iter_arg2 = %init_0) -> (f32, f32) { %t = affine.load %buffer[%i] : memref<1024xf32> %ret1 = arith.addf %t, %iter_arg1 : f32 %ret2 = arith.addf %t, %iter_arg2 : f32 affine.yield %ret1, %ret2 : f32, f32 } return %res1, %res2 : f32, f32 }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @delinearize(%linear_idx: index, %basis0: index, %basis1 :index) -> (index, index) { %1:2 = affine.delinearize_index %linear_idx into (%basis0, %basis1) : index, index return %1#0, %1#1 : index, index }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @delinearize(%linear_idx: index, %basis0: index, %basis1 :index) -> (index, index) { %1:2 = affine.delinearize_index %linear_idx into (%basis0, %basis1) : index, index return %1#0, %1#1 : index, index }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic ,1 "func.func @unroll_jam_imperfect_nest() { affine.for %i = 0 to 101 { %x = ""addi32""(%i, %i) : (index, index) -> i32 affine.for %j = 0 to 17 { %y = ""addi32""(%i, %i) : (index, index) -> i32 %z = ""addi32""(%y, %y) : (i32, i32) -> i32 } %w = ""foo""(%i, %x) : (index, i32) -> i32 } return } func.func @loop_nest_unknown_count_1(%N : index) { affine.for %i = 1 to %N { affine.for %j = 1 to 100 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_unknown_count_2(%N : index) { affine.for %i = %N to affine_map<()[s0] -> (s0+9)> ()[%N] { affine.for %j = 1 to 100 { ""foo""(%i) : (index) -> () } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = 0 to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%M, %N] { affine.for %j = 0 to %K { ""test.foo""(%i, %j) : (index, index) -> () } } return } func.func @no_unroll_jam_dependent_ubound(%in0: memref) { affine.for %i = 0 to 100 { affine.for %k = 0 to affine_map<(d0) -> (d0 + 1)>(%i) { %y = ""addi32""(%k, %k) : (index, index) -> i32 } } return } func.func @unroll_jam_one_iter_arg() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %cst) -> (i32) { %y = ""bar""(%i, %j, %acc) : (index, index, i32) -> i32 affine.yield %y : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args() { affine.for %i = 0 to 101 { %cst = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red:2 = affine.for %j = 0 to 17 iter_args(%acc = %cst, %acc1 = %cst1) -> (i32, i32) { %y = ""bar""(%i, %j, %acc) : (index, index, i32) -> i32 %z = ""bar1""(%i, %j, %acc1) : (index, index, i32) -> i32 affine.yield %y, %z : i32, i32 } %w = ""foo""(%i, %x, %red#0, %red#1) : (index, i32, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_func_arg(%in: i32) { affine.for %i = 0 to 101 { %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %in) -> (i32) { %y = ""bar""(%i, %j, %acc) : (index, index, i32) -> i32 affine.yield %y : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_nested() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %cst) -> (i32) { %red1 = affine.for %k = 0 to 35 iter_args(%acc1 = %acc) -> (i32) { %y = ""bar""(%i, %j, %k, %acc1) : (index, index, index, i32) -> i32 affine.yield %y : i32 } affine.yield %red1 : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_nested_affine_for_result() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %cst) -> (i32) { %red1 = affine.for %k = 0 to 35 iter_args(%acc1 = %acc) -> (i32) { %y = ""bar""(%i, %j, %k, %acc1) : (index, index, index, i32) -> i32 affine.yield %acc : i32 } %red2 = affine.for %l = 0 to 36 iter_args(%acc2 = %red1) -> (i32) { %y = ""bar""(%i, %j, %l, %acc2) : (index, index, index, i32) -> i32 affine.yield %y : i32 } affine.yield %red2 : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_nested_yield() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red:3 = affine.for %j = 0 to 17 iter_args(%acc = %cst, %acc1 = %cst, %acc2 = %cst) -> (i32, i32, i32) { %red1 = affine.for %k = 0 to 35 iter_args(%acc3 = %acc) -> (i32) { %y = ""bar""(%i, %j, %k, %acc3) : (index, index, index, i32) -> i32 affine.yield %y : i32 } %red2:2 = affine.for %l = 0 to 36 iter_args(%acc4 = %acc1, %acc5 = %acc2) -> (i32, i32) { %y = ""bar1""(%i, %j, %l, %acc4, %acc5) : (index, index, index, i32, i32) -> i32 affine.yield %y, %y : i32, i32 } affine.yield %red1, %red1, %red2#1 : i32, i32, i32 } %w = ""foo""(%i, %x, %red#0, %red#2) : (index, i32, i32, i32) -> i32 } return } func.func @unroll_jam_nested_iter_args_mulf(%arg0: memref<21x30xf32, 1>, %init : f32, %init1 : f32) { %0 = affine.for %arg3 = 0 to 21 iter_args(%arg4 = %init) -> (f32) { %1 = affine.for %arg5 = 0 to 30 iter_args(%arg6 = %init1) -> (f32) { %3 = affine.load %arg0[%arg3, %arg5] : memref<21x30xf32, 1> %4 = arith.addf %arg6, %3 : f32 affine.yield %4 : f32 } %2 = arith.mulf %arg4, %1 : f32 affine.yield %2 : f32 } return } func.func @unroll_jam_iter_args_addi(%arg0: memref<21xi32, 1>, %init : i32) { %0 = affine.for %arg3 = 0 to 21 iter_args(%arg4 = %init) -> (i32) { %1 = affine.load %arg0[%arg3] : memref<21xi32, 1> %2 = arith.addi %arg4, %1 : i32 affine.yield %2 : i32 } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll-jam=""unroll-jam-factor=2"" ",1 "func.func @unroll_jam_imperfect_nest() { affine.for %i = 0 to 101 { %x = ""addi32""(%i, %i) : (index, index) -> i32 affine.for %j = 0 to 17 { %y = ""addi32""(%i, %i) : (index, index) -> i32 %z = ""addi32""(%y, %y) : (i32, i32) -> i32 } %w = ""foo""(%i, %x) : (index, i32) -> i32 } return } func.func @loop_nest_unknown_count_1(%N : index) { affine.for %i = 1 to %N { affine.for %j = 1 to 100 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_unknown_count_2(%N : index) { affine.for %i = %N to affine_map<()[s0] -> (s0+9)> ()[%N] { affine.for %j = 1 to 100 { ""foo""(%i) : (index) -> () } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = 0 to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%M, %N] { affine.for %j = 0 to %K { ""test.foo""(%i, %j) : (index, index) -> () } } return } func.func @no_unroll_jam_dependent_ubound(%in0: memref) { affine.for %i = 0 to 100 { affine.for %k = 0 to affine_map<(d0) -> (d0 + 1)>(%i) { %y = ""addi32""(%k, %k) : (index, index) -> i32 } } return } func.func @unroll_jam_one_iter_arg() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %cst) -> (i32) { %y = ""bar""(%i, %j, %acc) : (index, index, i32) -> i32 affine.yield %y : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args() { affine.for %i = 0 to 101 { %cst = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red:2 = affine.for %j = 0 to 17 iter_args(%acc = %cst, %acc1 = %cst1) -> (i32, i32) { %y = ""bar""(%i, %j, %acc) : (index, index, i32) -> i32 %z = ""bar1""(%i, %j, %acc1) : (index, index, i32) -> i32 affine.yield %y, %z : i32, i32 } %w = ""foo""(%i, %x, %red#0, %red#1) : (index, i32, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_func_arg(%in: i32) { affine.for %i = 0 to 101 { %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %in) -> (i32) { %y = ""bar""(%i, %j, %acc) : (index, index, i32) -> i32 affine.yield %y : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_nested() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %cst) -> (i32) { %red1 = affine.for %k = 0 to 35 iter_args(%acc1 = %acc) -> (i32) { %y = ""bar""(%i, %j, %k, %acc1) : (index, index, index, i32) -> i32 affine.yield %y : i32 } affine.yield %red1 : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_nested_affine_for_result() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red = affine.for %j = 0 to 17 iter_args(%acc = %cst) -> (i32) { %red1 = affine.for %k = 0 to 35 iter_args(%acc1 = %acc) -> (i32) { %y = ""bar""(%i, %j, %k, %acc1) : (index, index, index, i32) -> i32 affine.yield %acc : i32 } %red2 = affine.for %l = 0 to 36 iter_args(%acc2 = %red1) -> (i32) { %y = ""bar""(%i, %j, %l, %acc2) : (index, index, index, i32) -> i32 affine.yield %y : i32 } affine.yield %red2 : i32 } %w = ""foo""(%i, %x, %red) : (index, i32, i32) -> i32 } return } func.func @unroll_jam_iter_args_nested_yield() { affine.for %i = 0 to 101 { %cst = arith.constant 1 : i32 %x = ""addi32""(%i, %i) : (index, index) -> i32 %red:3 = affine.for %j = 0 to 17 iter_args(%acc = %cst, %acc1 = %cst, %acc2 = %cst) -> (i32, i32, i32) { %red1 = affine.for %k = 0 to 35 iter_args(%acc3 = %acc) -> (i32) { %y = ""bar""(%i, %j, %k, %acc3) : (index, index, index, i32) -> i32 affine.yield %y : i32 } %red2:2 = affine.for %l = 0 to 36 iter_args(%acc4 = %acc1, %acc5 = %acc2) -> (i32, i32) { %y = ""bar1""(%i, %j, %l, %acc4, %acc5) : (index, index, index, i32, i32) -> i32 affine.yield %y, %y : i32, i32 } affine.yield %red1, %red1, %red2#1 : i32, i32, i32 } %w = ""foo""(%i, %x, %red#0, %red#2) : (index, i32, i32, i32) -> i32 } return } func.func @unroll_jam_nested_iter_args_mulf(%arg0: memref<21x30xf32, 1>, %init : f32, %init1 : f32) { %0 = affine.for %arg3 = 0 to 21 iter_args(%arg4 = %init) -> (f32) { %1 = affine.for %arg5 = 0 to 30 iter_args(%arg6 = %init1) -> (f32) { %3 = affine.load %arg0[%arg3, %arg5] : memref<21x30xf32, 1> %4 = arith.addf %arg6, %3 : f32 affine.yield %4 : f32 } %2 = arith.mulf %arg4, %1 : f32 affine.yield %2 : f32 } return } func.func @unroll_jam_iter_args_addi(%arg0: memref<21xi32, 1>, %init : i32) { %0 = affine.for %arg3 = 0 to 21 iter_args(%arg4 = %init) -> (i32) { %1 = affine.load %arg0[%arg3] : memref<21xi32, 1> %2 = arith.addi %arg4, %1 : i32 affine.yield %2 : i32 } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll-jam=""unroll-jam-factor=4"" ",1 "func.func @loop_nest_1d() { %A = memref.alloc() : memref<256 x f32> %B = memref.alloc() : memref<512 x f32> %F = memref.alloc() : memref<256 x f32, 2> affine.for %i = 0 to 256 { affine.load %A[%i] : memref<256 x f32> %idx = affine.apply affine_map<(d0) -> (d0 + 256)>(%i) affine.load %B[%idx] : memref<512 x f32> affine.load %F[%i] : memref<256 x f32, 2> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @loop_nest_1d() { %A = memref.alloc() : memref<256 x f32> %B = memref.alloc() : memref<512 x f32> %F = memref.alloc() : memref<256 x f32, 2> affine.for %i = 0 to 256 { affine.load %A[%i] : memref<256 x f32> %idx = affine.apply affine_map<(d0) -> (d0 + 256)>(%i) affine.load %B[%idx] : memref<512 x f32> affine.load %F[%i] : memref<256 x f32, 2> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @loop_nest_high_d(%A: memref<512 x 32 x f32>, %B: memref<512 x 32 x f32>, %C: memref<512 x 32 x f32>) { affine.for %jT = 0 to 32 { affine.for %kT = 0 to 32 { affine.for %iT = 0 to 32 { affine.for %kk = 0 to 16 { %k = affine.apply affine_map<(d0, d1) -> (16*d0 + d1)> (%kT, %kk) %v0 = affine.load %B[%k, %jT] : memref<512 x 32 x f32> ""foo""(%v0) : (f32) -> () } affine.for %ii = 0 to 16 { %i = affine.apply affine_map<(d0, d1) -> (16*d0 + d1)>(%iT, %ii) %v1 = affine.load %A[%i, %kT] : memref<512 x 32 x f32> ""bar""(%v1) : (f32) -> () } affine.for %ii_ = 0 to 16 { %v2 = ""abc_compute""() : () -> f32 %i_ = affine.apply affine_map<(d0, d1) -> (16*d0 + d1)>(%iT, %ii_) %v3 = affine.load %C[%i_, %jT] : memref<512 x 32 x f32> %v4 = ""addf32""(%v2, %v3) : (f32, f32) -> (f32) affine.store %v4, %C[%i_, %jT] : memref<512 x 32 x f32> } ""foobar""() : () -> () } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @loop_nest_high_d(%A: memref<512 x 32 x f32>, %B: memref<512 x 32 x f32>, %C: memref<512 x 32 x f32>) { affine.for %jT = 0 to 32 { affine.for %kT = 0 to 32 { affine.for %iT = 0 to 32 { affine.for %kk = 0 to 16 { %k = affine.apply affine_map<(d0, d1) -> (16*d0 + d1)> (%kT, %kk) %v0 = affine.load %B[%k, %jT] : memref<512 x 32 x f32> ""foo""(%v0) : (f32) -> () } affine.for %ii = 0 to 16 { %i = affine.apply affine_map<(d0, d1) -> (16*d0 + d1)>(%iT, %ii) %v1 = affine.load %A[%i, %kT] : memref<512 x 32 x f32> ""bar""(%v1) : (f32) -> () } affine.for %ii_ = 0 to 16 { %v2 = ""abc_compute""() : () -> f32 %i_ = affine.apply affine_map<(d0, d1) -> (16*d0 + d1)>(%iT, %ii_) %v3 = affine.load %C[%i_, %jT] : memref<512 x 32 x f32> %v4 = ""addf32""(%v2, %v3) : (f32, f32) -> (f32) affine.store %v4, %C[%i_, %jT] : memref<512 x 32 x f32> } ""foobar""() : () -> () } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @loop_nest_modulo() { %A = memref.alloc() : memref<256 x 8 x f32> affine.for %i = 0 to 32 step 4 { affine.for %j = 0 to 8 { %idx = affine.apply affine_map<(d0) -> (d0 mod 2)> (%j) %v = affine.load %A[%i, %idx] : memref<256 x 8 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @loop_nest_modulo() { %A = memref.alloc() : memref<256 x 8 x f32> affine.for %i = 0 to 32 step 4 { affine.for %j = 0 to 8 { %idx = affine.apply affine_map<(d0) -> (d0 mod 2)> (%j) %v = affine.load %A[%i, %idx] : memref<256 x 8 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @loop_nest_tiled() -> memref<256x1024xf32> { %0 = memref.alloc() : memref<256x1024xf32> affine.for %i0 = 0 to 256 step 32 { affine.for %i1 = 0 to 1024 step 32 { affine.for %i2 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 32)>(%i0) { affine.for %i3 = affine_map<(d0) -> (d0)>(%i1) to affine_map<(d0) -> (d0 + 32)>(%i1) { %1 = affine.load %0[%i2, %i3] : memref<256x1024xf32> } } } } return %0 : memref<256x1024xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @loop_nest_tiled() -> memref<256x1024xf32> { %0 = memref.alloc() : memref<256x1024xf32> affine.for %i0 = 0 to 256 step 32 { affine.for %i1 = 0 to 1024 step 32 { affine.for %i2 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 32)>(%i0) { affine.for %i3 = affine_map<(d0) -> (d0)>(%i1) to affine_map<(d0) -> (d0 + 32)>(%i1) { %1 = affine.load %0[%i2, %i3] : memref<256x1024xf32> } } } } return %0 : memref<256x1024xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_constant_dim_access(%A : memref<100x100xf32>) { %one = arith.constant 1 : index %N = arith.constant 100 : index affine.for %i = 0 to 100 { affine.for %j = 0 to affine_map<()[s0] -> (s0)> ()[%N] { affine.load %A[%one, %j] : memref<100 x 100 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_constant_dim_access(%A : memref<100x100xf32>) { %one = arith.constant 1 : index %N = arith.constant 100 : index affine.for %i = 0 to 100 { affine.for %j = 0 to affine_map<()[s0] -> (s0)> ()[%N] { affine.load %A[%one, %j] : memref<100 x 100 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) { %N = arith.constant 9 : index affine.for %i = 0 to 100 { affine.for %j = 0 to 100 { %idy = affine.apply affine_map<(d0, d1) [s0, s1] -> (d1 + s0 + s1)>(%i, %j)[%M, %N] affine.load %A[%i, %idy] : memref<100 x 100 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) { %N = arith.constant 9 : index affine.for %i = 0 to 100 { affine.for %j = 0 to 100 { %idy = affine.apply affine_map<(d0, d1) [s0, s1] -> (d1 + s0 + s1)>(%i, %j)[%M, %N] affine.load %A[%i, %idy] : memref<100 x 100 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_with_symbolic_loop_bounds(%A : memref<100x100xf32>, %M : index, %N: index) { %K = arith.constant 9 : index affine.for %i = 0 to 100 { affine.for %j = %M to %N { %idy = affine.apply affine_map<(d1) [s0] -> (d1 + s0)>(%j)[%K] affine.load %A[%i, %idy] : memref<100 x 100 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_with_symbolic_loop_bounds(%A : memref<100x100xf32>, %M : index, %N: index) { %K = arith.constant 9 : index affine.for %i = 0 to 100 { affine.for %j = %M to %N { %idy = affine.apply affine_map<(d1) [s0] -> (d1 + s0)>(%j)[%K] affine.load %A[%i, %idy] : memref<100 x 100 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_unknown_size(%arg0: memref) { %c0 = arith.constant 0 : index %M = memref.dim %arg0, %c0 : memref %N = memref.dim %arg0, %c0 : memref affine.for %i = 0 to %M { affine.for %j = 0 to %N { affine.load %arg0[%i, %j] : memref } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_unknown_size(%arg0: memref) { %c0 = arith.constant 0 : index %M = memref.dim %arg0, %c0 : memref %N = memref.dim %arg0, %c0 : memref affine.for %i = 0 to %M { affine.for %j = 0 to %N { affine.load %arg0[%i, %j] : memref } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_memref_3d(%arg0: memref<1024x1024x1024xf32>) { affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %idx = affine.apply affine_map<(d0) -> (d0 mod 128)>(%i) %idy = affine.apply affine_map<(d0) -> (d0 mod 128)>(%j) %idz = affine.apply affine_map<(d0) -> (d0 mod 128)>(%k) %v = affine.load %arg0[%idx, %idy, %idz] : memref<1024 x 1024 x 1024 x f32> } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_memref_3d(%arg0: memref<1024x1024x1024xf32>) { affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %idx = affine.apply affine_map<(d0) -> (d0 mod 128)>(%i) %idy = affine.apply affine_map<(d0) -> (d0 mod 128)>(%j) %idz = affine.apply affine_map<(d0) -> (d0 mod 128)>(%k) %v = affine.load %arg0[%idx, %idy, %idz] : memref<1024 x 1024 x 1024 x f32> } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @multi_load_store_union() { %A = memref.alloc() : memref<512 x 512 x f32> affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { %idx = affine.apply affine_map<(d0) -> (d0 + 64)>(%i) %idy = affine.apply affine_map<(d0) -> (d0 + 128)>(%j) %ishift = affine.apply affine_map<(d0) -> (d0 + 2)>(%i) %jshift = affine.apply affine_map<(d0) -> (d0 + 2)>(%j) %u = affine.load %A[%ishift, %idy] : memref<512 x 512 x f32> %v = affine.load %A[%idx, %jshift] : memref<512 x 512 x f32> %sidx = affine.apply affine_map<(d0) -> (d0 + 128)>(%i) %sidy = affine.apply affine_map<(d0) -> (d0 + 192)>(%j) affine.store %u, %A[%ishift, %sidy] : memref<512 x 512 x f32> affine.store %v, %A[%sidx, %jshift] : memref<512 x 512 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @multi_load_store_union() { %A = memref.alloc() : memref<512 x 512 x f32> affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { %idx = affine.apply affine_map<(d0) -> (d0 + 64)>(%i) %idy = affine.apply affine_map<(d0) -> (d0 + 128)>(%j) %ishift = affine.apply affine_map<(d0) -> (d0 + 2)>(%i) %jshift = affine.apply affine_map<(d0) -> (d0 + 2)>(%j) %u = affine.load %A[%ishift, %idy] : memref<512 x 512 x f32> %v = affine.load %A[%idx, %jshift] : memref<512 x 512 x f32> %sidx = affine.apply affine_map<(d0) -> (d0 + 128)>(%i) %sidy = affine.apply affine_map<(d0) -> (d0 + 192)>(%j) affine.store %u, %A[%ishift, %sidy] : memref<512 x 512 x f32> affine.store %v, %A[%sidx, %jshift] : memref<512 x 512 x f32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_loop_straightline_interspersed() { %c0 = arith.constant 0 : index %c255 = arith.constant 255 : index %A = memref.alloc() : memref<256 x f32> %v = affine.load %A[%c0] : memref<256 x f32> affine.for %i = 1 to 255 { affine.load %A[%i] : memref<256 x f32> } %l = affine.load %A[%c255] : memref<256 x f32> affine.store %l, %A[%c0] : memref<256 x f32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_loop_straightline_interspersed() { %c0 = arith.constant 0 : index %c255 = arith.constant 255 : index %A = memref.alloc() : memref<256 x f32> %v = affine.load %A[%c0] : memref<256 x f32> affine.for %i = 1 to 255 { affine.load %A[%i] : memref<256 x f32> } %l = affine.load %A[%c255] : memref<256 x f32> affine.store %l, %A[%c0] : memref<256 x f32> return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @dma_mixed_loop_blocks() { %c0 = arith.constant 0 : index %A = memref.alloc() : memref<256 x 256 x vector<8 x f32>> affine.for %i = 0 to 256 { %v = affine.load %A[%c0, %c0] : memref<256 x 256 x vector<8 x f32>> ""foo""(%v) : (vector<8 x f32>) -> () affine.for %j = 0 to 256 { %w = affine.load %A[%i, %j] : memref<256 x 256 x vector<8 x f32>> ""bar""(%w) : (vector<8 x f32>) -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @dma_mixed_loop_blocks() { %c0 = arith.constant 0 : index %A = memref.alloc() : memref<256 x 256 x vector<8 x f32>> affine.for %i = 0 to 256 { %v = affine.load %A[%c0, %c0] : memref<256 x 256 x vector<8 x f32>> ""foo""(%v) : (vector<8 x f32>) -> () affine.for %j = 0 to 256 { %w = affine.load %A[%i, %j] : memref<256 x 256 x vector<8 x f32>> ""bar""(%w) : (vector<8 x f32>) -> () } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @relative_loop_bounds(%arg0: memref<1027xf32>) { affine.for %i0 = 0 to 1024 { affine.for %i2 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 4)>(%i0) { %0 = arith.constant 0.0 : f32 affine.store %0, %arg0[%i2] : memref<1027xf32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @relative_loop_bounds(%arg0: memref<1027xf32>) { affine.for %i0 = 0 to 1024 { affine.for %i2 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 4)>(%i0) { %0 = arith.constant 0.0 : f32 affine.store %0, %arg0[%i2] : memref<1027xf32> } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @test_read_write_region_union() { %0 = memref.alloc() : memref<256xf32> affine.for %i0 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0 + 100)>(%i0) %a1 = affine.apply affine_map<(d0) -> (d0 + 25)>(%i0) %1 = affine.load %0[%a0] : memref<256xf32> affine.store %1, %0[%a1] : memref<256xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @test_read_write_region_union() { %0 = memref.alloc() : memref<256xf32> affine.for %i0 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0 + 100)>(%i0) %a1 = affine.apply affine_map<(d0) -> (d0 + 25)>(%i0) %1 = affine.load %0[%a0] : memref<256xf32> affine.store %1, %0[%a1] : memref<256xf32> } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "#map_lb = affine_map<(d0) -> (d0)> #map_ub = affine_map<(d0) -> (d0 + 3)> #map_acc = affine_map<(d0) -> (d0 floordiv 8)> func.func @test_analysis_util(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<2xf32>) -> (memref<144x9xf32>, memref<2xf32>) { %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<64x1xf32> %1 = memref.alloc() : memref<144x4xf32> %2 = arith.constant 0.0 : f32 affine.for %i8 = 0 to 9 step 3 { affine.for %i9 = #map_lb(%i8) to #map_ub(%i8) { affine.for %i17 = 0 to 64 { %23 = affine.apply #map_acc(%i9) %25 = affine.load %arg2[%23] : memref<2xf32> %26 = affine.apply #map_lb(%i17) %27 = affine.load %0[%26, %c0] : memref<64x1xf32> affine.store %27, %arg2[%23] : memref<2xf32> } } } return %arg1, %arg2 : memref<144x9xf32>, memref<2xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "#map_lb = affine_map<(d0) -> (d0)> #map_ub = affine_map<(d0) -> (d0 + 3)> #map_acc = affine_map<(d0) -> (d0 floordiv 8)> func.func @test_analysis_util(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<2xf32>) -> (memref<144x9xf32>, memref<2xf32>) { %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<64x1xf32> %1 = memref.alloc() : memref<144x4xf32> %2 = arith.constant 0.0 : f32 affine.for %i8 = 0 to 9 step 3 { affine.for %i9 = #map_lb(%i8) to #map_ub(%i8) { affine.for %i17 = 0 to 64 { %23 = affine.apply #map_acc(%i9) %25 = affine.load %arg2[%23] : memref<2xf32> %26 = affine.apply #map_lb(%i17) %27 = affine.load %0[%26, %c0] : memref<64x1xf32> affine.store %27, %arg2[%23] : memref<2xf32> } } } return %arg1, %arg2 : memref<144x9xf32>, memref<2xf32> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "#map3 = affine_map<(d0) -> (d0)> #map12 = affine_map<(d0) -> (d0 + 3)> #map14 = affine_map<(d0, d1) -> ((d0 + d1 * 72) floordiv 2304 + ((((d0 + d1 * 72) mod 2304) mod 1152) mod 9) floordiv 3)> #map15 = affine_map<(d0, d1) -> ((d0 + d1 * 72) mod 2304 - (((d0 + d1 * 72) mod 2304) floordiv 1152) * 1151 - ((((d0 + d1 * 72) mod 2304) mod 1152) floordiv 9) * 9 - (((((d0 + d1 * 72) mod 2304) mod 1152) mod 9) floordiv 3) * 3)> #map16 = affine_map<(d0, d1) -> (((((d0 + d1 * 72) mod 2304) mod 1152) floordiv 9) floordiv 8)> func.func @test_memref_bounds(%arg0: memref<4x4x16x1xvector<8x128xf32>>, %arg1: memref<144x9xvector<8x128xf32>>, %arg2: memref<2xvector<8x128xf32>>) -> (memref<144x9xvector<8x128xf32>>, memref<2xvector<8x128xf32>>) { %c0 = arith.constant 0 : index affine.for %i8 = 0 to 9 step 3 { affine.for %i9 = #map3(%i8) to #map12(%i8) { affine.for %i10 = 0 to 64 { %10 = affine.apply #map14(%i9, %i10) %11 = affine.apply #map15(%i9, %i10) %12 = affine.apply #map16(%i9, %i10) %13 = affine.load %arg0[%10, %11, %12, %c0] : memref<4x4x16x1xvector<8x128xf32>> } } } return %arg1, %arg2 : memref<144x9xvector<8x128xf32>>, memref<2xvector<8x128xf32>> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "#map3 = affine_map<(d0) -> (d0)> #map12 = affine_map<(d0) -> (d0 + 3)> #map14 = affine_map<(d0, d1) -> ((d0 + d1 * 72) floordiv 2304 + ((((d0 + d1 * 72) mod 2304) mod 1152) mod 9) floordiv 3)> #map15 = affine_map<(d0, d1) -> ((d0 + d1 * 72) mod 2304 - (((d0 + d1 * 72) mod 2304) floordiv 1152) * 1151 - ((((d0 + d1 * 72) mod 2304) mod 1152) floordiv 9) * 9 - (((((d0 + d1 * 72) mod 2304) mod 1152) mod 9) floordiv 3) * 3)> #map16 = affine_map<(d0, d1) -> (((((d0 + d1 * 72) mod 2304) mod 1152) floordiv 9) floordiv 8)> func.func @test_memref_bounds(%arg0: memref<4x4x16x1xvector<8x128xf32>>, %arg1: memref<144x9xvector<8x128xf32>>, %arg2: memref<2xvector<8x128xf32>>) -> (memref<144x9xvector<8x128xf32>>, memref<2xvector<8x128xf32>>) { %c0 = arith.constant 0 : index affine.for %i8 = 0 to 9 step 3 { affine.for %i9 = #map3(%i8) to #map12(%i8) { affine.for %i10 = 0 to 64 { %10 = affine.apply #map14(%i9, %i10) %11 = affine.apply #map15(%i9, %i10) %12 = affine.apply #map16(%i9, %i10) %13 = affine.load %arg0[%10, %11, %12, %c0] : memref<4x4x16x1xvector<8x128xf32>> } } } return %arg1, %arg2 : memref<144x9xvector<8x128xf32>>, memref<2xvector<8x128xf32>> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @load_store_same_memref(%arg0: memref<256x1024xf32>) { affine.for %i0 = 0 to 256 step 4 { affine.for %i1 = 0 to 1024 step 4 { affine.for %i2 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 4)>(%i0) { affine.for %i3 = affine_map<(d0) -> (d0)>(%i1) to affine_map<(d0) -> (d0 + 4)>(%i1) { %3 = affine.load %arg0[%i2, %i3] : memref<256x1024xf32> %4 = arith.mulf %3, %3 : f32 affine.store %4, %arg0[%i2, %i3] : memref<256x1024xf32> } } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "func.func @load_store_same_memref(%arg0: memref<256x1024xf32>) { affine.for %i0 = 0 to 256 step 4 { affine.for %i1 = 0 to 1024 step 4 { affine.for %i2 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 4)>(%i0) { affine.for %i3 = affine_map<(d0) -> (d0)>(%i1) to affine_map<(d0) -> (d0 + 4)>(%i1) { %3 = affine.load %arg0[%i2, %i3] : memref<256x1024xf32> %4 = arith.mulf %3, %3 : f32 affine.store %4, %arg0[%i2, %i3] : memref<256x1024xf32> } } } } return }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "#map0 = affine_map<(d0) -> (d0)> #map1 = affine_map<(d0) -> (d0 + 4)> func.func @simple_matmul(%arg0: memref<8x8xvector<64xf32>>, %arg1: memref<8x8xvector<64xf32>>, %arg2: memref<8x8xvector<64xf32>>) -> memref<8x8xvector<64xf32>> { affine.for %i = 0 to 8 step 4 { affine.for %j = 0 to 8 step 4 { affine.for %k = 0 to 8 step 4 { affine.for %ii = #map0(%i) to #map1(%i) { affine.for %jj = #map0(%j) to #map1(%j) { affine.for %kk = #map0(%k) to #map1(%k) { %5 = affine.load %arg0[%ii, %kk] : memref<8x8xvector<64xf32>> %6 = affine.load %arg1[%kk, %jj] : memref<8x8xvector<64xf32>> %7 = affine.load %arg2[%ii, %jj] : memref<8x8xvector<64xf32>> %8 = arith.mulf %5, %6 : vector<64xf32> %9 = arith.addf %7, %8 : vector<64xf32> affine.store %9, %arg2[%ii, %jj] : memref<8x8xvector<64xf32>> } } } } } } return %arg2 : memref<8x8xvector<64xf32>> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-space=2 skip-non-unit-stride-loops"" -verify-diagnostics ",1 "#map0 = affine_map<(d0) -> (d0)> #map1 = affine_map<(d0) -> (d0 + 4)> func.func @simple_matmul(%arg0: memref<8x8xvector<64xf32>>, %arg1: memref<8x8xvector<64xf32>>, %arg2: memref<8x8xvector<64xf32>>) -> memref<8x8xvector<64xf32>> { affine.for %i = 0 to 8 step 4 { affine.for %j = 0 to 8 step 4 { affine.for %k = 0 to 8 step 4 { affine.for %ii = #map0(%i) to #map1(%i) { affine.for %jj = #map0(%j) to #map1(%j) { affine.for %kk = #map0(%k) to #map1(%k) { %5 = affine.load %arg0[%ii, %kk] : memref<8x8xvector<64xf32>> %6 = affine.load %arg1[%kk, %jj] : memref<8x8xvector<64xf32>> %7 = affine.load %arg2[%ii, %jj] : memref<8x8xvector<64xf32>> %8 = arith.mulf %5, %6 : vector<64xf32> %9 = arith.addf %7, %8 : vector<64xf32> affine.store %9, %arg2[%ii, %jj] : memref<8x8xvector<64xf32>> } } } } } } return %arg2 : memref<8x8xvector<64xf32>> }"," mlir-opt -allow-unregistered-dialect -split-input-file -affine-data-copy-generate=""generate-dma fast-mem-capacity=16 fast-mem-space=2"" ",1 "func.func @reduce_window_max() { %cst = arith.constant 0.000000e+00 : f32 %0 = memref.alloc() : memref<1x8x8x64xf32> %1 = memref.alloc() : memref<1x18x18x64xf32> affine.for %arg0 = 0 to 1 { affine.for %arg1 = 0 to 8 { affine.for %arg2 = 0 to 8 { affine.for %arg3 = 0 to 64 { affine.store %cst, %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> } } } } affine.for %arg0 = 0 to 1 { affine.for %arg1 = 0 to 8 { affine.for %arg2 = 0 to 8 { affine.for %arg3 = 0 to 64 { affine.for %arg4 = 0 to 1 { affine.for %arg5 = 0 to 3 { affine.for %arg6 = 0 to 3 { affine.for %arg7 = 0 to 1 { %2 = affine.load %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> %3 = affine.load %1[%arg0 + %arg4, %arg1 * 2 + %arg5, %arg2 * 2 + %arg6, %arg3 + %arg7] : memref<1x18x18x64xf32> %4 = arith.cmpf ogt, %2, %3 : f32 %5 = arith.select %4, %2, %3 : f32 affine.store %5, %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> } } } } } } } } return } func.func @loop_nest_3d_outer_two_parallel(%N : index) { %0 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> %1 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> %2 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> affine.for %i = 0 to %N { affine.for %j = 0 to %N { %7 = affine.load %2[%i, %j] : memref<1024x1024xvector<64xf32>> affine.for %k = 0 to %N { %5 = affine.load %0[%i, %k] : memref<1024x1024xvector<64xf32>> %6 = affine.load %1[%k, %j] : memref<1024x1024xvector<64xf32>> %8 = arith.mulf %5, %6 : vector<64xf32> %9 = arith.addf %7, %8 : vector<64xf32> affine.store %9, %2[%i, %j] : memref<1024x1024xvector<64xf32>> } } } return } func.func @unknown_op_conservative() { affine.for %i = 0 to 10 { ""unknown""() : () -> () } return } func.func @non_affine_load() { %0 = memref.alloc() : memref<100 x f32> affine.for %i = 0 to 100 { memref.load %0[%i] : memref<100 x f32> } return } func.func @for_with_minmax(%m: memref, %lb0: index, %lb1: index, %ub0: index, %ub1: index) { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %lb1) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } return } func.func @nested_for_with_minmax(%m: memref, %lb0: index, %ub0: index, %ub1: index) { affine.for %j = 0 to 10 { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %j) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } } return } func.func @max_nested(%m: memref, %lb0: index, %lb1: index, %ub0: index, %ub1: index) { affine.for %i = affine_map<(d0) -> (d0)>(%lb0) to affine_map<(d0) -> (d0)>(%ub0) { affine.for %j = affine_map<(d0) -> (d0)>(%lb1) to affine_map<(d0) -> (d0)>(%ub1) { affine.load %m[%i, %j] : memref } } return } func.func @max_nested_1(%arg0: memref<4096x4096xf32>, %arg1: memref<4096x4096xf32>, %arg2: memref<4096x4096xf32>) { %0 = memref.alloc() : memref<4096x4096xf32> affine.for %arg3 = 0 to 4096 { affine.for %arg4 = 0 to 4096 { affine.for %arg5 = 0 to 4096 { %1 = affine.load %arg0[%arg3, %arg5] : memref<4096x4096xf32> %2 = affine.load %arg1[%arg5, %arg4] : memref<4096x4096xf32> %3 = affine.load %0[%arg3, %arg4] : memref<4096x4096xf32> %4 = arith.mulf %1, %2 : f32 %5 = arith.addf %3, %4 : f32 affine.store %5, %0[%arg3, %arg4] : memref<4096x4096xf32> } } } return } func.func @iter_args(%in: memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 %final_red = affine.for %i = 0 to 10 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i] : memref<10xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } return } func.func @nested_iter_args(%in: memref<20x10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 20 { %final_red = affine.for %j = 0 to 10 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<20x10xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } } return } func.func @strange_butterfly() { %cst1 = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1, %it2 = %cst2) -> (f32, f32) { %0 = arith.addf %it1, %it2 : f32 affine.yield %0, %0 : f32, f32 } return } func.func @repeated_use() { %cst1 = arith.constant 0.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1) -> (f32) { %0 = arith.addf %it1, %it1 : f32 affine.yield %0 : f32 } return } func.func @use_in_backward_slice() { %cst1 = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1, %it2 = %cst2) -> (f32, f32) { %0 = ""test.some_modification""(%it2) : (f32) -> f32 %1 = arith.addf %it1, %0 : f32 affine.yield %1, %1 : f32, f32 } return } func.func @nested_min_max(%m: memref, %lb0: index, %ub0: index, %ub1: index) { affine.for %j = 0 to 10 { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %j) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } } return } func.func @local_alloc() { %cst = arith.constant 0.0 : f32 affine.for %i = 0 to 100 { %m = memref.alloc() : memref<1xf32> %ma = memref.alloca() : memref<1xf32> affine.store %cst, %m[0] : memref<1xf32> } return } func.func @local_alloc_cast() { %cst = arith.constant 0.0 : f32 affine.for %i = 0 to 100 { %m = memref.alloc() : memref<128xf32> affine.for %j = 0 to 128 { affine.store %cst, %m[%j] : memref<128xf32> } affine.for %j = 0 to 128 { affine.store %cst, %m[0] : memref<128xf32> } %r = memref.reinterpret_cast %m to offset: [0], sizes: [8, 16], strides: [16, 1] : memref<128xf32> to memref<8x16xf32> affine.for %j = 0 to 8 { affine.store %cst, %r[%j, %j] : memref<8x16xf32> } } return } func.func @iter_arg_memrefs(%in: memref<10xf32>) { %mi = memref.alloc() : memref %mo = affine.for %i = 0 to 10 iter_args(%m_arg = %mi) -> (memref) { affine.yield %m_arg : memref } return }", mlir-opt -allow-unregistered-dialect -affine-parallelize ,1 "func.func @reduce_window_max() { %cst = arith.constant 0.000000e+00 : f32 %0 = memref.alloc() : memref<1x8x8x64xf32> %1 = memref.alloc() : memref<1x18x18x64xf32> affine.for %arg0 = 0 to 1 { affine.for %arg1 = 0 to 8 { affine.for %arg2 = 0 to 8 { affine.for %arg3 = 0 to 64 { affine.store %cst, %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> } } } } affine.for %arg0 = 0 to 1 { affine.for %arg1 = 0 to 8 { affine.for %arg2 = 0 to 8 { affine.for %arg3 = 0 to 64 { affine.for %arg4 = 0 to 1 { affine.for %arg5 = 0 to 3 { affine.for %arg6 = 0 to 3 { affine.for %arg7 = 0 to 1 { %2 = affine.load %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> %3 = affine.load %1[%arg0 + %arg4, %arg1 * 2 + %arg5, %arg2 * 2 + %arg6, %arg3 + %arg7] : memref<1x18x18x64xf32> %4 = arith.cmpf ogt, %2, %3 : f32 %5 = arith.select %4, %2, %3 : f32 affine.store %5, %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> } } } } } } } } return } func.func @loop_nest_3d_outer_two_parallel(%N : index) { %0 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> %1 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> %2 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> affine.for %i = 0 to %N { affine.for %j = 0 to %N { %7 = affine.load %2[%i, %j] : memref<1024x1024xvector<64xf32>> affine.for %k = 0 to %N { %5 = affine.load %0[%i, %k] : memref<1024x1024xvector<64xf32>> %6 = affine.load %1[%k, %j] : memref<1024x1024xvector<64xf32>> %8 = arith.mulf %5, %6 : vector<64xf32> %9 = arith.addf %7, %8 : vector<64xf32> affine.store %9, %2[%i, %j] : memref<1024x1024xvector<64xf32>> } } } return } func.func @unknown_op_conservative() { affine.for %i = 0 to 10 { ""unknown""() : () -> () } return } func.func @non_affine_load() { %0 = memref.alloc() : memref<100 x f32> affine.for %i = 0 to 100 { memref.load %0[%i] : memref<100 x f32> } return } func.func @for_with_minmax(%m: memref, %lb0: index, %lb1: index, %ub0: index, %ub1: index) { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %lb1) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } return } func.func @nested_for_with_minmax(%m: memref, %lb0: index, %ub0: index, %ub1: index) { affine.for %j = 0 to 10 { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %j) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } } return } func.func @max_nested(%m: memref, %lb0: index, %lb1: index, %ub0: index, %ub1: index) { affine.for %i = affine_map<(d0) -> (d0)>(%lb0) to affine_map<(d0) -> (d0)>(%ub0) { affine.for %j = affine_map<(d0) -> (d0)>(%lb1) to affine_map<(d0) -> (d0)>(%ub1) { affine.load %m[%i, %j] : memref } } return } func.func @max_nested_1(%arg0: memref<4096x4096xf32>, %arg1: memref<4096x4096xf32>, %arg2: memref<4096x4096xf32>) { %0 = memref.alloc() : memref<4096x4096xf32> affine.for %arg3 = 0 to 4096 { affine.for %arg4 = 0 to 4096 { affine.for %arg5 = 0 to 4096 { %1 = affine.load %arg0[%arg3, %arg5] : memref<4096x4096xf32> %2 = affine.load %arg1[%arg5, %arg4] : memref<4096x4096xf32> %3 = affine.load %0[%arg3, %arg4] : memref<4096x4096xf32> %4 = arith.mulf %1, %2 : f32 %5 = arith.addf %3, %4 : f32 affine.store %5, %0[%arg3, %arg4] : memref<4096x4096xf32> } } } return } func.func @iter_args(%in: memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 %final_red = affine.for %i = 0 to 10 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i] : memref<10xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } return } func.func @nested_iter_args(%in: memref<20x10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 20 { %final_red = affine.for %j = 0 to 10 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<20x10xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } } return } func.func @strange_butterfly() { %cst1 = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1, %it2 = %cst2) -> (f32, f32) { %0 = arith.addf %it1, %it2 : f32 affine.yield %0, %0 : f32, f32 } return } func.func @repeated_use() { %cst1 = arith.constant 0.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1) -> (f32) { %0 = arith.addf %it1, %it1 : f32 affine.yield %0 : f32 } return } func.func @use_in_backward_slice() { %cst1 = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1, %it2 = %cst2) -> (f32, f32) { %0 = ""test.some_modification""(%it2) : (f32) -> f32 %1 = arith.addf %it1, %0 : f32 affine.yield %1, %1 : f32, f32 } return } func.func @nested_min_max(%m: memref, %lb0: index, %ub0: index, %ub1: index) { affine.for %j = 0 to 10 { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %j) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } } return } func.func @local_alloc() { %cst = arith.constant 0.0 : f32 affine.for %i = 0 to 100 { %m = memref.alloc() : memref<1xf32> %ma = memref.alloca() : memref<1xf32> affine.store %cst, %m[0] : memref<1xf32> } return } func.func @local_alloc_cast() { %cst = arith.constant 0.0 : f32 affine.for %i = 0 to 100 { %m = memref.alloc() : memref<128xf32> affine.for %j = 0 to 128 { affine.store %cst, %m[%j] : memref<128xf32> } affine.for %j = 0 to 128 { affine.store %cst, %m[0] : memref<128xf32> } %r = memref.reinterpret_cast %m to offset: [0], sizes: [8, 16], strides: [16, 1] : memref<128xf32> to memref<8x16xf32> affine.for %j = 0 to 8 { affine.store %cst, %r[%j, %j] : memref<8x16xf32> } } return } func.func @iter_arg_memrefs(%in: memref<10xf32>) { %mi = memref.alloc() : memref %mo = affine.for %i = 0 to 10 iter_args(%m_arg = %mi) -> (memref) { affine.yield %m_arg : memref } return }", mlir-opt -allow-unregistered-dialect -affine-parallelize='max-nested=1' ,1 "func.func @reduce_window_max() { %cst = arith.constant 0.000000e+00 : f32 %0 = memref.alloc() : memref<1x8x8x64xf32> %1 = memref.alloc() : memref<1x18x18x64xf32> affine.for %arg0 = 0 to 1 { affine.for %arg1 = 0 to 8 { affine.for %arg2 = 0 to 8 { affine.for %arg3 = 0 to 64 { affine.store %cst, %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> } } } } affine.for %arg0 = 0 to 1 { affine.for %arg1 = 0 to 8 { affine.for %arg2 = 0 to 8 { affine.for %arg3 = 0 to 64 { affine.for %arg4 = 0 to 1 { affine.for %arg5 = 0 to 3 { affine.for %arg6 = 0 to 3 { affine.for %arg7 = 0 to 1 { %2 = affine.load %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> %3 = affine.load %1[%arg0 + %arg4, %arg1 * 2 + %arg5, %arg2 * 2 + %arg6, %arg3 + %arg7] : memref<1x18x18x64xf32> %4 = arith.cmpf ogt, %2, %3 : f32 %5 = arith.select %4, %2, %3 : f32 affine.store %5, %0[%arg0, %arg1, %arg2, %arg3] : memref<1x8x8x64xf32> } } } } } } } } return } func.func @loop_nest_3d_outer_two_parallel(%N : index) { %0 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> %1 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> %2 = memref.alloc() : memref<1024 x 1024 x vector<64xf32>> affine.for %i = 0 to %N { affine.for %j = 0 to %N { %7 = affine.load %2[%i, %j] : memref<1024x1024xvector<64xf32>> affine.for %k = 0 to %N { %5 = affine.load %0[%i, %k] : memref<1024x1024xvector<64xf32>> %6 = affine.load %1[%k, %j] : memref<1024x1024xvector<64xf32>> %8 = arith.mulf %5, %6 : vector<64xf32> %9 = arith.addf %7, %8 : vector<64xf32> affine.store %9, %2[%i, %j] : memref<1024x1024xvector<64xf32>> } } } return } func.func @unknown_op_conservative() { affine.for %i = 0 to 10 { ""unknown""() : () -> () } return } func.func @non_affine_load() { %0 = memref.alloc() : memref<100 x f32> affine.for %i = 0 to 100 { memref.load %0[%i] : memref<100 x f32> } return } func.func @for_with_minmax(%m: memref, %lb0: index, %lb1: index, %ub0: index, %ub1: index) { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %lb1) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } return } func.func @nested_for_with_minmax(%m: memref, %lb0: index, %ub0: index, %ub1: index) { affine.for %j = 0 to 10 { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %j) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } } return } func.func @max_nested(%m: memref, %lb0: index, %lb1: index, %ub0: index, %ub1: index) { affine.for %i = affine_map<(d0) -> (d0)>(%lb0) to affine_map<(d0) -> (d0)>(%ub0) { affine.for %j = affine_map<(d0) -> (d0)>(%lb1) to affine_map<(d0) -> (d0)>(%ub1) { affine.load %m[%i, %j] : memref } } return } func.func @max_nested_1(%arg0: memref<4096x4096xf32>, %arg1: memref<4096x4096xf32>, %arg2: memref<4096x4096xf32>) { %0 = memref.alloc() : memref<4096x4096xf32> affine.for %arg3 = 0 to 4096 { affine.for %arg4 = 0 to 4096 { affine.for %arg5 = 0 to 4096 { %1 = affine.load %arg0[%arg3, %arg5] : memref<4096x4096xf32> %2 = affine.load %arg1[%arg5, %arg4] : memref<4096x4096xf32> %3 = affine.load %0[%arg3, %arg4] : memref<4096x4096xf32> %4 = arith.mulf %1, %2 : f32 %5 = arith.addf %3, %4 : f32 affine.store %5, %0[%arg3, %arg4] : memref<4096x4096xf32> } } } return } func.func @iter_args(%in: memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 %final_red = affine.for %i = 0 to 10 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i] : memref<10xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } return } func.func @nested_iter_args(%in: memref<20x10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 20 { %final_red = affine.for %j = 0 to 10 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<20x10xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } } return } func.func @strange_butterfly() { %cst1 = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1, %it2 = %cst2) -> (f32, f32) { %0 = arith.addf %it1, %it2 : f32 affine.yield %0, %0 : f32, f32 } return } func.func @repeated_use() { %cst1 = arith.constant 0.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1) -> (f32) { %0 = arith.addf %it1, %it1 : f32 affine.yield %0 : f32 } return } func.func @use_in_backward_slice() { %cst1 = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 affine.for %i = 0 to 10 iter_args(%it1 = %cst1, %it2 = %cst2) -> (f32, f32) { %0 = ""test.some_modification""(%it2) : (f32) -> f32 %1 = arith.addf %it1, %0 : f32 affine.yield %1, %1 : f32, f32 } return } func.func @nested_min_max(%m: memref, %lb0: index, %ub0: index, %ub1: index) { affine.for %j = 0 to 10 { affine.for %i = max affine_map<(d0, d1) -> (d0, d1)>(%lb0, %j) to min affine_map<(d0, d1) -> (d0, d1)>(%ub0, %ub1) { affine.load %m[%i] : memref } } return } func.func @local_alloc() { %cst = arith.constant 0.0 : f32 affine.for %i = 0 to 100 { %m = memref.alloc() : memref<1xf32> %ma = memref.alloca() : memref<1xf32> affine.store %cst, %m[0] : memref<1xf32> } return } func.func @local_alloc_cast() { %cst = arith.constant 0.0 : f32 affine.for %i = 0 to 100 { %m = memref.alloc() : memref<128xf32> affine.for %j = 0 to 128 { affine.store %cst, %m[%j] : memref<128xf32> } affine.for %j = 0 to 128 { affine.store %cst, %m[0] : memref<128xf32> } %r = memref.reinterpret_cast %m to offset: [0], sizes: [8, 16], strides: [16, 1] : memref<128xf32> to memref<8x16xf32> affine.for %j = 0 to 8 { affine.store %cst, %r[%j, %j] : memref<8x16xf32> } } return } func.func @iter_arg_memrefs(%in: memref<10xf32>) { %mi = memref.alloc() : memref %mo = affine.for %i = 0 to 10 iter_args(%m_arg = %mi) -> (memref) { affine.yield %m_arg : memref } return }", mlir-opt -allow-unregistered-dialect -affine-parallelize='parallel-reductions=1' ,1 "func.func @normalize_parallel() { %cst = arith.constant 1.0 : f32 %0 = memref.alloc() : memref<2x4xf32> affine.parallel (%i, %j) = (0, 1) to (10, 5) step (3, 2) { affine.parallel (%k) = (%i) to (%j) { affine.store %cst, %0[%i, %k] : memref<2x4xf32> } } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @normalize_parallel() { %cst = arith.constant 1.0 : f32 %0 = memref.alloc() : memref<2x4xf32> affine.parallel (%i, %j) = (0, 1) to (10, 5) step (3, 2) { affine.parallel (%k) = (%i) to (%j) { affine.store %cst, %0[%i, %k] : memref<2x4xf32> } } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @relative_bounds(%arg: index) { affine.for %i = affine_map<(d0) -> (d0)>(%arg) to affine_map<(d0) -> (d0 + 4)>(%arg) { } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @relative_bounds(%arg: index) { affine.for %i = affine_map<(d0) -> (d0)>(%arg) to affine_map<(d0) -> (d0 + 4)>(%arg) { } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @promote_single_iter_loop(%in: memref<1xf32>, %out: memref<1xf32>) { affine.for %i = 0 to 1 { %1 = affine.load %in[%i] : memref<1xf32> affine.store %1, %out[%i] : memref<1xf32> } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @promote_single_iter_loop(%in: memref<1xf32>, %out: memref<1xf32>) { affine.for %i = 0 to 1 { %1 = affine.load %in[%i] : memref<1xf32> affine.store %1, %out[%i] : memref<1xf32> } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @simple_loop_nest(){ affine.for %i0 = 2 to 32 step 2 { affine.for %i1 = 0 to 32 step 3 { ""test.foo""(%i0, %i1) : (index, index) -> () } } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @simple_loop_nest(){ affine.for %i0 = 2 to 32 step 2 { affine.for %i1 = 0 to 32 step 3 { ""test.foo""(%i0, %i1) : (index, index) -> () } } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @loop_with_unknown_upper_bound(%arg0: memref, %arg1: index) { %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 2 to %0 step 32 { affine.for %i1 = 0 to %arg1 step 2 { ""test.foo""(%i0, %i1) : (index, index) -> () } } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @loop_with_unknown_upper_bound(%arg0: memref, %arg1: index) { %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 2 to %0 step 32 { affine.for %i1 = 0 to %arg1 step 2 { ""test.foo""(%i0, %i1) : (index, index) -> () } } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @loop_with_multiple_upper_bounds(%arg0: memref, %arg1 : index) { %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 2 to %0 step 32{ affine.for %i1 = 2 to min affine_map<(d0)[] -> (d0, 512)>(%arg1) { ""test.foo""(%i0, %i1) : (index, index) -> () } } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @loop_with_multiple_upper_bounds(%arg0: memref, %arg1 : index) { %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 2 to %0 step 32{ affine.for %i1 = 2 to min affine_map<(d0)[] -> (d0, 512)>(%arg1) { ""test.foo""(%i0, %i1) : (index, index) -> () } } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0) -> (d0)> #map2 = affine_map<(d0)[s0] -> (d0 + 32, s0)> #map3 = affine_map<() -> (0)> #map4 = affine_map<()[s0] -> (s0)> func.func @tiled_matmul(%0: memref<1024x1024xf32>, %1: memref<1024x1024xf32>, %2: memref<1024x1024xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %3 = memref.dim %0, %c0 : memref<1024x1024xf32> %4 = memref.dim %1, %c1 : memref<1024x1024xf32> %5 = memref.dim %0, %c1 : memref<1024x1024xf32> affine.for %arg0 = 0 to %3 step 32 { affine.for %arg1 = 0 to %4 step 32 { affine.for %arg2 = 0 to %5 step 32 { affine.for %arg3 = #map1(%arg0) to min #map2(%arg0)[%3] { affine.for %arg4 = #map1(%arg1) to min #map2(%arg1)[%4] { affine.for %arg5 = #map1(%arg2) to min #map2(%arg2)[%5] { %6 = affine.load %0[%arg3, %arg5] : memref<1024x1024xf32> %7 = affine.load %1[%arg5, %arg4] : memref<1024x1024xf32> %8 = affine.load %2[%arg3, %arg4] : memref<1024x1024xf32> %9 = arith.mulf %6, %7 : f32 %10 = arith.addf %8, %9 : f32 affine.store %10, %2[%arg3, %arg4] : memref<1024x1024xf32> } } } } } } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0) -> (d0)> #map2 = affine_map<(d0)[s0] -> (d0 + 32, s0)> #map3 = affine_map<() -> (0)> #map4 = affine_map<()[s0] -> (s0)> func.func @tiled_matmul(%0: memref<1024x1024xf32>, %1: memref<1024x1024xf32>, %2: memref<1024x1024xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %3 = memref.dim %0, %c0 : memref<1024x1024xf32> %4 = memref.dim %1, %c1 : memref<1024x1024xf32> %5 = memref.dim %0, %c1 : memref<1024x1024xf32> affine.for %arg0 = 0 to %3 step 32 { affine.for %arg1 = 0 to %4 step 32 { affine.for %arg2 = 0 to %5 step 32 { affine.for %arg3 = #map1(%arg0) to min #map2(%arg0)[%3] { affine.for %arg4 = #map1(%arg1) to min #map2(%arg1)[%4] { affine.for %arg5 = #map1(%arg2) to min #map2(%arg2)[%5] { %6 = affine.load %0[%arg3, %arg5] : memref<1024x1024xf32> %7 = affine.load %1[%arg5, %arg4] : memref<1024x1024xf32> %8 = affine.load %2[%arg3, %arg4] : memref<1024x1024xf32> %9 = arith.mulf %6, %7 : f32 %10 = arith.addf %8, %9 : f32 affine.store %10, %2[%arg3, %arg4] : memref<1024x1024xf32> } } } } } } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @constant_lower_bound() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.for %j = %c0 to %c1 step %c1 { affine.for %i = %c0 to %c1 { } } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @constant_lower_bound() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.for %j = %c0 to %c1 step %c1 { affine.for %i = %c0 to %c1 { } } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @upper_bound_by_symbol(%arg0: index, %arg1: index) { affine.for %i = 0 to affine_map<()[s0, s1] -> (s0)>()[%arg0, %arg1] step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @upper_bound_by_symbol(%arg0: index, %arg1: index) { affine.for %i = 0 to affine_map<()[s0, s1] -> (s0)>()[%arg0, %arg1] step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @lower_bound_by_symbol(%arg0: index, %arg1: index) { affine.for %i = affine_map<()[s0, s1] -> (s0)>()[%arg0, %arg1] to 10 step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @lower_bound_by_symbol(%arg0: index, %arg1: index) { affine.for %i = affine_map<()[s0, s1] -> (s0)>()[%arg0, %arg1] to 10 step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @upper_bound_by_dim(%arg0: index, %arg1: index) { affine.for %i = 0 to affine_map<(d0, d1) -> (d0)>(%arg0, %arg1) step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @upper_bound_by_dim(%arg0: index, %arg1: index) { affine.for %i = 0 to affine_map<(d0, d1) -> (d0)>(%arg0, %arg1) step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @upper_bound_by_dim(%arg0: index, %arg1: index) { affine.for %i = affine_map<(d0, d1) -> (d0)>(%arg0, %arg1) to 10 step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize -split-input-file ,1 "func.func @upper_bound_by_dim(%arg0: index, %arg1: index) { affine.for %i = affine_map<(d0, d1) -> (d0)>(%arg0, %arg1) to 10 step 4 { ""test.foo""(%i) : (index) -> () } return }", mlir-opt -affine-loop-normalize='promote-single-iter=1' -split-input-file ,1 "func.func @one_3d_nest() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c42 = arith.constant 42 : index %c56 = arith.constant 56 : index scf.for %i = %c0 to %c42 step %c1 { scf.for %j = %c0 to %c56 step %c1 { scf.for %k = %c0 to %c3 step %c1 { ""use""(%i, %j, %k) : (index, index, index) -> () } } } return } func.func @multi_use() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c1 to %c10 step %c1 { scf.for %j = %c1 to %c10 step %c1 { scf.for %k = %c1 to %c10 step %c1 { ""use1""(%i,%j,%k) : (index,index,index) -> () ""use2""(%i,%k,%j) : (index,index,index) -> () ""use3""(%k,%j,%i) : (index,index,index) -> () } } } return } func.func @unnormalized_loops() { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c5 = arith.constant 5 : index %c7 = arith.constant 7 : index %c10 = arith.constant 10 : index %c17 = arith.constant 17 : index scf.for %i = %c5 to %c10 step %c2 { scf.for %j = %c7 to %c17 step %c3 { ""use""(%i, %j) : (index, index) -> () } } return } func.func @parametric(%lb1 : index, %ub1 : index, %step1 : index, %lb2 : index, %ub2 : index, %step2 : index) { scf.for %i = %lb1 to %ub1 step %step1 { scf.for %j = %lb2 to %ub2 step %step2 { ""foo""(%i, %j) : (index, index) -> () } } return } func.func @two_bands() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c0 to %c10 step %c1 { scf.for %j = %c0 to %c10 step %c1 { scf.for %k = %i to %j step %c1 { scf.for %l = %i to %j step %c1 { ""foo""() : () -> () } } } } return }", mlir-opt -split-input-file -allow-unregistered-dialect -affine-loop-coalescing ,1 "func.func @coalesce_affine_for() { affine.for %i = 0 to 16 { affine.for %j = 0 to 64 { affine.for %k = 0 to 8 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -allow-unregistered-dialect -affine-loop-coalescing ,1 "func.func @coalesce_affine_for(%arg0: memref) { %c0 = arith.constant 0 : index %M = memref.dim %arg0, %c0 : memref %N = memref.dim %arg0, %c0 : memref %K = memref.dim %arg0, %c0 : memref affine.for %i = 0 to %M { affine.for %j = 0 to %N { affine.for %k = 0 to %K { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -allow-unregistered-dialect -affine-loop-coalescing ,1 "func.func @coalesce_affine_for(%arg0: memref) { %c0 = arith.constant 0 : index %M = memref.dim %arg0, %c0 : memref %N = memref.dim %arg0, %c0 : memref affine.for %i = 0 to %M { affine.for %j = 0 to %N { affine.for %k = 0 to 64 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -allow-unregistered-dialect -affine-loop-coalescing ,1 "#myMap = affine_map<()[s1] -> (s1, -s1)> func.func @coalesce_affine_for(%arg0: memref) { %c0 = arith.constant 0 : index %M = memref.dim %arg0, %c0 : memref %N = memref.dim %arg0, %c0 : memref %K = memref.dim %arg0, %c0 : memref affine.for %i = 0 to min #myMap()[%M] { affine.for %j = 0 to %N { affine.for %k = 0 to %K { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -allow-unregistered-dialect -affine-loop-coalescing ,1 "#map0 = affine_map<(d0) -> (d0 * 110)> #map1 = affine_map<(d0) -> (696, d0 * 110 + 110)> func.func @test_loops_do_not_get_coalesced() { affine.for %i = 0 to 7 { affine.for %j = #map0(%i) to min #map1(%i) { } } return }", mlir-opt -split-input-file -allow-unregistered-dialect -affine-loop-coalescing ,1 "func.func @f(%0: index) { %1 = memref.alloc() : memref<3x4x5xf32> %2 = memref.alloc(%0) : memref<3x4x?xf32> %3 = memref.alloc(%0) : memref<3x?x5xf32> %4 = memref.alloc(%0) : memref %5 = memref.alloc(%0, %0) : memref %6 = memref.alloc(%0, %0, %0) : memref %11 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i, j, k)>> %b11 = memref.alloc() : memref<3x4x5xf32, strided<[20, 5, 1], offset: 0>> %12 = memref.alloc(%0) : memref<3x4x?xf32, affine_map<(i, j, k)->(i, j, k)>> %13 = memref.alloc(%0) : memref<3x?x5xf32, affine_map<(i, j, k)->(i, j, k)>> %14 = memref.alloc(%0) : memref(i, j, k)>> %15 = memref.alloc(%0, %0) : memref(i, j, k)>> %16 = memref.alloc(%0, %0, %0) : memref(i, j, k)>> %21 = memref.alloc()[%0] : memref<3x4x5xf32, affine_map<(i, j, k)[M]->(32 * i + 16 * j + M * k + 1)>> %22 = memref.alloc()[%0] : memref<3x4x5xf32, affine_map<(i, j, k)[M]->(32 * i + M * j + 16 * k + 3)>> %b22 = memref.alloc(%0)[%0, %0] : memref<3x4x?xf32, strided<[?, ?, 1], offset: 0>> %23 = memref.alloc(%0)[%0] : memref<3x?x5xf32, affine_map<(i, j, k)[M]->(M * i + 32 * j + 16 * k + 7)>> %b23 = memref.alloc(%0)[%0] : memref<3x?x5xf32, strided<[?, 5, 1], offset: 0>> %24 = memref.alloc(%0)[%0] : memref<3x?x5xf32, affine_map<(i, j, k)[M]->(M * i + 32 * j + 16 * k + M)>> %b24 = memref.alloc(%0)[%0, %0] : memref<3x?x5xf32, strided<[?, 32, 16], offset: ?>> %25 = memref.alloc(%0, %0)[%0, %0] : memref(M * i + N * j + k + 1)>> %b25 = memref.alloc(%0, %0)[%0, %0] : memref> %26 = memref.alloc(%0)[] : memref(i)>> %27 = memref.alloc()[%0] : memref<5xf32, affine_map<(i)[M]->(M)>> %28 = memref.alloc()[%0] : memref<5xf32, affine_map<(i)[M]->(123)>> %29 = memref.alloc()[%0] : memref(M)>> %30 = memref.alloc()[%0] : memref(123)>> %101 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i floordiv 4 + j + k)>> %102 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i ceildiv 4 + j + k)>> %103 = memref.alloc() : memref<3x4x5xf32, affine_map<(i, j, k)->(i mod 4 + j + k)>> %200 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * i + N * i + N * j + K * k - (M + N - 20)* i)>> %201 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * i + N * i + N * K * j + K * K * k - (M + N - 20) * (i + 1))>> %202 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M * (i + 1) + j + k - M)>> %203 = memref.alloc()[%0, %0, %0] : memref<3x4x5xf32, affine_map<(i, j, k)[M, N, K]->(M + M * (i + N * (j + K * k)))>> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-memref-stride-calculation))"" -o /dev/null ",1 "func.func @slicing_test() { %0 = memref.alloc() : memref<1xi32> %1 = ""slicing-test-op"" () : () -> i1 %2 = ""slicing-test-op"" () : () -> i2 %3 = ""slicing-test-op"" () : () -> i3 %4 = ""slicing-test-op"" () : () -> i4 %5 = ""slicing-test-op"" (%1, %2) : (i1, i2) -> i5 %6 = ""slicing-test-op"" (%3, %4) : (i3, i4) -> i6 %7 = ""slicing-test-op"" (%1, %5) : (i1, i5) -> i7 %8 = ""slicing-test-op"" (%5, %6) : (i5, i6) -> i8 %9 = ""slicing-test-op"" (%7, %8) : (i7, i8) -> i9 return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -forward-slicing=true 2>&1 ,1 "func.func @slicing_test() { %0 = memref.alloc() : memref<1xi32> %1 = ""slicing-test-op"" () : () -> i1 %2 = ""slicing-test-op"" () : () -> i2 %3 = ""slicing-test-op"" () : () -> i3 %4 = ""slicing-test-op"" () : () -> i4 %5 = ""slicing-test-op"" (%1, %2) : (i1, i2) -> i5 %6 = ""slicing-test-op"" (%3, %4) : (i3, i4) -> i6 %7 = ""slicing-test-op"" (%1, %5) : (i1, i5) -> i7 %8 = ""slicing-test-op"" (%5, %6) : (i5, i6) -> i8 %9 = ""slicing-test-op"" (%7, %8) : (i7, i8) -> i9 return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -backward-slicing=true 2>&1 ,1 "func.func @slicing_test() { %0 = memref.alloc() : memref<1xi32> %1 = ""slicing-test-op"" () : () -> i1 %2 = ""slicing-test-op"" () : () -> i2 %3 = ""slicing-test-op"" () : () -> i3 %4 = ""slicing-test-op"" () : () -> i4 %5 = ""slicing-test-op"" (%1, %2) : (i1, i2) -> i5 %6 = ""slicing-test-op"" (%3, %4) : (i3, i4) -> i6 %7 = ""slicing-test-op"" (%1, %5) : (i1, i5) -> i7 %8 = ""slicing-test-op"" (%5, %6) : (i5, i6) -> i8 %9 = ""slicing-test-op"" (%7, %8) : (i7, i8) -> i9 return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -slicing=true 2>&1 ,1 "func.func @slicing_test_2() { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c16 = arith.constant 16 : index affine.for %i0 = %c0 to %c16 { affine.for %i1 = affine_map<(i)[] -> (i)>(%i0) to 10 { %b = ""slicing-test-op""(%i1): (index) -> index %c = ""slicing-test-op""(%i0): (index) -> index } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -forward-slicing=true 2>&1 ,1 "func.func @slicing_test_2() { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c16 = arith.constant 16 : index affine.for %i0 = %c0 to %c16 { affine.for %i1 = affine_map<(i)[] -> (i)>(%i0) to 10 { %b = ""slicing-test-op""(%i1): (index) -> index %c = ""slicing-test-op""(%i0): (index) -> index } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -backward-slicing=true 2>&1 ,1 "func.func @slicing_test_2() { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c16 = arith.constant 16 : index affine.for %i0 = %c0 to %c16 { affine.for %i1 = affine_map<(i)[] -> (i)>(%i0) to 10 { %b = ""slicing-test-op""(%i1): (index) -> index %c = ""slicing-test-op""(%i0): (index) -> index } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -slicing=true 2>&1 ,1 "func.func @slicing_test_3() { %f = arith.constant 1.0 : f32 %c = ""slicing-test-op""(%f): (f32) -> index scf.for %i2 = %c to %c step %c { %d = ""slicing-test-op""(%c, %i2): (index, index) -> index } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -forward-slicing=true 2>&1 ,1 "func.func @slicing_test_3() { %f = arith.constant 1.0 : f32 %c = ""slicing-test-op""(%f): (f32) -> index scf.for %i2 = %c to %c step %c { %d = ""slicing-test-op""(%c, %i2): (index, index) -> index } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -backward-slicing=true 2>&1 ,1 "func.func @slicing_test_3() { %f = arith.constant 1.0 : f32 %c = ""slicing-test-op""(%f): (f32) -> index scf.for %i2 = %c to %c step %c { %d = ""slicing-test-op""(%c, %i2): (index, index) -> index } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -slicing=true 2>&1 ,1 "func.func @slicing_test_function_argument(%arg0: index) -> index { %0 = ""slicing-test-op""(%arg0, %arg0): (index, index) -> index return %0 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -forward-slicing=true 2>&1 ,1 "func.func @slicing_test_function_argument(%arg0: index) -> index { %0 = ""slicing-test-op""(%arg0, %arg0): (index, index) -> index return %0 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -backward-slicing=true 2>&1 ,1 "func.func @slicing_test_function_argument(%arg0: index) -> index { %0 = ""slicing-test-op""(%arg0, %arg0): (index, index) -> index return %0 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -slicing=true 2>&1 ,1 "func.func @slicing_test_multiple_return(%arg0: index) -> (index, index) { %0:2 = ""slicing-test-op""(%arg0, %arg0): (index, index) -> (index, index) return %0#0, %0#1 : index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -forward-slicing=true 2>&1 ,1 "func.func @slicing_test_multiple_return(%arg0: index) -> (index, index) { %0:2 = ""slicing-test-op""(%arg0, %arg0): (index, index) -> (index, index) return %0#0, %0#1 : index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -backward-slicing=true 2>&1 ,1 "func.func @slicing_test_multiple_return(%arg0: index) -> (index, index) { %0:2 = ""slicing-test-op""(%arg0, %arg0): (index, index) -> (index, index) return %0#0, %0#1 : index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-super-vectorizer-test -slicing=true 2>&1 ,1 "func.func @loop_nest_simplest() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = arith.constant 1 : i32 } } return } func.func @loop_nest_simple_iv_use() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_body_def_use() { affine.for %i = 0 to 100 step 2 { %c0 = arith.constant 0 : index affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %c0) : (index, index) -> index } } return } func.func @loop_nest_strided() { affine.for %i = 0 to 100 { affine.for %j = 2 to 6 step 2 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } affine.for %k = 2 to 7 step 2 { %z = ""affine.apply"" (%k) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %w = ""addi32""(%z, %z) : (index, index) -> index } } return } func.func @loop_nest_multiple_results() { affine.for %i = 0 to 100 { affine.for %j = 0 to 2 step 1 { %x = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %j) %y = ""addi32""(%x, %x) : (index, index) -> index %z = affine.apply affine_map<(d0, d1) -> (d0 + 3)> (%i, %j) %w:2 = ""fma""(%z, %x, %x) : (index, index, index) -> (index, index) } } return } func.func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { %c128 = arith.constant 128 : index affine.for %i = 0 to 100 { %ld = ""vld""(%i) : (index) -> i32 affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""vmulf""(%j, %x) : (index, index) -> index %z = ""vaddf""(%y, %y) : (index, index) -> index } %addr = ""scale""(%c128, %i) : (index, index) -> index ""vst""(%addr, %i) : (index, index) -> () } return } func.func @loop_nest_seq_multiple() { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) ""mul""(%x, %x) : (index, index) -> () } %k = arith.constant 99 : index affine.for %m = 0 to 100 step 2 { affine.for %n = 0 to 4 { %y = ""affine.apply"" (%n) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %z = ""affine.apply"" (%n, %k) { map = affine_map<(d0) [s0] -> (d0 + s0 + 1)> } : (index, index) -> (index) } } return } func.func @loop_nest_unroll_full() { affine.for %i = 0 to 1 { %x = ""foo""() : () -> i32 %y = ""bar""() : () -> i32 } return } func.func @loop_nest_outer_unroll() { affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } } return } func.func @loop_nest_seq_long() -> i32 { %A = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %B = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %C = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %zero = arith.constant 0 : i32 %one = arith.constant 1 : i32 %two = arith.constant 2 : i32 %zero_idx = arith.constant 0 : index affine.for %n0 = 0 to 512 { affine.for %n1 = 0 to 8 { memref.store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } affine.for %x = 0 to 2 { affine.for %y = 0 to 2 { affine.for %arg2 = 0 to 8 { %b2 = ""affine.apply"" (%y, %arg2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %z = memref.load %B[%x, %b2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op1""(%z) : (i32) -> () } affine.for %j1 = 0 to 8 { affine.for %j2 = 0 to 8 { %a2 = ""affine.apply"" (%y, %j2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %v203 = memref.load %A[%j1, %a2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op2""(%v203) : (i32) -> () } affine.for %k2 = 0 to 8 { %s0 = ""op3""() : () -> i32 %c2 = ""affine.apply"" (%x, %k2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %s1 = memref.load %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %s2 = ""addi32""(%s0, %s1) : (i32, i32) -> i32 memref.store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } ""op4""() : () -> () } } %ret = memref.load %C[%zero_idx, %zero_idx] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> return %ret : i32 } func.func @unroll_unit_stride_no_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 8 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } affine.for %k = 0 to 8 { } } return } func.func @unroll_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 10 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @unroll_non_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 2 to 48 step 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @loop_nest_single_iteration_after_unroll(%N: index) { affine.for %i = 0 to %N { affine.for %j = 0 to 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_operand1() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to affine_map<(d0) -> (d0 - d0 mod 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_operand2() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (5*d0 + 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @floordiv_mod_ub(%M : index, %N : index) { affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) floordiv (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) mod (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } return } func.func @loop_nest_operand3() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (d0 + 9)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound_with_step(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N step 3 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = %M to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%N, %K] { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound(%M : index, %N : index) { %T = affine.apply affine_map<(d0) -> (4*d0 + 1)>(%M) %K = affine.apply affine_map<(d0) -> (d0 - 1)> (%T) affine.for %i = 0 to min affine_map<(d0, d1) -> (4 * d0, d1, 1024)>(%N, %K) { ""foo""() : () -> () } return } func.func @multi_upper_bound(%arg0: index) { affine.for %i = 0 to min affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] { ""test.foo""() : () -> () } return } func.func @multi_lower_bound(%arg0: index) { affine.for %i = max affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] to 100 { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound_alt(%M : index, %N : index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) affine.for %i = 0 to min affine_map<()[s0, s1] -> (4 * s0, s1, 1024)>()[%N, %K] { ""foo""() : () -> () } return } func.func @unroll_by_one_should_promote_single_iteration_loop() { affine.for %i = 0 to 1 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @loop_unroll_with_iter_args_and_cleanup(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 %sum:2 = affine.for %iv = 0 to 10 iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %cf1 : f32 %sum1 = arith.addf %i1, %cf2 : f32 affine.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @unroll_with_iter_args_and_promotion(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = affine.for %iv = 0 to 9 iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 affine.yield %next : f32 } return %sum : f32 } func.func @unroll_zero_trip_count_case() { affine.for %i = 0 to 0 { } return } func.func @unroll_cleanup_loop_with_larger_unroll_factor() { affine.for %i = 0 to 3 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_smaller_unroll_factor() { affine.for %i = 0 to 7 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_identical_unroll_factor() { affine.for %i = 0 to 5 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @known_multiple_ceildiv(%N: index, %S: index) { %cst = arith.constant 0.0 : f32 %m = memref.alloc(%S) : memref affine.for %i = 0 to affine_map<(d0) -> (32 * d0 + 64)>(%N) step 8 { affine.store %cst, %m[%i] : memref } affine.for %i = 0 to affine_map<(d0) -> ((32 * d0 + 64) floordiv 8)>(%N) { affine.store %cst, %m[%i] : memref } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll=""unroll-full"" ",1 "func.func @loop_nest_simplest() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = arith.constant 1 : i32 } } return } func.func @loop_nest_simple_iv_use() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_body_def_use() { affine.for %i = 0 to 100 step 2 { %c0 = arith.constant 0 : index affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %c0) : (index, index) -> index } } return } func.func @loop_nest_strided() { affine.for %i = 0 to 100 { affine.for %j = 2 to 6 step 2 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } affine.for %k = 2 to 7 step 2 { %z = ""affine.apply"" (%k) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %w = ""addi32""(%z, %z) : (index, index) -> index } } return } func.func @loop_nest_multiple_results() { affine.for %i = 0 to 100 { affine.for %j = 0 to 2 step 1 { %x = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %j) %y = ""addi32""(%x, %x) : (index, index) -> index %z = affine.apply affine_map<(d0, d1) -> (d0 + 3)> (%i, %j) %w:2 = ""fma""(%z, %x, %x) : (index, index, index) -> (index, index) } } return } func.func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { %c128 = arith.constant 128 : index affine.for %i = 0 to 100 { %ld = ""vld""(%i) : (index) -> i32 affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""vmulf""(%j, %x) : (index, index) -> index %z = ""vaddf""(%y, %y) : (index, index) -> index } %addr = ""scale""(%c128, %i) : (index, index) -> index ""vst""(%addr, %i) : (index, index) -> () } return } func.func @loop_nest_seq_multiple() { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) ""mul""(%x, %x) : (index, index) -> () } %k = arith.constant 99 : index affine.for %m = 0 to 100 step 2 { affine.for %n = 0 to 4 { %y = ""affine.apply"" (%n) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %z = ""affine.apply"" (%n, %k) { map = affine_map<(d0) [s0] -> (d0 + s0 + 1)> } : (index, index) -> (index) } } return } func.func @loop_nest_unroll_full() { affine.for %i = 0 to 1 { %x = ""foo""() : () -> i32 %y = ""bar""() : () -> i32 } return } func.func @loop_nest_outer_unroll() { affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } } return } func.func @loop_nest_seq_long() -> i32 { %A = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %B = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %C = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %zero = arith.constant 0 : i32 %one = arith.constant 1 : i32 %two = arith.constant 2 : i32 %zero_idx = arith.constant 0 : index affine.for %n0 = 0 to 512 { affine.for %n1 = 0 to 8 { memref.store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } affine.for %x = 0 to 2 { affine.for %y = 0 to 2 { affine.for %arg2 = 0 to 8 { %b2 = ""affine.apply"" (%y, %arg2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %z = memref.load %B[%x, %b2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op1""(%z) : (i32) -> () } affine.for %j1 = 0 to 8 { affine.for %j2 = 0 to 8 { %a2 = ""affine.apply"" (%y, %j2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %v203 = memref.load %A[%j1, %a2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op2""(%v203) : (i32) -> () } affine.for %k2 = 0 to 8 { %s0 = ""op3""() : () -> i32 %c2 = ""affine.apply"" (%x, %k2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %s1 = memref.load %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %s2 = ""addi32""(%s0, %s1) : (i32, i32) -> i32 memref.store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } ""op4""() : () -> () } } %ret = memref.load %C[%zero_idx, %zero_idx] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> return %ret : i32 } func.func @unroll_unit_stride_no_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 8 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } affine.for %k = 0 to 8 { } } return } func.func @unroll_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 10 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @unroll_non_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 2 to 48 step 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @loop_nest_single_iteration_after_unroll(%N: index) { affine.for %i = 0 to %N { affine.for %j = 0 to 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_operand1() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to affine_map<(d0) -> (d0 - d0 mod 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_operand2() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (5*d0 + 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @floordiv_mod_ub(%M : index, %N : index) { affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) floordiv (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) mod (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } return } func.func @loop_nest_operand3() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (d0 + 9)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound_with_step(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N step 3 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = %M to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%N, %K] { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound(%M : index, %N : index) { %T = affine.apply affine_map<(d0) -> (4*d0 + 1)>(%M) %K = affine.apply affine_map<(d0) -> (d0 - 1)> (%T) affine.for %i = 0 to min affine_map<(d0, d1) -> (4 * d0, d1, 1024)>(%N, %K) { ""foo""() : () -> () } return } func.func @multi_upper_bound(%arg0: index) { affine.for %i = 0 to min affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] { ""test.foo""() : () -> () } return } func.func @multi_lower_bound(%arg0: index) { affine.for %i = max affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] to 100 { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound_alt(%M : index, %N : index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) affine.for %i = 0 to min affine_map<()[s0, s1] -> (4 * s0, s1, 1024)>()[%N, %K] { ""foo""() : () -> () } return } func.func @unroll_by_one_should_promote_single_iteration_loop() { affine.for %i = 0 to 1 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @loop_unroll_with_iter_args_and_cleanup(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 %sum:2 = affine.for %iv = 0 to 10 iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %cf1 : f32 %sum1 = arith.addf %i1, %cf2 : f32 affine.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @unroll_with_iter_args_and_promotion(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = affine.for %iv = 0 to 9 iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 affine.yield %next : f32 } return %sum : f32 } func.func @unroll_zero_trip_count_case() { affine.for %i = 0 to 0 { } return } func.func @unroll_cleanup_loop_with_larger_unroll_factor() { affine.for %i = 0 to 3 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_smaller_unroll_factor() { affine.for %i = 0 to 7 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_identical_unroll_factor() { affine.for %i = 0 to 5 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @known_multiple_ceildiv(%N: index, %S: index) { %cst = arith.constant 0.0 : f32 %m = memref.alloc(%S) : memref affine.for %i = 0 to affine_map<(d0) -> (32 * d0 + 64)>(%N) step 8 { affine.store %cst, %m[%i] : memref } affine.for %i = 0 to affine_map<(d0) -> ((32 * d0 + 64) floordiv 8)>(%N) { affine.store %cst, %m[%i] : memref } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll=""unroll-full unroll-full-threshold=2"" ",1 "func.func @loop_nest_simplest() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = arith.constant 1 : i32 } } return } func.func @loop_nest_simple_iv_use() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_body_def_use() { affine.for %i = 0 to 100 step 2 { %c0 = arith.constant 0 : index affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %c0) : (index, index) -> index } } return } func.func @loop_nest_strided() { affine.for %i = 0 to 100 { affine.for %j = 2 to 6 step 2 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } affine.for %k = 2 to 7 step 2 { %z = ""affine.apply"" (%k) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %w = ""addi32""(%z, %z) : (index, index) -> index } } return } func.func @loop_nest_multiple_results() { affine.for %i = 0 to 100 { affine.for %j = 0 to 2 step 1 { %x = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %j) %y = ""addi32""(%x, %x) : (index, index) -> index %z = affine.apply affine_map<(d0, d1) -> (d0 + 3)> (%i, %j) %w:2 = ""fma""(%z, %x, %x) : (index, index, index) -> (index, index) } } return } func.func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { %c128 = arith.constant 128 : index affine.for %i = 0 to 100 { %ld = ""vld""(%i) : (index) -> i32 affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""vmulf""(%j, %x) : (index, index) -> index %z = ""vaddf""(%y, %y) : (index, index) -> index } %addr = ""scale""(%c128, %i) : (index, index) -> index ""vst""(%addr, %i) : (index, index) -> () } return } func.func @loop_nest_seq_multiple() { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) ""mul""(%x, %x) : (index, index) -> () } %k = arith.constant 99 : index affine.for %m = 0 to 100 step 2 { affine.for %n = 0 to 4 { %y = ""affine.apply"" (%n) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %z = ""affine.apply"" (%n, %k) { map = affine_map<(d0) [s0] -> (d0 + s0 + 1)> } : (index, index) -> (index) } } return } func.func @loop_nest_unroll_full() { affine.for %i = 0 to 1 { %x = ""foo""() : () -> i32 %y = ""bar""() : () -> i32 } return } func.func @loop_nest_outer_unroll() { affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } } return } func.func @loop_nest_seq_long() -> i32 { %A = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %B = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %C = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %zero = arith.constant 0 : i32 %one = arith.constant 1 : i32 %two = arith.constant 2 : i32 %zero_idx = arith.constant 0 : index affine.for %n0 = 0 to 512 { affine.for %n1 = 0 to 8 { memref.store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } affine.for %x = 0 to 2 { affine.for %y = 0 to 2 { affine.for %arg2 = 0 to 8 { %b2 = ""affine.apply"" (%y, %arg2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %z = memref.load %B[%x, %b2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op1""(%z) : (i32) -> () } affine.for %j1 = 0 to 8 { affine.for %j2 = 0 to 8 { %a2 = ""affine.apply"" (%y, %j2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %v203 = memref.load %A[%j1, %a2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op2""(%v203) : (i32) -> () } affine.for %k2 = 0 to 8 { %s0 = ""op3""() : () -> i32 %c2 = ""affine.apply"" (%x, %k2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %s1 = memref.load %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %s2 = ""addi32""(%s0, %s1) : (i32, i32) -> i32 memref.store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } ""op4""() : () -> () } } %ret = memref.load %C[%zero_idx, %zero_idx] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> return %ret : i32 } func.func @unroll_unit_stride_no_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 8 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } affine.for %k = 0 to 8 { } } return } func.func @unroll_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 10 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @unroll_non_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 2 to 48 step 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @loop_nest_single_iteration_after_unroll(%N: index) { affine.for %i = 0 to %N { affine.for %j = 0 to 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_operand1() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to affine_map<(d0) -> (d0 - d0 mod 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_operand2() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (5*d0 + 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @floordiv_mod_ub(%M : index, %N : index) { affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) floordiv (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) mod (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } return } func.func @loop_nest_operand3() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (d0 + 9)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound_with_step(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N step 3 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = %M to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%N, %K] { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound(%M : index, %N : index) { %T = affine.apply affine_map<(d0) -> (4*d0 + 1)>(%M) %K = affine.apply affine_map<(d0) -> (d0 - 1)> (%T) affine.for %i = 0 to min affine_map<(d0, d1) -> (4 * d0, d1, 1024)>(%N, %K) { ""foo""() : () -> () } return } func.func @multi_upper_bound(%arg0: index) { affine.for %i = 0 to min affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] { ""test.foo""() : () -> () } return } func.func @multi_lower_bound(%arg0: index) { affine.for %i = max affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] to 100 { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound_alt(%M : index, %N : index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) affine.for %i = 0 to min affine_map<()[s0, s1] -> (4 * s0, s1, 1024)>()[%N, %K] { ""foo""() : () -> () } return } func.func @unroll_by_one_should_promote_single_iteration_loop() { affine.for %i = 0 to 1 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @loop_unroll_with_iter_args_and_cleanup(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 %sum:2 = affine.for %iv = 0 to 10 iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %cf1 : f32 %sum1 = arith.addf %i1, %cf2 : f32 affine.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @unroll_with_iter_args_and_promotion(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = affine.for %iv = 0 to 9 iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 affine.yield %next : f32 } return %sum : f32 } func.func @unroll_zero_trip_count_case() { affine.for %i = 0 to 0 { } return } func.func @unroll_cleanup_loop_with_larger_unroll_factor() { affine.for %i = 0 to 3 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_smaller_unroll_factor() { affine.for %i = 0 to 7 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_identical_unroll_factor() { affine.for %i = 0 to 5 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @known_multiple_ceildiv(%N: index, %S: index) { %cst = arith.constant 0.0 : f32 %m = memref.alloc(%S) : memref affine.for %i = 0 to affine_map<(d0) -> (32 * d0 + 64)>(%N) step 8 { affine.store %cst, %m[%i] : memref } affine.for %i = 0 to affine_map<(d0) -> ((32 * d0 + 64) floordiv 8)>(%N) { affine.store %cst, %m[%i] : memref } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll=""unroll-factor=4"" ",1 "func.func @loop_nest_simplest() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = arith.constant 1 : i32 } } return } func.func @loop_nest_simple_iv_use() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_body_def_use() { affine.for %i = 0 to 100 step 2 { %c0 = arith.constant 0 : index affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %c0) : (index, index) -> index } } return } func.func @loop_nest_strided() { affine.for %i = 0 to 100 { affine.for %j = 2 to 6 step 2 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } affine.for %k = 2 to 7 step 2 { %z = ""affine.apply"" (%k) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %w = ""addi32""(%z, %z) : (index, index) -> index } } return } func.func @loop_nest_multiple_results() { affine.for %i = 0 to 100 { affine.for %j = 0 to 2 step 1 { %x = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %j) %y = ""addi32""(%x, %x) : (index, index) -> index %z = affine.apply affine_map<(d0, d1) -> (d0 + 3)> (%i, %j) %w:2 = ""fma""(%z, %x, %x) : (index, index, index) -> (index, index) } } return } func.func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { %c128 = arith.constant 128 : index affine.for %i = 0 to 100 { %ld = ""vld""(%i) : (index) -> i32 affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""vmulf""(%j, %x) : (index, index) -> index %z = ""vaddf""(%y, %y) : (index, index) -> index } %addr = ""scale""(%c128, %i) : (index, index) -> index ""vst""(%addr, %i) : (index, index) -> () } return } func.func @loop_nest_seq_multiple() { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) ""mul""(%x, %x) : (index, index) -> () } %k = arith.constant 99 : index affine.for %m = 0 to 100 step 2 { affine.for %n = 0 to 4 { %y = ""affine.apply"" (%n) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %z = ""affine.apply"" (%n, %k) { map = affine_map<(d0) [s0] -> (d0 + s0 + 1)> } : (index, index) -> (index) } } return } func.func @loop_nest_unroll_full() { affine.for %i = 0 to 1 { %x = ""foo""() : () -> i32 %y = ""bar""() : () -> i32 } return } func.func @loop_nest_outer_unroll() { affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } } return } func.func @loop_nest_seq_long() -> i32 { %A = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %B = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %C = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %zero = arith.constant 0 : i32 %one = arith.constant 1 : i32 %two = arith.constant 2 : i32 %zero_idx = arith.constant 0 : index affine.for %n0 = 0 to 512 { affine.for %n1 = 0 to 8 { memref.store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } affine.for %x = 0 to 2 { affine.for %y = 0 to 2 { affine.for %arg2 = 0 to 8 { %b2 = ""affine.apply"" (%y, %arg2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %z = memref.load %B[%x, %b2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op1""(%z) : (i32) -> () } affine.for %j1 = 0 to 8 { affine.for %j2 = 0 to 8 { %a2 = ""affine.apply"" (%y, %j2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %v203 = memref.load %A[%j1, %a2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op2""(%v203) : (i32) -> () } affine.for %k2 = 0 to 8 { %s0 = ""op3""() : () -> i32 %c2 = ""affine.apply"" (%x, %k2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %s1 = memref.load %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %s2 = ""addi32""(%s0, %s1) : (i32, i32) -> i32 memref.store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } ""op4""() : () -> () } } %ret = memref.load %C[%zero_idx, %zero_idx] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> return %ret : i32 } func.func @unroll_unit_stride_no_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 8 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } affine.for %k = 0 to 8 { } } return } func.func @unroll_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 10 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @unroll_non_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 2 to 48 step 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @loop_nest_single_iteration_after_unroll(%N: index) { affine.for %i = 0 to %N { affine.for %j = 0 to 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_operand1() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to affine_map<(d0) -> (d0 - d0 mod 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_operand2() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (5*d0 + 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @floordiv_mod_ub(%M : index, %N : index) { affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) floordiv (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) mod (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } return } func.func @loop_nest_operand3() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (d0 + 9)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound_with_step(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N step 3 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = %M to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%N, %K] { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound(%M : index, %N : index) { %T = affine.apply affine_map<(d0) -> (4*d0 + 1)>(%M) %K = affine.apply affine_map<(d0) -> (d0 - 1)> (%T) affine.for %i = 0 to min affine_map<(d0, d1) -> (4 * d0, d1, 1024)>(%N, %K) { ""foo""() : () -> () } return } func.func @multi_upper_bound(%arg0: index) { affine.for %i = 0 to min affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] { ""test.foo""() : () -> () } return } func.func @multi_lower_bound(%arg0: index) { affine.for %i = max affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] to 100 { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound_alt(%M : index, %N : index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) affine.for %i = 0 to min affine_map<()[s0, s1] -> (4 * s0, s1, 1024)>()[%N, %K] { ""foo""() : () -> () } return } func.func @unroll_by_one_should_promote_single_iteration_loop() { affine.for %i = 0 to 1 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @loop_unroll_with_iter_args_and_cleanup(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 %sum:2 = affine.for %iv = 0 to 10 iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %cf1 : f32 %sum1 = arith.addf %i1, %cf2 : f32 affine.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @unroll_with_iter_args_and_promotion(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = affine.for %iv = 0 to 9 iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 affine.yield %next : f32 } return %sum : f32 } func.func @unroll_zero_trip_count_case() { affine.for %i = 0 to 0 { } return } func.func @unroll_cleanup_loop_with_larger_unroll_factor() { affine.for %i = 0 to 3 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_smaller_unroll_factor() { affine.for %i = 0 to 7 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_identical_unroll_factor() { affine.for %i = 0 to 5 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @known_multiple_ceildiv(%N: index, %S: index) { %cst = arith.constant 0.0 : f32 %m = memref.alloc(%S) : memref affine.for %i = 0 to affine_map<(d0) -> (32 * d0 + 64)>(%N) step 8 { affine.store %cst, %m[%i] : memref } affine.for %i = 0 to affine_map<(d0) -> ((32 * d0 + 64) floordiv 8)>(%N) { affine.store %cst, %m[%i] : memref } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll=""unroll-factor=1"" ",1 "func.func @loop_nest_simplest() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = arith.constant 1 : i32 } } return } func.func @loop_nest_simple_iv_use() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to 4 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_body_def_use() { affine.for %i = 0 to 100 step 2 { %c0 = arith.constant 0 : index affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %c0) : (index, index) -> index } } return } func.func @loop_nest_strided() { affine.for %i = 0 to 100 { affine.for %j = 2 to 6 step 2 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } affine.for %k = 2 to 7 step 2 { %z = ""affine.apply"" (%k) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %w = ""addi32""(%z, %z) : (index, index) -> index } } return } func.func @loop_nest_multiple_results() { affine.for %i = 0 to 100 { affine.for %j = 0 to 2 step 1 { %x = affine.apply affine_map<(d0, d1) -> (d0 + 1)> (%i, %j) %y = ""addi32""(%x, %x) : (index, index) -> index %z = affine.apply affine_map<(d0, d1) -> (d0 + 3)> (%i, %j) %w:2 = ""fma""(%z, %x, %x) : (index, index, index) -> (index, index) } } return } func.func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) { %c128 = arith.constant 128 : index affine.for %i = 0 to 100 { %ld = ""vld""(%i) : (index) -> i32 affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""vmulf""(%j, %x) : (index, index) -> index %z = ""vaddf""(%y, %y) : (index, index) -> index } %addr = ""scale""(%c128, %i) : (index, index) -> index ""vst""(%addr, %i) : (index, index) -> () } return } func.func @loop_nest_seq_multiple() { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) ""mul""(%x, %x) : (index, index) -> () } %k = arith.constant 99 : index affine.for %m = 0 to 100 step 2 { affine.for %n = 0 to 4 { %y = ""affine.apply"" (%n) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %z = ""affine.apply"" (%n, %k) { map = affine_map<(d0) [s0] -> (d0 + s0 + 1)> } : (index, index) -> (index) } } return } func.func @loop_nest_unroll_full() { affine.for %i = 0 to 1 { %x = ""foo""() : () -> i32 %y = ""bar""() : () -> i32 } return } func.func @loop_nest_outer_unroll() { affine.for %i = 0 to 2 { affine.for %j = 0 to 4 { %x = ""affine.apply"" (%j) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %y = ""addi32""(%x, %x) : (index, index) -> index } } return } func.func @loop_nest_seq_long() -> i32 { %A = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %B = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %C = memref.alloc() : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %zero = arith.constant 0 : i32 %one = arith.constant 1 : i32 %two = arith.constant 2 : i32 %zero_idx = arith.constant 0 : index affine.for %n0 = 0 to 512 { affine.for %n1 = 0 to 8 { memref.store %one, %A[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %two, %B[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> memref.store %zero, %C[%n0, %n1] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } affine.for %x = 0 to 2 { affine.for %y = 0 to 2 { affine.for %arg2 = 0 to 8 { %b2 = ""affine.apply"" (%y, %arg2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %z = memref.load %B[%x, %b2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op1""(%z) : (i32) -> () } affine.for %j1 = 0 to 8 { affine.for %j2 = 0 to 8 { %a2 = ""affine.apply"" (%y, %j2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %v203 = memref.load %A[%j1, %a2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> ""op2""(%v203) : (i32) -> () } affine.for %k2 = 0 to 8 { %s0 = ""op3""() : () -> i32 %c2 = ""affine.apply"" (%x, %k2) {map = affine_map<(d0, d1) -> (16*d0 + d1)>} : (index, index) -> index %s1 = memref.load %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> %s2 = ""addi32""(%s0, %s1) : (i32, i32) -> i32 memref.store %s2, %C[%j1, %c2] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> } } ""op4""() : () -> () } } %ret = memref.load %C[%zero_idx, %zero_idx] : memref<512 x 512 x i32, affine_map<(d0, d1) -> (d0, d1)>, 2> return %ret : i32 } func.func @unroll_unit_stride_no_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 8 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } affine.for %k = 0 to 8 { } } return } func.func @unroll_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 0 to 10 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @unroll_non_unit_stride_cleanup() { affine.for %i = 0 to 100 { affine.for %j = 2 to 48 step 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 %y = ""addi32""(%x, %x) : (i32, i32) -> i32 } } return } func.func @loop_nest_single_iteration_after_unroll(%N: index) { affine.for %i = 0 to %N { affine.for %j = 0 to 5 { %x = ""addi32""(%j, %j) : (index, index) -> i32 } } return } func.func @loop_nest_operand1() { affine.for %i = 0 to 100 step 2 { affine.for %j = 0 to affine_map<(d0) -> (d0 - d0 mod 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_operand2() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (5*d0 + 4)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @floordiv_mod_ub(%M : index, %N : index) { affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) floordiv (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } affine.for %i = 0 to %N step 4 { affine.for %j = 0 to min affine_map<(d0)[s0] -> ((16 * d0) mod (4 * s0))>(%i)[%N] { ""test.foo""() : () -> () } } return } func.func @loop_nest_operand3() { affine.for %i = 0 to 100 step 2 { affine.for %j = affine_map<(d0) -> (d0)> (%i) to affine_map<(d0) -> (d0 + 9)> (%i) { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_bound_with_step(%N : index) { affine.for %i = 0 to 100 { affine.for %j = 0 to %N step 3 { %x = ""foo""() : () -> i32 } } return } func.func @loop_nest_symbolic_and_min_upper_bound(%M : index, %N : index, %K : index) { affine.for %i = %M to min affine_map<()[s0, s1] -> (s0, s1, 1024)>()[%N, %K] { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound(%M : index, %N : index) { %T = affine.apply affine_map<(d0) -> (4*d0 + 1)>(%M) %K = affine.apply affine_map<(d0) -> (d0 - 1)> (%T) affine.for %i = 0 to min affine_map<(d0, d1) -> (4 * d0, d1, 1024)>(%N, %K) { ""foo""() : () -> () } return } func.func @multi_upper_bound(%arg0: index) { affine.for %i = 0 to min affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] { ""test.foo""() : () -> () } return } func.func @multi_lower_bound(%arg0: index) { affine.for %i = max affine_map<()[s0] -> (8 * s0, 12 * s0)>()[%arg0] to 100 { ""test.foo""() : () -> () } return } func.func @loop_nest_non_trivial_multiple_upper_bound_alt(%M : index, %N : index) { %K = affine.apply affine_map<(d0) -> (4*d0)> (%M) affine.for %i = 0 to min affine_map<()[s0, s1] -> (4 * s0, s1, 1024)>()[%N, %K] { ""foo""() : () -> () } return } func.func @unroll_by_one_should_promote_single_iteration_loop() { affine.for %i = 0 to 1 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @loop_unroll_with_iter_args_and_cleanup(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 %sum:2 = affine.for %iv = 0 to 10 iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %cf1 : f32 %sum1 = arith.addf %i1, %cf2 : f32 affine.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @unroll_with_iter_args_and_promotion(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = affine.for %iv = 0 to 9 iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 affine.yield %next : f32 } return %sum : f32 } func.func @unroll_zero_trip_count_case() { affine.for %i = 0 to 0 { } return } func.func @unroll_cleanup_loop_with_larger_unroll_factor() { affine.for %i = 0 to 3 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_smaller_unroll_factor() { affine.for %i = 0 to 7 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @unroll_cleanup_loop_with_identical_unroll_factor() { affine.for %i = 0 to 5 { %x = ""foo""(%i) : (index) -> i32 } return } func.func @known_multiple_ceildiv(%N: index, %S: index) { %cst = arith.constant 0.0 : f32 %m = memref.alloc(%S) : memref affine.for %i = 0 to affine_map<(d0) -> (32 * d0 + 64)>(%N) step 8 { affine.store %cst, %m[%i] : memref } affine.for %i = 0 to affine_map<(d0) -> ((32 * d0 + 64) floordiv 8)>(%N) { affine.store %cst, %m[%i] : memref } return }"," mlir-opt -allow-unregistered-dialect -affine-loop-unroll=""unroll-factor=5 cleanup-unroll=true"" ",1 "func.func @func_with_affine_ops(%N: index) { %c = arith.constant 200 : index affine.for %i = 1 to 10 { affine.if affine_set<(i)[N] : (i - 2 >= 0, 4 - i >= 0)>(%i)[%c] { %w = affine.apply affine_map<(d0,d1)[s0] -> (d0+d1+s0)> (%i, %i) [%N] } } return } func.func @inline_with_affine_ops() { %c = arith.constant 1 : index call @func_with_affine_ops(%c) : (index) -> () return } func.func @not_inline_in_affine_op() { %c = arith.constant 1 : index affine.for %i = 1 to 10 { func.call @func_with_affine_ops(%c) : (index) -> () } return }"," mlir-opt -allow-unregistered-dialect -inline=""default-pipeline=''"" ",1 "func.func @func_with_invalid_nested_op() { affine.for %i = 1 to 10 { ""foo.opaque""() : () -> () } return } func.func @not_inline_invalid_nest_op() { call @func_with_invalid_nested_op() : () -> () return }"," mlir-opt -allow-unregistered-dialect -inline=""default-pipeline=''"" ",1 "func.func @func_noop() { return } func.func @inline_into_affine_ops() { affine.for %i = 1 to 10 { func.call @func_noop() : () -> () } return }"," mlir-opt -allow-unregistered-dialect -inline=""default-pipeline=''"" ",1 "func.func @func_dim(%arg0: index, %arg1: memref) { affine.load %arg1[%arg0] : memref return } func.func @inline_dimension(%arg0: memref) { affine.for %i = 1 to 42 { func.call @func_dim(%i, %arg0) : (index, memref) -> () } return }"," mlir-opt -allow-unregistered-dialect -inline=""default-pipeline=''"" ",1 "func.func @func_vector_dim(%arg0: index, %arg1: memref<32xf32>) { affine.vector_load %arg1[%arg0] : memref<32xf32>, vector<4xf32> return } func.func @inline_dimension_vector(%arg0: memref<32xf32>) { affine.for %i = 1 to 42 { func.call @func_vector_dim(%i, %arg0) : (index, memref<32xf32>) -> () } return }"," mlir-opt -allow-unregistered-dialect -inline=""default-pipeline=''"" ",1 "func.func private @get_index() -> index func.func @func_top_level(%arg0: memref) { %0 = call @get_index() : () -> index affine.load %arg0[%0] : memref return } func.func @no_inline_not_top_level(%arg0: memref) { affine.for %i = 1 to 42 { func.call @func_top_level(%arg0) : (memref) -> () } return }"," mlir-opt -allow-unregistered-dialect -inline=""default-pipeline=''"" ",1 "func.func private @external() -> () func.func @test_gaussian_elimination_empty_set0() { affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1) : (2 == 0)>(%arg0, %arg1) { func.call @external() : () -> () } } } return } func.func @test_gaussian_elimination_empty_set1() { affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1) : (1 >= 0, -1 >= 0)> (%arg0, %arg1) { func.call @external() : () -> () } } } return } func.func @test_gaussian_elimination_non_empty_set2() { affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1) : (d0 - 100 == 0, d1 - 10 == 0, -d0 + 100 >= 0, d1 >= 0, d1 + 101 >= 0)>(%arg0, %arg1) { func.call @external() : () -> () } } } return } func.func @test_gaussian_elimination_empty_set3() { %c7 = arith.constant 7 : index %c11 = arith.constant 11 : index affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1)[s0, s1] : (d0 - s0 == 0, d0 + s0 == 0, s0 - 1 == 0)>(%arg0, %arg1)[%c7, %c11] { func.call @external() : () -> () } } } return } #set_2d_non_empty = affine_set<(d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0, d0 * 5 - d1 * 11 + s0 * 7 + s1 == 0, d0 * 11 + d1 * 7 - s0 * 5 + s1 == 0, d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0)> func.func @test_gaussian_elimination_non_empty_set4() { %c7 = arith.constant 7 : index %c11 = arith.constant 11 : index affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if #set_2d_non_empty(%arg0, %arg1)[%c7, %c11] { func.call @external() : () -> () } } } return } #set_2d_empty = affine_set<(d0, d1)[s0, s1] : (d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0, d0 * 5 - d1 * 11 + s0 * 7 + s1 == 0, d0 * 11 + d1 * 7 - s0 * 5 + s1 == 0, d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0, d0 - 1 == 0, d0 + 2 == 0)> func.func @test_gaussian_elimination_empty_set5() { %c7 = arith.constant 7 : index %c11 = arith.constant 11 : index affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if #set_2d_empty(%arg0, %arg1)[%c7, %c11] { func.call @external() : () -> () } } } return } #set_fuzz_virus = affine_set<(d0, d1, d2, d3, d4, d5) : ( 1089234*d0 + 203472*d1 + 82342 >= 0, -55*d0 + 24*d1 + 238*d2 - 234*d3 - 9743 >= 0, -5445*d0 - 284*d1 + 23*d2 + 34*d3 - 5943 >= 0, -5445*d0 + 284*d1 + 238*d2 - 34*d3 >= 0, 445*d0 + 284*d1 + 238*d2 + 39*d3 >= 0, -545*d0 + 214*d1 + 218*d2 - 94*d3 >= 0, 44*d0 - 184*d1 - 231*d2 + 14*d3 >= 0, -45*d0 + 284*d1 + 138*d2 - 39*d3 >= 0, 154*d0 - 84*d1 + 238*d2 - 34*d3 >= 0, 54*d0 - 284*d1 - 223*d2 + 384*d3 >= 0, -55*d0 + 284*d1 + 23*d2 + 34*d3 >= 0, 54*d0 - 84*d1 + 28*d2 - 34*d3 >= 0, 54*d0 - 24*d1 - 23*d2 + 34*d3 >= 0, -55*d0 + 24*d1 + 23*d2 + 4*d3 >= 0, 15*d0 - 84*d1 + 238*d2 - 3*d3 >= 0, 5*d0 - 24*d1 - 223*d2 + 84*d3 >= 0, -5*d0 + 284*d1 + 23*d2 - 4*d3 >= 0, 14*d0 + 4*d2 + 7234 >= 0, -174*d0 - 534*d2 + 9834 >= 0, 194*d0 - 954*d2 + 9234 >= 0, 47*d0 - 534*d2 + 9734 >= 0, -194*d0 - 934*d2 + 984 >= 0, -947*d0 - 953*d2 + 234 >= 0, 184*d0 - 884*d2 + 884 >= 0, -174*d0 + 834*d2 + 234 >= 0, 844*d0 + 634*d2 + 9874 >= 0, -797*d2 - 79*d3 + 257 >= 0, 2039*d0 + 793*d2 - 99*d3 - 24*d4 + 234*d5 >= 0, 78*d2 - 788*d5 + 257 >= 0, d3 - (d5 + 97*d0) floordiv 423 >= 0, 234* (d0 + d3 mod 5 floordiv 2342) mod 2309 + (d0 + 2038*d3) floordiv 208 >= 0, 239* (d0 + 2300 * d3) floordiv 2342 mod 2309 mod 239423 == 0, d0 + d3 mod 2642 + (d3 + 2*d0) mod 1247 mod 2038 mod 2390 mod 2039 floordiv 55 >= 0 )> func.func @test_fuzz_explosion(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index) { affine.for %arg4 = 1 to 10 { affine.for %arg5 = 1 to 100 { affine.if #set_fuzz_virus(%arg4, %arg5, %arg0, %arg1, %arg2, %arg3) { func.call @external() : () -> () } } } return } func.func @test_empty_set(%N : index) { affine.for %i = 0 to 10 { affine.for %j = 0 to 10 { affine.if affine_set<(d0, d1) : (d0 - d1 >= 0, d1 - d0 - 1 >= 0)>(%i, %j) { ""foo""() : () -> () } affine.if affine_set<(d0) : (d0 >= 0, -d0 - 1 >= 0)>(%i) { ""bar""() : () -> () } affine.if affine_set<(d0) : (d0 >= 0, -d0 - 1 >= 0)>(%i) { ""foo""() : () -> () } affine.if affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 - 1 >= 0, -s0 >= 0)>(%i)[%N, %N] { ""bar""() : () -> () } affine.if affine_set<(d0, d1, d2) : (d0 - d1 == 0, d2 - d0 >= 0, d0 - d1 - 1 >= 0)>(%i, %j, %N) { ""foo""() : () -> () } affine.if affine_set<(d0, d1) : (d0*2 -d1*2 - 1 == 0, d0 >= 0, -d0 + 100 >= 0, d1 >= 0, -d1 + 100 >= 0)>(%i, %j) { ""foo""() : () -> () } affine.if affine_set<(d0, d1) : (d1 == 0, d0 - 1 >= 0, - d0 - 1 >= 0)>(%i, %j) { ""foo""() : () -> () } } } affine.for %k = 0 to 10 { affine.for %l = 0 to 10 { affine.if affine_set<(d0) : (8*d0 - 4 >= 0, -8*d0 + 7 >= 0)>(%k) { ""foo""() : () -> () } affine.if affine_set<(d0, d1) : (d0 - 4*d1 == 0, 4*d1 - 5 >= 0, -4*d1 + 7 >= 0)>(%k, %l) { ""foo""() : () -> () } affine.if affine_set<(d0, d1) : (4*d0 + 8*d1 - 9 >= 0, -4*d0 - 8*d1 + 11 >= 0)>(%k, %l) { ""foo""() : () -> () } affine.if affine_set<(d0, d1, d2) : (d0 - 4*d2 == 0, d0 + 8*d1 - 9 >= 0, -d0 - 8*d1 + 11 >= 0)>(%k, %k, %l) { ""foo""() : () -> () } } } affine.for %m = 0 to 10 { affine.if affine_set<(d0) : (d0 mod 2 - 3 == 0)> (%m) { ""foo""() : () -> () } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func private @external() -> () func.func @simplify_set(%a : index, %b : index) { affine.if affine_set<(d0, d1) : (d0 - d1 + d1 + d0 >= 0, 2 >= 0, d0 >= 0, -d0 + 50 >= 0, -d0 + 100 >= 0)>(%a, %b) { func.call @external() : () -> () } affine.if affine_set<(d0, d1) : (d0 mod 2 - 1 == 0, d0 - 2 * (d0 floordiv 2) == 0)>(%a, %b) { func.call @external() : () -> () } affine.if affine_set<(d0, d1) : (1 >= 0, 3 >= 0)>(%a, %b) { func.call @external() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @affine.apply(%N : index) -> index { %v = affine.apply affine_map<(d0, d1) -> (d0 + d1 + 1)>(%N, %N) %res = arith.addi %v, %v : index return %res: index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @simplify_zero_dim_map(%in : memref) -> f32 { %out = affine.load %in[] : memref return %out : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semiaffine_mod(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] ->((-((d0 floordiv s0) * s0) + s0 * s0) mod s0)> (%arg0)[%arg1] return %a : index } func.func @semiaffine_floordiv(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] ->((-((d0 floordiv s0) * s0) + ((2 * s0) mod (3 * s0))) floordiv s0)> (%arg0)[%arg1] return %a : index } func.func @semiaffine_ceildiv(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] ->((-((d0 floordiv s0) * s0) + s0 * 42 + ((5-5) floordiv s0)) ceildiv s0)> (%arg0)[%arg1] return %a : index } func.func @semiaffine_composite_floor(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] ->(((((s0 * 2) ceildiv 4) * 5) + s0 * 42) ceildiv s0)> (%arg0)[%arg1] return %a : index } func.func @semiaffine_unsimplified_symbol(%arg0: index, %arg1: index) -> index { %a = affine.apply affine_map<(d0)[s0] ->(s0 mod (2 * s0 - s0))> (%arg0)[%arg1] return %a : index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func private @external() -> () func.func private @external1() -> () func.func @test_always_true_if_elimination() { affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1) : (1 >= 0)> (%arg0, %arg1) { func.call @external() : () -> () } else { func.call @external1() : () -> () } } } return } func.func @test_always_false_if_elimination() { affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1) : (-1 >= 0)> (%arg0, %arg1) { func.call @external() : () -> () } else { func.call @external1() : () -> () } } } return } func.func @test_dimensional_if_elimination() { affine.for %arg0 = 1 to 10 { affine.for %arg1 = 1 to 100 { affine.if affine_set<(d0, d1) : (d0-1 == 0)> (%arg0, %arg1) { func.call @external() : () -> () } else { func.call @external() : () -> () } } } return } func.func @test_num_results_if_elimination() -> index { %zero = arith.constant 0 : index %0 = affine.if affine_set<() : ()> () -> index { affine.yield %zero : index } else { affine.yield %zero : index } return %0 : index } func.func @test_trivially_false_returning_two_results(%arg0: index) -> (index, index) { %c7 = arith.constant 7 : index %c13 = arith.constant 13 : index %res:2 = affine.if affine_set<(d0, d1) : (5 >= 0, -2 >= 0)> (%c7, %c13) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index affine.yield %c0, %c1 : index, index } else { %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index affine.yield %c7, %arg0 : index, index } return %res#0, %res#1 : index, index } func.func @test_trivially_true_returning_five_results() -> (index, index, index, index, index) { %c12 = arith.constant 12 : index %c13 = arith.constant 13 : index %res:5 = affine.if affine_set<(d0, d1) : (1 >= 0, 3 >= 0)>(%c12, %c13) -> (index, index, index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index affine.yield %c0, %c1, %c2, %c3, %c4 : index, index, index, index, index } else { %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %c7 = arith.constant 7 : index %c8 = arith.constant 8 : index %c9 = arith.constant 9 : index affine.yield %c5, %c6, %c7, %c8, %c9 : index, index, index, index, index } return %res#0, %res#1, %res#2, %res#3, %res#4 : index, index, index, index, index } func.func @test_not_trivially_true_or_false_returning_three_results() -> (index, index, index) { %c8 = arith.constant 8 : index %c13 = arith.constant 13 : index %res:3 = affine.if affine_set<(d0, d1) : (d0 - 1 == 0)>(%c8, %c13) -> (index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index affine.yield %c0, %c1, %c2 : index, index, index } else { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index affine.yield %c3, %c4, %c5 : index, index, index } return %res#0, %res#1, %res#2 : index, index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semiaffine_simplification_mod(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) -> (index, index, index) { %a = affine.apply affine_map<(d0, d1)[s0, s1, s2, s3] -> ((-(d1 * s0 - (s0 - s1) mod s2) + s3) + (d0 * s1 + d1 * s0))>(%arg0, %arg1)[%arg2, %arg3, %arg4, %arg5] %b = affine.apply affine_map<(d0)[s0, s1, s2, s3] -> (d0 mod (s0 - s1 * s2 + s3 - s0))>(%arg0)[%arg0, %arg1, %arg2, %arg3] %c = affine.apply affine_map<(d0)[s0, s1, s2] -> (d0 + (d0 + s0) mod s2 + s0 * s1 - (d0 + s0) mod s2 - (d0 - s0) mod s2)>(%arg0)[%arg1, %arg2, %arg3] return %a, %b, %c : index, index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semiaffine_simplification_floordiv_and_ceildiv(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index) -> (index, index, index) { %a = affine.apply affine_map<(d0)[s0, s1, s2, s3] -> (d0 floordiv (s0 - s1 * s2 + s3 - s0))>(%arg0)[%arg0, %arg1, %arg2, %arg3] %b = affine.apply affine_map<(d0)[s0, s1, s2, s3] -> ((-(d0 * s1 - (s0 - s1) floordiv s2) + s3) + (d0 * s1 + s0))>(%arg0)[%arg1, %arg2, %arg3, %arg4] %c = affine.apply affine_map<(d0)[s0, s1, s2, s3] -> (d0 ceildiv (s0 - s1 * s2 + s3 - s0))>(%arg0)[%arg0, %arg1, %arg2, %arg3] return %a, %b, %c : index, index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semiaffine_simplification_product(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) -> (index, index) { %a = affine.apply affine_map<(d0)[s0, s1, s2, s3] -> ((-(s0 - (s0 - s1) * s2) + s3) + (d0 + s0))>(%arg0)[%arg1, %arg2, %arg3, %arg4] %b = affine.apply affine_map<(d0, d1, d2)[s0, s1] -> (d0 + d1 * s1 + d1 + d0 * s0 + d1 * s0 + d2 * s1 + d2)>(%arg0, %arg1, %arg2)[%arg3, %arg4] return %a, %b : index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semi_affine_simplification_euclidean_lemma(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) -> (index, index) { %a = affine.apply affine_map<(d0, d1)[s0, s1] -> ((d0 + d1) - ((d0 + d1) floordiv (s0 - s1)) * (s0 - s1) - (d0 + d1) mod (s0 - s1))>(%arg0, %arg1)[%arg2, %arg3] %b = affine.apply affine_map<(d0, d1)[s0, s1] -> ((d0 + d1 - s0) - ((d0 + d1 - s0) floordiv (s0 + s1)) * (s0 + s1))>(%arg0, %arg1)[%arg2, %arg3] return %a, %b : index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semiaffine_modulo(%arg0: index) -> index { %a = affine.apply affine_map<()[s0] -> (s0 mod 2 + (s0 floordiv 2) * s0)> ()[%arg0] return %a : index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @semiaffine_modulo_dim(%arg0: index, %arg1: index, %arg2: index) -> index { %a = affine.apply affine_map<(d0)[s0, s1] -> (((d0 floordiv 2) * s0 + s1 floordiv 2) * 2 + d0 mod 2)> (%arg0)[%arg1, %arg2] return %a : index }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-simplify-structures ,1 "func.func @test0(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i0, %i1] : memref<100x100xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @test1(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i0 + 3, %i1 + 7] : memref<100x100xf32> affine.store %1, %0[%i0 + 3, %i1 + 7] : memref<100x100xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @test2(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i0 + %arg0, %i1 + %arg1] : memref<100x100xf32> affine.store %1, %0[%i0 + %arg0, %i1 + %arg1] : memref<100x100xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @test3(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i0 + symbol(%arg0), %i1 + symbol(%arg1)] : memref<100x100xf32> affine.store %1, %0[%i0 + symbol(%arg0), %i1 + symbol(%arg1)] : memref<100x100xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @test4(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[(%i0 + symbol(%arg0)) floordiv 3 + 11, (%i1 + symbol(%arg1)) mod 4 + 7] : memref<100x100xf32> affine.store %1, %0[(%i0 + symbol(%arg0)) floordiv 3 + 11, (%i1 + symbol(%arg1)) mod 4 + 7] : memref<100x100xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @test5(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<10x10x10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %1 = affine.load %0[%i2, %i0, %i1] : memref<10x10x10xf32> affine.store %1, %0[%i2, %i0, %i1] : memref<10x10x10xf32> } } } return }", mlir-opt -split-input-file ,1 "func.func @test6(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<10x10x10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %1 = affine.load %0[%i2 + %arg0, %i0 + %i1, %i1 + %arg0 + %arg1] : memref<10x10x10xf32> affine.store %1, %0[%i2 + %arg0, %i0 + %i1, %i1 + %arg0 + %arg1] : memref<10x10x10xf32> } } } return }", mlir-opt -split-input-file ,1 "func.func @test6(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<10x10x10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %1 = affine.load %0[%i2 + symbol(%arg0), %i0 + %i1, %i1 + symbol(%arg0) + symbol(%arg1)] : memref<10x10x10xf32> affine.store %1, %0[%i2 + symbol(%arg0), %i0 + %i1, %i1 + symbol(%arg0) + symbol(%arg1)] : memref<10x10x10xf32> } } } return }", mlir-opt -split-input-file ,1 "func.func @test7() { %0 = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { %1 = affine.apply affine_map<(d1) -> (d1 + 1)>(%i0) %2 = affine.load %0[%1] : memref<10xf32> affine.store %2, %0[%1] : memref<10xf32> } return }", mlir-opt -split-input-file ,1 "func.func @zero_dim(%arg0 : memref, %arg1 : memref) { %0 = affine.load %arg0[] : memref affine.store %0, %arg1[] : memref return }", mlir-opt -split-input-file ,1 "func.func @test_prefetch(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i0 + 3, %i1 + 7] : memref<100x100xf32> affine.prefetch %0[%i0 + 3, %i1 + 11], write, locality<0>, data : memref<100x100xf32> affine.prefetch %0[%i0, %i1 + 1], read, locality<3>, instr : memref<100x100xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @vector_load_vector_store_iv() { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 16 step 8 { %1 = affine.vector_load %0[%i0, %i1] : memref<100x100xf32>, vector<8xf32> affine.vector_store %1, %0[%i0, %i1] : memref<100x100xf32>, vector<8xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @vector_load_vector_store_iv_constant() { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 16 step 4 { %1 = affine.vector_load %0[%i0 + 3, %i1 + 7] : memref<100x100xf32>, vector<4xf32> affine.vector_store %1, %0[%i0 + 3, %i1 + 7] : memref<100x100xf32>, vector<4xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @vector_load_vector_store_2d() { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 16 step 2{ affine.for %i1 = 0 to 16 step 8 { %1 = affine.vector_load %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32> affine.vector_store %1, %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32> } } return }", mlir-opt -split-input-file ,1 "func.func @affine_apply(%variable : index) -> (index, index, index) { %c177 = arith.constant 177 : index %c211 = arith.constant 211 : index %N = arith.constant 1075 : index %x0 = affine.apply affine_map<(d0, d1)[S0] -> ( (d0 + 128 * S0) floordiv 128 + d1 mod 128)> (%c177, %c211)[%N] %x1 = affine.apply affine_map<(d0, d1)[S0] -> (128 * (S0 ceildiv 128))> (%c177, %c211)[%N] %y = affine.apply affine_map<(d0) -> (42)> (%variable) return %x0, %x1, %y : index, index, index }", mlir-opt -test-constant-fold -split-input-file ,1 "func.func @affine_min(%variable: index) -> (index, index) { %c42 = arith.constant 42 : index %c44 = arith.constant 44 : index %0 = affine.min affine_map<(d0, d1) -> (d0, d1)>(%c42, %variable) %1 = affine.min affine_map<(d0, d1) -> (d0, d1)>(%c42, %c44) return %0, %1 : index, index }", mlir-opt -test-constant-fold -split-input-file ,1 "func.func @affine_min(%variable: index) -> (index, index) { %c42 = arith.constant 42 : index %c44 = arith.constant 44 : index %0 = affine.max affine_map<(d0, d1) -> (d0, d1)>(%c42, %variable) %1 = affine.max affine_map<(d0, d1) -> (d0, d1)>(%c42, %c44) return %0, %1 : index, index }", mlir-opt -test-constant-fold -split-input-file ,1 "func.func @nested_loops_both_having_invariant_code() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 affine.for %arg1 = 0 to 10 { affine.store %v0, %m[%arg0] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @store_affine_apply() -> memref<10xf32> { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %arg0 = 0 to 10 { %t0 = affine.apply affine_map<(d1) -> (d1 + 1)>(%arg0) affine.store %cf7, %m[%t0] : memref<10xf32> } return %m : memref<10xf32> }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @nested_loops_code_invariant_to_both() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @nested_loops_inner_loops_invariant_to_outermost_loop(%m : memref<10xindex>) { affine.for %arg0 = 0 to 20 { affine.for %arg1 = 0 to 30 { %v0 = affine.for %arg2 = 0 to 10 iter_args (%prevAccum = %arg1) -> index { %v1 = affine.load %m[%arg2] : memref<10xindex> %newAccum = arith.addi %prevAccum, %v1 : index affine.yield %newAccum : index } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @single_loop_nothing_invariant() { %m1 = memref.alloc() : memref<10xf32> %m2 = memref.alloc() : memref<11xf32> affine.for %arg0 = 0 to 10 { %v0 = affine.load %m1[%arg0] : memref<10xf32> %v1 = affine.load %m2[%arg0] : memref<11xf32> %v2 = arith.addf %v0, %v1 : f32 affine.store %v2, %m1[%arg0] : memref<10xf32> } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_code_inside_affine_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %t0 = affine.apply affine_map<(d1) -> (d1 + 1)>(%arg0) affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %t0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @dependent_stores() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 affine.for %arg1 = 0 to 10 { %v1 = arith.mulf %cf7, %cf7 : f32 affine.store %v1, %m[%arg1] : memref<10xf32> affine.store %v0, %m[%arg0] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @independent_stores() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 affine.for %arg1 = 0 to 10 { %v1 = arith.mulf %cf7, %cf7 : f32 affine.store %v0, %m[%arg0] : memref<10xf32> affine.store %v1, %m[%arg1] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @load_dependent_store() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 affine.for %arg1 = 0 to 10 { %v1 = arith.addf %cf7, %cf7 : f32 affine.store %v0, %m[%arg1] : memref<10xf32> %v2 = affine.load %m[%arg0] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @load_after_load() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 affine.for %arg1 = 0 to 10 { %v1 = arith.addf %cf7, %cf7 : f32 %v3 = affine.load %m[%arg1] : memref<10xf32> %v2 = affine.load %m[%arg0] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_if2() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg1] : memref<10xf32> } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_nested_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { affine.store %cf9, %m[%arg1] : memref<10xf32> } } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_nested_if_else() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { affine.store %cf9, %m[%arg0] : memref<10xf32> } else { affine.store %cf9, %m[%arg1] : memref<10xf32> } } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_nested_if_else2() { %m = memref.alloc() : memref<10xf32> %m2 = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 %tload1 = affine.load %m[%arg0] : memref<10xf32> affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { affine.store %cf9, %m2[%arg0] : memref<10xf32> } else { %tload2 = affine.load %m[%arg0] : memref<10xf32> } } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_nested_if2() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 %v1 = affine.load %m[%arg0] : memref<10xf32> affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %v2 = affine.load %m[%arg0] : memref<10xf32> } } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_affine_for_inside_affine_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> affine.for %arg2 = 0 to 10 { affine.store %cf9, %m[%arg2] : memref<10xf32> } } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @invariant_constant_and_load() { %m = memref.alloc() : memref<100xf32> %m2 = memref.alloc() : memref<100xf32> affine.for %arg0 = 0 to 5 { %c0 = arith.constant 0 : index %v = affine.load %m2[%c0] : memref<100xf32> affine.store %v, %m[%arg0] : memref<100xf32> } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @nested_load_store_same_memref() { %m = memref.alloc() : memref<10xf32> %cst = arith.constant 8.0 : f32 %c0 = arith.constant 0 : index affine.for %arg0 = 0 to 10 { %v0 = affine.load %m[%c0] : memref<10xf32> affine.for %arg1 = 0 to 10 { affine.store %cst, %m[%arg1] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @nested_load_store_same_memref2() { %m = memref.alloc() : memref<10xf32> %cst = arith.constant 8.0 : f32 %c0 = arith.constant 0 : index affine.for %arg0 = 0 to 10 { affine.store %cst, %m[%c0] : memref<10xf32> affine.for %arg1 = 0 to 10 { %v0 = affine.load %m[%arg0] : memref<10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @do_not_hoist_dependent_side_effect_free_op(%arg0: memref<10x512xf32>) { %0 = memref.alloca() : memref<1xf32> %cst = arith.constant 8.0 : f32 affine.for %i = 0 to 512 { affine.for %j = 0 to 10 { %5 = affine.load %arg0[%i, %j] : memref<10x512xf32> %6 = affine.load %0[0] : memref<1xf32> %add = arith.addf %5, %6 : f32 affine.store %add, %0[0] : memref<1xf32> } %3 = affine.load %0[0] : memref<1xf32> %4 = arith.mulf %3, %cst : f32 } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @vector_loop_nothing_invariant() { %m1 = memref.alloc() : memref<40xf32> %m2 = memref.alloc() : memref<40xf32> affine.for %arg0 = 0 to 10 { %v0 = affine.vector_load %m1[%arg0*4] : memref<40xf32>, vector<4xf32> %v1 = affine.vector_load %m2[%arg0*4] : memref<40xf32>, vector<4xf32> %v2 = arith.addf %v0, %v1 : vector<4xf32> affine.vector_store %v2, %m1[%arg0*4] : memref<40xf32>, vector<4xf32> } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @vector_loop_all_invariant() { %m1 = memref.alloc() : memref<4xf32> %m2 = memref.alloc() : memref<4xf32> %m3 = memref.alloc() : memref<4xf32> affine.for %arg0 = 0 to 10 { %v0 = affine.vector_load %m1[0] : memref<4xf32>, vector<4xf32> %v1 = affine.vector_load %m2[0] : memref<4xf32>, vector<4xf32> %v2 = arith.addf %v0, %v1 : vector<4xf32> affine.vector_store %v2, %m3[0] : memref<4xf32>, vector<4xf32> } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "#set = affine_set<(d0): (d0 - 10 >= 0)> func.func @affine_if_not_invariant(%buffer: memref<1024xf32>) -> f32 { %sum_init_0 = arith.constant 0.0 : f32 %sum_init_1 = arith.constant 1.0 : f32 %res = affine.for %i = 0 to 10 step 2 iter_args(%sum_iter = %sum_init_0) -> f32 { %t = affine.load %buffer[%i] : memref<1024xf32> %sum_next = affine.if #set(%i) -> (f32) { %new_sum = arith.addf %sum_iter, %t : f32 affine.yield %new_sum : f32 } else { affine.yield %sum_iter : f32 } %modified_sum = arith.addf %sum_next, %sum_init_1 : f32 affine.yield %modified_sum : f32 } return %res : f32 }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @affine_for_not_invariant(%in : memref<30x512xf32, 1>, %out : memref<30x1xf32, 1>) { %sum_0 = arith.constant 0.0 : f32 %cst_0 = arith.constant 1.1 : f32 affine.for %j = 0 to 30 { %sum = affine.for %i = 0 to 512 iter_args(%sum_iter = %sum_0) -> (f32) { %t = affine.load %in[%j,%i] : memref<30x512xf32,1> %sum_next = arith.addf %sum_iter, %t : f32 affine.yield %sum_next : f32 } %mod_sum = arith.mulf %sum, %cst_0 : f32 affine.store %mod_sum, %out[%j, 0] : memref<30x1xf32, 1> } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @use_of_iter_operands_invariant(%m : memref<10xindex>) { %sum_1 = arith.constant 0 : index %v0 = affine.for %arg1 = 0 to 11 iter_args (%prevAccum = %sum_1) -> index { %prod = arith.muli %sum_1, %sum_1 : index %newAccum = arith.addi %prevAccum, %prod : index affine.yield %newAccum : index } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @use_of_iter_args_not_invariant(%m : memref<10xindex>) { %sum_1 = arith.constant 0 : index %v0 = affine.for %arg1 = 0 to 11 iter_args (%prevAccum = %sum_1) -> index { %newAccum = arith.addi %prevAccum, %sum_1 : index affine.yield %newAccum : index } return } #map = affine_map<(d0) -> (64, d0 * -64 + 1020)> func.func @affine_parallel(%memref_8: memref<4090x2040xf32>, %x: index) { %cst = arith.constant 0.000000e+00 : f32 affine.parallel (%arg3) = (0) to (32) { affine.for %arg4 = 0 to 16 { affine.parallel (%arg5, %arg6) = (0, 0) to (min(128, 122), min(64, %arg3 * -64 + 2040)) { affine.for %arg7 = 0 to min #map(%arg4) { affine.store %cst, %memref_8[%arg5 + 3968, %arg6 + %arg3 * 64] : memref<4090x2040xf32> } } } } %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c32 = arith.constant 32 : index scf.parallel (%arg3) = (%c0) to (%c32) step (%c1) { affine.for %arg4 = 0 to 16 { affine.parallel (%arg5, %arg6) = (0, 0) to (min(128, 122), min(64, %x * -64 + 2040)) { affine.for %arg7 = 0 to min #map(%arg4) { affine.store %cst, %memref_8[%arg5 + 3968, %arg6] : memref<4090x2040xf32> } } } } affine.for %arg3 = 0 to 32 { affine.for %arg4 = 0 to 16 { affine.parallel (%arg5, %arg6) = (0, 0) to (min(128, 122), min(64, %arg3 * -64 + 2040)) { scf.for %arg7 = %c0 to %x step %c1 { affine.store %cst, %memref_8[%arg5 + 3968, %arg6 + %arg3 * 64] : memref<4090x2040xf32> } } } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "#map = affine_map<(d0) -> (d0 * 163840)> func.func @affine_invariant_use_after_dma(%arg0: memref<10485760xi32>, %arg1: memref<1xi32>, %arg2: memref<10485760xi32>) { %c320 = arith.constant 320 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %alloc = memref.alloc() {alignment = 16 : i64} : memref<0xi32, 2> %alloc_0 = memref.alloc() : memref<1xi32, 2> affine.for %arg3 = 0 to 64 { %0 = affine.apply #map(%arg3) %alloc_1 = memref.alloc() {alignment = 16 : i64} : memref<0xi32, 2> %alloc_2 = memref.alloc() : memref<320xi32, 2> affine.dma_start %arg0[%0], %alloc_2[%c0], %alloc_1[%c0], %c320 : memref<10485760xi32>, memref<320xi32, 2>, memref<0xi32, 2> affine.dma_start %arg1[%c0], %alloc_0[%c0], %alloc[%c0], %c1 : memref<1xi32>, memref<1xi32, 2>, memref<0xi32, 2> affine.dma_wait %alloc_1[%c0], %c320 : memref<0xi32, 2> affine.dma_wait %alloc[%c0], %c1 : memref<0xi32, 2> %1 = affine.apply #map(%arg3) %alloc_3 = memref.alloc() {alignment = 16 : i64} : memref<0xi32, 2> %alloc_4 = memref.alloc() : memref<320xi32, 2> affine.for %arg4 = 0 to 320 { %2 = affine.load %alloc_2[%arg4] : memref<320xi32, 2> %3 = affine.load %alloc_0[0] : memref<1xi32, 2> %4 = arith.addi %2, %3 : i32 %5 = arith.addi %4, %2 : i32 affine.store %5, %alloc_4[%arg4] : memref<320xi32, 2> } affine.dma_start %alloc_4[%c0], %arg2[%1], %alloc_3[%c0], %c320 : memref<320xi32, 2>, memref<10485760xi32>, memref<0xi32, 2> affine.dma_wait %alloc_3[%c0], %c320 : memref<0xi32, 2> } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @affine_prefetch_invariant() { %0 = memref.alloc() : memref<10x10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i0, %i1] : memref<10x10xf32> affine.prefetch %0[%i0, %i0], write, locality<0>, data : memref<10x10xf32> } } return }", mlir-opt -affine-loop-invariant-code-motion -split-input-file ,1 "func.func @legal_loop() { %0 = memref.alloc() : memref<64xf32> affine.for %i = 0 to 64 { %1 = affine.load %0[%i] : memref<64xf32> %2 = arith.addf %1, %1 : f32 affine.store %2, %0[%i] : memref<64xf32> } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" -verify-diagnostics ",1 "func.func @illegal_loop_with_diag_dependence() { %A = memref.alloc() : memref<64x64xf32> affine.for %i = 0 to 64 { affine.for %j = 0 to 64 { %0 = affine.load %A[%j, %i] : memref<64x64xf32> %1 = affine.load %A[%i, %j - 1] : memref<64x64xf32> %2 = arith.addf %0, %1 : f32 affine.store %2, %A[%i, %j] : memref<64x64xf32> } } return }"," mlir-opt -split-input-file -affine-loop-tile=""tile-size=32"" -verify-diagnostics ",1 "#id = affine_map<(d0) -> (d0)> #ub = affine_map<(d0) -> (d0 + 128)> func.func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<4096x4096xf32>) -> memref<4096x4096xf32> { affine.for %i = 0 to 4096 step 128 { affine.for %j = 0 to 4096 step 128 { affine.for %k = 0 to 4096 step 128 { affine.for %ii = #id(%i) to #ub(%i) { affine.for %jj = #id(%j) to #ub(%j) { affine.for %kk = #id(%k) to #ub(%k) { %5 = affine.load %A[%ii, %kk] : memref<4096x4096xf32> %6 = affine.load %B[%kk, %jj] : memref<4096x4096xf32> %7 = affine.load %C[%ii, %jj] : memref<4096x4096xf32> %8 = arith.mulf %5, %6 : f32 %9 = arith.addf %7, %8 : f32 affine.store %9, %C[%ii, %jj] : memref<4096x4096xf32> } } } } } } return %C : memref<4096x4096xf32> }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"" ",1 "#id = affine_map<(d0) -> (d0)> #ub = affine_map<(d0) -> (d0 + 128)> func.func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<4096x4096xf32>) -> memref<4096x4096xf32> { affine.for %i = 0 to 4096 step 128 { affine.for %j = 0 to 4096 step 128 { affine.for %k = 0 to 4096 step 128 { affine.for %ii = #id(%i) to #ub(%i) { affine.for %jj = #id(%j) to #ub(%j) { affine.for %kk = #id(%k) to #ub(%k) { %5 = affine.load %A[%ii, %kk] : memref<4096x4096xf32> %6 = affine.load %B[%kk, %jj] : memref<4096x4096xf32> %7 = affine.load %C[%ii, %jj] : memref<4096x4096xf32> %8 = arith.mulf %5, %6 : f32 %9 = arith.addf %7, %8 : f32 affine.store %9, %C[%ii, %jj] : memref<4096x4096xf32> } } } } } } return %C : memref<4096x4096xf32> }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 fast-mem-capacity=1"" ",1 "#id = affine_map<(d0) -> (d0)> #ub = affine_map<(d0) -> (d0 + 128)> func.func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<4096x4096xf32>) -> memref<4096x4096xf32> { affine.for %i = 0 to 4096 step 128 { affine.for %j = 0 to 4096 step 128 { affine.for %k = 0 to 4096 step 128 { affine.for %ii = #id(%i) to #ub(%i) { affine.for %jj = #id(%j) to #ub(%j) { affine.for %kk = #id(%k) to #ub(%k) { %5 = affine.load %A[%ii, %kk] : memref<4096x4096xf32> %6 = affine.load %B[%kk, %jj] : memref<4096x4096xf32> %7 = affine.load %C[%ii, %jj] : memref<4096x4096xf32> %8 = arith.mulf %5, %6 : f32 %9 = arith.addf %7, %8 : f32 affine.store %9, %C[%ii, %jj] : memref<4096x4096xf32> } } } } } } return %C : memref<4096x4096xf32> }", mlir-opt -split-input-file -test-affine-data-copy='memref-filter' ,1 "#id = affine_map<(d0) -> (d0)> #ub = affine_map<(d0) -> (d0 + 128)> func.func @matmul(%A: memref<4096x4096xf32>, %B: memref<4096x4096xf32>, %C: memref<4096x4096xf32>) -> memref<4096x4096xf32> { affine.for %i = 0 to 4096 step 128 { affine.for %j = 0 to 4096 step 128 { affine.for %k = 0 to 4096 step 128 { affine.for %ii = #id(%i) to #ub(%i) { affine.for %jj = #id(%j) to #ub(%j) { affine.for %kk = #id(%k) to #ub(%k) { %5 = affine.load %A[%ii, %kk] : memref<4096x4096xf32> %6 = affine.load %B[%kk, %jj] : memref<4096x4096xf32> %7 = affine.load %C[%ii, %jj] : memref<4096x4096xf32> %8 = arith.mulf %5, %6 : f32 %9 = arith.addf %7, %8 : f32 affine.store %9, %C[%ii, %jj] : memref<4096x4096xf32> } } } } } } return %C : memref<4096x4096xf32> }", mlir-opt -split-input-file -test-affine-data-copy='for-memref-region' ,1 "func.func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>) -> memref<1024x1024xf32> { affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %6 = affine.load %arg1[%k, %j] : memref<1024x1024xf32> %7 = affine.load %arg2[%i, %j] : memref<1024x1024xf32> %9 = arith.addf %6, %7 : f32 affine.store %9, %arg2[%i, %j] : memref<1024x1024xf32> } } } return %arg2 : memref<1024x1024xf32> }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"" ",1 "func.func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>) -> memref<1024x1024xf32> { affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %6 = affine.load %arg1[%k, %j] : memref<1024x1024xf32> %7 = affine.load %arg2[%i, %j] : memref<1024x1024xf32> %9 = arith.addf %6, %7 : f32 affine.store %9, %arg2[%i, %j] : memref<1024x1024xf32> } } } return %arg2 : memref<1024x1024xf32> }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 fast-mem-capacity=1"" ",1 "func.func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>) -> memref<1024x1024xf32> { affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %6 = affine.load %arg1[%k, %j] : memref<1024x1024xf32> %7 = affine.load %arg2[%i, %j] : memref<1024x1024xf32> %9 = arith.addf %6, %7 : f32 affine.store %9, %arg2[%i, %j] : memref<1024x1024xf32> } } } return %arg2 : memref<1024x1024xf32> }", mlir-opt -split-input-file -test-affine-data-copy='memref-filter' ,1 "func.func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>) -> memref<1024x1024xf32> { affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %6 = affine.load %arg1[%k, %j] : memref<1024x1024xf32> %7 = affine.load %arg2[%i, %j] : memref<1024x1024xf32> %9 = arith.addf %6, %7 : f32 affine.store %9, %arg2[%i, %j] : memref<1024x1024xf32> } } } return %arg2 : memref<1024x1024xf32> }", mlir-opt -split-input-file -test-affine-data-copy='for-memref-region' ,1 "#map_ub = affine_map<(d0) -> (4096, d0 + 100)> func.func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> { affine.for %i = 0 to 4096 step 100 { affine.for %ii = affine_map<(d0) -> (d0)>(%i) to min #map_ub(%i) { %5 = affine.load %A[%ii] : memref<4096xf32> %6 = arith.mulf %5, %5 : f32 affine.store %6, %A[%ii] : memref<4096xf32> } } return %A : memref<4096xf32> }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"" ",1 "#map_ub = affine_map<(d0) -> (4096, d0 + 100)> func.func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> { affine.for %i = 0 to 4096 step 100 { affine.for %ii = affine_map<(d0) -> (d0)>(%i) to min #map_ub(%i) { %5 = affine.load %A[%ii] : memref<4096xf32> %6 = arith.mulf %5, %5 : f32 affine.store %6, %A[%ii] : memref<4096xf32> } } return %A : memref<4096xf32> }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 fast-mem-capacity=1"" ",1 "#map_ub = affine_map<(d0) -> (4096, d0 + 100)> func.func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> { affine.for %i = 0 to 4096 step 100 { affine.for %ii = affine_map<(d0) -> (d0)>(%i) to min #map_ub(%i) { %5 = affine.load %A[%ii] : memref<4096xf32> %6 = arith.mulf %5, %5 : f32 affine.store %6, %A[%ii] : memref<4096xf32> } } return %A : memref<4096xf32> }", mlir-opt -split-input-file -test-affine-data-copy='memref-filter' ,1 "#map_ub = affine_map<(d0) -> (4096, d0 + 100)> func.func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> { affine.for %i = 0 to 4096 step 100 { affine.for %ii = affine_map<(d0) -> (d0)>(%i) to min #map_ub(%i) { %5 = affine.load %A[%ii] : memref<4096xf32> %6 = arith.mulf %5, %5 : f32 affine.store %6, %A[%ii] : memref<4096xf32> } } return %A : memref<4096xf32> }", mlir-opt -split-input-file -test-affine-data-copy='for-memref-region' ,1 "#lb = affine_map<()[s0, s1] -> (s0 * 512, s1 * 6)> #ub = affine_map<()[s0, s1] -> (s0 * 512 + 512, s1 * 6 + 6)> func.func @max_lower_bound(%M: memref<2048x516xf64>, %i : index, %j : index) { affine.for %ii = 0 to 2048 { affine.for %jj = max #lb()[%i, %j] to min #ub()[%i, %j] { affine.load %M[%ii, %jj] : memref<2048x516xf64> } } return }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"" ",1 "#lb = affine_map<()[s0, s1] -> (s0 * 512, s1 * 6)> #ub = affine_map<()[s0, s1] -> (s0 * 512 + 512, s1 * 6 + 6)> func.func @max_lower_bound(%M: memref<2048x516xf64>, %i : index, %j : index) { affine.for %ii = 0 to 2048 { affine.for %jj = max #lb()[%i, %j] to min #ub()[%i, %j] { affine.load %M[%ii, %jj] : memref<2048x516xf64> } } return }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 fast-mem-capacity=1"" ",1 "#lb = affine_map<()[s0, s1] -> (s0 * 512, s1 * 6)> #ub = affine_map<()[s0, s1] -> (s0 * 512 + 512, s1 * 6 + 6)> func.func @max_lower_bound(%M: memref<2048x516xf64>, %i : index, %j : index) { affine.for %ii = 0 to 2048 { affine.for %jj = max #lb()[%i, %j] to min #ub()[%i, %j] { affine.load %M[%ii, %jj] : memref<2048x516xf64> } } return }", mlir-opt -split-input-file -test-affine-data-copy='memref-filter' ,1 "#lb = affine_map<()[s0, s1] -> (s0 * 512, s1 * 6)> #ub = affine_map<()[s0, s1] -> (s0 * 512 + 512, s1 * 6 + 6)> func.func @max_lower_bound(%M: memref<2048x516xf64>, %i : index, %j : index) { affine.for %ii = 0 to 2048 { affine.for %jj = max #lb()[%i, %j] to min #ub()[%i, %j] { affine.load %M[%ii, %jj] : memref<2048x516xf64> } } return }", mlir-opt -split-input-file -test-affine-data-copy='for-memref-region' ,1 "func.func @empty_loops(%arg0: memref<1024x1024xf64>) { affine.for %i = 0 to 0 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } affine.for %i = 0 to -16 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } return } #map16 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2)> #map17 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2 + 2)> func.func @affine_parallel(%85:memref<2x5x4x2xi64>) { affine.for %arg0 = 0 to 2 { affine.parallel (%arg1) = (0) to (5) { affine.parallel (%arg2) = (0) to (4) { affine.for %arg3 = #map16(%arg0, %arg1, %arg2) to #map17(%arg0, %arg1, %arg2) { %105 = affine.load %85[((%arg3 floordiv 2) floordiv 4) floordiv 5, ((%arg3 floordiv 2) floordiv 4) mod 5, (%arg3 floordiv 2) mod 4, %arg3 mod 2] : memref<2x5x4x2xi64> } } } } return } func.func @index_elt_type(%arg0: memref<1x2x4x8xindex>) { affine.for %arg1 = 0 to 1 { affine.for %arg2 = 0 to 2 { affine.for %arg3 = 0 to 4 { affine.for %arg4 = 0 to 8 { affine.store %arg4, %arg0[%arg1, %arg2, %arg3, %arg4] : memref<1x2x4x8xindex> } } } } return }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"" ",1 "func.func @empty_loops(%arg0: memref<1024x1024xf64>) { affine.for %i = 0 to 0 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } affine.for %i = 0 to -16 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } return } #map16 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2)> #map17 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2 + 2)> func.func @affine_parallel(%85:memref<2x5x4x2xi64>) { affine.for %arg0 = 0 to 2 { affine.parallel (%arg1) = (0) to (5) { affine.parallel (%arg2) = (0) to (4) { affine.for %arg3 = #map16(%arg0, %arg1, %arg2) to #map17(%arg0, %arg1, %arg2) { %105 = affine.load %85[((%arg3 floordiv 2) floordiv 4) floordiv 5, ((%arg3 floordiv 2) floordiv 4) mod 5, (%arg3 floordiv 2) mod 4, %arg3 mod 2] : memref<2x5x4x2xi64> } } } } return } func.func @index_elt_type(%arg0: memref<1x2x4x8xindex>) { affine.for %arg1 = 0 to 1 { affine.for %arg2 = 0 to 2 { affine.for %arg3 = 0 to 4 { affine.for %arg4 = 0 to 8 { affine.store %arg4, %arg0[%arg1, %arg2, %arg3, %arg4] : memref<1x2x4x8xindex> } } } } return }"," mlir-opt -split-input-file -affine-data-copy-generate=""generate-dma=false fast-mem-space=0 fast-mem-capacity=1"" ",1 "func.func @empty_loops(%arg0: memref<1024x1024xf64>) { affine.for %i = 0 to 0 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } affine.for %i = 0 to -16 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } return } #map16 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2)> #map17 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2 + 2)> func.func @affine_parallel(%85:memref<2x5x4x2xi64>) { affine.for %arg0 = 0 to 2 { affine.parallel (%arg1) = (0) to (5) { affine.parallel (%arg2) = (0) to (4) { affine.for %arg3 = #map16(%arg0, %arg1, %arg2) to #map17(%arg0, %arg1, %arg2) { %105 = affine.load %85[((%arg3 floordiv 2) floordiv 4) floordiv 5, ((%arg3 floordiv 2) floordiv 4) mod 5, (%arg3 floordiv 2) mod 4, %arg3 mod 2] : memref<2x5x4x2xi64> } } } } return } func.func @index_elt_type(%arg0: memref<1x2x4x8xindex>) { affine.for %arg1 = 0 to 1 { affine.for %arg2 = 0 to 2 { affine.for %arg3 = 0 to 4 { affine.for %arg4 = 0 to 8 { affine.store %arg4, %arg0[%arg1, %arg2, %arg3, %arg4] : memref<1x2x4x8xindex> } } } } return }", mlir-opt -split-input-file -test-affine-data-copy='memref-filter' ,1 "func.func @empty_loops(%arg0: memref<1024x1024xf64>) { affine.for %i = 0 to 0 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } affine.for %i = 0 to -16 { affine.load %arg0[0, %i] : memref<1024x1024xf64> } return } #map16 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2)> #map17 = affine_map<(d0, d1, d2) -> (d0 * 40 + d1 * 8 + d2 * 2 + 2)> func.func @affine_parallel(%85:memref<2x5x4x2xi64>) { affine.for %arg0 = 0 to 2 { affine.parallel (%arg1) = (0) to (5) { affine.parallel (%arg2) = (0) to (4) { affine.for %arg3 = #map16(%arg0, %arg1, %arg2) to #map17(%arg0, %arg1, %arg2) { %105 = affine.load %85[((%arg3 floordiv 2) floordiv 4) floordiv 5, ((%arg3 floordiv 2) floordiv 4) mod 5, (%arg3 floordiv 2) mod 4, %arg3 mod 2] : memref<2x5x4x2xi64> } } } } return } func.func @index_elt_type(%arg0: memref<1x2x4x8xindex>) { affine.for %arg1 = 0 to 1 { affine.for %arg2 = 0 to 2 { affine.for %arg3 = 0 to 4 { affine.for %arg4 = 0 to 8 { affine.store %arg4, %arg0[%arg1, %arg2, %arg3, %arg4] : memref<1x2x4x8xindex> } } } } return }", mlir-opt -split-input-file -test-affine-data-copy='for-memref-region' ,1 "func.func @simple_store_load() { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } memref.dealloc %m : memref<10xf32> return } func.func @multi_store_load() { %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 %cf9 = arith.constant 9.0 : f32 %m = gpu.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 affine.store %cf8, %m[%i0] : memref<10xf32> affine.store %cf9, %m[%i0] : memref<10xf32> %v2 = affine.load %m[%i0] : memref<10xf32> %v3 = affine.load %m[%i0] : memref<10xf32> %v4 = arith.mulf %v2, %v3 : f32 } gpu.dealloc %m : memref<10xf32> return } func.func @store_load_affine_apply() -> memref<10x10xf32> { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10x10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %t0 = affine.apply affine_map<(d0, d1) -> (d1 + 1)>(%i0, %i1) %t1 = affine.apply affine_map<(d0, d1) -> (d0)>(%i0, %i1) %idx0 = affine.apply affine_map<(d0, d1) -> (d1)> (%t0, %t1) %idx1 = affine.apply affine_map<(d0, d1) -> (d0 - 1)> (%t0, %t1) affine.store %cf7, %m[%idx0, %idx1] : memref<10x10xf32> %v0 = affine.load %m[%i0, %i1] : memref<10x10xf32> %v1 = arith.addf %v0, %v0 : f32 } } return %m : memref<10x10xf32> } func.func @store_load_nested(%N : index) { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } } return } func.func @multi_store_load_nested_no_fwd(%N : index) { %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { affine.store %cf8, %m[%i1] : memref<10xf32> } affine.for %i2 = 0 to %N { %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } } return } func.func @store_load_store_nested_no_fwd(%N : index) { %cf7 = arith.constant 7.0 : f32 %cf9 = arith.constant 9.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 affine.store %cf9, %m[%i0] : memref<10xf32> } } return } func.func @multi_store_load_nested_fwd(%N : index) { %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 %cf9 = arith.constant 9.0 : f32 %cf10 = arith.constant 10.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { affine.store %cf8, %m[%i1] : memref<10xf32> } affine.for %i2 = 0 to %N { affine.store %cf9, %m[%i2] : memref<10xf32> } affine.store %cf10, %m[%i0] : memref<10xf32> affine.for %i3 = 0 to %N { %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } } return } func.func @store_load_no_fwd() { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %v0 = affine.load %m[%i2] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } } } return } func.func @store_load_fwd() { %cf7 = arith.constant 7.0 : f32 %c0 = arith.constant 0 : index %m = memref.alloc() : memref<10xf32> affine.store %cf7, %m[%c0] : memref<10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %v0 = affine.load %m[%c0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } } } return } func.func @store_load_store_nested_fwd(%N : index) -> f32 { %cf7 = arith.constant 7.0 : f32 %cf9 = arith.constant 9.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 %idx = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0) affine.store %cf9, %m[%idx] : memref<10xf32> } } %v3 = affine.load %m[%c1] : memref<10xf32> return %v3 : f32 } func.func @should_not_fwd(%A: memref<100xf32>, %M : index, %N : index) -> f32 { %cf = arith.constant 0.0 : f32 affine.store %cf, %A[%M] : memref<100xf32> %v = affine.load %A[%N] : memref<100xf32> return %v : f32 } func.func @refs_not_known_to_be_equal(%A : memref<100 x 100 x f32>, %M : index) { %N = affine.apply affine_map<(d0) -> (d0 + 1)> (%M) %cf1 = arith.constant 1.0 : f32 affine.for %i = 0 to 100 { affine.for %j = 0 to 100 { %u = affine.load %A[%i, %j] : memref<100x100xf32> affine.store %cf1, %A[%j, %i] : memref<100x100xf32> %v = affine.load %A[%i, %j] : memref<100x100xf32> %w = affine.load %A[%j, %i] : memref<100x100xf32> ""foo"" (%u, %v, %w) : (f32, f32, f32) -> () } } return } func.func @vector_forwarding(%in : memref<512xf32>, %out : memref<512xf32>) { %tmp = memref.alloc() : memref<512xf32> affine.for %i = 0 to 16 { %ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> affine.vector_store %ld0, %tmp[32*%i] : memref<512xf32>, vector<32xf32> %ld1 = affine.vector_load %tmp[32*%i] : memref<512xf32>, vector<32xf32> affine.vector_store %ld1, %out[32*%i] : memref<512xf32>, vector<32xf32> } return } func.func @vector_no_forwarding(%in : memref<512xf32>, %out : memref<512xf32>) { %tmp = memref.alloc() : memref<512xf32> affine.for %i = 0 to 16 { %ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> affine.vector_store %ld0, %tmp[32*%i] : memref<512xf32>, vector<32xf32> %ld1 = affine.vector_load %tmp[32*%i] : memref<512xf32>, vector<16xf32> affine.vector_store %ld1, %out[32*%i] : memref<512xf32>, vector<16xf32> } return } func.func @simple_three_loads(%in : memref<10xf32>) { affine.for %i0 = 0 to 10 { %v0 = affine.load %in[%i0] : memref<10xf32> %v1 = affine.load %in[%i0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 %v3 = affine.load %in[%i0] : memref<10xf32> %v4 = arith.addf %v2, %v3 : f32 } return } func.func @nested_loads_const_index(%in : memref<10xf32>) { %c0 = arith.constant 0 : index %v0 = affine.load %in[%c0] : memref<10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 20 { affine.for %i2 = 0 to 30 { %v1 = affine.load %in[%c0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 } } } return } func.func @nested_loads(%N : index, %in : memref<10xf32>) { affine.for %i0 = 0 to 10 { %v0 = affine.load %in[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { %v1 = affine.load %in[%i0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 } } return } func.func @nested_loads_different_memref_accesses_no_cse(%in : memref<10xf32>) { affine.for %i0 = 0 to 10 { %v0 = affine.load %in[%i0] : memref<10xf32> affine.for %i1 = 0 to 20 { %v1 = affine.load %in[%i1] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 } } return } func.func @load_load_store(%m : memref<10xf32>) { affine.for %i0 = 0 to 10 { %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = affine.load %m[%i0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 affine.store %v2, %m[%i0] : memref<10xf32> } return } func.func @load_load_store_2_loops_no_cse(%N : index, %m : memref<10xf32>) { affine.for %i0 = 0 to 10 { %v0 = affine.load %m[%i0] : memref<10xf32> affine.for %i1 = 0 to %N { %v1 = affine.load %m[%i0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 affine.store %v2, %m[%i0] : memref<10xf32> } } return } func.func @load_load_store_3_loops_no_cse(%m : memref<10xf32>) { %cf1 = arith.constant 1.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %m[%i0] : memref<10xf32> affine.for %i1 = 0 to 20 { affine.for %i2 = 0 to 30 { %v1 = affine.load %m[%i0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 } affine.store %cf1, %m[%i0] : memref<10xf32> } } return } func.func @load_load_store_3_loops(%m : memref<10xf32>) { %cf1 = arith.constant 1.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 20 { %v0 = affine.load %m[%i0] : memref<10xf32> affine.for %i2 = 0 to 30 { %v1 = affine.load %m[%i0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 } } affine.store %cf1, %m[%i0] : memref<10xf32> } return } func.func @loads_in_sibling_loops_const_index_no_cse(%m : memref<10xf32>) { %c0 = arith.constant 0 : index affine.for %i0 = 0 to 10 { %v0 = affine.load %m[%c0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%c0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } return } func.func @load_load_affine_apply(%in : memref<10x10xf32>) { affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %t0 = affine.apply affine_map<(d0, d1) -> (d1 + 1)>(%i0, %i1) %t1 = affine.apply affine_map<(d0, d1) -> (d0)>(%i0, %i1) %idx0 = affine.apply affine_map<(d0, d1) -> (d1)> (%t0, %t1) %idx1 = affine.apply affine_map<(d0, d1) -> (d0 - 1)> (%t0, %t1) %v0 = affine.load %in[%idx0, %idx1] : memref<10x10xf32> %v1 = affine.load %in[%i0, %i1] : memref<10x10xf32> %v2 = arith.addf %v0, %v1 : f32 } } return } func.func @vector_loads(%in : memref<512xf32>, %out : memref<512xf32>) { affine.for %i = 0 to 16 { %ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> %ld1 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> %add = arith.addf %ld0, %ld1 : vector<32xf32> affine.vector_store %ld1, %out[32*%i] : memref<512xf32>, vector<32xf32> } return } func.func @vector_loads_no_cse(%in : memref<512xf32>, %out : memref<512xf32>) { affine.for %i = 0 to 16 { %ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> %ld1 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<16xf32> affine.vector_store %ld1, %out[32*%i] : memref<512xf32>, vector<16xf32> } return } func.func @vector_load_store_load_no_cse(%in : memref<512xf32>, %out : memref<512xf32>) { affine.for %i = 0 to 16 { %ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> affine.vector_store %ld0, %in[16*%i] : memref<512xf32>, vector<32xf32> %ld1 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> %add = arith.addf %ld0, %ld1 : vector<32xf32> affine.vector_store %ld1, %out[32*%i] : memref<512xf32>, vector<32xf32> } return } func.func @reduction_multi_store() -> memref<1xf32> { %A = memref.alloc() : memref<1xf32> %cf0 = arith.constant 0.0 : f32 %cf5 = arith.constant 5.0 : f32 affine.store %cf0, %A[0] : memref<1xf32> affine.for %i = 0 to 100 step 2 { %l = affine.load %A[0] : memref<1xf32> %s = arith.addf %l, %cf5 : f32 affine.store %s, %A[0] : memref<1xf32> %m = affine.load %A[0] : memref<1xf32> ""test.foo""(%m) : (f32) -> () } return %A : memref<1xf32> } func.func @vector_load_affine_apply_store_load(%in : memref<512xf32>, %out : memref<512xf32>) { %cf1 = arith.constant 1: index affine.for %i = 0 to 15 { %ld0 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> %idx = affine.apply affine_map<(d0) -> (d0 + 1)> (%i) affine.vector_store %ld0, %in[32*%idx] : memref<512xf32>, vector<32xf32> %ld1 = affine.vector_load %in[32*%i] : memref<512xf32>, vector<32xf32> %add = arith.addf %ld0, %ld1 : vector<32xf32> affine.vector_store %ld1, %out[32*%i] : memref<512xf32>, vector<32xf32> } return } func.func @external_no_forward_load(%in : memref<512xf32>, %out : memref<512xf32>) { affine.for %i = 0 to 16 { %ld0 = affine.load %in[32*%i] : memref<512xf32> affine.store %ld0, %out[32*%i] : memref<512xf32> ""memop""(%in, %out) : (memref<512xf32>, memref<512xf32>) -> () %ld1 = affine.load %in[32*%i] : memref<512xf32> affine.store %ld1, %out[32*%i] : memref<512xf32> } return } func.func @external_no_forward_store(%in : memref<512xf32>, %out : memref<512xf32>) { %cf1 = arith.constant 1.0 : f32 affine.for %i = 0 to 16 { affine.store %cf1, %in[32*%i] : memref<512xf32> ""memop""(%in, %out) : (memref<512xf32>, memref<512xf32>) -> () %ld1 = affine.load %in[32*%i] : memref<512xf32> affine.store %ld1, %out[32*%i] : memref<512xf32> } return } func.func @no_forward_cast(%in : memref<512xf32>, %out : memref<512xf32>) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 %m2 = memref.cast %in : memref<512xf32> to memref affine.for %i = 0 to 16 { affine.store %cf1, %in[32*%i] : memref<512xf32> affine.store %cf2, %m2[32*%i] : memref %ld1 = affine.load %in[32*%i] : memref<512xf32> affine.store %ld1, %out[32*%i] : memref<512xf32> } return } func.func @overlap_no_fwd(%N : index) -> f32 { %cf7 = arith.constant 7.0 : f32 %cf9 = arith.constant 9.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 5 { affine.store %cf7, %m[2 * %i0] : memref<10xf32> affine.for %i1 = 0 to %N { %v0 = affine.load %m[2 * %i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 affine.store %cf9, %m[%i0 + 1] : memref<10xf32> } } %v3 = affine.load %m[%c1] : memref<10xf32> return %v3 : f32 } func.func @redundant_store_elim(%out : memref<512xf32>) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 affine.for %i = 0 to 16 { affine.store %cf1, %out[32*%i] : memref<512xf32> affine.store %cf2, %out[32*%i] : memref<512xf32> } return } func.func @redundant_store_elim_fail(%out : memref<512xf32>) { %cf1 = arith.constant 1.0 : f32 %cf2 = arith.constant 2.0 : f32 affine.for %i = 0 to 16 { affine.store %cf1, %out[32*%i] : memref<512xf32> ""test.use""(%out) : (memref<512xf32>) -> () affine.store %cf2, %out[32*%i] : memref<512xf32> } return } func.func @with_inner_ops(%arg0: memref, %arg1: memref, %arg2: i1) { %cst = arith.constant 0.000000e+00 : f64 %cst_0 = arith.constant 3.140000e+00 : f64 %cst_1 = arith.constant 1.000000e+00 : f64 affine.for %arg3 = 0 to 28 { affine.store %cst, %arg1[%arg3] : memref affine.store %cst_0, %arg1[%arg3] : memref %0 = scf.if %arg2 -> (f64) { scf.yield %cst_1 : f64 } else { %1 = affine.load %arg1[%arg3] : memref scf.yield %1 : f64 } affine.store %0, %arg0[%arg3] : memref } return } func.func @affine_store_load_in_scope(%memref: memref<1x4094x510x1xf32>, %memref_2: memref<4x4x1x64xf32>, %memref_0: memref<1x2046x254x1x64xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c64 = arith.constant 64 : index %c768 = arith.constant 768 : index scf.for %i = %c0 to %c768 step %c1 { %9 = arith.remsi %i, %c64 : index %10 = arith.divsi %i, %c64 : index %11 = arith.remsi %10, %c2 : index %12 = arith.divsi %10, %c2 : index test.affine_scope { %14 = arith.muli %12, %c2 : index %15 = arith.addi %c2, %14 : index %16 = arith.addi %15, %c0 : index %18 = arith.muli %11, %c2 : index %19 = arith.addi %c2, %18 : index %20 = affine.load %memref[0, symbol(%16), symbol(%19), 0] : memref<1x4094x510x1xf32> %21 = affine.load %memref_2[0, 0, 0, symbol(%9)] : memref<4x4x1x64xf32> %24 = affine.load %memref_0[0, symbol(%12), symbol(%11), 0, symbol(%9)] : memref<1x2046x254x1x64xf32> %25 = arith.mulf %20, %21 : f32 %26 = arith.addf %24, %25 : f32 affine.store %26, %memref_0[0, symbol(%12), symbol(%11), 0, symbol(%9)] : memref<1x2046x254x1x64xf32> %27 = arith.addi %19, %c1 : index %28 = affine.load %memref[0, symbol(%16), symbol(%27), 0] : memref<1x4094x510x1xf32> %29 = affine.load %memref_2[0, 1, 0, symbol(%9)] : memref<4x4x1x64xf32> %30 = affine.load %memref_0[0, symbol(%12), symbol(%11), 0, symbol(%9)] : memref<1x2046x254x1x64xf32> %31 = arith.mulf %28, %29 : f32 %32 = arith.addf %30, %31 : f32 ""terminate""() : () -> () } } return } func.func @affine_load_store_in_different_scopes() -> memref<1xf32> { %A = memref.alloc() : memref<1xf32> %cf0 = arith.constant 0.0 : f32 %cf5 = arith.constant 5.0 : f32 affine.store %cf0, %A[0] : memref<1xf32> test.affine_scope { affine.store %cf5, %A[0] : memref<1xf32> ""test.terminate""() : () -> () } %v = affine.load %A[0] : memref<1xf32> return %A : memref<1xf32> } func.func @no_forwarding_across_scopes() -> memref<1xf32> { %A = memref.alloc() : memref<1xf32> %cf0 = arith.constant 0.0 : f32 %cf5 = arith.constant 5.0 : f32 %c0 = arith.constant 0 : index %c100 = arith.constant 100 : index %c1 = arith.constant 1 : index affine.store %cf0, %A[0] : memref<1xf32> test.affine_scope { %l = affine.load %A[0] : memref<1xf32> %s = arith.addf %l, %cf5 : f32 affine.store %s, %A[0] : memref<1xf32> ""terminator""() : () -> () } return %A : memref<1xf32> } func.func @parallel_store_load() { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.parallel (%i0) = (0) to (10) { affine.store %cf7, %m[%i0] : memref<10xf32> %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } memref.dealloc %m : memref<10xf32> return } func.func @non_constant_parallel_store_load(%N : index) { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.parallel (%i0) = (0) to (%N) { affine.store %cf7, %m[%i0] : memref<10xf32> %v0 = affine.load %m[%i0] : memref<10xf32> %v1 = arith.addf %v0, %v0 : f32 } memref.dealloc %m : memref<10xf32> return } func.func @parallel_surrounding_for() { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10x10xf32> affine.parallel (%i0) = (0) to (10) { affine.for %i1 = 0 to 10 { affine.store %cf7, %m[%i0,%i1] : memref<10x10xf32> %v0 = affine.load %m[%i0,%i1] : memref<10x10xf32> %v1 = arith.addf %v0, %v0 : f32 } } memref.dealloc %m : memref<10x10xf32> return } func.func @dead_affine_region_op() { %c1 = arith.constant 1 : index %alloc = memref.alloc() : memref<15xi1> %true = arith.constant true affine.store %true, %alloc[%c1] : memref<15xi1> affine.store %true, %alloc[%c1] : memref<15xi1> affine.if affine_set<(d0, d1, d2, d3) : ((d0 + 1) mod 8 >= 0, d0 * -8 >= 0)>(%c1, %c1, %c1, %c1){ affine.load %alloc[%c1] : memref<15xi1> } return } func.func @cross_block() { %c10 = arith.constant 10 : index %alloc_83 = memref.alloc() : memref<1x13xf32> %alloc_99 = memref.alloc() : memref<13xi1> %true_110 = arith.constant true affine.store %true_110, %alloc_99[%c10] : memref<13xi1> %true = arith.constant true affine.store %true, %alloc_99[%c10] : memref<13xi1> cf.br ^bb1(%alloc_83 : memref<1x13xf32>) ^bb1(%35: memref<1x13xf32>): %69 = affine.load %alloc_99[%c10] : memref<13xi1> return }", mlir-opt -allow-unregistered-dialect -affine-scalrep ,1 "func.func @simple_test_1(%0: index, %1: index, %2: index, %lb: index, %ub: index, %step: index) { %a = affine.apply affine_map<(d0) -> ((d0 floordiv 32) mod 4 + 42)>(%1) ""some_side_effecting_consumer""(%a) : (index) -> () return }", mlir-opt -allow-unregistered-dialect -test-decompose-affine-ops -split-input-file -loop-invariant-code-motion -cse ,1 "func.func @simple_test_2(%0: index, %1: index, %2: index, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { scf.for %j = %lb to %ub step %step { %a = affine.apply affine_map<(d0)[s0] -> ((d0 floordiv 32) mod 4 + s0 + 42)>(%j)[%i] ""some_side_effecting_consumer""(%a) : (index) -> () } } return }", mlir-opt -allow-unregistered-dialect -test-decompose-affine-ops -split-input-file -loop-invariant-code-motion -cse ,1 "func.func @larger_test(%0: index, %1: index, %2: index, %lb: index, %ub: index, %step: index) { %c2 = arith.constant 2 : index %c6 = arith.constant 6 : index scf.for %i = %lb to %ub step %step { scf.for %j = %lb to %ub step %step { %a = affine.apply affine_map<()[s0, s1, s2, s3] -> (s1 * 16 + s2 * 32 + s3 * 32 + s0 floordiv 4)>()[%0, %1, %2, %i] %b = affine.apply affine_map<()[s0, s1, s2] -> (s1 * 16 + s2 * 32 + s0 floordiv 4)>()[%0, %1, %2] %c = affine.apply affine_map<()[s0] -> (s0 * 8 - (s0 floordiv 4) * 32)>()[%0] %d = affine.apply affine_map<()[s0, s1] -> (s0 * 8 + s1 * 32 - (s0 floordiv 4) * 32)>()[%0, %j] scf.for %k = %lb to %ub step %step { %e = affine.apply affine_map<()[s0, s1] -> (s0 + s1 * 8 - (s1 floordiv 4) * 32)>()[%k, %0] %f = affine.apply affine_map<(d0)[s0] -> ((d0 floordiv 32) mod 4 + s0)>(%k)[%j] %g = affine.apply affine_map<()[s0, s1, s2, s3] -> (s0 + s2 * 16 + s3 * 32 + s1 floordiv 4)>()[%k, %0, %1, %2] ""some_side_effecting_consumer""(%a) : (index) -> () ""some_side_effecting_consumer""(%b) : (index) -> () ""some_side_effecting_consumer""(%c) : (index) -> () ""some_side_effecting_consumer""(%d) : (index) -> () ""some_side_effecting_consumer""(%e) : (index) -> () ""some_side_effecting_consumer""(%f) : (index) -> () ""some_side_effecting_consumer""(%g) : (index) -> () } } } return }", mlir-opt -allow-unregistered-dialect -test-decompose-affine-ops -split-input-file -loop-invariant-code-motion -cse ,1 "func.func @loop_tiling_3d(%t0 : index, %t1 : index, %t2 : index) { affine.for %i = 0 to 256 { affine.for %j = 0 to 512 { affine.for %k = 0 to 1024 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @loop_tiling_non_unit_step(%t0: index, %t1: index, %t2: index){ affine.for %i = 0 to 256 step 4 { affine.for %j = 0 to 512 step 3 { affine.for %k = 0 to 1024 step 2 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "#ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)> func.func @tile_loop_with_div_in_upper_bound(%t5 : index, %A : memref, %L : index, %U : index) { %c0 = arith.constant 0 : index %M = memref.dim %A, %c0 : memref affine.for %i = 0 to min #ub()[%M, %U] { arith.addi %i, %i : index } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "#ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)> func.func @tile_loop_with_div_in_upper_bound_non_unit_step(%t5 : index, %A : memref, %L : index, %U : index) { %c0 = arith.constant 0 : index %M = memref.dim %A, %c0 : memref affine.for %i = 0 to min #ub()[%M, %U] step 4 { arith.addi %i, %i : index } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "#ubi = affine_map<()[s0] -> (s0 + 16)> func.func @tile_loop_with_non_zero_lb(%t0: index, %t1: index, %t2: index, %U: index){ affine.for %i = 8 to 256 { affine.for %j = 8 to #ubi()[%U] { affine.for %k = 8 to #ubi()[%U] step 4 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @simple_matmul(%t6 : index, %t7 : index, %t8 : index, %arg0: memref<256x256xvector<64xf32>>, %arg1: memref<256x256xvector<64xf32>>, %arg2: memref<256x256xvector<64xf32>>) -> memref<256x256xvector<64xf32>> { affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { affine.for %k = 0 to 250 { %l = affine.load %arg0[%i, %k] : memref<256x256xvector<64xf32>> %r = affine.load %arg1[%k, %j] : memref<256x256xvector<64xf32>> %o = affine.load %arg2[%i, %j] : memref<256x256xvector<64xf32>> %m = arith.mulf %l, %r : vector<64xf32> %a = arith.addf %o, %m : vector<64xf32> affine.store %a, %arg2[%i, %j] : memref<256x256xvector<64xf32>> } } } return %arg2 : memref<256x256xvector<64xf32>> }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @tile_with_symbolic_loop_upper_bounds(%t9 : index, %t10: index, %arg0: memref, %arg1: memref, %arg2: memref) { %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index %0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %0 { affine.store %cst, %arg2[%i0, %i1] : memref affine.for %i2 = 0 to %0 { %1 = affine.load %arg0[%i0, %i2] : memref %2 = affine.load %arg1[%i2, %i1] : memref %3 = arith.mulf %1, %2 : f32 %4 = affine.load %arg2[%i0, %i1] : memref %5 = arith.addf %4, %3 : f32 affine.store %5, %arg2[%i0, %i1] : memref } } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @tile_with_loop_upper_bounds_in_two_symbols(%t11 : index, %arg0: memref, %limit: index) { %c0 = arith.constant 0 : index %dim0 = memref.dim %arg0, %c0 : memref affine.for %i0 = 0 to affine_map<()[s0, s1] -> (s0 + s1)> ()[%dim0, %limit] { %v0 = affine.load %arg0[%i0] : memref } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @tile_with_upper_bounds_in_dimensions_and_symbols(%t12 : index, %t13 :index, %M: index, %N: index, %K: index) { affine.for %i = 0 to affine_map<(d0)[s0] -> (d0 + s0 + 2)>(%M)[%K] { affine.for %j = 0 to affine_map<(d0)[s0] -> (d0 + s0 + 4)>(%N)[%K] { ""test.foo"" () : () -> () } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @tile_with_upper_bounds_in_dimensions_and_symbols_non_unit_steps(%t12 : index, %t13 :index, %M: index, %N : index, %K: index) { affine.for %i = 0 to affine_map<(d0)[s0] -> (d0 + s0 + 2)>(%M)[%K] step 2 { affine.for %j = 0 to affine_map<(d0)[s0] -> (d0 + s0 + 4)>(%N)[%K] step 4 { ""test.foo"" () : () -> () } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @too_few_tile_size_params() { affine.for %i = 0 to 256 { affine.for %j = 0 to 512 { affine.for %k = 0 to 1024 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @invalid_type_for_tile_size_params(%arg0: f32, %arg1: f32, %arg2: f32) { affine.for %i = 0 to 256 { affine.for %j = 0 to 512 { affine.for %k = 0 to 1024 { ""test.foo""(%i, %j, %k) : (index, index, index) -> () } } } return }", mlir-opt -split-input-file -test-affine-parametric-tile -verify-diagnostics ,1 "func.func @permute(%U0 : index, %U1 : index, %U2 : index) { ""abc""() : () -> () affine.for %arg0 = 0 to %U0 { affine.for %arg1 = 0 to %U1 { affine.for %arg2 = 0 to %U2 { ""foo""(%arg0, %arg1) : (index, index) -> () ""bar""(%arg2) : (index) -> () } } } ""xyz""() : () -> () return }"," mlir-opt -allow-unregistered-dialect -test-loop-permutation=""permutation-map=1,2,0"" ",1 "func.func @permute(%U0 : index, %U1 : index, %U2 : index) { ""abc""() : () -> () affine.for %arg0 = 0 to %U0 { affine.for %arg1 = 0 to %U1 { affine.for %arg2 = 0 to %U2 { ""foo""(%arg0, %arg1) : (index, index) -> () ""bar""(%arg2) : (index) -> () } } } ""xyz""() : () -> () return }"," mlir-opt -allow-unregistered-dialect -test-loop-permutation=""permutation-map=1,0,2"" ",1 "func.func @permute(%U0 : index, %U1 : index, %U2 : index) { ""abc""() : () -> () affine.for %arg0 = 0 to %U0 { affine.for %arg1 = 0 to %U1 { affine.for %arg2 = 0 to %U2 { ""foo""(%arg0, %arg1) : (index, index) -> () ""bar""(%arg2) : (index) -> () } } } ""xyz""() : () -> () return }"," mlir-opt -allow-unregistered-dialect -test-loop-permutation=""permutation-map=0,1,2"" ",1 "func.func @permute(%U0 : index, %U1 : index, %U2 : index) { ""abc""() : () -> () affine.for %arg0 = 0 to %U0 { affine.for %arg1 = 0 to %U1 { affine.for %arg2 = 0 to %U2 { ""foo""(%arg0, %arg1) : (index, index) -> () ""bar""(%arg2) : (index) -> () } } } ""xyz""() : () -> () return }"," mlir-opt -allow-unregistered-dialect -test-loop-permutation=""permutation-map=0,2,1"" ",1 "func.func @permute(%U0 : index, %U1 : index, %U2 : index) { ""abc""() : () -> () affine.for %arg0 = 0 to %U0 { affine.for %arg1 = 0 to %U1 { affine.for %arg2 = 0 to %U2 { ""foo""(%arg0, %arg1) : (index, index) -> () ""bar""(%arg2) : (index) -> () } } } ""xyz""() : () -> () return }"," mlir-opt -allow-unregistered-dialect -test-loop-permutation=""permutation-map=2,0,1"" ",1 "func.func @permute(%U0 : index, %U1 : index, %U2 : index) { ""abc""() : () -> () affine.for %arg0 = 0 to %U0 { affine.for %arg1 = 0 to %U1 { affine.for %arg2 = 0 to %U2 { ""foo""(%arg0, %arg1) : (index, index) -> () ""bar""(%arg2) : (index) -> () } } } ""xyz""() : () -> () return }"," mlir-opt -allow-unregistered-dialect -test-loop-permutation=""permutation-map=2,1,0"" ",1 "func.func @vec2d(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %P { %a2 = affine.load %A[%i0, %i1, %i2] : memref } } } affine.for %i3 = 0 to %M { affine.for %i4 = 0 to %N { affine.for %i5 = 0 to %P { %a5 = affine.load %A[%i4, %i5, %i3] : memref } } } return } func.func @vec2d_imperfectly_nested(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %A, %c0 : memref %1 = memref.dim %A, %c1 : memref %2 = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %1 { affine.for %i2 = 0 to %2 { %a2 = affine.load %A[%i2, %i1, %i0] : memref } } affine.for %i3 = 0 to %1 { affine.for %i4 = 0 to %2 { %a4 = affine.load %A[%i3, %i4, %i0] : memref } affine.for %i5 = 0 to %2 { %a5 = affine.load %A[%i3, %i5, %i0] : memref } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=32,256 test-fastest-varying=0,1"" ",1 "func.func @vecdim_reduction(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_minf(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0x7F800000 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %min = arith.minf %red_iter, %ld : f32 affine.yield %min : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_maxf(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0xFF800000 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %max = arith.maxf %red_iter, %ld : f32 affine.yield %max : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_minsi(%in: memref<256x512xi32>, %out: memref<256xi32>) { %cst = arith.constant 2147483647 : i32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (i32) { %ld = affine.load %in[%i, %j] : memref<256x512xi32> %min = arith.minsi %red_iter, %ld : i32 affine.yield %min : i32 } affine.store %final_red, %out[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_maxsi(%in: memref<256x512xi32>, %out: memref<256xi32>) { %cst = arith.constant -2147483648 : i32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (i32) { %ld = affine.load %in[%i, %j] : memref<256x512xi32> %max = arith.maxsi %red_iter, %ld : i32 affine.yield %max : i32 } affine.store %final_red, %out[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_minui(%in: memref<256x512xi32>, %out: memref<256xi32>) { %cst = arith.constant -1 : i32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (i32) { %ld = affine.load %in[%i, %j] : memref<256x512xi32> %min = arith.minui %red_iter, %ld : i32 affine.yield %min : i32 } affine.store %final_red, %out[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_maxui(%in: memref<256x512xi32>, %out: memref<256xi32>) { %cst = arith.constant 0 : i32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (i32) { %ld = affine.load %in[%i, %j] : memref<256x512xi32> %max = arith.maxui %red_iter, %ld : i32 affine.yield %max : i32 } affine.store %final_red, %out[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_andi(%in: memref<256x512xi32>, %out: memref<256xi32>) { %cst = arith.constant -1 : i32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (i32) { %ld = affine.load %in[%i, %j] : memref<256x512xi32> %or = arith.andi %red_iter, %ld : i32 affine.yield %or : i32 } affine.store %final_red, %out[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_ori(%in: memref<256x512xi32>, %out: memref<256xi32>) { %cst = arith.constant 0 : i32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (i32) { %ld = affine.load %in[%i, %j] : memref<256x512xi32> %or = arith.ori %red_iter, %ld : i32 affine.yield %or : i32 } affine.store %final_red, %out[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_comm(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %ld, %red_iter : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_expsin(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %sin = math.sin %ld : f32 %exp = math.exp %sin : f32 %add = arith.addf %red_iter, %exp : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @two_vecdim_reductions(%in: memref<256x512xf32>, %out_sum: memref<256xf32>, %out_prod: memref<256xf32>) { %cst = arith.constant 1.000000e+00 : f32 affine.for %i = 0 to 256 { %sum, %prod = affine.for %j = 0 to 512 iter_args(%part_sum = %cst, %part_prod = %cst) -> (f32, f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %part_sum, %ld : f32 %mul = arith.mulf %part_prod, %ld : f32 affine.yield %add, %mul : f32, f32 } affine.store %sum, %out_sum[%i] : memref<256xf32> affine.store %prod, %out_prod[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @two_vecdim_reductions_int(%in: memref<256x512xi64>, %out_sum: memref<256xi64>, %out_prod: memref<256xi64>) { %cst0 = arith.constant 0 : i64 %cst1 = arith.constant 1 : i64 affine.for %i = 0 to 256 { %sum, %prod = affine.for %j = 0 to 512 iter_args(%part_sum = %cst0, %part_prod = %cst1) -> (i64, i64) { %ld = affine.load %in[%i, %j] : memref<256x512xi64> %add = arith.addi %part_sum, %ld : i64 %mul = arith.muli %part_prod, %ld : i64 affine.yield %add, %mul : i64, i64 } affine.store %sum, %out_sum[%i] : memref<256xi64> affine.store %prod, %out_prod[%i] : memref<256xi64> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_nested(%in: memref<256x512xf32>, %out: memref<1xf32>) { %cst = arith.constant 0.000000e+00 : f32 %outer_red = affine.for %j = 0 to 512 iter_args(%outer_iter = %cst) -> (f32) { %inner_red = affine.for %i = 0 to 256 iter_args(%inner_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %inner_iter, %ld : f32 affine.yield %add : f32 } %outer_add = arith.addf %outer_iter, %inner_red : f32 affine.yield %outer_add : f32 } affine.store %outer_red, %out[0] : memref<1xf32> return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_partial_sums_1_rejected(%in: memref<256x512xf32>, %out_sum: memref<256xf32>, %out_prod: memref<256xf32>, %out_partsum: memref<256x512xf32>) { %cst = arith.constant 1.000000e+00 : f32 affine.for %i = 0 to 256 { %sum, %prod = affine.for %j = 0 to 512 iter_args(%part_sum = %cst, %part_prod = %cst) -> (f32, f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %part_sum, %ld : f32 %mul = arith.mulf %part_prod, %ld : f32 affine.store %add, %out_partsum[%i, %j] : memref<256x512xf32> affine.yield %add, %mul : f32, f32 } affine.store %sum, %out_sum[%i] : memref<256xf32> affine.store %prod, %out_prod[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_partial_sums_2_rejected(%in: memref<256x512xf32>, %out_sum: memref<256xf32>, %out_prod: memref<256xf32>, %out_partsum: memref<256x512xf32>) { %cst = arith.constant 1.000000e+00 : f32 affine.for %i = 0 to 256 { %sum, %prod = affine.for %j = 0 to 512 iter_args(%part_sum = %cst, %part_prod = %cst) -> (f32, f32) { affine.store %part_sum, %out_partsum[%i, %j] : memref<256x512xf32> %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %part_sum, %ld : f32 %mul = arith.mulf %part_prod, %ld : f32 affine.yield %add, %mul : f32, f32 } affine.store %sum, %out_sum[%i] : memref<256xf32> affine.store %prod, %out_prod[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_unknown_reduction_rejected(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 1.000000e+00 : f32 %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %add = arith.addf %red_iter, %red_iter : f32 affine.yield %add : f32 } affine.store %final_red, %out[0] : memref<256xf32> return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_none_reduction_rejected(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 1.000000e+00 : f32 %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { affine.yield %red_iter : f32 } affine.store %final_red, %out[0] : memref<256xf32> return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_masked(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 500 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_masked_unknown_ub(%in: memref<256x512xf32>, %out: memref<256xf32>, %bnd: index) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to %bnd iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_nonzero_lb(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 127 to 511 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_masked_unknown_lb(%in: memref<256x512xf32>, %out: memref<256xf32>, %lb: index) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = %lb to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_reduction_complex_ub(%in: memref<256x512xf32>, %out: memref<256xf32>, %M: index, %N: index) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to min affine_map<(d0, d1) -> (d0, d1*2)>(%M, %N) iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vecdim_two_reductions_masked(%in: memref<256x512xf32>, %out: memref<512xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_sum, %final_expsum = affine.for %j = 0 to 500 iter_args(%sum_iter = %cst, %expsum_iter = %cst) -> (f32, f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %exp = math.exp %ld : f32 %add = arith.addf %sum_iter, %ld : f32 %eadd = arith.addf %expsum_iter, %exp : f32 affine.yield %add, %eadd : f32, f32 } affine.store %final_sum, %out[2*%i] : memref<512xf32> affine.store %final_expsum, %out[2*%i + 1] : memref<512xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0 vectorize-reductions=true"" -split-input-file ",1 "func.func @vector_add_2d(%arg0: index, %arg1: index) -> f32 { %0 = memref.alloc(%arg0, %arg1) : memref %1 = memref.alloc(%arg0, %arg1) : memref %2 = memref.alloc(%arg0, %arg1) : memref %c0 = arith.constant 0 : index %cst = arith.constant 1.000000e+00 : f32 %cst_1 = arith.constant dense<1.000000e+00> : vector<8x256xf32> %cst_a = arith.constant dense<1.000000e+00> : vector<1x3x7x8x8xf32> %cst_b = arith.constant dense<1.000000e+00> : vector<1x3x7x4x4xf32> %cst_c = arith.constant dense<1.000000e+00> : vector<3x4x5x8xf32> %cst_d = arith.constant dense<1.000000e+00> : vector<3x4x4x8xf32> %cst_e = arith.constant dense<1.000000e+00> : vector<1x2x10x32xf32> %c7 = arith.constant 7 : index %c42 = arith.constant 42 : index %9 = memref.load %2[%c7, %c42] : memref return %9 : f32 } func.func @double_loop_nest(%a: memref<20x30xf32>, %b: memref<20xf32>) { affine.for %i = 0 to 20 { %b_ld = affine.load %b[%i] : memref<20xf32> affine.for %j = 0 to 30 { %a_ld = affine.load %a[%i, %j] : memref<20x30xf32> affine.store %a_ld, %a[%i, %j] : memref<20x30xf32> } affine.store %b_ld, %b[%i] : memref<20xf32> } return }", mlir-opt -affine-super-vectorizer-test -vector-shape-ratio 4 -vector-shape-ratio 8 2>&1 ,1 "func.func @vector_add_2d(%arg0: index, %arg1: index) -> f32 { %0 = memref.alloc(%arg0, %arg1) : memref %1 = memref.alloc(%arg0, %arg1) : memref %2 = memref.alloc(%arg0, %arg1) : memref %c0 = arith.constant 0 : index %cst = arith.constant 1.000000e+00 : f32 %cst_1 = arith.constant dense<1.000000e+00> : vector<8x256xf32> %cst_a = arith.constant dense<1.000000e+00> : vector<1x3x7x8x8xf32> %cst_b = arith.constant dense<1.000000e+00> : vector<1x3x7x4x4xf32> %cst_c = arith.constant dense<1.000000e+00> : vector<3x4x5x8xf32> %cst_d = arith.constant dense<1.000000e+00> : vector<3x4x4x8xf32> %cst_e = arith.constant dense<1.000000e+00> : vector<1x2x10x32xf32> %c7 = arith.constant 7 : index %c42 = arith.constant 42 : index %9 = memref.load %2[%c7, %c42] : memref return %9 : f32 } func.func @double_loop_nest(%a: memref<20x30xf32>, %b: memref<20xf32>) { affine.for %i = 0 to 20 { %b_ld = affine.load %b[%i] : memref<20xf32> affine.for %j = 0 to 30 { %a_ld = affine.load %a[%i, %j] : memref<20x30xf32> affine.store %a_ld, %a[%i, %j] : memref<20x30xf32> } affine.store %b_ld, %b[%i] : memref<20xf32> } return }", mlir-opt -affine-super-vectorizer-test -vector-shape-ratio 2 -vector-shape-ratio 5 -vector-shape-ratio 2 2>&1 ,1 "func.func @vector_add_2d(%arg0: index, %arg1: index) -> f32 { %0 = memref.alloc(%arg0, %arg1) : memref %1 = memref.alloc(%arg0, %arg1) : memref %2 = memref.alloc(%arg0, %arg1) : memref %c0 = arith.constant 0 : index %cst = arith.constant 1.000000e+00 : f32 %cst_1 = arith.constant dense<1.000000e+00> : vector<8x256xf32> %cst_a = arith.constant dense<1.000000e+00> : vector<1x3x7x8x8xf32> %cst_b = arith.constant dense<1.000000e+00> : vector<1x3x7x4x4xf32> %cst_c = arith.constant dense<1.000000e+00> : vector<3x4x5x8xf32> %cst_d = arith.constant dense<1.000000e+00> : vector<3x4x4x8xf32> %cst_e = arith.constant dense<1.000000e+00> : vector<1x2x10x32xf32> %c7 = arith.constant 7 : index %c42 = arith.constant 42 : index %9 = memref.load %2[%c7, %c42] : memref return %9 : f32 } func.func @double_loop_nest(%a: memref<20x30xf32>, %b: memref<20xf32>) { affine.for %i = 0 to 20 { %b_ld = affine.load %b[%i] : memref<20xf32> affine.for %j = 0 to 30 { %a_ld = affine.load %a[%i, %j] : memref<20x30xf32> affine.store %a_ld, %a[%i, %j] : memref<20x30xf32> } affine.store %b_ld, %b[%i] : memref<20xf32> } return }", mlir-opt -affine-super-vectorizer-test -vectorize-affine-loop-nest 2>&1 ,1 "func.func @uniform_arg(%in : memref<512xf32>, %uniform : f32) { affine.for %i = 0 to 512 { %ld = affine.load %in[%i] : memref<512xf32> %add = arith.addf %ld, %uniform : f32 } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128"" -split-input-file ",1 "func.func @multi_use_uniform_arg(%in : memref<512xf32>, %uniform : f32) { affine.for %i = 0 to 512 { %ld = affine.load %in[%i] : memref<512xf32> %user0 = arith.addf %ld, %uniform : f32 %user1 = arith.addf %ld, %uniform : f32 } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128"" -split-input-file ",1 "func.func @uniform_load(%A : memref, %C : memref) { %c0 = arith.constant 0 : index %N = memref.dim %A, %c0 : memref affine.for %i = 0 to %N { %uniform_ld = affine.load %A[%i, %i] : memref affine.for %j = 0 to %N { %b = affine.load %A[%i, %j] : memref %c = arith.addf %uniform_ld, %b : f32 } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128"" -split-input-file ",1 "func.func @invalid_operand(%a : vector<4xf32>, %b : vector<4xf32>) { affine.for %j = 0 to 10 { %1 = vector.reduction , %a : vector<4xf32> into f32 } return } func.func @invalid_result(%a : memref<10x20xf32>, %b : memref<10x20xf32>) { affine.for %j = 0 to 10 { affine.for %i = 0 to 5 { %ld0 = affine.vector_load %a[%j, %i] : memref<10x20xf32>, vector<4xf32> affine.vector_store %ld0, %b[%j, %i] : memref<10x20xf32>, vector<4xf32> } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128"" -split-input-file ",1 "func.func @vec1d_1(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i0 = 0 to %M { %a0 = affine.load %A[%c0, %c0] : memref } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec1d_2(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i3 = 0 to %M { %a3 = affine.load %A[%c0, %i3] : memref } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec1d_3(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i8 = 0 to %M { affine.for %i9 = 0 to %N { %a9 = affine.load %A[%i9, %i8 + %i9] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vector_add_2d(%M : index, %N : index) -> f32 { %A = memref.alloc (%M, %N) : memref %B = memref.alloc (%M, %N) : memref %C = memref.alloc (%M, %N) : memref %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.store %f1, %A[%i0, %i1] : memref } } affine.for %i2 = 0 to %M { affine.for %i3 = 0 to %N { affine.store %f2, %B[%i2, %i3] : memref } } affine.for %i4 = 0 to %M { affine.for %i5 = 0 to %N { %a5 = affine.load %A[%i4, %i5] : memref %b5 = affine.load %B[%i4, %i5] : memref %s5 = arith.addf %a5, %b5 : f32 %s6 = arith.addf %s5, %f1 : f32 %s7 = arith.addf %s5, %f2 : f32 %s8 = arith.addf %s7, %s6 : f32 affine.store %s8, %C[%i4, %i5] : memref } } %c7 = arith.constant 7 : index %c42 = arith.constant 42 : index %res = affine.load %C[%c7, %c42] : memref return %res : f32 }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_constant_with_two_users(%M : index, %N : index) -> (f32, f32) { %A = memref.alloc (%M, %N) : memref %B = memref.alloc (%M) : memref %f1 = arith.constant 1.0 : f32 affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.store %f1, %A[%i1, %i0] : memref } affine.store %f1, %B[%i0] : memref } %c12 = arith.constant 12 : index %res1 = affine.load %A[%c12, %c12] : memref %res2 = affine.load %B[%c12] : memref return %res1, %res2 : f32, f32 }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_block_arg(%A : memref<32x512xi32>) { affine.for %i = 0 to 512 { affine.for %j = 0 to 32 { %idx = arith.index_cast %j : index to i32 affine.store %idx, %A[%j, %i] : memref<32x512xi32> } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_block_arg_2(%A : memref) { %c0 = arith.constant 0 : index %N = memref.dim %A, %c0 : memref affine.for %i0 = 0 to %N { affine.for %i1 = 0 to 512 { affine.for %i2 = 0 to 2 { %0 = affine.load %A[%i0 * 2 + %i2 - 1, %i1] : memref %mul = arith.muli %i0, %0 : index %add = arith.addi %mul, %i2 : index } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_1(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i1 = 0 to %M { %a1 = affine.load %A[%i1, %i1] : memref } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_2(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i2 = 0 to %M { %a2 = affine.load %A[%i2, %c0] : memref } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_3(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i4 = 0 to %M { affine.for %i5 = 0 to %N { %a5 = affine.load %A[%i5, %i4] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_4(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i6 = 0 to %M { affine.for %i7 = 0 to %N { %a7 = affine.load %A[%i6 + %i7, %i6] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_5(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i10 = 0 to %M { affine.for %i11 = 0 to %N { %a11 = affine.load %A[%i10, %i11] : memref affine.store %a11, %A[%i11, %i10] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_6(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i12 = 0 to %M { affine.for %i13 = 0 to %N { affine.for %i14 = 0 to %P { %a14 = affine.load %B[%i13, %i12 + %i13, %i12 + %i14] : memref } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_7(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i16 = 0 to %M { %a16 = memref.alloc(%M) : memref> %l16 = affine.load %a16[%i16] : memref> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_8(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i17 = 0 to %M { affine.for %i18 = 0 to %M { %a18 = affine.load %A[%c0, %c0] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_9(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i17 = 0 to %M { affine.for %i18 = 0 to %M { %a18 = affine.load %A[%c0, %c0] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "#set0 = affine_set<(i) : (i >= 0)> func.func @vec_rejected_10(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i15 = 0 to %M { affine.if #set0(%i15) { %a15 = affine.load %A[%c0, %c0] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_11(%A : memref, %B : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %B, %c2 : memref affine.for %i10 = 0 to %M { affine.for %i11 = 0 to %N { %a11 = affine.load %A[%i11, %i10] : memref affine.store %a11, %A[%i10, %i11] : memref } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_sequential(%A : memref) { %c0 = arith.constant 0 : index %N = memref.dim %A, %c0 : memref affine.for %i = 0 to %N { %a = affine.load %A[%i] : memref affine.store %a, %A[%i + 1] : memref } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_no_load_store_ops(%a: f32, %b: f32) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 128 { %add = arith.addf %a, %b : f32 } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_rejected_unsupported_block_arg(%A : memref<512xi32>) { affine.for %i = 0 to 512 { %idx = arith.index_cast %i : index to i32 affine.store %idx, %A[%i] : memref<512xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_non_vecdim_reduction(%in: memref<128x256xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 128 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%j, %i] : memref<128x256xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_non_vecdim_reductions(%in0: memref<128x256xf32>, %in1: memref<128x256xi32>, %out0: memref<256xf32>, %out1: memref<256xi32>) { %zero = arith.constant 0.000000e+00 : f32 %one = arith.constant 1 : i32 affine.for %i = 0 to 256 { %red0, %red1 = affine.for %j = 0 to 128 iter_args(%red_iter0 = %zero, %red_iter1 = %one) -> (f32, i32) { %ld0 = affine.load %in0[%j, %i] : memref<128x256xf32> %add = arith.addf %red_iter0, %ld0 : f32 %ld1 = affine.load %in1[%j, %i] : memref<128x256xi32> %mul = arith.muli %red_iter1, %ld1 : i32 affine.yield %add, %mul : f32, i32 } affine.store %red0, %out0[%i] : memref<256xf32> affine.store %red1, %out1[%i] : memref<256xi32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_no_vecdim_last_value(%in: memref<128x256xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %last_val = affine.for %j = 0 to 128 iter_args(%last_iter = %cst) -> (f32) { %ld = affine.load %in[%j, %i] : memref<128x256xf32> affine.yield %ld : f32 } affine.store %last_val, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec_vecdim_reduction_rejected(%in: memref<256x512xf32>, %out: memref<256xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i = 0 to 256 { %final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { %ld = affine.load %in[%i, %j] : memref<256x512xf32> %add = arith.addf %red_iter, %ld : f32 affine.yield %add : f32 } affine.store %final_red, %out[%i] : memref<256xf32> } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=128 test-fastest-varying=0"" -split-input-file ",1 "func.func @vec3d(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %A, %c0 : memref %1 = memref.dim %A, %c1 : memref %2 = memref.dim %A, %c2 : memref affine.for %t0 = 0 to %0 { affine.for %t1 = 0 to %0 { affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %1 { affine.for %i2 = 0 to %2 { %a2 = affine.load %A[%i0, %i1, %i2] : memref } } } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=32,64,256 test-fastest-varying=2,1,0"" ",1 "func.func @vec2d(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %P { %a2 = affine.load %A[%i0, %i1, %i2] : memref } } } affine.for %i3 = 0 to %M { affine.for %i4 = 0 to %N { affine.for %i5 = 0 to %P { %a5 = affine.load %A[%i4, %i5, %i3] : memref } } } return } func.func @vector_add_2d(%M : index, %N : index) -> f32 { %A = memref.alloc (%M, %N) : memref %B = memref.alloc (%M, %N) : memref %C = memref.alloc (%M, %N) : memref %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.store %f1, %A[%i0, %i1] : memref } } affine.for %i2 = 0 to %M { affine.for %i3 = 0 to %N { affine.store %f2, %B[%i2, %i3] : memref } } affine.for %i4 = 0 to %M { affine.for %i5 = 0 to %N { %a5 = affine.load %A[%i4, %i5] : memref %b5 = affine.load %B[%i4, %i5] : memref %s5 = arith.addf %a5, %b5 : f32 %s6 = arith.addf %s5, %f1 : f32 %s7 = arith.addf %s5, %f2 : f32 %s8 = arith.addf %s7, %s6 : f32 affine.store %s8, %C[%i4, %i5] : memref } } %c7 = arith.constant 7 : index %c42 = arith.constant 42 : index %res = affine.load %C[%c7, %c42] : memref return %res : f32 } func.func @vectorize_matmul(%arg0: memref, %arg1: memref, %arg2: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %M = memref.dim %arg0, %c0 : memref %K = memref.dim %arg0, %c1 : memref %N = memref.dim %arg2, %c1 : memref affine.for %i0 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%M) { affine.for %i1 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%N) { %cst = arith.constant 0.000000e+00 : f32 affine.store %cst, %arg2[%i0, %i1] : memref } } affine.for %i2 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%M) { affine.for %i3 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%N) { affine.for %i4 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%K) { %6 = affine.load %arg1[%i4, %i3] : memref %7 = affine.load %arg0[%i2, %i4] : memref %8 = arith.mulf %7, %6 : f32 %9 = affine.load %arg2[%i2, %i3] : memref %10 = arith.addf %9, %8 : f32 affine.store %10, %arg2[%i2, %i3] : memref } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=4,8"" ",1 "func.func @vec2d(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %P { %a2 = affine.load %A[%i0, %i1, %i2] : memref } } } affine.for %i3 = 0 to %M { affine.for %i4 = 0 to %N { affine.for %i5 = 0 to %P { %a5 = affine.load %A[%i4, %i5, %i3] : memref } } } return } func.func @vector_add_2d(%M : index, %N : index) -> f32 { %A = memref.alloc (%M, %N) : memref %B = memref.alloc (%M, %N) : memref %C = memref.alloc (%M, %N) : memref %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.store %f1, %A[%i0, %i1] : memref } } affine.for %i2 = 0 to %M { affine.for %i3 = 0 to %N { affine.store %f2, %B[%i2, %i3] : memref } } affine.for %i4 = 0 to %M { affine.for %i5 = 0 to %N { %a5 = affine.load %A[%i4, %i5] : memref %b5 = affine.load %B[%i4, %i5] : memref %s5 = arith.addf %a5, %b5 : f32 %s6 = arith.addf %s5, %f1 : f32 %s7 = arith.addf %s5, %f2 : f32 %s8 = arith.addf %s7, %s6 : f32 affine.store %s8, %C[%i4, %i5] : memref } } %c7 = arith.constant 7 : index %c42 = arith.constant 42 : index %res = affine.load %C[%c7, %c42] : memref return %res : f32 } func.func @vectorize_matmul(%arg0: memref, %arg1: memref, %arg2: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %M = memref.dim %arg0, %c0 : memref %K = memref.dim %arg0, %c1 : memref %N = memref.dim %arg2, %c1 : memref affine.for %i0 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%M) { affine.for %i1 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%N) { %cst = arith.constant 0.000000e+00 : f32 affine.store %cst, %arg2[%i0, %i1] : memref } } affine.for %i2 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%M) { affine.for %i3 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%N) { affine.for %i4 = affine_map<(d0) -> (d0)>(%c0) to affine_map<(d0) -> (d0)>(%K) { %6 = affine.load %arg1[%i4, %i3] : memref %7 = affine.load %arg0[%i2, %i4] : memref %8 = arith.mulf %7, %6 : f32 %9 = affine.load %arg2[%i2, %i3] : memref %10 = arith.addf %9, %8 : f32 affine.store %10, %arg2[%i2, %i3] : memref } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=32,256 test-fastest-varying=1,0"" ",1 "func.func @vec2d(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %P { %a2 = affine.load %A[%i0, %i1, %i2] : memref } } } affine.for %i3 = 0 to %M { affine.for %i4 = 0 to %N { affine.for %i5 = 0 to %P { %a5 = affine.load %A[%i4, %i5, %i3] : memref } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=32,256 test-fastest-varying=2,0"" ",1 "func.func @vec2d(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %A, %c0 : memref %N = memref.dim %A, %c1 : memref %P = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %M { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %P { %a2 = affine.load %A[%i0, %i1, %i2] : memref } } } affine.for %i3 = 0 to %M { affine.for %i4 = 0 to %N { affine.for %i5 = 0 to %P { %a5 = affine.load %A[%i4, %i5, %i3] : memref } } } return } func.func @vec2d_imperfectly_nested(%A : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %A, %c0 : memref %1 = memref.dim %A, %c1 : memref %2 = memref.dim %A, %c2 : memref affine.for %i0 = 0 to %0 { affine.for %i1 = 0 to %1 { affine.for %i2 = 0 to %2 { %a2 = affine.load %A[%i2, %i1, %i0] : memref } } affine.for %i3 = 0 to %1 { affine.for %i4 = 0 to %2 { %a4 = affine.load %A[%i3, %i4, %i0] : memref } affine.for %i5 = 0 to %2 { %a5 = affine.load %A[%i3, %i5, %i0] : memref } } } return }"," mlir-opt -affine-super-vectorize=""virtual-vector-size=32,256 test-fastest-varying=0,2"" ",1 "func.func @matmul_tensors_1( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul { test.attrA } ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> func.return %0 : tensor<128x128xf32> } func.func @matmul_tensors_2( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul { test.attrA, test.attrC } ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> func.return %0 : tensor<128x128xf32> } func.func @matmul_tensors_3( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul { test.attrC } ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> func.return %0 : tensor<128x128xf32> } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @pdl_target_attrA : benefit(1) { %args = operands %results = types %attr = attribute %0 = operation ""linalg.matmul""(%args : !pdl.range) {""test.attrA"" = %attr}-> (%results : !pdl.range) rewrite %0 with ""transform.dialect"" } pdl.pattern @pdl_target_attrC : benefit(1) { %args = operands %results = types %attr = attribute %0 = operation ""linalg.matmul""(%args : !pdl.range) {""test.attrC"" = %attr}-> (%results : !pdl.range) rewrite %0 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @pdl_target_attrA in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.tile %0 [4, 4, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %1 = pdl_match @pdl_target_attrC in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.get_closest_isolated_parent %1 : (!transform.any_op) -> !transform.any_op transform.structured.vectorize %2 : (!transform.any_op) -> !transform.any_op } }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "func.func @vectorize_one( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul {test.attrA} ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> func.return %0 : tensor<128x128xf32> } func.func @vectorize_none( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> func.return %0 : tensor<128x128xf32> } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @pdl_target : benefit(1) { %args = operands %results = types %attr = attribute %0 = operation ""linalg.matmul""(%args : !pdl.range) {""test.attrA"" = %attr}-> (%results : !pdl.range) rewrite %0 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @pdl_target in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op } }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "func.func @vectorize_all( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>, %arg3: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul {test.attrA} ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> %1 = linalg.matmul ins(%arg0, %0: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg3: tensor<128x128xf32>) -> tensor<128x128xf32> return %1 : tensor<128x128xf32> } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.structured.vectorize %arg0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): } } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): } } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.sequence %arg0 : !transform.any_op -> !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): yield %arg1 : !transform.any_op } transform.sequence %0 : !transform.any_op failures(propagate) { ^bb2(%arg2: !transform.any_op): } transform.sequence %0 : !transform.any_op failures(propagate) { ^bb3(%arg3: !transform.any_op): } } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_op): transform.sequence %arg0, %arg1, %arg2 : !transform.any_op, !transform.any_op, !transform.any_op failures(propagate) { ^bb0(%arg3: !transform.any_op, %arg4: !transform.any_op, %arg5: !transform.any_op): } } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_op): transform.sequence %arg0, %arg1, %arg2 : (!transform.any_op, !transform.any_op, !transform.any_op) failures(propagate) { ^bb0(%arg3: !transform.any_op, %arg4: !transform.any_op, %arg5: !transform.any_op): } } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_op): transform.sequence %arg0, %arg1, %arg2 : (!transform.any_op, !transform.any_op, !transform.any_op) failures(propagate) { ^bb0(%arg3: !transform.any_op, %arg4: !transform.any_op, %arg5: !transform.any_op): } } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.foreach %arg0 : !transform.any_op { ^bb1(%arg1: !transform.any_op): } } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = cast %arg0: !transform.any_op to !transform.any_op %1 = cast %0: !transform.any_op to !transform.op<""builtin.module""> } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.print %arg0 : !transform.any_op transform.print transform.print %arg0 {name = ""test""} : !transform.any_op transform.print {name = ""test""} } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.tile %0 [4, 4, [4]] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt | mlir-opt ,1 "func.func @update_tracked_op_mapping() { ""test.container""() ({ %0 = ""test.foo""() {replace_with_new_op = ""test.foo""} : () -> (i32) }) : () -> () return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.container""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.foo""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.apply_patterns [""transform.test""] to %0 : !transform.any_op transform.annotate %1 ""annotated"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @replacement_op_not_found() { ""test.container""() ({ %0 = ""test.foo""() {replace_with_new_op = ""test.bar""} : () -> (i32) }) : () -> () return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.container""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.foo""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.apply_patterns [""transform.test""] to %0 : !transform.any_op transform.annotate %1 ""annotated"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @replacement_op_for_dead_handle_not_found() { ""test.container""() ({ %0 = ""test.foo""() {replace_with_new_op = ""test.bar""} : () -> (i32) }) : () -> () return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.container""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.foo""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.apply_patterns [""transform.test""] to %0 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @replacement_op_not_found_silenced() { ""test.container""() ({ %0 = ""test.foo""() {replace_with_new_op = ""test.bar""} : () -> (i32) }) : () -> () return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.container""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.foo""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.apply_patterns [""transform.test""] to %0 {fail_on_payload_replacement_not_found = false}: !transform.any_op transform.annotate %1 ""annotated"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @patterns_apply_only_to_target_body() { %0 = ""test.foo""() {replace_with_new_op = ""test.bar""} : () -> (i32) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.foo""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.apply_patterns [""transform.test""] to %0 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @erase_tracked_op() { ""test.container""() ({ %0 = ""test.erase_op""() {replace_with_new_op = ""test.foo""} : () -> (i32) }) : () -> () return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.container""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""test.erase_op""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_print_remark_at_operand %1, ""matched op"" : !transform.any_op transform.apply_patterns [""transform.test""] to %0 : !transform.any_op transform.test_print_remark_at_operand %1, ""op was deleted"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.test_transform_op %0 = transform.test_produce_self_handle_or_forward_operand { foo = ""bar"" } : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %0, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op %1 = transform.cast %0: !transform.any_op to !transform.test_dialect_op", mlir-opt ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @infer(%op: !transform.any_op, %other: !transform.any_op, %param: !transform.param) { transform.test_consume_operand %op : !transform.any_op transform.test_print_remark_at_operand %other, """" : !transform.any_op transform.yield } }", mlir-opt --transform-infer-effects ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_transform_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_self_handle_or_forward_operand { foo = ""bar"" } : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %0, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_self_handle_or_forward_operand { foo = ""bar"" } : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %0, ""transform.sequence"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_self_handle_or_forward_operand { foo = ""bar"" } : () -> !transform.any_op %1 = transform.test_copy_payload %0 : (!transform.any_op) -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %0, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): test_transform_op ""a"" test_transform_op ""b"" test_transform_op ""c"" } test_transform_op ""d"" test_transform_op ""e"" }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op sequence %0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): test_consume_operand_of_op_kind_or_fail %arg1, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = sequence %arg0 : !transform.any_op -> !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %1 = test_produce_self_handle_or_forward_operand : () -> !transform.any_op yield %1 : !transform.any_op } test_consume_operand_of_op_kind_or_fail %0, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @const : benefit(1) { %r = pdl.types %0 = pdl.operation ""arith.constant"" -> (%r : !pdl.range) pdl.rewrite %0 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %f = pdl_match @const in %arg1 : (!transform.any_op) -> !transform.any_op %m = get_closest_isolated_parent %f : (!transform.any_op) -> !transform.any_op test_print_remark_at_operand %m, ""parent function"" : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { %0 = arith.constant 0 : i32 return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @match_func : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""func.func""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @match_func in %arg1 : (!transform.any_op) -> !transform.any_op transform.alternatives %0 : !transform.any_op { ^bb2(%arg2: !transform.any_op): %1 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %1, ""transform.sequence"" : !transform.any_op }, { ^bb2(%arg2: !transform.any_op): %1 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %1, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func private @bar() func.func @foo() { call @bar() : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @match_call : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""func.call""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op transform.alternatives %1 : !transform.any_op { ^bb2(%arg2: !transform.any_op): %2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_emit_remark_and_erase_operand %2, ""applying"" {fail_after_erase} : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func private @bar() func.func @foo() { call @bar() : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @match_call : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""func.call""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op transform.alternatives %1 : !transform.any_op { ^bb2(%arg2: !transform.any_op): %2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_emit_remark_and_erase_operand %2, ""applying"" {fail_after_erase} : !transform.any_op }, { ^bb2(%arg2: !transform.any_op): %2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_print_remark_at_operand %2, ""still here"" : !transform.any_op }, { ^bb2(%arg2: !transform.any_op): %2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_emit_remark_and_erase_operand %2, ""should not happen"" {fail_after_erase} : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func private @bar() func.func @erase_call() { call @bar() : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @match_call : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""func.call""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op transform.alternatives %1 : !transform.any_op { ^bb2(%arg2: !transform.any_op): %2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_emit_remark_and_erase_operand %2, ""applying"" {fail_after_erase} : !transform.any_op }, { ^bb2(%arg2: !transform.any_op): %2 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_emit_remark_and_erase_operand %2, ""applying second time"" : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func private @bar() func.func @foo() { call @bar() : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @match_call : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""func.call""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @match_call in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.alternatives %1 : !transform.any_op -> !transform.any_op { ^bb2(%arg2: !transform.any_op): %3 = transform.pdl_match @match_call in %arg2 : (!transform.any_op) -> !transform.any_op transform.test_emit_remark_and_erase_operand %3, ""applying"" {fail_after_erase} : !transform.any_op %4 = transform.test_produce_self_handle_or_forward_operand %3 : (!transform.any_op) -> !transform.any_op transform.yield %4 : !transform.any_op }, { ^bb2(%arg2: !transform.any_op): %4 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.yield %4 : !transform.any_op } transform.test_consume_operand_of_op_kind_or_fail %2, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): transform.alternatives %arg1 : !transform.any_op { ^bb2(%arg2: !transform.any_op): %0 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %0, ""transform.sequence"" : !transform.any_op }, { ^bb2(%arg2: !transform.any_op): %0 = transform.test_produce_self_handle_or_forward_operand : () -> !transform.any_op transform.test_consume_operand_of_op_kind_or_fail %0, ""transform.test_produce_self_handle_or_forward_operand"" : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo(%arg0: index, %arg1: index, %arg2: index) { scf.for %i = %arg0 to %arg1 step %arg2 { %0 = arith.constant 0 : i32 } return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @match_const : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""arith.constant""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.pdl_match @match_const in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.loop.get_parent_for %0 : (!transform.any_op) -> !transform.any_op alternatives %1 : !transform.any_op { ^bb2(%arg2: !transform.any_op): } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_wrong_number_of_results %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () : () -> () ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_wrong_number_of_multi_results %0 : (!transform.any_op) -> (!transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () : () -> () ""op"" () : () -> () ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.test_correct_number_of_multi_results %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""wrong_op_name"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.test_correct_number_of_multi_results %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_mixed_null_and_non_null_results %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo(%arg0: index) { %0 = arith.addi %arg0, %arg0 : index %1 = arith.subi %arg0, %arg0 : index %2 = arith.addi %0, %1 : index return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @addi : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""arith.addi""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } pdl.pattern @subi : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""arith.subi""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @addi in %arg1 : (!transform.any_op) -> !transform.any_op %1 = pdl_match @subi in %arg1 : (!transform.any_op) -> !transform.any_op %2 = merge_handles %0, %1 : !transform.any_op test_print_remark_at_operand %2, ""matched"" : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo(%arg0: index) { %0 = arith.addi %arg0, %arg0 : index return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @addi : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""arith.addi""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @addi in %arg1 : (!transform.any_op) -> !transform.any_op %1 = pdl_match @addi in %arg1 : (!transform.any_op) -> !transform.any_op %2 = merge_handles deduplicate %0, %1 : !transform.any_op test_print_number_of_associated_payload_ir_ops %2 : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () { target_me } : () -> () ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_mixed_success_and_silenceable %0 : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(suppress) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op test_emit_remark_and_erase_operand %0, ""foo"" {fail_after_erase} : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @foo() { ""op"" () : () -> () return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""op""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op test_emit_remark_and_erase_operand %0, ""foo"" {fail_after_erase} : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { func.func private @foo() func.func private @bar() transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @func : benefit(1) { %0 = pdl.operands %1 = pdl.types %2 = pdl.operation ""func.func""(%0 : !pdl.range) -> (%1 : !pdl.range) pdl.rewrite %2 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @func in %arg1 : (!transform.any_op) -> !transform.any_op %1 = replicate num(%0) %arg1 : !transform.any_op, !transform.any_op test_print_number_of_associated_payload_ir_ops %1 : !transform.any_op %2 = replicate num(%0) %1 : !transform.any_op, !transform.any_op test_print_number_of_associated_payload_ir_ops %2 : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @bar() { %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @const : benefit(1) { %r = pdl.types %0 = pdl.operation ""arith.constant"" -> (%r : !pdl.range) pdl.rewrite %0 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %f = pdl_match @const in %arg1 : (!transform.any_op) -> !transform.any_op transform.foreach %f : !transform.any_op { ^bb2(%arg2: !transform.any_op): transform.test_print_number_of_associated_payload_ir_ops %arg2 : !transform.any_op transform.test_print_remark_at_operand %arg2, ""transform applied"" : !transform.any_op } } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @bar() { scf.execute_region { %0 = arith.constant 0 : i32 scf.yield } scf.execute_region { %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 scf.yield } return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @const : benefit(1) { %r = pdl.types %0 = pdl.operation ""arith.constant"" -> (%r : !pdl.range) pdl.rewrite %0 with ""transform.dialect"" } pdl.pattern @execute_region : benefit(1) { %r = pdl.types %0 = pdl.operation ""scf.execute_region"" -> (%r : !pdl.range) pdl.rewrite %0 with ""transform.dialect"" } transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %f = pdl_match @execute_region in %arg1 : (!transform.any_op) -> !transform.any_op %results = transform.foreach %f : !transform.any_op -> !transform.any_op { ^bb2(%arg2: !transform.any_op): %g = transform.pdl_match @const in %arg2 : (!transform.any_op) -> !transform.any_op transform.yield %g : !transform.any_op } transform.test_print_number_of_associated_payload_ir_ops %results : !transform.any_op transform.test_print_remark_at_operand %results, ""transform applied"" : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_parent_for_op_no_loop(%arg0: index, %arg1: index) { %0 = arith.muli %arg0, %arg1 : index arith.addi %0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %addi = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %muli = get_producer_of_operand %addi[0] : (!transform.any_op) -> !transform.any_op transform.test_print_remark_at_operand %muli, ""found muli"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_parent_for_op_no_loop(%arg0: index, %arg1: index) { %0 = arith.muli %arg0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %arg1 : (!transform.any_op) -> !transform.any_op %bbarg = get_producer_of_operand %muli[0] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_consumer(%arg0: index, %arg1: index) { %0 = arith.muli %arg0, %arg1 : index arith.addi %0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %arg1 : (!transform.any_op) -> !transform.any_op %addi = get_consumers_of_result %muli[0] : (!transform.any_op) -> !transform.any_op transform.test_print_remark_at_operand %addi, ""found addi"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_consumer_fail_1(%arg0: index, %arg1: index) { %0 = arith.muli %arg0, %arg1 : index %1 = arith.muli %arg0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %arg1 : (!transform.any_op) -> !transform.any_op %bbarg = get_consumers_of_result %muli[0] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_consumer_fail_2(%arg0: index, %arg1: index) { %0 = arith.muli %arg0, %arg1 : index return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %arg1 : (!transform.any_op) -> !transform.any_op %bbarg = get_consumers_of_result %muli[1] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @split_handle(%a: index, %b: index, %c: index) { %0 = arith.muli %a, %b : index %1 = arith.muli %a, %c : index return } transform.sequence failures(propagate) { ^bb1(%fun: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h:2 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op %muli_2 = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h_2:3 = split_handle %muli_2 : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @split_handle(%a: index, %b: index, %c: index) { %0 = arith.muli %a, %b : index %1 = arith.muli %a, %c : index return } transform.sequence failures(suppress) { ^bb1(%fun: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h:2 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op %muli_2 = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h_2:3 = split_handle %muli_2 : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) transform.test_print_number_of_associated_payload_ir_ops %h_2#0 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @split_handle(%a: index, %b: index, %c: index) { %0 = arith.muli %a, %b : index %1 = arith.muli %a, %c : index return } transform.sequence failures(propagate) { ^bb1(%fun: !transform.any_op): %muli_2 = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h:3 = split_handle %muli_2 {fail_on_payload_too_small = false} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op transform.test_print_number_of_associated_payload_ir_ops %h#1 : !transform.any_op transform.test_print_number_of_associated_payload_ir_ops %h#2 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @split_handle(%a: index, %b: index, %c: index) { %0 = arith.muli %a, %b : index %1 = arith.muli %a, %c : index %2 = arith.muli %a, %c : index %3 = arith.muli %a, %c : index return } transform.sequence failures(propagate) { ^bb1(%fun: !transform.any_op): %muli_2 = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h:2 = split_handle %muli_2 {overflow_result = 0} : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op transform.test_print_number_of_associated_payload_ir_ops %h#1 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 """test.some_op""() : () -> () ""other_dialect.other_op""() : () -> () transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operation ""test.some_op"" pdl.rewrite %0 with ""transform.dialect"" } sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.cast %0 : !transform.any_op to !transform.test_dialect_op transform.cast %2 : !transform.test_dialect_op to !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 """test.some_op""() : () -> () ""other_dialect.other_op""() : () -> () transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @other : benefit(1) { %0 = pdl.operation ""other_dialect.other_op"" pdl.rewrite %0 with ""transform.dialect"" } sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @other in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.cast %0 : !transform.any_op to !transform.test_dialect_op transform.cast %2 : !transform.test_dialect_op to !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 """test.some_op""() : () -> () ""other_dialect.other_op""() : () -> () transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operation ""test.some_op"" pdl.rewrite %0 with ""transform.dialect"" } sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.cast %0 : !transform.any_op to !transform.op<""test.some_op""> transform.cast %2 : !transform.op<""test.some_op""> to !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 """test.some_op""() : () -> () ""other_dialect.other_op""() : () -> () transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): pdl.pattern @other : benefit(1) { %0 = pdl.operation ""other_dialect.other_op"" pdl.rewrite %0 with ""transform.dialect"" } sequence %arg0 : !transform.any_op failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = pdl_match @other in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.cast %0 : !transform.any_op to !transform.op<""test.some_op""> transform.cast %2 : !transform.op<""test.some_op""> to !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): transform.sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_report_number_of_tracked_handles_nested_under %arg1 : !transform.any_op transform.test_emit_remark_and_erase_operand %0, ""erased"" : !transform.any_op transform.test_report_number_of_tracked_handles_nested_under %arg1 : !transform.any_op } pdl.pattern @some : benefit(1) { %0 = pdl.operation ""test.some_op"" pdl.rewrite %0 with ""transform.dialect"" } } ""test.some_op""() : () -> ()", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @split_handle(%a: index, %b: index, %c: index) { %0 = arith.muli %a, %b : index %1 = arith.muli %a, %c : index return } transform.sequence -> !transform.any_op failures(propagate) { ^bb1(%fun: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %fun : (!transform.any_op) -> !transform.any_op %h_2:3 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) yield %fun : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence -> !transform.any_op failures(suppress) { ^bb0(%arg0: !transform.any_op): %muli = transform.structured.match ops{[""arith.muli""]} in %arg0 : (!transform.any_op) -> !transform.any_op %0:3 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) yield %0#0 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_integer_param_with_type i32 : !transform.test_dialect_param transform.test_print_param %0 : !transform.test_dialect_param }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_produce_integer_param_with_type i32 : !transform.param }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_add_to_param 40 %1 = transform.test_add_to_param %0, 2 transform.test_print_param %1 : !transform.test_dialect_param }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg0 : (!transform.any_op) -> !transform.any_op %1 = transform.test_produce_param_with_number_of_test_ops %0 : !transform.any_op transform.test_print_param %1 : !transform.test_dialect_param %2 = transform.test_add_to_param %1, 100 transform.test_print_param %2 : !transform.test_dialect_param } func.func private @one_test_op(%arg0: i32) { ""test.op_a""(%arg0) { attr = 0 : i32} : (i32) -> i32 return } func.func private @three_test_ops(%arg0: i32) { ""test.op_a""(%arg0) { attr = 0 : i32} : (i32) -> i32 ""test.op_a""(%arg0) { attr = 0 : i32} : (i32) -> i32 ""test.op_a""(%arg0) { attr = 0 : i32} : (i32) -> i32 return }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_produce_transform_param_or_forward_operand %arg0 { first_result_is_param } : (!transform.any_op) -> (!transform.any_op, !transform.param) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_produce_transform_param_or_forward_operand %arg0 { first_result_is_null } : (!transform.any_op) -> (!transform.any_op, !transform.param) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_produce_transform_param_or_forward_operand %arg0 { second_result_is_handle } : (!transform.any_op) -> (!transform.any_op, !transform.param) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_produce_transform_param_or_forward_operand %arg0 { second_result_is_handle } : (!transform.any_op) -> (!transform.any_value, !transform.param) } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_null_payload : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_null_param : !transform.param }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_null_value : !transform.any_value }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module { }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0 = test_produce_value_handle_to_self_operand %arg0 : (!transform.any_op) -> !transform.any_value test_print_remark_at_operand_value %0, ""value handle"" : !transform.any_value }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "%0:2 = ""test.get_two_results""() : () -> (i32, i32) %1:3 = ""test.get_three_results""() : () -> (i32, i32, f32) transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %2 = transform.structured.match ops{[""test.get_two_results"", ""test.get_three_results""]} in %arg0 : (!transform.any_op) -> !transform.any_op %3 = test_produce_value_handle_to_result %2, 1 : (!transform.any_op) -> !transform.any_value test_print_remark_at_operand_value %3, ""result handle"" : !transform.any_value }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 """test.op_with_regions""() ({ ^bb0: ""test.regon_terminator""() : () -> () }, { ^bb1: ""test.regon_terminator""() : () -> () ^bb2(%arg0: i32, %arg1: f64, %arg3: index): ""test.match_anchor""() : () -> () ""test.regon_terminator""() : () -> () }) : () -> () transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %2 = transform.structured.match ops{[""test.match_anchor""]} in %arg0 : (!transform.any_op) -> !transform.any_op %3 = test_produce_value_handle_to_argument_of_parent_block %2, 2 : (!transform.any_op) -> !transform.any_value test_print_remark_at_operand_value %3, ""block argument handle"" : !transform.any_value }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op test_consume_operand %0 : !transform.test_dialect_param }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_result_of_op(%arg0: index, %arg1: index) -> index { %r = arith.addi %arg0, %arg1 : index return %r : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %addi = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %result = transform.get_result %addi[0] : (!transform.any_op) -> !transform.any_value transform.test_print_remark_at_operand_value %result, ""addi result"" : !transform.any_value }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_out_of_bounds_result_of_op(%arg0: index, %arg1: index) -> index { %r = arith.addi %arg0, %arg1 : index return %r : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %addi = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %result = transform.get_result %addi[1] : (!transform.any_op) -> !transform.any_value transform.test_print_remark_at_operand_value %result, ""addi result"" : !transform.any_value }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_result_of_op(%arg0: index, %arg1: index) -> index { %r = arith.addi %arg0, %arg1 : index return %r : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %addi = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %result = transform.get_result %addi[0] : (!transform.any_op) -> !transform.any_value %op = transform.get_defining_op %result : (!transform.any_value) -> !transform.any_op transform.test_print_remark_at_operand %op, ""matched"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @get_result_of_op_bbarg(%arg0: index, %arg1: index) -> index { %r = arith.addi %arg0, %arg1 : index return %r : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %addi = transform.structured.match ops{[""arith.addi""]} in %arg1 : (!transform.any_op) -> !transform.any_op %bbarg = test_produce_value_handle_to_argument_of_parent_block %addi, 0 : (!transform.any_op) -> !transform.any_value %op = transform.get_defining_op %bbarg : (!transform.any_value) -> !transform.any_op transform.test_print_remark_at_operand %op, ""matched"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module @named_inclusion attributes { transform.with_named_sequence } { transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}) -> () { transform.test_transform_op ""a"" transform.yield } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): include @foo failures(propagate) (%arg0) : (!transform.any_op) -> () } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module @named_inclusion_in_named attributes { transform.with_named_sequence } { transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}) -> () { transform.test_transform_op ""a"" transform.yield } transform.named_sequence @bar(%arg0: !transform.any_op {transform.readonly}) -> () { transform.test_transform_op ""b"" transform.include @foo failures(propagate) (%arg0) : (!transform.any_op) -> () transform.yield } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.include @bar failures(suppress) (%arg0) : (!transform.any_op) -> () } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module @named_operands attributes { transform.with_named_sequence } { transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}, %arg1: !transform.any_value {transform.readonly}) -> () { transform.test_print_remark_at_operand %arg0, ""operation"" : !transform.any_op transform.test_print_remark_at_operand_value %arg1, ""value"" : !transform.any_value transform.yield } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.test_produce_value_handle_to_self_operand %arg0 : (!transform.any_op) -> !transform.any_value include @foo failures(propagate) (%arg0, %0) : (!transform.any_op, !transform.any_value) -> () } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module @named_return attributes { transform.with_named_sequence } { transform.named_sequence @foo(%arg0: !transform.any_op {transform.readonly}) -> (!transform.any_op, !transform.any_value) { %0 = transform.test_produce_value_handle_to_self_operand %arg0 : (!transform.any_op) -> !transform.any_value transform.yield %arg0, %0 : !transform.any_op, !transform.any_value } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0:2 = include @foo failures(propagate) (%arg0) : (!transform.any_op) -> (!transform.any_op, !transform.any_value) transform.test_print_remark_at_operand %0#0, ""operation"" : !transform.any_op transform.test_print_remark_at_operand_value %0#1, ""value"" : !transform.any_value } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @match1(%current: !transform.any_op {transform.readonly}) -> (!transform.any_op) { transform.test_succeed_if_operand_of_op_kind %current, ""test.some_op"" : !transform.any_op transform.yield %current : !transform.any_op } transform.named_sequence @match2(%current: !transform.any_op {transform.readonly}) -> (!transform.any_op) { transform.test_succeed_if_operand_of_op_kind %current, ""func.func"" : !transform.any_op transform.yield %current : !transform.any_op } transform.named_sequence @action1(%current: !transform.any_op {transform.readonly}) { transform.test_print_remark_at_operand %current, ""matched1"" : !transform.any_op transform.yield } transform.named_sequence @action2(%current: !transform.any_op {transform.readonly}) { transform.test_print_remark_at_operand %current, ""matched2"" : !transform.any_op transform.yield } transform.sequence failures(propagate) { ^bb0(%root: !transform.any_op): transform.foreach_match in %root @match1 -> @action1, @match2 -> @action2 : (!transform.any_op) -> (!transform.any_op) transform.yield } func.func private @foo() func.func private @bar() ""test.testtest""() : () -> () ""test.some_op""() : () -> () }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @match(!transform.any_op {transform.readonly}) transform.named_sequence @action() transform.sequence failures(propagate) { ^bb0(%root: !transform.any_op): transform.foreach_match in %root @match -> @action : (!transform.any_op) -> !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @match(%arg: !transform.any_op {transform.readonly}) { transform.yield } transform.named_sequence @action() transform.sequence failures(propagate) { ^bb0(%root: !transform.any_op): transform.foreach_match in %root @match -> @action : (!transform.any_op) -> !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @match(%arg: !transform.any_op {transform.readonly}) { ""test.unknown_op""() : () -> () transform.yield } transform.named_sequence @action() { transform.yield } transform.sequence failures(propagate) { ^bb0(%root: !transform.any_op): transform.foreach_match in %root @match -> @action : (!transform.any_op) -> !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @match_func(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @print_func(%arg0: !transform.any_op {transform.readonly}) { transform.test_print_remark_at_operand %arg0, ""matched func"" : !transform.any_op transform.yield } transform.sequence failures(propagate) { ^bb(%arg0: !transform.any_op): transform.foreach_match in %arg0 @match_func -> @print_func : (!transform.any_op) -> !transform.any_op transform.yield } func.func @payload() { return } func.func private @declaration() ""test.something_else""() : () -> () }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes { transform.with_named_sequence } { transform.named_sequence @eq_1(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op %0 = transform.test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op %1 = transform.param.constant 1 : i32 -> !transform.test_dialect_param transform.match.param.cmpi eq %0, %1 : !transform.test_dialect_param transform.test_print_remark_at_operand %arg0, ""matched == 1"" : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @ne_0(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op %0 = transform.test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op %1 = transform.param.constant 0 : i32 -> !transform.test_dialect_param transform.match.param.cmpi ne %0, %1 : !transform.test_dialect_param transform.test_print_remark_at_operand %arg0, ""matched != 0"" : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @gt_m1(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op %0 = transform.test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op %1 = transform.param.constant -1 : i32 -> !transform.test_dialect_param transform.match.param.cmpi gt %0, %1 : !transform.test_dialect_param transform.test_print_remark_at_operand %arg0, ""matched > -1"" : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @ge_1(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op %0 = transform.test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op %1 = transform.param.constant 1 : i32 -> !transform.test_dialect_param transform.match.param.cmpi ge %0, %1 : !transform.test_dialect_param transform.test_print_remark_at_operand %arg0, ""matched >= 1"" : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @lt_1(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op %0 = transform.test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op %1 = transform.param.constant 1 : i32 -> !transform.test_dialect_param transform.match.param.cmpi lt %0, %1 : !transform.test_dialect_param transform.test_print_remark_at_operand %arg0, ""matched < 1"" : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @le_1(%arg0: !transform.any_op {transform.readonly}) -> !transform.any_op { transform.match.operation_name %arg0 [""func.func""] : !transform.any_op %0 = transform.test_produce_param_with_number_of_test_ops %arg0 : !transform.any_op %1 = transform.param.constant 1 : i32 -> !transform.test_dialect_param transform.match.param.cmpi le %0, %1 : !transform.test_dialect_param transform.test_print_remark_at_operand %arg0, ""matched <= 1"" : !transform.any_op transform.yield %arg0 : !transform.any_op } transform.named_sequence @do_nothing(%arg0: !transform.any_op {transform.readonly}) { transform.yield } transform.sequence failures(propagate) { ^bb(%arg0: !transform.any_op): %0 = transform.foreach_match in %arg0 @eq_1 -> @do_nothing : (!transform.any_op) -> !transform.any_op %1 = transform.foreach_match in %0 @ne_0 -> @do_nothing : (!transform.any_op) -> !transform.any_op %2 = transform.foreach_match in %1 @gt_m1 -> @do_nothing : (!transform.any_op) -> !transform.any_op %3 = transform.foreach_match in %2 @ge_1 -> @do_nothing : (!transform.any_op) -> !transform.any_op %4 = transform.foreach_match in %3 @lt_1 -> @do_nothing : (!transform.any_op) -> !transform.any_op %5 = transform.foreach_match in %4 @le_1 -> @do_nothing : (!transform.any_op) -> !transform.any_op transform.yield } func.func private @declaration() func.func @definition() { ""test.something""() : () -> () return } }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @test_tracked_rewrite() { %0 = ""test.replace_me""() {replacement = ""test.update_mapping""} : () -> (i1) %1 = ""test.replace_me""() {replacement = ""test.drop_mapping""} : () -> (i1) %2 = ""test.replace_me""() {replacement = ""test.update_mapping""} : () -> (i1) } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""test.replace_me""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.test_tracked_rewrite %0 : (!transform.any_op) -> () test_print_number_of_associated_payload_ir_ops %0 : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "func.func @test_annotation() { %0 = ""test.annotate_me""() : () -> (i1) %1 = ""test.annotate_me""() {existing_attr = ""test""} : () -> (i1) %2 = ""test.annotate_me""() {new_attr = 0} : () -> (i1) } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0 = transform.structured.match ops{[""test.annotate_me""]} in %arg0 : (!transform.any_op) -> !transform.any_op %1 = transform.test_produce_param_with_number_of_test_ops %0 : !transform.any_op transform.annotate %0 ""new_attr"" = %1 : !transform.any_op, !transform.test_dialect_param %2 = transform.param.constant 2 -> !transform.param transform.annotate %0 ""broadcast_attr"" = %2 : !transform.any_op, !transform.param transform.annotate %0 ""unit_attr"" : !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -allow-unregistered-dialect --split-input-file --verify-diagnostics ,1 "module attributes {transform.with_named_sequence} { transform.named_sequence private @foo(!transform.any_op {transform.readonly}) transform.named_sequence private @unannotated(!transform.any_op {transform.readonly}) transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): include @foo failures(propagate) (%arg0) : (!transform.any_op) -> () include @unannotated failures(propagate) (%arg0) : (!transform.any_op) -> () } }"," mlir-opt --pass-pipeline=""builtin.module(test-transform-dialect-interpreter{transform-library-file-name=%p/test-interpreter-external-symbol-def.mlir})"" --verify-diagnostics --split-input-file ",1 "module attributes {transform.with_named_sequence} { transform.named_sequence private @foo(!transform.any_op {transform.readonly}) transform.named_sequence private @unannotated(!transform.any_op {transform.readonly}) transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): include @foo failures(propagate) (%arg0) : (!transform.any_op) -> () include @unannotated failures(propagate) (%arg0) : (!transform.any_op) -> () } }"," mlir-opt --pass-pipeline=""builtin.module(test-transform-dialect-interpreter{transform-library-file-name=%p/test-interpreter-external-symbol-def.mlir}, test-transform-dialect-interpreter)"" --verify-diagnostics --split-input-file ",1 "module attributes {transform.with_named_sequence} { transform.named_sequence private @foo(!transform.any_op {transform.readonly}) transform.named_sequence private @unannotated(!transform.any_op {transform.readonly}) transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): include @foo failures(propagate) (%arg0) : (!transform.any_op) -> () include @unannotated failures(propagate) (%arg0) : (!transform.any_op) -> () } }"," mlir-opt --pass-pipeline=""builtin.module(test-transform-dialect-interpreter{transform-library-file-name=%p/test-interpreter-external-symbol-def.mlir}, test-transform-dialect-interpreter{transform-library-file-name=%p/test-interpreter-external-symbol-def.mlir})"" --verify-diagnostics --split-input-file ",1 "module { transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.test_print_remark_at_operand %arg0, ""remark"" : !transform.any_op } }", mlir-opt --test-transform-dialect-interpreter --mlir-disable-threading --debug-only=transform-dialect-dump-repro 2>&1 ,1 "func.func @make_pad_loop_independent_1(%lb: index, %ub: index, %step: index, %t: tensor, %f: f32) { scf.for %i = %lb to %ub step %step { %high = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub] %p = tensor.pad %t low[5] high[%high] { ^bb0(%arg1: index): tensor.yield %f : f32 } : tensor to tensor ""dummy.some_use""(%p) : (tensor) -> () } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.tensor.make_loop_independent %0 {num_loops = 1} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @make_pad_loop_independent_1(%lb: index, %ub: index, %step: index, %t: tensor, %f: f32) { scf.for %i = %lb to %ub step %step { %low = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub] %p = tensor.pad %t low[%low] high[5] { ^bb0(%arg1: index): tensor.yield %f : f32 } : tensor to tensor ""dummy.some_use""(%p) : (tensor) -> () } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.tensor.make_loop_independent %0 {num_loops = 1} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @two_loops(%lb: index, %ub: index, %step: index, %t: tensor, %f: f32) { scf.for %i = %lb to %ub step %step { scf.for %j = %lb to %ub step %step { %low = affine.apply affine_map<(d0, d1)[] -> (d0 + d1)> (%i, %j)[] %p = tensor.pad %t low[%low] high[5] { ^bb0(%arg1: index): tensor.yield %f : f32 } : tensor to tensor ""dummy.some_use""(%p) : (tensor) -> () } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.tensor.make_loop_independent %0 {num_loops = 2} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @not_enough_loops(%lb: index, %ub: index, %step: index, %t: tensor, %f: f32) { scf.for %i = %lb to %ub step %step { scf.for %j = %lb to %ub step %step { %low = affine.apply affine_map<(d0, d1)[] -> (d0 + d1)> (%i, %j)[] %p = tensor.pad %t low[%low] high[5] { ^bb0(%arg1: index): tensor.yield %f : f32 } : tensor to tensor ""dummy.some_use""(%p) : (tensor) -> () } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.tensor.make_loop_independent %0 {num_loops = 3} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @make_empty_loop_independent(%lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %sz = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub] %empty = tensor.empty(%sz) : tensor ""dummy.some_use""(%empty) : (tensor) -> () } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.empty""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.tensor.make_loop_independent %0 {num_loops = 1} : (!transform.any_op) -> !transform.any_op }", mlir-opt -allow-unregistered-dialect -test-transform-dialect-interpreter -canonicalize -split-input-file -verify-diagnostics ,1 "func.func @single_dim_packing(%arg0: tensor<256xf32>) -> tensor<8x32xf32> { %empty = tensor.empty() : tensor<8x32xf32> %0 = tensor.pack %arg0 inner_dims_pos = [0] inner_tiles = [32] into %empty : tensor<256xf32> -> tensor<8x32xf32> return %0 : tensor<8x32xf32> }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-simplify-pack-patterns"" ",1 "func.func @single_dim_packing_with_padding(%arg0: tensor<255xf32>) -> tensor<8x32xf32> { %empty = tensor.empty() : tensor<8x32xf32> %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pack %arg0 padding_value(%cst : f32) inner_dims_pos = [0] inner_tiles = [32] into %empty : tensor<255xf32> -> tensor<8x32xf32> return %0 : tensor<8x32xf32> }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-simplify-pack-patterns"" ",1 "func.func @unknown_op() -> index { %0 = ""test.foo""() : () -> (tensor) %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @cast(%t: tensor<10xf32>) -> index { %0 = tensor.cast %t : tensor<10xf32> to tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @cast_unranked(%t: tensor<*xf32>) -> index { %0 = tensor.cast %t : tensor<*xf32> to tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @dim(%t: tensor) -> index { %c0 = arith.constant 0 : index %0 = tensor.dim %t, %c0 : tensor %1 = ""test.reify_bound""(%0) : (index) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @empty(%sz: index) -> (index, index) { %0 = tensor.empty(%sz) : tensor<6x?xf32> %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor<6x?xf32>) -> (index) %2 = ""test.reify_bound""(%0) {dim = 1} : (tensor<6x?xf32>) -> (index) return %1, %2 : index, index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @extract_slice_dynamic(%t: tensor, %sz: index) -> index { %0 = tensor.extract_slice %t[2][%sz][1] : tensor to tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @extract_slice_static(%t: tensor) -> index { %0 = tensor.extract_slice %t[2][5][1] : tensor to tensor<5xf32> %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor<5xf32>) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @extract_slice_dynamic_constant(%t: tensor, %sz: index) -> index { %0 = tensor.extract_slice %t[2][%sz][1] : tensor to tensor %1 = ""test.reify_constant_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @extract_slice_static_constant(%t: tensor) -> index { %0 = tensor.extract_slice %t[2][5][1] : tensor to tensor<5xf32> %1 = ""test.reify_constant_bound""(%0) {dim = 0} : (tensor<5xf32>) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @extract_slice_rank_reduce(%t: tensor, %sz: index) -> index { %0 = tensor.extract_slice %t[0, 2][1, %sz][1, 1] : tensor to tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @insert(%t: tensor, %f: f32, %pos: index) -> index { %0 = tensor.insert %f into %t[%pos] : tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @pad(%t: tensor, %a: index, %b: index) -> (index, index) { %pad = arith.constant 0.0 : f32 %0 = tensor.pad %t low[%a, 5] high[%a, %b] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor to tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) %2 = ""test.reify_bound""(%0) {dim = 1} : (tensor) -> (index) return %1, %2 : index, index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @rank(%t: tensor<5xf32>) -> index { %0 = tensor.rank %t : tensor<5xf32> %1 = ""test.reify_bound""(%0) : (index) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @dynamic_dims_are_equal(%t: tensor) { %c0 = arith.constant 0 : index %dim0 = tensor.dim %t, %c0 : tensor %dim1 = tensor.dim %t, %c0 : tensor ""test.are_equal""(%dim0, %dim1) : (index, index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @dynamic_dims_are_different(%t: tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %dim0 = tensor.dim %t, %c0 : tensor %val = arith.addi %dim0, %c1 : index ""test.are_equal""(%dim0, %val) : (index, index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @dynamic_dims_are_maybe_equal_1(%t: tensor) { %c0 = arith.constant 0 : index %c5 = arith.constant 5 : index %dim0 = tensor.dim %t, %c0 : tensor ""test.are_equal""(%dim0, %c5) : (index, index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @dynamic_dims_are_maybe_equal_2(%t: tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %dim0 = tensor.dim %t, %c0 : tensor %dim1 = tensor.dim %t, %c1 : tensor ""test.are_equal""(%dim0, %dim1) : (index, index) -> () return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "func.func @slice_constant(%arg0 : tensor<2x1xf32>) -> tensor<1x1xf32> { %cst = arith.constant dense<[[10.0], [11.0]]> : tensor<2x1xf32> %slice = tensor.extract_slice %cst[0, 0] [1, 1] [1, 1] : tensor<2x1xf32> to tensor<1x1xf32> return %slice : tensor<1x1xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-constant-extract-slice ,1 "func.func @slice_constant_3x4(%arg0 : tensor<3x4xf32>) -> tensor<2x2xf32> { %cst = arith.constant dense<[[10.0, 9.0, 8.0, 7.0], [11.0, 12.0, 13.0, 14.0], [1.0, 3.0, 5.0, 7.0]]> : tensor<3x4xf32> %slice = tensor.extract_slice %cst[0, 0] [2, 2] [1, 1] : tensor<3x4xf32> to tensor<2x2xf32> return %slice : tensor<2x2xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-constant-extract-slice ,1 "func.func @slice_constant_3x4_offsets(%arg0 : tensor<3x4xf32>) -> tensor<2x2xf32> { %cst = arith.constant dense<[[10.0, 9.0, 8.0, 7.0], [11.0, 12.0, 13.0, 14.0], [1.0, 3.0, 5.0, 7.0]]> : tensor<3x4xf32> %slice = tensor.extract_slice %cst[1, 1] [2, 2] [1, 1] : tensor<3x4xf32> to tensor<2x2xf32> return %slice : tensor<2x2xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-constant-extract-slice ,1 "func.func @fold_vector_transfer_read_with_rank_reduced_extract_slice( %arg0 : tensor, %arg1: index, %arg2 : index, %arg3 : index, %arg4: index, %arg5 : index, %arg6 : index) -> vector<4xf32> { %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %arg0[0, %arg1, %arg2] [1, %arg3, %arg4] [1, 1, 1] : tensor to tensor %1 = vector.transfer_read %0[%arg5, %arg6], %cst {in_bounds = [true]} : tensor, vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @transfer_read_from_rank_reducing_extract_slice_failure( %src: tensor<1x8x8x8xf32>, %i1: index, %i2: index, %i3: index, %i4: index) -> vector<4xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %f0 = arith.constant 0.000000e+00 : f32 %0 = tensor.extract_slice %src[0, %i1, %i2, %i3] [1, 4, 1, 4] [2, 3, 4, 5] : tensor<1x8x8x8xf32> to tensor<1x4x4xf32> %1 = vector.transfer_read %0[%c1, %i4, %c2], %f0 {in_bounds = [true]} : tensor<1x4x4xf32>, vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @transfer_read_of_extract_slice(%t : tensor, %s1 : index, %s2 : index) -> vector<5x6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1] [10, %s2] [1, 1] : tensor to tensor<10x?xf32> %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true, true]} : tensor<10x?xf32>, vector<5x6xf32> return %1 : vector<5x6xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @fold_extract_slice_with_transfer_read_0d( %arg0 : tensor<12x32xf32>, %arg1 : index, %arg2 : index, %arg3 : index) -> vector { %f1 = arith.constant 1.0 : f32 %0 = tensor.extract_slice %arg0[%arg1, %arg2][1, 1][1, 1] : tensor<12x32xf32> to tensor %1 = vector.transfer_read %0[], %f1 : tensor, vector return %1 : vector }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @transfer_read_of_extract_slice(%t : tensor, %s1 : index, %s2 : index) -> vector<6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1] [10, %s2] [1, 1] : tensor to tensor<10x?xf32> %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true]} : tensor<10x?xf32>, vector<6xf32> return %1 : vector<6xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @transfer_read_of_extract_slice_rank_reducing(%t : tensor, %s1 : index, %s2 : index) -> vector<5x6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1, 6] [1, %s2, 12] [1, 1, 1] : tensor to tensor %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true, true]} : tensor, vector<5x6xf32> return %1 : vector<5x6xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @transfer_read_of_extract_slice_swappy_rank_reducing(%t : tensor, %s1 : index, %s2 : index) -> vector<5x6xf32> { %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.0 : f32 %0 = tensor.extract_slice %t[5, %s1, %s2] [%s2, 1, 12] [1, 1, 1] : tensor to tensor %1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true, true]} : tensor, vector<5x6xf32> return %1 : vector<5x6xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @fold_vector_transfer_write_with_rank_reduced_insert_slice( %arg0 : tensor, %arg1 : vector<4xf32>, %arg2: index, %arg3 : index, %arg4 : index, %arg5: index, %arg6 : index, %arg7 : index, %st : tensor) -> tensor { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_write %arg1, %st[%arg6, %arg7] {in_bounds = [true]} : vector<4xf32>, tensor %1 = tensor.insert_slice %0 into %arg0[0, %arg2, %arg3] [1, %arg4, %arg5] [1, 1, 1] : tensor into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @fold_vector_transfer_write_with_inner_rank_reduced_insert_slice( %arg0 : tensor, %arg1 : vector<4xf32>, %arg2: index, %arg3 : index, %arg4 : index, %arg5: index, %arg6 : index, %arg7 : index, %st : tensor) -> tensor { %cst = arith.constant 0.0 : f32 %0 = vector.transfer_write %arg1, %st[%arg6, %arg7] {in_bounds = [true]} : vector<4xf32>, tensor %1 = tensor.insert_slice %0 into %arg0[%arg2, %arg3, 0] [%arg4, %arg5, 1] [1, 1, 1] : tensor into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_transfer_write(%t1 : tensor, %v : vector<5x6xf32>, %s : index, %t2 : tensor<5x6xf32>) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %t2[%c0, %c0] {in_bounds = [true, true]} : vector<5x6xf32>, tensor<5x6xf32> %1 = tensor.insert_slice %0 into %t1[3, %s] [5, 6] [1, 1] : tensor<5x6xf32> into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_transfer_write_swappy_rank_extending( %t1 : tensor, %v : vector<5x6xf32>, %s : index, %t2 : tensor<5x6xf32>) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %t2[%c0, %c0] {in_bounds = [true, true]} : vector<5x6xf32>, tensor<5x6xf32> %1 = tensor.insert_slice %0 into %t1[4, 3, %s] [5, 1, 6] [1, 1, 1] : tensor<5x6xf32> into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_transfer_write_rank_extending(%t1 : tensor, %v : vector<5x6xf32>, %s : index, %t2 : tensor<5x6xf32>) -> tensor { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %t2[%c0, %c0] {in_bounds = [true, true]} : vector<5x6xf32>, tensor<5x6xf32> %1 = tensor.insert_slice %0 into %t1[4, 3, %s] [1, 5, 6] [1, 1, 1] : tensor<5x6xf32> into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_insert_slice(%t: tensor, %r0: tensor<1x1xf32>, %r1: tensor<1x14xf32>, %pos: index) -> tensor<1x14xf32> { %0 = tensor.insert_slice %t into %r0[1, 2] [1, 1] [1, 1] : tensor into tensor<1x1xf32> %1 = tensor.insert_slice %0 into %r1[3, %pos] [1, 1] [1, 1] : tensor<1x1xf32> into tensor<1x14xf32> return %1 : tensor<1x14xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_insert_slice(%t: tensor, %r0: tensor<1xf32>, %r1: tensor<1x14xf32>, %pos: index) -> tensor<1x14xf32> { %0 = tensor.insert_slice %t into %r0[2] [1] [1] : tensor into tensor<1xf32> %1 = tensor.insert_slice %0 into %r1[3, %pos] [1, 1] [1, 1] : tensor<1xf32> into tensor<1x14xf32> return %1 : tensor<1x14xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @fail_insert_slice_of_insert_slice( %t: tensor<4xf32>, %r0: tensor, %r1: tensor, %pos: index) -> tensor { %0 = tensor.insert_slice %t into %r0[%pos] [4] [1] : tensor<4xf32> into tensor %1 = tensor.insert_slice %0 into %r1[%pos, 423] [%pos, 1] [1, 1] : tensor into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_insert_slice_dynamic( %t: tensor, %r0: tensor, %r1: tensor, %pos: index) -> tensor { %0 = tensor.insert_slice %t into %r0[%pos] [%pos] [1] : tensor into tensor %1 = tensor.insert_slice %0 into %r1[%pos, 423] [%pos, 1] [1, 1] : tensor into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_of_insert_slice_dynamic( %t: tensor, %r0: tensor, %r1: tensor, %pos: index) -> tensor { %0 = tensor.insert_slice %t into %r0[%pos] [%pos] [1] : tensor into tensor %1 = tensor.insert_slice %0 into %r1[%pos, 423] [%pos, 1] [1, 1] : tensor into tensor return %1 : tensor }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @parallel_insert_slice_of_insert_slice_dynamic( %t: tensor<12x34xf32>, %o0: index, %o1: index, %sz0: index, %sz1: index) -> tensor<12x34xf32>{ %0 = scf.forall (%arg0, %arg1) in (27, 8) shared_outs(%arg2 = %t) -> (tensor<12x34xf32>) { %tt = ""make_me_a_tensor""() : () -> tensor %tt2 = ""make_me_another_tensor""() : () -> tensor %inserted_slice = tensor.insert_slice %tt into %tt2[%o1, 0] [%sz0, %sz1] [1, 1] : tensor into tensor scf.forall.in_parallel { tensor.parallel_insert_slice %inserted_slice into %arg2[%o0, %o1] [%sz0, %sz1] [1, 1] : tensor into tensor<12x34xf32> } } return %0: tensor<12x34xf32> }", mlir-opt -fold-tensor-subset-ops -split-input-file --allow-unregistered-dialect ,1 "func.func @tensor_bitcast_chain_ok(%input: tensor<2xi32>) -> tensor<2xf32> { %0 = tensor.bitcast %input : tensor<2xi32> to tensor<2xui32> %1 = tensor.bitcast %0 : tensor<2xui32> to tensor<2xf32> return %1 : tensor<2xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @tensor_bitcast_chain_nop(%input: tensor<4xi32>) -> tensor<4xi32> { %0 = tensor.bitcast %input : tensor<4xi32> to tensor<4xui32> %1 = tensor.bitcast %0 : tensor<4xui32> to tensor<4xi32> return %1 : tensor<4xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @cast_values(%arg0: tensor<*xi32>) -> tensor<2xi32> { %0 = tensor.cast %arg0 : tensor<*xi32> to tensor<*xi32> %2 = tensor.cast %0 : tensor<*xi32> to tensor<2xi32> %4 = tensor.cast %2 : tensor<2xi32> to tensor<2xi32> return %4 : tensor<2xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @tensor.cast_chain_ok(%input: tensor<*xi32>) -> tensor<4x8xi32> { %0 = tensor.cast %input : tensor<*xi32> to tensor<4x?xi32> %1 = tensor.cast %0 : tensor<4x?xi32> to tensor<4x8xi32> return %1 : tensor<4x8xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @tensor.cast_chain_regain(%input: tensor<4xi32>) -> tensor<4xi32> { %0 = tensor.cast %input : tensor<4xi32> to tensor %1 = tensor.cast %0 : tensor to tensor<4xi32> return %1 : tensor<4xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @tensor.cast_chain_keep(%input: tensor) -> tensor { %0 = tensor.cast %input : tensor to tensor<4x?xi32> %1 = tensor.cast %0 : tensor<4x?xi32> to tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @tensor.cast_chain_invalid(%input: tensor<4x8xi32>) -> tensor<8x4xi32> { %0 = tensor.cast %input : tensor<4x8xi32> to tensor %1 = tensor.cast %0 : tensor to tensor<8x4xi32> return %1 : tensor<8x4xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_extract(%arg0 : index) -> (f32, f16, f16, i32, complex) { %const_0 = arith.constant 0 : index %const_1 = arith.constant 1 : index %const_3 = arith.constant 3 : index %0 = arith.constant dense<4.0> : tensor<4xf32> %ext_1 = tensor.extract %0[%arg0] : tensor<4xf32> %1 = arith.constant sparse<[[0, 0, 0], [1, 1, 1]], [-5.0, -2.0]> : tensor<4x4x4xf16> %ext_2 = tensor.extract %1[%const_1, %const_1, %const_1] : tensor<4x4x4xf16> %2 = arith.constant sparse<[[1, 1, 1]], [-2.0]> : tensor<2x2x2xf16> %ext_3 = tensor.extract %2[%const_0, %const_0, %const_0] : tensor<2x2x2xf16> %3 = arith.constant dense<[[[1, -2, 1, 36]], [[0, 2, -1, 64]]]> : tensor<2x1x4xi32> %ext_4 = tensor.extract %3[%const_1, %const_0, %const_3] : tensor<2x1x4xi32> %4 = arith.constant dense<(1.2, 2.3)> : tensor> %ext_5 = tensor.extract %4[] : tensor> return %ext_1, %ext_2, %ext_3, %ext_4, %ext_5 : f32, f16, f16, i32, complex }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_insert(%arg0 : index) -> (tensor<4xf32>) { %0 = arith.constant dense<4.0> : tensor<4xf32> %1 = arith.constant 4.0 : f32 %ins_1 = tensor.insert %1 into %0[%arg0] : tensor<4xf32> return %ins_1 : tensor<4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.cast(%tensor: tensor<9xf32>) -> f32 { %c0 = arith.constant 0 : index %casted = tensor.cast %tensor : tensor<9xf32> to tensor %result = tensor.extract %casted[%c0] : tensor return %result : f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.from_elements(%element : index) -> index { %c0 = arith.constant 0 : index %tensor = tensor.from_elements %element : tensor<1xindex> %extracted_element = tensor.extract %tensor[%c0] : tensor<1xindex> return %extracted_element : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.from_elements_0d(%element : index) -> index { %c0 = arith.constant 0 : index %tensor = tensor.from_elements %element : tensor %extracted_element = tensor.extract %tensor[] : tensor return %extracted_element : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.from_elements_3d() -> (f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32) { %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 %f3 = arith.constant 3.0 : f32 %f4 = arith.constant 4.0 : f32 %f5 = arith.constant 5.0 : f32 %f6 = arith.constant 6.0 : f32 %f7 = arith.constant 7.0 : f32 %f8 = arith.constant 8.0 : f32 %f9 = arith.constant 9.0 : f32 %f10 = arith.constant 10.0 : f32 %f11 = arith.constant 11.0 : f32 %tensor = tensor.from_elements %f0,%f1,%f2,%f3,%f4,%f5,%f6,%f7,%f8,%f9,%f10,%f11 : tensor<3x2x2xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %r0 = tensor.extract %tensor[%c0, %c0, %c0] : tensor<3x2x2xf32> %r1 = tensor.extract %tensor[%c0, %c0, %c1] : tensor<3x2x2xf32> %r2 = tensor.extract %tensor[%c0, %c1, %c0] : tensor<3x2x2xf32> %r3 = tensor.extract %tensor[%c0, %c1, %c1] : tensor<3x2x2xf32> %r4 = tensor.extract %tensor[%c1, %c0, %c0] : tensor<3x2x2xf32> %r5 = tensor.extract %tensor[%c1, %c0, %c1] : tensor<3x2x2xf32> %r6 = tensor.extract %tensor[%c1, %c1, %c0] : tensor<3x2x2xf32> %r7 = tensor.extract %tensor[%c1, %c1, %c1] : tensor<3x2x2xf32> %r8 = tensor.extract %tensor[%c2, %c0, %c0] : tensor<3x2x2xf32> %r9 = tensor.extract %tensor[%c2, %c0, %c1] : tensor<3x2x2xf32> %r10 = tensor.extract %tensor[%c2, %c1, %c0] : tensor<3x2x2xf32> %r11 = tensor.extract %tensor[%c2, %c1, %c1] : tensor<3x2x2xf32> return %r0,%r1,%r2,%r3,%r4,%r5,%r6,%r7,%r8,%r9,%r10,%r11 : f32,f32,f32,f32,f32,f32,f32,f32,f32,f32,f32,f32 }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_elements_complex_i() -> tensor<3xcomplex> { %c1 = arith.constant dense<(1, 2)> : tensor> %complex1 = tensor.extract %c1[] : tensor> %c2 = arith.constant dense<(3, 2)> : tensor> %complex2 = tensor.extract %c2[] : tensor> %tensor = tensor.from_elements %complex1, %complex2, %complex1 : tensor<3xcomplex> return %tensor : tensor<3xcomplex> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_elements_complex_f() -> tensor<3xcomplex> { %c1 = arith.constant dense<(1.2, 2.3)> : tensor> %complex1 = tensor.extract %c1[] : tensor> %c2 = arith.constant dense<(3.2, 2.1)> : tensor> %complex2 = tensor.extract %c2[] : tensor> %tensor = tensor.from_elements %complex1, %complex2, %complex1 : tensor<3xcomplex> return %tensor : tensor<3xcomplex> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_negative_from_tensor.from_elements(%element : index) -> index { %c-1 = arith.constant -1 : index %tensor = tensor.from_elements %element : tensor<1xindex> %extracted_element = tensor.extract %tensor[%c-1] : tensor<1xindex> return %extracted_element : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_oob_from_tensor.from_elements(%element : index) -> index { %c1 = arith.constant 1 : index %tensor = tensor.from_elements %element : tensor<1xindex> %extracted_element = tensor.extract %tensor[%c1] : tensor<1xindex> return %extracted_element : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_oob_from_tensor.from_elements(%element : index) -> index { %c2 = arith.constant 2 : index %tensor = tensor.from_elements %element : tensor<1xindex> %extracted_element = tensor.extract %tensor[%c2] : tensor<1xindex> return %extracted_element : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.generate(%idx: index, %tensor: tensor<*xf32>) -> index { %size = tensor.rank %tensor : tensor<*xf32> %0 = tensor.generate %size { ^bb0(%arg0: index): %1 = tensor.dim %tensor, %arg0 : tensor<*xf32> tensor.yield %1 : index } : tensor %1 = tensor.extract %0[%idx] : tensor return %1 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.generate_2d(%idx0: index, %idx1: index, %tensor: tensor<*xf32>) -> index { %size = tensor.rank %tensor : tensor<*xf32> %0 = tensor.generate %size, %size { ^bb0(%arg0: index, %arg1: index): %1 = tensor.dim %tensor, %arg0 : tensor<*xf32> %2 = tensor.dim %tensor, %arg1 : tensor<*xf32> %3 = arith.addi %1, %2 : index tensor.yield %3 : index } : tensor %4 = tensor.extract %0[%idx0, %idx1] : tensor return %4 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @extract_from_tensor.generate_sideeffects(%idx: index, %tensor: tensor<*xf32>, %mem: memref) -> index { %size = tensor.rank %tensor : tensor<*xf32> %0 = tensor.generate %size { ^bb0(%arg0: index): %1 = tensor.dim %tensor, %arg0 : tensor<*xf32> memref.store %1, %mem[%arg0] : memref tensor.yield %1 : index } : tensor %1 = tensor.extract %0[%idx] : tensor return %1 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @static_tensor.generate(%size1: index, %size4: index) -> tensor<3x?x?x7x?xindex> { %c5 = arith.constant 5 : index %0 = tensor.generate %size1, %c5, %size4 { ^bb0(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index): %1 = arith.constant 32 : index tensor.yield %1 : index } : tensor<3x?x?x7x?xindex> return %0 : tensor<3x?x?x7x?xindex> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @from_elements.constant() -> tensor<3xindex> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %tensor = tensor.from_elements %c1, %c2, %c1 : tensor<3xindex> return %tensor : tensor<3xindex> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = tensor.extract_slice %arg0[%c0, %arg1, %c1] [%c4, %c1, %arg2] [%c1, %c1, %c1] : tensor to tensor return %0 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @rank_reducing_slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = tensor.extract_slice %arg0[%c0, %arg1, %c1] [%c4, 1, %arg2] [%c1, %c1, %c1] : tensor to tensor return %0 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @trivial_slice(%arg0 : tensor<4x6x16x32xi8>) -> tensor<4x6x16x32xi8> { %0 = tensor.extract_slice %arg0[0, 0, 0, 0] [4, 6, 16, 32] [1, 1, 1, 1] : tensor<4x6x16x32xi8> to tensor<4x6x16x32xi8> return %0 : tensor<4x6x16x32xi8> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @trivial_insert_slice(%arg0 : tensor<4x6x16x32xi8>, %arg1 : tensor<4x6x16x32xi8>) -> tensor<4x6x16x32xi8> { %0 = tensor.insert_slice %arg0 into %arg1[0, 0, 0, 0] [4, 6, 16, 32] [1, 1, 1, 1] : tensor<4x6x16x32xi8> into tensor<4x6x16x32xi8> return %0 : tensor<4x6x16x32xi8> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @rank_reducing_tensor_of_cast(%arg : tensor<4x6x16x32xi8>) -> tensor<16x32xi8> { %0 = tensor.cast %arg : tensor<4x6x16x32xi8> to tensor %1 = tensor.extract_slice %0[0, 1, 0, 0] [1, 1, 16, 32] [1, 1, 1, 1] : tensor to tensor<16x32xi8> return %1 : tensor<16x32xi8> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @rank_reducing_insert_slice_of_cast(%a : tensor<16x32xi8>, %b : tensor<4x6x16x32xi8>) -> tensor<4x6x16x32xi8> { %c0 = arith.constant 0: index %cast = tensor.cast %a : tensor<16x32xi8> to tensor %sz = tensor.dim %cast, %c0: tensor %res = tensor.insert_slice %cast into %b[0, 1, 0, 0] [1, 1, %sz, 32] [1, 1, 1, 1] : tensor into tensor<4x6x16x32xi8> return %res : tensor<4x6x16x32xi8> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @insert_slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = tensor.insert_slice %arg0 into %arg3[%c0, %arg1, %c1] [%c4, %c1, %arg2] [%c1, %c1, %c1] : tensor into tensor return %0 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @slice_to_insert_slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = tensor.extract_slice %arg0[%c0, %arg1, %c1] [%c4, %c1, %arg2] [%c1, %c1, %c1] : tensor to tensor %1 = tensor.insert_slice %0 into %arg3[%c0, %arg1, %c1] [%c4, %c1, %arg2] [%c1, %c1, %c1] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @rank_reducing_insert_slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = tensor.insert_slice %arg0 into %arg3[%c0, %arg1, %c1] [%c4, 1, %arg2] [%c1, %c1, %c1] : tensor into tensor return %0 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @rank_reducing_slice_to_insert_slice_canonicalize(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %0 = tensor.extract_slice %arg0[%c0, %arg1, %c1] [%c4, 1, %arg2] [%c1, %c1, %c1] : tensor to tensor %1 = tensor.insert_slice %0 into %arg3[%c0, %arg1, %c1] [%c4, 1, %arg2] [%c1, %c1, %c1] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @insert_slice_propagate_dest_cast(%arg0 : tensor<2x?xi32>, %arg1 : tensor, %arg2 : index, %arg3 : index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c8 = arith.constant 8 : index %0 = tensor.dim %arg0, %c1 : tensor<2x?xi32> %1 = tensor.extract %arg1[] : tensor %2 = tensor.generate %arg2, %c8 { ^bb0(%arg4: index, %arg5: index): tensor.yield %1 : i32 } : tensor %3 = tensor.insert_slice %arg0 into %2[0, %arg3] [2, %0] [1, 1] : tensor<2x?xi32> into tensor return %3 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @insert_slice_output_dest_canonicalize(%arg0 : tensor<2x3xi32>, %arg1 : tensor) -> tensor<3x9xi32> { %c9 = arith.constant 9 : index %c3 = arith.constant 3 : index %2 = tensor.extract %arg1[] : tensor %4 = tensor.generate %c3, %c9 { ^bb0(%arg2: index, %arg3: index): tensor.yield %2 : i32 } : tensor %5 = tensor.insert_slice %arg0 into %4[0, 1] [2, 3] [1, 1] : tensor<2x3xi32> into tensor %6 = tensor.cast %5 : tensor to tensor<3x9xi32> return %6 : tensor<3x9xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dim_of_tensor.generate(%arg0: index, %arg1: index) -> index { %c3 = arith.constant 3 : index %0 = tensor.generate %arg0, %arg1 { ^bb0(%arg2: index, %arg3: index, %arg4: index, %arg5: index, %arg6: index): tensor.yield %c3 : index } : tensor<2x?x4x?x5xindex> %1 = tensor.dim %0, %c3 : tensor<2x?x4x?x5xindex> return %1 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_dim_of_tensor.cast(%arg0 : tensor<4x?xf32>) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.cast %arg0 : tensor<4x?xf32> to tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor return %1, %2: index, index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @insert_tensor_cast_on_insert_slice_src( %arg0 : tensor, %arg1 : tensor, %sz0: index, %sz2: index) -> tensor { %c64 = arith.constant 64: index %r = tensor.insert_slice %arg0 into %arg1[0, 1, 2] [%c64, 5, %c64] [1, 1, 1] : tensor into tensor return %r : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_extract_insert(%input : tensor, %slice: tensor<4x?x8xf32>, %i: index, %size: index) -> (tensor<4x?x8xf32>) { %c0 = arith.constant 0: index %c1 = arith.constant 1: index %0 = tensor.insert_slice %slice into %input[%c0, %i, 0] [4, %size, 8] [1, 1, %c1] : tensor<4x?x8xf32> into tensor %1 = tensor.extract_slice %0[%c0, %i, 0] [4, %size, 8] [1, 1, %c1] : tensor to tensor<4x?x8xf32> return %1 : tensor<4x?x8xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_extract_constant_splat() -> (tensor<4x4xi32>) { %cst = arith.constant dense<42> : tensor<1024x1024xi32> %1 = tensor.extract_slice %cst[0,0] [4,4] [1, 1] : tensor<1024x1024xi32> to tensor<4x4xi32> return %1 : tensor<4x4xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_overlapping_insert(%input : tensor, %slice1: tensor<4x?x8xf32>, %slice2: tensor<4x?x8xf32>, %i: index, %size: index) -> (tensor) { %c0 = arith.constant 0: index %c1 = arith.constant 1: index %0 = tensor.insert_slice %slice1 into %input[%c0, %i, 0] [4, %size, 8] [1, 1, %c1] : tensor<4x?x8xf32> into tensor %1 = tensor.insert_slice %slice2 into %0[0, %i, 0] [4, %size, 8] [1, 1, %c1] : tensor<4x?x8xf32> into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_expand_of_expand(%arg0 : tensor) -> tensor { %0 = tensor.expand_shape %arg0 [[0, 1], [2]] : tensor into tensor %1 = tensor.expand_shape %0 [[0, 1], [2], [3, 4]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_expand_of_expand_of_zero_dim(%arg0 : tensor) -> tensor<1x1x1xf32> { %0 = tensor.expand_shape %arg0 [] : tensor into tensor<1xf32> %1 = tensor.expand_shape %0 [[0, 1, 2]] : tensor<1xf32> into tensor<1x1x1xf32> return %1 : tensor<1x1x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @collapse_of_cast(%t: tensor<8x12x32xf32>) -> tensor { %0 = tensor.cast %t : tensor<8x12x32xf32> to tensor %1 = tensor.collapse_shape %0 [[0, 1], [2]] : tensor into tensor %2 = tensor.cast %1 : tensor to tensor return %2 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand(%arg0 : tensor<12x4xf32>) -> tensor<12x4xf32> { %0 = tensor.expand_shape %arg0 [[0, 1], [2]] : tensor<12x4xf32> into tensor<3x4x4xf32> %1 = tensor.collapse_shape %0 [[0, 1], [2]] : tensor<3x4x4xf32> into tensor<12x4xf32> return %1 : tensor<12x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand_dynamic(%arg0 : tensor) -> tensor { %0 = tensor.expand_shape %arg0 [[0, 1], [2]] : tensor into tensor %1 = tensor.collapse_shape %0 [[0, 1], [2]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_expand_of_collapse(%arg0 : tensor<2x3x4x5x6x7x8xf32>) -> tensor<24x5x42x8xf32> { %0 = tensor.collapse_shape %arg0 [[0, 1, 2, 3, 4, 5, 6]] : tensor<2x3x4x5x6x7x8xf32> into tensor<40320xf32> %1 = tensor.expand_shape %0 [[0, 1, 2, 3]] : tensor<40320xf32> into tensor<24x5x42x8xf32> return %1 : tensor<24x5x42x8xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_expand_of_collapse_7D(%arg0 : tensor<24x5x42x8xf32>) -> tensor<2x3x4x5x6x7x8xf32> { %0 = tensor.collapse_shape %arg0 [[0, 1, 2, 3]] : tensor<24x5x42x8xf32> into tensor<40320xf32> %1 = tensor.expand_shape %0 [[0, 1, 2, 3, 4, 5, 6]] : tensor<40320xf32> into tensor<2x3x4x5x6x7x8xf32> return %1 : tensor<2x3x4x5x6x7x8xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_expand(%arg : tensor) -> tensor { %0 = tensor.expand_shape %arg [[0], [1], [2, 3]] : tensor into tensor %1 = tensor.collapse_shape %0 [[0, 1], [2, 3]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_expand_1D(%arg0 : tensor<2048xf32>) -> tensor<4x512xf32> { %0 = tensor.expand_shape %arg0 [[0, 1, 2, 3]] : tensor<2048xf32> into tensor<1x4x1x512xf32> %1 = tensor.collapse_shape %0 [[0, 1, 2], [3]] : tensor<1x4x1x512xf32> into tensor<4x512xf32> return %1 : tensor<4x512xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_expand_of_collapse_0_rank_to_expand(%arg0 : tensor<1x1x1xf32>) -> tensor<1x1x1x1xf32> { %0 = tensor.collapse_shape %arg0 [] : tensor<1x1x1xf32> into tensor %1 = tensor.expand_shape %0 [] : tensor into tensor<1x1x1x1xf32> return %1 : tensor<1x1x1x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_expand_of_collapse_0_rank_to_collapse(%arg0 : tensor<1x1x1x1xf32>) -> tensor<1x1x1xf32> { %0 = tensor.collapse_shape %arg0 [] : tensor<1x1x1x1xf32> into tensor %1 = tensor.expand_shape %0 [] : tensor into tensor<1x1x1xf32> return %1 : tensor<1x1x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @zero_rank_reshape_multi(%arg0: tensor) -> tensor { %0 = tensor.expand_shape %arg0 [] : tensor into tensor<1xf32> %1 = tensor.expand_shape %0 [[0, 1]] : tensor<1xf32> into tensor<1x1xf32> %2 = tensor.collapse_shape %1 [] : tensor<1x1xf32> into tensor return %2 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_collapse(%arg0 : tensor) -> tensor { %0 = tensor.collapse_shape %arg0 [[0, 1], [2], [3, 4]] : tensor into tensor %1 = tensor.collapse_shape %0 [[0, 1], [2]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_collapse_zero_dim(%arg0 : tensor<1x1x1xf32>) -> tensor { %0 = tensor.collapse_shape %arg0 [[0, 1, 2]] : tensor<1x1x1xf32> into tensor<1xf32> %1 = tensor.collapse_shape %0 [] : tensor<1xf32> into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand_1D(%arg0 : tensor<4x512xf32>) -> tensor<2048xf32> { %0 = tensor.expand_shape %arg0 [[0, 1, 2], [3]] : tensor<4x512xf32> into tensor<1x4x1x512xf32> %1 = tensor.collapse_shape %0 [[0, 1, 2, 3]] : tensor<1x4x1x512xf32> into tensor<2048xf32> return %1 : tensor<2048xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand_unit_dims(%arg0 : tensor<2048x1x1xf32>) -> tensor<4x512x1x1xf32> { %0 = tensor.expand_shape %arg0 [[0, 1, 2, 3], [4], [5]] : tensor<2048x1x1xf32> into tensor<1x4x1x512x1x1xf32> %1 = tensor.collapse_shape %0 [[0, 1, 2], [3], [4], [5]] : tensor<1x4x1x512x1x1xf32> into tensor<4x512x1x1xf32> return %1 : tensor<4x512x1x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_expand_unit_dims(%arg0 : tensor<2048x1x2048xf32>) -> tensor<4x512x1x512x4xf32> { %0 = tensor.expand_shape %arg0 [[0, 1, 2, 3, 4], [5], [6, 7, 8]] : tensor<2048x1x2048xf32> into tensor<1x4x1x512x1x1x512x1x4xf32> %1 = tensor.collapse_shape %0 [[0, 1, 2], [3, 4], [5], [6, 7], [8]] : tensor<1x4x1x512x1x1x512x1x4xf32> into tensor<4x512x1x512x4xf32> return %1 : tensor<4x512x1x512x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_expand_trailing_unit_dims(%arg0: tensor<2xf32>) -> tensor<2x1xf32> { %0 = tensor.expand_shape %arg0 [[0, 1, 2]] : tensor<2xf32> into tensor<2x1x1xf32> %1 = tensor.collapse_shape %0 [[0], [1, 2]] : tensor<2x1x1xf32> into tensor<2x1xf32> return %1 : tensor<2x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @compose_collapse_of_collapse_unit_dims_dynamic( %arg0 : tensor) -> tensor { %0 = tensor.collapse_shape %arg0 [[0], [1, 2], [3], [4], [5], [6, 7, 8]] : tensor into tensor %1 = tensor.collapse_shape %0 [[0], [1], [2, 3, 4], [5]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand_trailing_unit_dims(%arg0: tensor<2xf32>) -> tensor<2x1xf32> { %0 = tensor.expand_shape %arg0 [[0, 1, 2]] : tensor<2xf32> into tensor<2x1x1xf32> %1 = tensor.collapse_shape %0 [[0], [1, 2]] : tensor<2x1x1xf32> into tensor<2x1xf32> return %1 : tensor<2x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_collapse_trailing_unit_dims_dynamic( %arg0: tensor<1x1x?x1x1x1xf32>) -> tensor { %0 = tensor.collapse_shape %arg0 [[0, 1, 2], [3], [4], [5]] : tensor<1x1x?x1x1x1xf32> into tensor %1 = tensor.collapse_shape %0 [[0, 1, 2, 3]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand_trailing_unit_dims(%arg0: tensor<12x42x1x1xf32>) -> tensor<12x42xf32> { %0 = tensor.expand_shape %arg0 [[0], [1], [2], [3, 4]] : tensor<12x42x1x1xf32> into tensor<12x42x1x1x1xf32> %1 = tensor.collapse_shape %0 [[0], [1, 2, 3, 4]] : tensor<12x42x1x1x1xf32> into tensor<12x42xf32> return %1 : tensor<12x42xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_of_expand_unit_dims_in_middle(%arg0 : tensor) -> tensor { %0 = tensor.expand_shape %arg0 [[0], [1], [2, 3]] : tensor into tensor %1 = tensor.collapse_shape %0 [[0], [1, 2, 3]] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @no_fold_collapse_of_expand_incompatible(%arg0 : tensor<4x6x8xf32>) -> tensor<2x6x16xf32> { %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3], [4]] : tensor<4x6x8xf32> into tensor<2x2x3x2x8xf32> %1 = tensor.collapse_shape %0 [[0], [1, 2], [3, 4]] : tensor<2x2x3x2x8xf32> into tensor<2x6x16xf32> return %1 : tensor<2x6x16xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @no_fold_collapse_of_expand_empty_expr(%arg0: tensor<3x2x2xf32>) -> tensor<12x1xf32> { %0 = tensor.expand_shape %arg0 [[0], [1], [2, 3]] : tensor<3x2x2xf32> into tensor<3x2x2x1xf32> %1 = tensor.collapse_shape %0 [[0, 1, 2], [3]] : tensor<3x2x2x1xf32> into tensor<12x1xf32> return %1 : tensor<12x1xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @reshape_splat_constant_int32() -> tensor<2x4x2xi32> { %c0 = arith.constant dense<42> : tensor<2x8xi32> %0 = tensor.expand_shape %c0 [[0], [1, 2]] : tensor<2x8xi32> into tensor<2x4x2xi32> return %0 : tensor<2x4x2xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @expand_shape_splat(%arg : f32) -> tensor<2x2x2xf32> { %c0 = tensor.splat %arg : tensor<2x4xf32> %0 = tensor.expand_shape %c0 [[0], [1, 2]] : tensor<2x4xf32> into tensor<2x2x2xf32> return %0 : tensor<2x2x2xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @collapse_shape_splat(%arg : f32) -> tensor<2x4xf32> { %c0 = tensor.splat %arg : tensor<2x2x2xf32> %0 = tensor.collapse_shape %c0 [[0], [1, 2]] : tensor<2x2x2xf32> into tensor<2x4xf32> return %0 : tensor<2x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @reshape_splat_constant_int16() -> tensor<2x4x2xi16> { %c0 = arith.constant dense<42> : tensor<2x8xi16> %0 = tensor.expand_shape %c0 [[0], [1, 2]] : tensor<2x8xi16> into tensor<2x4x2xi16> return %0 : tensor<2x4x2xi16> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @reshape_splat_constant_float32() -> tensor<2x4x2xf32> { %c0 = arith.constant dense<42.0> : tensor<2x8xf32> %0 = tensor.expand_shape %c0 [[0], [1, 2]] : tensor<2x8xf32> into tensor<2x4x2xf32> return %0 : tensor<2x4x2xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @reshape_splat_constant_float64() -> tensor<2x4x2xf64> { %c0 = arith.constant dense<42.0> : tensor<2x8xf64> %0 = tensor.expand_shape %c0 [[0], [1, 2]] : tensor<2x8xf64> into tensor<2x4x2xf64> return %0 : tensor<2x4x2xf64> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_rank() -> (index) { %const_0 = arith.constant dense<[[[1, -2, 1, 36]], [[0, 2, -1, 64]]]> : tensor<2x1x4xi32> %rank_0 = tensor.rank %const_0 : tensor<2x1x4xi32> return %rank_0 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_same_static_shape(%arg0: tensor<5x6xf32>, %a: index) -> tensor<5x6xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pad %arg0 low[%a, 0] high[0, %a] { ^bb0(%arg1: index, %arg2: index): tensor.yield %cst : f32 } : tensor<5x6xf32> to tensor<5x6xf32> return %0 : tensor<5x6xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_fold_static(%arg0: tensor) -> tensor { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %padding = arith.constant 4 : index %padded = tensor.pad %arg0 low[0, %padding, 1, 1] high[0, %padding, 1, 1] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst: f32 } : tensor to tensor return %padded : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_nofold_same_static_shape(%arg0: tensor<5x6xf32>, %a: index) -> tensor<5x6xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pad %arg0 nofold low[%a, 0] high[0, %a] { ^bb0(%arg1: index, %arg2: index): tensor.yield %cst : f32 } : tensor<5x6xf32> to tensor<5x6xf32> return %0 : tensor<5x6xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_after_cast_different_shape(%arg0: tensor) -> tensor { %cst = arith.constant 0.000000e+00 : f32 %dynamic = tensor.cast %arg0 : tensor to tensor %padded = tensor.pad %dynamic low[0, 0, 1, 1] high[0, 0, 1, 1] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst: f32 } : tensor to tensor return %padded: tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_after_cast_same_shape(%arg0: tensor, %padding : index) -> tensor { %cst = arith.constant 0.000000e+00 : f32 %dynamic = tensor.cast %arg0 : tensor to tensor %padded = tensor.pad %dynamic low[0, %padding, 1, 1] high[0, %padding, 1, 1] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst: f32 } : tensor to tensor return %padded: tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_of_cast(%t: tensor<8x?xf32>, %s: index) -> tensor<8x32xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.cast %t : tensor<8x?xf32> to tensor %1 = tensor.pad %0 low[%c0, %c0] high[%c0, %s] { ^bb0(%arg9: index, %arg10: index): tensor.yield %cst : f32 } : tensor to tensor<8x32xf32> return %1 : tensor<8x32xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @cast_of_pad_more_static(%arg0: tensor, %padding: index) -> tensor<32x32xf32> { %cst = arith.constant 0.000000e+00 : f32 %padded = tensor.pad %arg0 low[%padding, %padding] high[0, 0] { ^bb0(%arg1: index, %arg2: index): tensor.yield %cst : f32 } : tensor to tensor %casted = tensor.cast %padded : tensor to tensor<32x32xf32> return %casted : tensor<32x32xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @cast_of_pad_less_static(%arg0: tensor<32x?x?xf32>, %padding: index) -> tensor { %cst = arith.constant 0.000000e+00 : f32 %padded = tensor.pad %arg0 low[%padding, %padding, %padding] high[0, 0, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %cst : f32 } : tensor<32x?x?xf32> to tensor<32x?x?xf32> %casted = tensor.cast %padded : tensor<32x?x?xf32> to tensor return %casted : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_cast_fold(%arg0: tensor<4x4xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = tensor.cast %arg0 : tensor<4x4xf32> to tensor %1 = tensor.pad %0 low[%c0, %c0] high[%c0, %c0] { ^bb0(%arg1: index, %arg2: index): tensor.yield %cst : f32 } : tensor to tensor<4x4xf32> return %1 : tensor<4x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_pad_source_cast(%arg0: tensor<4x?xf32>) -> tensor<4x4xf32> { %cst = arith.constant 0.0 : f32 %0 = tensor.cast %arg0 : tensor<4x?xf32> to tensor %1 = tensor.pad %0 low[0, 0] high[0, 1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %cst : f32 } : tensor to tensor<4x4xf32> return %1 : tensor<4x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_static_zero_cast(%arg0: tensor, %pad_value: f32) -> tensor<2x3x4xf32> { %c0 = arith.constant 0 : index %0 = tensor.pad %arg0 low[0, %c0, 0] high[0, 0, %c0] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %pad_value : f32 } : tensor to tensor<2x3x4xf32> return %0 : tensor<2x3x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pad_nofold_static_zero(%arg0: tensor, %pad_value: f32) -> tensor<2x3x4xf32> { %c0 = arith.constant 0 : index %0 = tensor.pad %arg0 nofold low[0, %c0, 0] high[0, 0, %c0] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %pad_value : f32 } : tensor to tensor<2x3x4xf32> return %0 : tensor<2x3x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_orthogonal_pad_chains(%arg0: tensor<64x64xf32>, %sz0 : index, %sz1 : index, %pw0 : index, %pw1 : index) -> tensor<8x4xf32> { %pad_value = arith.constant 0.0 : f32 %0 = tensor.extract_slice %arg0[16, 0] [%sz0, 64] [1, 1] : tensor<64x64xf32> to tensor %1 = tensor.pad %0 low[0, 0] high[%pw0, 0] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor to tensor<8x64xf32> %2 = tensor.extract_slice %1[0, 4] [8, %sz1] [1, 1] : tensor<8x64xf32> to tensor<8x?xf32> %3 = tensor.pad %2 nofold low[0, 0] high[0, %pw1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<8x?xf32> to tensor<8x4xf32> func.return %3 : tensor<8x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_pad_chains(%arg0: tensor<64x64xf32>, %sz0 : index, %sz1 : index, %pw0 : index, %pw1 : index) -> (tensor<8x4xf32>, tensor<4x64xf32>, tensor<8x4xf32>, tensor<6x4xf32>) { %pad_value = arith.constant 0.0 : f32 %0 = tensor.extract_slice %arg0[16, 0] [%sz0, 64] [1, 1] : tensor<64x64xf32> to tensor %1 = tensor.pad %0 low[0, 0] high[%pw0, 0] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor to tensor<8x64xf32> %different_value = arith.constant 1.0 : f32 %2 = tensor.extract_slice %1[0, 4] [8, %sz1] [1, 1] : tensor<8x64xf32> to tensor<8x?xf32> %3 = tensor.pad %2 nofold low[0, 0] high[0, %pw1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %different_value : f32 } : tensor<8x?xf32> to tensor<8x4xf32> %4 = tensor.extract_slice %1[4, 0] [%sz1, 64] [1, 1] : tensor<8x64xf32> to tensor %5 = tensor.pad %4 nofold low[0, 0] high[%pw1, 0] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor to tensor<4x64xf32> %6 = tensor.extract_slice %1[%sz0, 4] [8, %sz1] [1, 1] : tensor<8x64xf32> to tensor<8x?xf32> %7 = tensor.pad %6 nofold low[0, 0] high[0, %pw1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<8x?xf32> to tensor<8x4xf32> %8 = tensor.extract_slice %1[0, 4] [6, %sz1] [1, 1] : tensor<8x64xf32> to tensor<6x?xf32> %9 = tensor.pad %8 nofold low[0, 0] high[0, %pw1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<6x?xf32> to tensor<6x4xf32> func.return %3, %5, %7, %9 : tensor<8x4xf32>, tensor<4x64xf32>, tensor<8x4xf32>, tensor<6x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_collapse_shape_from_elements(%arg0: i32) -> tensor { %0 = tensor.from_elements %arg0 : tensor<1xi32> %1 = tensor.collapse_shape %0 [] : tensor<1xi32> into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_expand_shape_from_elements(%arg0: i32) -> tensor<1xi32> { %0 = tensor.from_elements %arg0 : tensor %1 = tensor.expand_shape %0 [] : tensor into tensor<1xi32> return %1 : tensor<1xi32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @propogate_index_cast(%arg0: tensor<1xi32>) -> index { %c0 = arith.constant 0 : index %0 = arith.index_cast %arg0 : tensor<1xi32> to tensor<1xindex> %1 = tensor.extract %0[%c0] : tensor<1xindex> return %1 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @splat_fold() -> tensor<4xf32> { %c = arith.constant 1.0 : f32 %t = tensor.splat %c : tensor<4xf32> return %t : tensor<4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @insert_slice_cast(%arg0 : tensor<1x?xf32>, %arg1 : tensor, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index, %arg7 : index) -> tensor { %0 = tensor.cast %arg0 : tensor<1x?xf32> to tensor %1 = tensor.insert_slice %0 into %arg1[%arg2, %arg3] [%arg4, %arg5] [%arg6, %arg7] : tensor into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @cast_extract_slice(%arg0 : tensor<128x512xf32>, %s : index, %o : index) -> tensor<16x512xf32> { %0 = tensor.extract_slice %arg0[%o, 0] [%s, 512] [1, 1] : tensor<128x512xf32> to tensor %1 = tensor.cast %0 : tensor to tensor<16x512xf32> return %1 : tensor<16x512xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @cast_extract_slice_rank_reduce(%arg0 : tensor<128x512xf32>, %s : index, %o : index) -> tensor<16xf32> { %0 = tensor.extract_slice %arg0[%o, 0] [%s, 1] [1, 1] : tensor<128x512xf32> to tensor %1 = tensor.cast %0 : tensor to tensor<16xf32> return %1 : tensor<16xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @canonicalize_parallel_insert_slice_indices( %arg0 : tensor<1x5xf32>, %arg1: tensor, %num_threads : index) -> tensor { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = scf.forall (%tidx) in (%num_threads) shared_outs(%o = %arg1) -> (tensor) { %3 = tensor.cast %arg0 : tensor<1x5xf32> to tensor scf.forall.in_parallel { tensor.parallel_insert_slice %3 into %o[%tidx, %c0] [%c1, 5] [%c1, %c1] : tensor into tensor } } return %2 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_parallel_insert_slice( %arg0 : tensor<1x5xf32>, %arg1: tensor<1x5xf32>) -> tensor<1x5xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = scf.forall () in () shared_outs(%o = %arg1) -> (tensor<1x5xf32>) { scf.forall.in_parallel { tensor.parallel_insert_slice %arg0 into %o[%c0, %c0] [1, 5] [%c1, %c1] : tensor<1x5xf32> into tensor<1x5xf32> } } return %2 : tensor<1x5xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_insert_slice_after_extract_slice(%input: tensor<1x2x2x4xf32>) -> tensor<1x2x2x4xf32> { %c0 = arith.constant 0 : index %0 = tensor.extract_slice %input[0, 0, 0, 0] [1, 1, 2, 4] [1, 1, 1, 1] : tensor<1x2x2x4xf32> to tensor<1x2x4xf32> %1 = tensor.insert_slice %0 into %input[%c0, 0, %c0, 0] [1, 1, 2, 4] [1, 1, 1, 1] : tensor<1x2x4xf32> into tensor<1x2x2x4xf32> return %1: tensor<1x2x2x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_mismatched_source_dst(%input0: tensor<1x2x2x4xf32>, %input1: tensor<1x2x2x4xf32>) -> tensor<1x2x2x4xf32> { %c0 = arith.constant 0 : index %0 = tensor.extract_slice %input0[0, 0, 0, 0] [1, 1, 2, 4] [1, 1, 1, 1] : tensor<1x2x2x4xf32> to tensor<1x2x4xf32> %1 = tensor.insert_slice %0 into %input1[%c0, 0, %c0, 0] [1, 1, 2, 4] [1, 1, 1, 1] : tensor<1x2x4xf32> into tensor<1x2x2x4xf32> return %1: tensor<1x2x2x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dont_fold_mismatched_parameters(%input: tensor<1x2x2x4xf32>) -> tensor<1x2x2x4xf32> { %c0 = arith.constant 0 : index %0 = tensor.extract_slice %input[0, 0, 0, 0] [1, 1, 2, 4] [1, 1, 1, 1] : tensor<1x2x2x4xf32> to tensor<1x2x4xf32> %1 = tensor.insert_slice %0 into %input[%c0, 1, %c0, 0] [1, 1, 2, 4] [1, 1, 1, 1] : tensor<1x2x4xf32> into tensor<1x2x2x4xf32> return %1: tensor<1x2x2x4xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @empty_canonicalize() -> (tensor<4x5x?xf32>) { %c6 = arith.constant 6 : index %0 = tensor.empty(%c6) : tensor<4x5x?xf32> return %0 : tensor<4x5x?xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @fold_empty_tensor_with_cast(%arg0 : index) -> tensor<1x12xf32> { %0 = tensor.empty(%arg0) : tensor %1 = tensor.cast %0 : tensor to tensor<1x12xf32> return %1 : tensor<1x12xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func private @some_use(%i : index, %j : index) func.func @empty_tensor_canonicalize(%i : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.empty(%i) : tensor %1 = tensor.dim %0, %c0: tensor %2 = tensor.dim %0, %c1: tensor call @some_use(%1, %2) : (index, index) -> () return }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dim_of_expand_shape(%t: tensor) -> index { %c2 = arith.constant 2 : index %0 = tensor.expand_shape %t [[0], [1, 2, 3, 4, 5]] : tensor into tensor %1 = tensor.dim %0, %c2 : tensor return %1 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @dim_of_collapse_shape(%t: tensor) -> index { %c1 = arith.constant 1 : index %0 = tensor.collapse_shape %t [[0], [1, 2, 3, 4]] : tensor into tensor %1 = tensor.dim %0, %c1 : tensor return %1 : index }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @collapse_expand_fold_to_cast(%t: tensor) -> (tensor) { %0 = tensor.expand_shape %t [[0, 1]] : tensor into tensor<1x?xf32> %1 = tensor.collapse_shape %0 [[0, 1]] : tensor<1x?xf32> into tensor return %1 : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unpack_pack(%t: tensor<128x128xf32>) -> tensor<128x128xf32> { %tensor_empty = tensor.empty() : tensor<16x16x8x8xf32> %packed = tensor.pack %t inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %tensor_empty : tensor<128x128xf32> -> tensor<16x16x8x8xf32> %tensor_empty1 = tensor.empty() : tensor<128x128xf32> %unpacked = tensor.unpack %packed inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %tensor_empty1 : tensor<16x16x8x8xf32> -> tensor<128x128xf32> return %unpacked : tensor<128x128xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unpack_pack(%t: tensor<128x128xf32>) -> tensor<128x128xf32> { %tensor_empty = tensor.empty() : tensor<16x16x8x8xf32> %packed = tensor.pack %t inner_dims_pos = [1, 0] inner_tiles = [8, 8] into %tensor_empty : tensor<128x128xf32> -> tensor<16x16x8x8xf32> %tensor_empty1 = tensor.empty() : tensor<128x128xf32> %unpacked = tensor.unpack %packed inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %tensor_empty1 : tensor<16x16x8x8xf32> -> tensor <128x128xf32> return %unpacked : tensor<128x128xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unpack_pack(%t: tensor<128x128xf32>) -> tensor<128x128xf32> { %tensor_empty = tensor.empty() : tensor<16x16x8x8xf32> %packed = tensor.pack %t outer_dims_perm = [1, 0] inner_dims_pos = [1, 0] inner_tiles = [8, 8] into %tensor_empty : tensor<128x128xf32> -> tensor<16x16x8x8xf32> %tensor_empty1 = tensor.empty() : tensor<128x128xf32> %unpacked = tensor.unpack %packed inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %tensor_empty1 : tensor<16x16x8x8xf32> -> tensor <128x128xf32> return %unpacked : tensor<128x128xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @unpack_pack(%t: tensor<128x128xf32>, %tile1: index, %tile2: index) -> tensor<128x128xf32> { %tensor_empty = tensor.empty(%tile1, %tile2) : tensor<16x16x?x?xf32> %packed = tensor.pack %t inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty : tensor<128x128xf32> -> tensor<16x16x?x?xf32> %tensor_empty1 = tensor.empty() : tensor<128x128xf32> %unpacked = tensor.unpack %packed inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty1 : tensor<16x16x?x?xf32> -> tensor <128x128xf32> return %unpacked : tensor<128x128xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pack_unpack(%t: tensor<16x16x?x?xf32>, %tile1: index, %tile2: index) -> tensor<16x16x?x?xf32> { %tensor_empty = tensor.empty() : tensor<128x128xf32> %unpacked = tensor.unpack %t inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty : tensor<16x16x?x?xf32> -> tensor<128x128xf32> %tensor_empty1 = tensor.empty(%tile1, %tile2) : tensor<16x16x?x?xf32> %packed = tensor.pack %unpacked inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty1 : tensor<128x128xf32> -> tensor<16x16x?x?xf32> return %packed : tensor<16x16x?x?xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pack_unpack(%t: tensor<16x16x8x8xf32>) -> tensor<16x16x8x8xf32> { %tensor_empty = tensor.empty() : tensor<128x128xf32> %unpacked = tensor.unpack %t inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %tensor_empty : tensor<16x16x8x8xf32> -> tensor<128x128xf32> %tensor_empty1 = tensor.empty() : tensor<16x16x8x8xf32> %packed = tensor.pack %unpacked inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %tensor_empty1 : tensor<128x128xf32> -> tensor<16x16x8x8xf32> return %packed : tensor<16x16x8x8xf32> }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pack_unpack_same_tiles(%t: tensor, %dim1: index, %dim2: index, %dim3: index, %dim4: index, %dim5: index, %dim6: index, %tile1: index, %tile2: index) -> tensor { %tensor_empty = tensor.empty(%dim1, %dim2) : tensor %unpacked = tensor.unpack %t inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty : tensor -> tensor %tensor_empty1 = tensor.empty(%dim3, %dim4, %dim5, %dim6) : tensor %packed = tensor.pack %unpacked inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty1 : tensor -> tensor return %packed : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pack_unpack_different_tiles(%t: tensor, %dim1: index, %dim2: index, %dim3: index, %dim4: index, %dim5: index, %dim6: index, %tile1: index, %tile2: index) -> tensor { %tensor_empty = tensor.empty(%dim1, %dim2) : tensor %unpacked = tensor.unpack %t inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty : tensor -> tensor %tensor_empty1 = tensor.empty(%dim3, %dim4, %dim5, %dim6) : tensor %packed = tensor.pack %unpacked inner_dims_pos = [0, 1] inner_tiles = [%tile2, %tile1] into %tensor_empty1 : tensor -> tensor return %packed : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @pack_unpack_dynamic_with_padding(%t: tensor, %dim1: index, %dim2: index, %dim3: index, %dim4: index, %dim5: index, %dim6: index, %tile1: index, %tile2: index, %pad: f32) -> tensor { %tensor_empty = tensor.empty(%dim1, %dim2) : tensor %unpacked = tensor.unpack %t inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty : tensor -> tensor %tensor_empty1 = tensor.empty(%dim3, %dim4, %dim5, %dim6) : tensor %packed = tensor.pack %unpacked padding_value(%pad: f32) inner_dims_pos = [0, 1] inner_tiles = [%tile1, %tile2] into %tensor_empty1 : tensor -> tensor return %packed : tensor }"," mlir-opt -split-input-file -canonicalize=""test-convergence"" ",1 "func.func @insert_slice( %arg0 : tensor, %arg1 : tensor, %arg2 : index, %arg3 : index, %arg4 : index) -> (index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %d2 = tensor.dim %arg0, %c2 : tensor %0 = tensor.insert_slice %arg0 into %arg1[%arg2, %arg3, %arg4] [%d0, %d1, %d2] [1, 1, 1] : tensor into tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor %3 = tensor.dim %0, %c2 : tensor return %1, %2, %3 : index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : index) -> (index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [%arg1, %arg2, %arg3] [1, 1, 1] : tensor to tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor %3 = tensor.dim %0, %c2 : tensor return %1, %2, %3 : index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice_rank_reduced_1(%arg0 : tensor, %arg1 : index) -> index { %c0 = arith.constant 0 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [1, %arg1, 1] [1, 1, 1] : tensor to tensor %1 = tensor.dim %0, %c0 : tensor return %1 : index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice_rank_reduced_2(%arg0 : tensor, %arg1 : index) -> index { %c0 = arith.constant 0 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [1, %arg1, 1] [1, 1, 1] : tensor to tensor %1 = tensor.dim %0, %c0 : tensor return %1 : index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice_rank_reduced_3(%arg0 : tensor, %arg1 : index) -> index { %c1 = arith.constant 1 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [1, %arg1, 1] [1, 1, 1] : tensor to tensor<1x?xf32> %1 = tensor.dim %0, %c1 : tensor<1x?xf32> return %1 : index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice_rank_reduced_4(%arg0 : tensor, %arg1 : index) -> index { %c1 = arith.constant 1 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [1, %arg1, 1] [1, 1, 1] : tensor to tensor<1x?x1xf32> %1 = tensor.dim %0, %c1 : tensor<1x?x1xf32> return %1 : index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice_rank_reduced_5(%arg0 : tensor, %arg1 : index, %arg2 : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [%arg1, 1, %arg2] [1, 1, 1] : tensor to tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor return %1, %2 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @extract_slice_rank_reduced_6(%arg0 : tensor, %arg1 : index, %arg2 : index) -> (index, index) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %0 = tensor.extract_slice %arg0[0, 0, 0] [%arg1, 1, %arg2] [1, 1, 1] : tensor to tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c2 : tensor return %1, %2 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @dim(%arg0: tensor<*xf32>, %arg1: index) -> index { %0 = tensor.dim %arg0, %arg1 : tensor<*xf32> return %0 : index }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @rank(%arg0: tensor<*xf32>) -> index { %0 = tensor.rank %arg0 : tensor<*xf32> return %0 : index }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.cast(%arg0: tensor) -> tensor<2xindex> { %0 = tensor.cast %arg0 : tensor to tensor<2xindex> return %0 : tensor<2xindex> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.cast_from_unranked(%arg0: tensor<*xf32>) -> tensor<2xf32> { %0 = tensor.cast %arg0 : tensor<*xf32> to tensor<2xf32> return %0 : tensor<2xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.cast_to_unranked(%arg0: tensor<2xf32>) -> tensor<*xf32> { %0 = tensor.cast %arg0 : tensor<2xf32> to tensor<*xf32> return %0 : tensor<*xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.empty() -> tensor<5xf32> { %0 = tensor.empty() : tensor<5xf32> return %0 : tensor<5xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.extract(%arg0: tensor, %arg1: index) -> f32 { %0 = tensor.extract %arg0[%arg1] : tensor return %0 : f32 }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.from_elements_0d(%arg0: index) -> tensor { %0 = tensor.from_elements %arg0 : tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.from_elements_1d(%arg0: index, %arg1: index) -> tensor<2xindex> { %0 = tensor.from_elements %arg0, %arg1 : tensor<2xindex> return %0 : tensor<2xindex> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.from_elements_2d(%arg0: index, %arg1: index) -> tensor<3x2xindex> { %0 = tensor.from_elements %arg0, %arg1, %arg0, %arg1, %arg0, %arg1 : tensor<3x2xindex> return %0 : tensor<3x2xindex> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.from_elements_3d(%f0 : f32) -> tensor<3x2x2xf32> { %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 %f3 = arith.constant 3.0 : f32 %f4 = arith.constant 4.0 : f32 %f5 = arith.constant 5.0 : f32 %f6 = arith.constant 6.0 : f32 %f7 = arith.constant 7.0 : f32 %f8 = arith.constant 8.0 : f32 %f9 = arith.constant 9.0 : f32 %f10 = arith.constant 10.0 : f32 %f11 = arith.constant 11.0 : f32 %0 = tensor.from_elements %f0,%f1,%f2,%f3,%f4,%f5,%f6,%f7,%f8,%f9,%f10,%f11 : tensor<3x2x2xf32> return %0 : tensor<3x2x2xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.generate(%arg: tensor<*xf32>, %dynamic_extent: index) -> tensor { %result = tensor.generate %dynamic_extent { ^bb0(%i : index): %elem = tensor.dim %arg, %i : tensor<*xf32> tensor.yield %elem : index } : tensor return %result : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.generate_static_and_dynamic(%arg0: index) -> tensor<16x?xindex> { %result = tensor.generate %arg0 { ^bb0(%i: index, %j: index): %sum = arith.addi %i, %j : index tensor.yield %sum : index } : tensor<16x?xindex> return %result : tensor<16x?xindex> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.generate_unknown_ops_in_body(%arg0: index) -> tensor { %tensor = tensor.generate %arg0 { ^bb0(%iv: index): %0 = ""test.source""() : () -> index tensor.yield %0 : index } : tensor return %tensor : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.extract_slice( %t1: tensor, %idx1: index, %idx2: index) -> tensor { %0 = tensor.extract_slice %t1[5, %idx2][%idx1, 10][1, 1] : tensor to tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.extract_slice_rank_reducing( %t1: tensor, %idx1: index, %idx2: index) -> tensor { %0 = tensor.extract_slice %t1[5, %idx1, 10][%idx2, 1, 15][1, 1, 1] : tensor to tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.insert_slice(%t1: tensor, %t2: tensor, %idx1: index, %idx2: index) -> tensor { %0 = tensor.insert_slice %t2 into %t1[%idx1, 5][%idx2, 10][1, 1] : tensor into tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.insert_slice_rank_reducing_1( %t1: tensor, %f: tensor, %idx1: index, %idx2: index) -> tensor { %0 = tensor.insert_slice %f into %t1[%idx1, %idx2][1, 1][1, 1] : tensor into tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.insert_slice_rank_reducing_2( %t1: tensor, %t2: tensor<2x1x4x1x1xf32>, %i: index) -> tensor { %0 = tensor.insert_slice %t2 into %t1[%i, %i, %i, %i, %i, %i, %i][1, 2, 1, 4, 1, 1, 1][1, 1, 1, 1, 1, 1, 1] : tensor<2x1x4x1x1xf32> into tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.insert(%t1: tensor<5xf32>, %idx1: index, %f: f32) -> tensor<5xf32> { %0 = tensor.insert %f into %t1[%idx1] : tensor<5xf32> return %0 : tensor<5xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.expand_shape(%t1: tensor) -> tensor<2x?x10xf32> { %0 = tensor.expand_shape %t1 [[0, 1], [2]] : tensor into tensor<2x?x10xf32> return %0 : tensor<2x?x10xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.expand_shape_of_slice( %t1: tensor, %o1: index, %s1: index) -> tensor { %0 = tensor.extract_slice %t1[%o1, 5][%s1, 10][1, 1] : tensor to tensor %1 = tensor.expand_shape %0 [[0, 1], [2, 3]] : tensor into tensor return %1 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.expand_shape_of_scalar_slice( %t1: tensor, %o1: index, %s1: index) -> tensor<1xf32> { %0 = tensor.extract_slice %t1[%o1][1][1] : tensor to tensor %1 = tensor.expand_shape %0 [] : tensor into tensor<1xf32> return %1 : tensor<1xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape(%t1: tensor<2x?x?xf32>) -> tensor { %0 = tensor.collapse_shape %t1 [[0, 1], [2]] : tensor<2x?x?xf32> into tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape_to_scalar(%t1: tensor<1x1x1xf32>) -> tensor { %0 = tensor.collapse_shape %t1 [] : tensor<1x1x1xf32> into tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape_of_slice(%arg0: tensor<2xi32>) -> tensor { %0 = tensor.extract_slice %arg0[1] [1] [1] : tensor<2xi32> to tensor<1xi32> %1 = tensor.collapse_shape %0 [] : tensor<1xi32> into tensor return %1 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape_of_slice2( %arg0: tensor, %o1: index, %o2: index, %o3: index, %o4: index) -> tensor<87x63648xi64> { %0 = tensor.extract_slice %arg0[%o1, %o2, %o3, %o4] [87, 78, 68, 12] [1, 1, 1, 1] : tensor to tensor<87x78x68x12xi64> %1 = tensor.collapse_shape %0 [[0], [1, 2, 3]] : tensor<87x78x68x12xi64> into tensor<87x63648xi64> return %1 : tensor<87x63648xi64> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape_of_slice3(%t1: tensor<1x2xf32>) -> tensor<1xf32> { %0 = tensor.extract_slice %t1[0, 0][1, 1][1, 1] : tensor<1x2xf32> to tensor<1x1xf32> %1 = tensor.collapse_shape %0 [[0, 1]] : tensor<1x1xf32> into tensor<1xf32> return %1 : tensor<1xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape_of_slice4(%arg0: tensor, %offset: index, %size: index) -> tensor<8xf32> { %0 = tensor.extract_slice %arg0[0, 0, %offset] [4, 2, 1] [1, 1, 1] : tensor to tensor<4x2x1xf32> %ret = tensor.collapse_shape %0 [[0, 1, 2]] : tensor<4x2x1xf32> into tensor<8xf32> return %ret: tensor<8xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.collapse_shape_of_slice5(%arg0: tensor<2x2x2xi64>) -> tensor<4xi64> { %0 = tensor.extract_slice %arg0[0, 0, 0] [2, 1, 2] [1, 1, 1] : tensor<2x2x2xi64> to tensor<2x1x2xi64> %1 = tensor.collapse_shape %0 [[0, 1, 2]] : tensor<2x1x2xi64> into tensor<4xi64> return %1 : tensor<4xi64> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.reshape(%t1: tensor) -> tensor<2x2x5xf32> { %two = arith.constant 2 : i64 %five = arith.constant 5 : i64 %shape = tensor.from_elements %two, %two, %five : tensor<3xi64> %reshaped = tensor.reshape %t1(%shape) : (tensor, tensor<3xi64>) -> tensor<2x2x5xf32> return %reshaped : tensor<2x2x5xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.pad(%t1: tensor, %l2: index, %h1: index, %h2: index) -> tensor { %0 = tensor.pad %t1 low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): %m = arith.muli %arg0, %arg1 : index tensor.yield %m : index } : tensor to tensor return %0 : tensor }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @tensor.splat(%f: f32) -> tensor<10x2x4xf32> { %t = tensor.splat %f : tensor<10x2x4xf32> return %t : tensor<10x2x4xf32> }", mlir-opt -tensor-bufferize -cse -split-input-file -verify-diagnostics ,1 "func.func @extract_slice_static(%input: tensor<3x5x7x11xf32>) -> tensor<20x11xf32> { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<3x5x7x11xf32> into tensor<105x11xf32> %slice = tensor.extract_slice %collapsed [0, 0] [20, 11] [1, 1] : tensor<105x11xf32> to tensor<20x11xf32> return %slice : tensor<20x11xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @extract_slice_static(%input: tensor<3x5x7x11xf32>) -> tensor<20x11xf32> { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<3x5x7x11xf32> into tensor<105x11xf32> %slice = tensor.extract_slice %collapsed [0, 0] [20, 11] [1, 1] : tensor<105x11xf32> to tensor<20x11xf32> return %slice : tensor<20x11xf32> }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @extract_slice_static_strided(%input: tensor<3x5x7x11xf32>) -> tensor<10x5xf32> { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<3x5x7x11xf32> into tensor<105x11xf32> %slice = tensor.extract_slice %collapsed [13, 0] [10, 5] [2, 2] : tensor<105x11xf32> to tensor<10x5xf32> return %slice : tensor<10x5xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @extract_slice_static_strided(%input: tensor<3x5x7x11xf32>) -> tensor<10x5xf32> { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<3x5x7x11xf32> into tensor<105x11xf32> %slice = tensor.extract_slice %collapsed [13, 0] [10, 5] [2, 2] : tensor<105x11xf32> to tensor<10x5xf32> return %slice : tensor<10x5xf32> }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @extract_slice_dynamic(%input: tensor<3x?x?x11xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<3x?x?x11xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 5] [2, 2] : tensor to tensor return %slice : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @extract_slice_dynamic(%input: tensor<3x?x?x11xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<3x?x?x11xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 5] [2, 2] : tensor to tensor return %slice : tensor }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @extract_slice_dynamic_multidim(%input: tensor<3x?x?x11x?xf32>, %offt0: index, %size0: index, %offt1: index, %size1: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3, 4]] : tensor<3x?x?x11x?xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt0, %offt1] [%size0, %size1] [1, 1] : tensor to tensor return %slice : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @extract_slice_dynamic_multidim(%input: tensor<3x?x?x11x?xf32>, %offt0: index, %size0: index, %offt1: index, %size1: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3, 4]] : tensor<3x?x?x11x?xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt0, %offt1] [%size0, %size1] [1, 1] : tensor to tensor return %slice : tensor }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @extract_slice_non_sliced_linearized_dim(%input: tensor<3x?x?x11x2xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3, 4]] : tensor<3x?x?x11x2xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 22] [1, 1] : tensor to tensor return %slice : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @extract_slice_non_sliced_linearized_dim(%input: tensor<3x?x?x11x2xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3, 4]] : tensor<3x?x?x11x2xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 22] [1, 1] : tensor to tensor return %slice : tensor }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @no_sliced_linearized_dims(%input: tensor<30x11x100xf32>, %offt: index, %size: index) -> tensor<330x?xf32> { %collapsed = tensor.collapse_shape %input [[0, 1], [2]] : tensor<30x11x100xf32> into tensor<330x100xf32> %slice = tensor.extract_slice %collapsed [0, %offt] [330, %size] [1, 1] : tensor<330x100xf32> to tensor<330x?xf32> return %slice : tensor<330x?xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @no_sliced_linearized_dims(%input: tensor<30x11x100xf32>, %offt: index, %size: index) -> tensor<330x?xf32> { %collapsed = tensor.collapse_shape %input [[0, 1], [2]] : tensor<30x11x100xf32> into tensor<330x100xf32> %slice = tensor.extract_slice %collapsed [0, %offt] [330, %size] [1, 1] : tensor<330x100xf32> to tensor<330x?xf32> return %slice : tensor<330x?xf32> }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @collapse_and_slice_unit_dim(%input: tensor<1x11x100xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1], [2]] : tensor<1x11x100xf32> into tensor<11x100xf32> %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 100] [1, 1] : tensor<11x100xf32> to tensor return %slice : tensor } func.func @collapse_and_slice_multiple_unit_dim_dynamic(%input: tensor<1x?x1x100xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<1x?x1x100xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 100] [1, 1] : tensor to tensor return %slice : tensor } func.func @collapse_and_slice_multiple_unit_dim_mixed(%input: tensor<1x?x1x100x10xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3, 4]] : tensor<1x?x1x100x10xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, %offt] [%size, %size] [1, 1] : tensor to tensor return %slice : tensor } func.func @collapse_and_slice_multiple_all_unit_dim(%input: tensor<1x1x1x100xf32>) -> tensor<1x100xf32> { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<1x1x1x100xf32> into tensor<1x100xf32> %slice = tensor.extract_slice %collapsed [0, 0] [1, 100] [1, 1] : tensor<1x100xf32> to tensor<1x100xf32> return %slice : tensor<1x100xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-rewrite-extract-slice-from-collapse-shape ,1 "func.func @collapse_and_slice_unit_dim(%input: tensor<1x11x100xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1], [2]] : tensor<1x11x100xf32> into tensor<11x100xf32> %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 100] [1, 1] : tensor<11x100xf32> to tensor return %slice : tensor } func.func @collapse_and_slice_multiple_unit_dim_dynamic(%input: tensor<1x?x1x100xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<1x?x1x100xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, 0] [%size, 100] [1, 1] : tensor to tensor return %slice : tensor } func.func @collapse_and_slice_multiple_unit_dim_mixed(%input: tensor<1x?x1x100x10xf32>, %offt: index, %size: index) -> tensor { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3, 4]] : tensor<1x?x1x100x10xf32> into tensor %slice = tensor.extract_slice %collapsed [%offt, %offt] [%size, %size] [1, 1] : tensor to tensor return %slice : tensor } func.func @collapse_and_slice_multiple_all_unit_dim(%input: tensor<1x1x1x100xf32>) -> tensor<1x100xf32> { %collapsed = tensor.collapse_shape %input [[0, 1, 2], [3]] : tensor<1x1x1x100xf32> into tensor<1x100xf32> %slice = tensor.extract_slice %collapsed [0, 0] [1, 100] [1, 1] : tensor<1x100xf32> to tensor<1x100xf32> return %slice : tensor<1x100xf32> }"," mlir-opt -split-input-file -test-tensor-transform-patterns=""test-rewrite-extract-slice-from-collapse-shape use-foreach"" ",1 "func.func @test_drop_rank_expansion(%src: tensor<128x480xf32>, %dest: tensor<1x1x128x480xf32>) -> tensor<123x456xf32> { %inserted_slice = tensor.insert_slice %src into %dest[0, 0, 0, 0] [1, 1, 128, 480] [1, 1, 1, 1] : tensor<128x480xf32> into tensor<1x1x128x480xf32> %extracted_slice = tensor.extract_slice %inserted_slice[0, 0, 0, 0] [1, 1, 123, 456] [1, 1, 1, 1] : tensor<1x1x128x480xf32> to tensor<123x456xf32> return %extracted_slice : tensor<123x456xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-drop-redundant-insert-slice-rank-expansion ,1 "func.func @cast(%arg0: tensor<*xf32>, %arg1 : tensor<4x4xf32>, %arg2: tensor) { %0 = tensor.cast %arg0 : tensor<*xf32> to tensor %1 = tensor.cast %arg1 : tensor<4x4xf32> to tensor<*xf32> %2 = tensor.cast %arg2 : tensor to tensor<4x?xf32> %3 = tensor.cast %2 : tensor<4x?xf32> to tensor return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @empty(%sz: index) -> tensor<5x?x6xf32> { %0 = tensor.empty(%sz) : tensor<5x?x6xf32> return %0 : tensor<5x?x6xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @empty_with_encoding(%sz: index) -> tensor<5x?x6xf32, ""foo""> { %0 = tensor.empty(%sz) : tensor<5x?x6xf32, ""foo""> return %0 : tensor<5x?x6xf32, ""foo""> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @extract(%arg0: tensor, %arg1: index) { %0 = tensor.extract %arg0[%arg1, %arg1, %arg1] : tensor return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @insert(%arg0: f32, %arg1: index, %arg2: tensor) { %0 = tensor.insert %arg0 into %arg2[%arg1, %arg1, %arg1] : tensor return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @tensor.from_elements() { %c0 = ""arith.constant""() {value = 0: index} : () -> index %0 = tensor.from_elements %c0 : tensor<1xindex> %c1 = ""arith.constant""() {value = 1: index} : () -> index %1 = tensor.from_elements %c0, %c1 : tensor<2xindex> %c0_f32 = ""arith.constant""() {value = 0.0: f32} : () -> f32 %2 = tensor.from_elements %c0_f32 : tensor<1xf32> %3 = tensor.from_elements : tensor<0xindex> %4 = tensor.from_elements %c0, %c1, %c0, %c1, %c0, %c1 : tensor<2x3xindex> %5 = tensor.from_elements %c0 : tensor return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @tensor.generate(%m : index, %n : index) -> tensor { %tnsr = tensor.generate %m, %n { ^bb0(%i : index, %j : index, %k : index): %elem = arith.constant 8.0 : f32 tensor.yield %elem : f32 } : tensor return %tnsr : tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @tensor_reshape(%unranked: tensor<*xf32>, %shape1: tensor<1xi32>, %shape2: tensor<2xi32>, %shape3: tensor) -> tensor<*xf32> { %dyn_vec = tensor.reshape %unranked(%shape1) : (tensor<*xf32>, tensor<1xi32>) -> tensor %dyn_mat = tensor.reshape %dyn_vec(%shape2) : (tensor, tensor<2xi32>) -> tensor %new_unranked = tensor.reshape %dyn_mat(%shape3) : (tensor, tensor) -> tensor<*xf32> return %new_unranked : tensor<*xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @slice(%t: tensor<8x16x4xf32>, %idx : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %1 = tensor.extract_slice %t[%c0, %c0, %c0][%idx, %idx, %idx][%c1, %c1, %c1] : tensor<8x16x4xf32> to tensor %2 = tensor.extract_slice %t[0, 2, 0][4, 4, 4][1, 1, 1] : tensor<8x16x4xf32> to tensor<4x4x4xf32> %3 = tensor.extract_slice %t[0, 2, 0][4, 1, 4][1, 1, 1] : tensor<8x16x4xf32> to tensor<4x4xf32> return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @insert_slice( %t: tensor<8x16x4xf32>, %td: tensor<8x?x4xf32>, %t2: tensor<16x32x8xf32>, %t3: tensor<4x4xf32>, %idx : index, %sz : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %1 = tensor.insert_slice %t into %t2[%c0, %c0, %c0][8, 16, 4][%c1, %c1, %c1] : tensor<8x16x4xf32> into tensor<16x32x8xf32> %2 = tensor.insert_slice %t into %t2[%c0, %idx, %c0][8, 16, 4][%c1, 1, %c1] : tensor<8x16x4xf32> into tensor<16x32x8xf32> %3 = tensor.insert_slice %t3 into %t[0, 2, 0][4, 1, 4][1, 1, 1] : tensor<4x4xf32> into tensor<8x16x4xf32> %4 = tensor.insert_slice %td into %t[0, %idx, 0][8, %sz, 4][1, 1, 1] : tensor<8x?x4xf32> into tensor<8x16x4xf32> return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @tensor_reshape_zero_dim(%arg0 : tensor<1x1xf32>, %arg1 : tensor) -> (tensor, tensor<1x1xf32>) { %0 = tensor.collapse_shape %arg0 [] : tensor<1x1xf32> into tensor %1 = tensor.expand_shape %0 [] : tensor into tensor<1x1xf32> return %0, %1 : tensor, tensor<1x1xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @legal_collapsing_reshape_dynamic_tensor (%arg0: tensor) -> tensor { %0 = tensor.collapse_shape %arg0 [[0], [1], [2, 3, 4]] : tensor into tensor return %0 : tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @rank(%t : tensor<4x4x?xf32>) { %0 = ""tensor.rank""(%t) : (tensor<4x4x?xf32>) -> index %1 = tensor.rank %t : tensor<4x4x?xf32> return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pad_dynamic(%arg0: tensor<1x2x2x?xf32>, %low: index, %high: index, %pad_value: f32) -> tensor<6x?x?x?xf32> { %0 = tensor.pad %arg0 low[2, %low, 3, 3] high[3, 3, %high, 2] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %pad_value : f32 } : tensor<1x2x2x?xf32> to tensor<6x?x?x?xf32> return %0 : tensor<6x?x?x?xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pad_static(%arg0: tensor<3x4xf32>, %pad_value: f32) -> tensor<6x9xf32> { %0 = tensor.pad %arg0 low[1, 2] high[2, 3] { ^bb0(%arg1 : index, %arg2 : index): tensor.yield %pad_value : f32 } : tensor<3x4xf32> to tensor<6x9xf32> return %0 : tensor<6x9xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pad_asymmetrical(%arg0: tensor<2x3xf32>, %ub0: index, %ub1: index, %pad_value: f32) -> tensor { %0 = tensor.pad %arg0 low[0, 0] high[%ub0, %ub1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<2x3xf32> to tensor return %0 : tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pad_to_static_size(%arg0: tensor, %ub0: index, %ub1: index, %pad_value: f32) -> tensor<2x3xf32> { %0 = tensor.pad %arg0 low[0, 0] high[%ub0, %ub1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor to tensor<2x3xf32> return %0 : tensor<2x3xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @test_splat_op(%s : f32) { %v = tensor.splat %s : tensor<8xf32> %u = ""tensor.splat""(%s) : (f32) -> tensor<4xf32> return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @gather_scatter( %dest : tensor<4x5x6xf32>, %indices: tensor<1x3x2xindex>, %indices_i32: tensor<1x3x2xi32>) { %gathered = tensor.gather %dest[%indices_i32] gather_dims([1, 2]) unique: (tensor<4x5x6xf32>, tensor<1x3x2xi32>) -> tensor<1x3x4x1x1xf32> %rank_reduced_gathered = tensor.gather %dest[%indices] gather_dims([1, 2]) unique: (tensor<4x5x6xf32>, tensor<1x3x2xindex>) -> tensor<1x3x4xf32> %scattered = tensor.scatter %gathered into %dest[%indices] scatter_dims([1, 2]) unique: (tensor<1x3x4x1x1xf32>, tensor<4x5x6xf32>, tensor<1x3x2xindex>) -> tensor<4x5x6xf32> %rank_reduced_scattered = tensor.scatter %rank_reduced_gathered into %dest[%indices_i32] scatter_dims([1, 2]) unique: (tensor<1x3x4xf32>, tensor<4x5x6xf32>, tensor<1x3x2xi32>) -> tensor<4x5x6xf32> return }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pack_nc_to_ncnc(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) -> tensor<128x256xf32> { %0 = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> %1 = tensor.empty() : tensor<128x256xf32> %2 = tensor.unpack %0 inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %1 : tensor<4x16x32x16xf32> -> tensor<128x256xf32> return %2 : tensor<128x256xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pack_nc_to_ncnc_with_padding(%source: tensor<13x15xf32>, %dest: tensor<2x8x8x2xf32>, %padding: f32) -> tensor<13x15xf32> { %0 = tensor.pack %source padding_value(%padding : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %dest : tensor<13x15xf32> -> tensor<2x8x8x2xf32> %1 = tensor.empty() : tensor<13x15xf32> %2 = tensor.unpack %0 inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %1 : tensor<2x8x8x2xf32> -> tensor<13x15xf32> return %2 : tensor<13x15xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pack_ck_to_kcck(%source: tensor<128x256xf32>, %dest: tensor<16x4x32x16xf32>) -> tensor<128x256xf32> { %0 = tensor.pack %source outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<16x4x32x16xf32> %1 = tensor.empty() : tensor<128x256xf32> %2 = tensor.unpack %0 outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %1 : tensor<16x4x32x16xf32> -> tensor<128x256xf32> return %2 : tensor<128x256xf32> }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pad_and_pack_fully_dynamic(%source: tensor, %dest: tensor, %pad: f32, %tile_n : index, %tile_m : index) -> tensor { %0 = tensor.pack %source padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [%tile_n, %tile_m] into %dest : tensor -> tensor return %0 : tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @pad_and_pack_partially_dynamic(%source: tensor, %dest: tensor, %pad: f32) -> tensor { %0 = tensor.pack %source padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %dest : tensor -> tensor return %0 : tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @unpack_fully_dynamic(%source: tensor, %dest: tensor, %tile_n : index, %tile_m : index) -> tensor { %0 = tensor.unpack %source inner_dims_pos = [0, 1] inner_tiles = [%tile_n, %tile_m] into %dest : tensor -> tensor return %0 : tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @unpack_partially_dynamic(%source: tensor, %dest: tensor) -> tensor { %0 = tensor.unpack %source inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %dest : tensor -> tensor return %0: tensor }", mlir-opt --split-input-file | mlir-opt ,1 "func.func @insert_slice_fun( %A0 : tensor {bufferization.writable = false}, %A1 : tensor {bufferization.writable = true}, %t0 : tensor<4xf32> {bufferization.writable = false}, %t1 : tensor<4xf32> {bufferization.writable = true}) -> (tensor, tensor, tensor, tensor) { %r0 = tensor.insert_slice %t0 into %A0[0][4][1] : tensor<4xf32> into tensor %r1 = tensor.insert_slice %t1 into %A0[0][4][1] : tensor<4xf32> into tensor %r2 = tensor.insert_slice %t0 into %A1[0][4][1] : tensor<4xf32> into tensor %r3 = tensor.insert_slice %t1 into %A1[0][4][1] : tensor<4xf32> into tensor return %r0, %r1, %r2, %r3: tensor, tensor, tensor, tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_slice_fun( %A : tensor {bufferization.writable = true}, %t : tensor<4xf32> {bufferization.writable = false}) -> tensor { %f0 = arith.constant 0.0 : f32 %r0 = tensor.insert_slice %t into %A[0][4][1] : tensor<4xf32> into tensor %r1 = linalg.fill ins(%f0 : f32) outs(%r0 : tensor) -> tensor return %r1: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_slice_fun( %A : tensor {bufferization.writable = true}, %t : tensor<4xf32> {bufferization.writable = false}) -> tensor { %f0 = arith.constant 0.0 : f32 %r0 = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor %r1 = tensor.insert_slice %t into %r0[0][4][1] : tensor<4xf32> into tensor return %r1: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_slice_fun_not_inplace( %A : tensor {bufferization.writable = false}, %t : tensor<4xf32> {bufferization.writable = false}) -> tensor { %r0 = tensor.insert_slice %t into %A[0][4][1] : tensor<4xf32> into tensor return %r0: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @tensor_cast_not_in_place( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = false}, %idx: index) -> (tensor) { %r0 = tensor.cast %A : tensor to tensor<4xf32> %r1 = tensor.insert_slice %r0 into %A[%idx][4][1] : tensor<4xf32> into tensor return %r1 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_op(%t1 : tensor {bufferization.writable = true}, %s : f32, %i : index) -> tensor { %0 = tensor.insert %s into %t1[%i] : tensor return %0 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @rank_reducing( %i: index, %j: index, %arg0: tensor<8x18x32xf32>) -> tensor { %c1 = arith.constant 1 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %c32 = arith.constant 32 : index %c0 = arith.constant 0 : index %0 = bufferization.alloc_tensor() : tensor<4x1x6x8xf32> %1 = tensor.cast %0 : tensor<4x1x6x8xf32> to tensor %2 = bufferization.alloc_tensor() : tensor<1x6x8xf32> %5 = scf.for %arg7 = %c0 to %c32 step %c8 iter_args(%arg8 = %1) -> (tensor) { %7 = affine.apply affine_map<(d0) -> (d0 ceildiv 8)>(%arg7) %8 = tensor.extract_slice %arg0[%i, %j, %arg7] [1, 6, 8] [1, 1, 1] : tensor<8x18x32xf32> to tensor<1x6x8xf32> %9 = scf.for %arg9 = %c0 to %c6 step %c1 iter_args(%arg10 = %2) -> (tensor<1x6x8xf32>) { %11 = tensor.extract_slice %8[0, %arg9, 0] [1, 1, 8] [1, 1, 1] : tensor<1x6x8xf32> to tensor<1x1x8xf32> %12 = tensor.insert_slice %11 into %arg10[0, %arg9, 0] [1, 1, 8] [1, 1, 1] : tensor<1x1x8xf32> into tensor<1x6x8xf32> scf.yield %12 : tensor<1x6x8xf32> } %10 = tensor.insert_slice %9 into %arg8[%7, 0, 0, 0] [1, 1, 6, 8] [1, 1, 1, 1] : tensor<1x6x8xf32> into tensor scf.yield %10 : tensor } return %5: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @rank_reducing_parallel_insert_slice(%in: tensor<100xf32>, %out: tensor<200x100xf32>) { %c1 = arith.constant 1 : index %num_threads = arith.constant 100 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs (%o = %out) -> tensor<200x100xf32> { %1 = tensor.extract_slice %in[%thread_idx][1][1] : tensor<100xf32> to tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %1 into %o[1, %thread_idx][1, 1][1, 1] : tensor<1xf32> into tensor<200x100xf32> } } return }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @dealloc_generate_buffer(%arg: tensor<*xf32>, %sz: index, %idx: index) -> index { %0 = tensor.generate %sz { ^bb0(%i : index): %elem = tensor.dim %arg, %i : tensor<*xf32> tensor.yield %elem : index } : tensor %r = tensor.extract %0[%idx] : tensor return %r : index }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @dealloc_pad_buffer(%t1: tensor, %l2: index, %h1: index, %h2: index, %idx: index) -> index { %0 = tensor.pad %t1 low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): %m = arith.muli %arg0, %arg1 : index tensor.yield %m : index } : tensor to tensor %r = tensor.extract %0[%idx, %idx] : tensor return %r : index }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_equivalent_tensor(%t: tensor<10xf32>) -> tensor<10xf32> { %cst = arith.constant 4.200000e+01 : f32 %0 = linalg.fill ins(%cst : f32) outs(%t : tensor<10xf32>) -> tensor<10xf32> %1 = tensor.insert_slice %0 into %t[0][10][1] : tensor<10xf32> into tensor<10xf32> return %1 : tensor<10xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @pad_memory_space(%t: tensor, %h1: index, %f: f32, %pos: index) -> f32 { %0 = bufferization.alloc_tensor() copy(%t) {memory_space = 3 : i64} : tensor %1 = tensor.pad %0 low[2] high[%h1] { ^bb0(%arg0: index): tensor.yield %f : f32 } : tensor to tensor<15xf32> %2 = tensor.extract %1[%pos] : tensor<15xf32> return %2 : f32 }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_slice_regression(%t: tensor<10xf32>, %b: tensor<5xf32>) -> tensor<10xf32> { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %1 = linalg.fill ins(%cst : f32) outs(%t : tensor<10xf32>) -> tensor<10xf32> %vec = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<10xf32> vector.print %vec : vector<10xf32> %2 = tensor.insert_slice %b into %t[0][5][1] : tensor<5xf32> into tensor<10xf32> return %2 : tensor<10xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @insert_slice_full_overwrite(%t: tensor<10xf32>, %b: tensor<10xf32>) -> tensor<10xf32> { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %1 = linalg.fill ins(%cst : f32) outs(%t : tensor<10xf32>) -> tensor<10xf32> %vec = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<10xf32> vector.print %vec : vector<10xf32> %2 = tensor.insert_slice %b into %t[0][10][1] : tensor<10xf32> into tensor<10xf32> return %2 : tensor<10xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @dim_not_reading(%t: tensor, %f: f32, %pos: index) -> (tensor, index) { %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%pos] : tensor %1 = tensor.dim %t, %c0 : tensor return %0, %1 : tensor, index }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @cast_retains_buffer_layout( %t: tensor {bufferization.buffer_layout = affine_map<(d0) -> (d0 + 5)>}, %sz: index) -> (tensor<10xf32>, tensor) { %casted = tensor.cast %t : tensor to tensor<10xf32> %slice = tensor.extract_slice %casted[2][%sz][1] : tensor<10xf32> to tensor return %casted, %slice : tensor<10xf32>, tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @parallel_insert_slice_source_out_of_place(%in: tensor<1xf32>, %out: tensor<100xf32>, %f: f32) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %num_threads = arith.constant 50 : index %result = scf.forall (%thread_idx) in (%num_threads) shared_outs (%o = %out) -> tensor<100xf32> { %insert = tensor.insert %f into %in[%c0] : tensor<1xf32> %r = tensor.extract %in[%c0] : tensor<1xf32> vector.print %r : f32 scf.forall.in_parallel { tensor.parallel_insert_slice %insert into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<100xf32> } } return }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @tensor.reshape() -> tensor<2x2x5xf32> { %t1_static = arith.constant dense<0.> : tensor<2x10xf32> %t1 = tensor.cast %t1_static : tensor<2x10xf32> to tensor %shape = arith.constant dense<[2, 2, 5]> : tensor<3xi64> %reshaped = tensor.reshape %t1(%shape) : (tensor, tensor<3xi64>) -> tensor<2x2x5xf32> return %reshaped : tensor<2x2x5xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @empty_reshape_expansion(%arg0 : index) -> tensor<2x3x5x4x?x7xf32> { %0 = tensor.empty(%arg0) : tensor<6x5x?xf32> %1 = tensor.expand_shape %0 [[0, 1], [2], [3, 4, 5]] : tensor<6x5x?xf32> into tensor<2x3x5x4x?x7xf32> return %1 : tensor<2x3x5x4x?x7xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-empty-op-folding ,1 "func.func @empty_reshape_collapse(%arg0 : index) -> tensor<6x5x?xf32> { %0 = tensor.empty(%arg0) : tensor<2x3x5x4x?x7xf32> %1 = tensor.collapse_shape %0 [[0, 1], [2], [3, 4, 5]] : tensor<2x3x5x4x?x7xf32> into tensor<6x5x?xf32> return %1 : tensor<6x5x?xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-empty-op-folding ,1 "func.func @fold_empty_tensor_with_slice (%arg0 : index, %arg1 : index) -> tensor<5x?x20xf32> { %0 = tensor.empty(%arg0) : tensor %1 = tensor.extract_slice %0[0, 0, 0] [5, %arg1, 20] [1, 1, 1] : tensor to tensor<5x?x20xf32> return %1 : tensor<5x?x20xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-empty-op-folding ,1 "func.func @rank_reducing_empty_tensor_extract(%sz : index, %idx : index) -> tensor<2xf32> { %a = tensor.empty(%sz) : tensor %r = tensor.extract_slice %a[%idx, 0] [1, 2] [1, 1] : tensor to tensor<2xf32> return %r: tensor<2xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-empty-op-folding ,1 "func.func @extract_slice_same_rank( %src: tensor, %offset0: index, %offset1: index, %size0: index, %size1: index) -> tensor<8x16x32x?xf32> { %0 = tensor.extract_slice %src[0, 1, 2, %offset0] [128, 128, 128, %size0] [1, 1, 1, 1] : tensor to tensor<128x128x128x?xf32> %1 = tensor.extract_slice %0[7, 8, 9, %offset1] [8, 16, 32, %size1] [1, 1, 1, 1] : tensor<128x128x128x?xf32> to tensor<8x16x32x?xf32> return %1: tensor<8x16x32x?xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @extract_slice_rank_reducing_consumer( %src: tensor, %offset0: index, %offset1: index, %size0: index, %size1: index) -> tensor<16x?xf32> { %0 = tensor.extract_slice %src[0, 1, 2, %offset0] [128, 128, 128, %size0] [1, 1, 1, 1] : tensor to tensor<128x128x128x?xf32> %1 = tensor.extract_slice %0[7, 8, 9, %offset1] [1, 16, 1, %size1] [1, 1, 1, 1] : tensor<128x128x128x?xf32> to tensor<16x?xf32> return %1: tensor<16x?xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @extract_slice_rank_reducing_producer( %src: tensor, %offset0: index, %offset1: index, %size0: index, %size1: index) -> tensor<8x?xf32> { %0 = tensor.extract_slice %src[0, 1, 2, %offset0] [1, 128, 1, %size0] [1, 1, 1, 1] : tensor to tensor<128x?xf32> %1 = tensor.extract_slice %0[7, %offset1] [8, %size1] [1, 1] : tensor<128x?xf32> to tensor<8x?xf32> return %1: tensor<8x?xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @extract_slice_non_one_stride( %src: tensor, %offset0: index, %offset1: index, %size0: index, %size1: index, %stride0: index, %stride1: index) -> tensor { %0 = tensor.extract_slice %src[%offset0] [%size0] [%stride0] : tensor to tensor %1 = tensor.extract_slice %0[%offset1] [%size1] [%stride1] : tensor to tensor return %1: tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @insert_slice_rank_reducing( %dst: tensor<128x128x128x128xf32>, %mid: tensor<1x16x1xf32>, %src: tensor<16xf32>, %offset: index) -> tensor<128x128x128x128xf32> { %0 = tensor.insert_slice %src into %mid[0, 0, 0] [1, 16, 1] [1, 1, 1] : tensor<16xf32> into tensor<1x16x1xf32> %1 = tensor.insert_slice %0 into %dst[6, 7, 8, %offset] [1, 1, 16, 1] [1, 1, 1, 1] : tensor<1x16x1xf32> into tensor<128x128x128x128xf32> return %1: tensor<128x128x128x128xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @insert_slice_rank_reducing_dynamic_shape( %dst: tensor<128x128x128x128xf32>, %mid: tensor<1x?x1xf32>, %src: tensor, %offset: index, %size: index) -> tensor<128x128x128x128xf32> { %0 = tensor.insert_slice %src into %mid[0, 0, 0] [1, %size, 1] [1, 1, 1] : tensor into tensor<1x?x1xf32> %1 = tensor.insert_slice %0 into %dst[6, 7, 8, %offset] [1, 1, %size, 1] [1, 1, 1, 1] : tensor<1x?x1xf32> into tensor<128x128x128x128xf32> return %1: tensor<128x128x128x128xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @parallel_insert_slice(%t0: tensor<1x2xf32>, %t1: tensor, %t2: tensor<1x1xf32>) -> tensor<1x2xf32> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %r = scf.forall (%arg2, %arg3) in (%c1, %c2) shared_outs(%arg4 = %t0) -> (tensor<1x2xf32>) { %inserted_slice = tensor.insert_slice %t1 into %t2[0, 0] [1, 1] [1, 1] : tensor into tensor<1x1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %inserted_slice into %arg4[%arg2, %arg3] [1, 1] [1, 1] : tensor<1x1xf32> into tensor<1x2xf32> } } return %r : tensor<1x2xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-consecutive-insert-extract-slice -canonicalize -mlir-print-local-scope ,1 "func.func @fold_unpack_slice(%arg0 : tensor, %arg1 : tensor, %arg2 : index, %arg3 : index) -> tensor { %0 = tensor.unpack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 4] into %arg1 : tensor -> tensor %1 = tensor.extract_slice %0[0, 0] [%arg2, %arg3] [1, 1] : tensor to tensor return %1 : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-into-pack-and-unpack ,1 "func.func @nofold_unpack_slice_non_zero_offset(%arg0 : tensor, %arg1 : tensor, %arg2 : index, %arg3 : index, %arg4 : index) -> tensor { %0 = tensor.unpack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 4] into %arg1 : tensor -> tensor %1 = tensor.extract_slice %0[0, %arg4] [%arg2, %arg3] [1, 1] : tensor to tensor return %1 : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-into-pack-and-unpack ,1 "func.func @nofold_unpack_slice_non_unit_stride(%arg0 : tensor, %arg1 : tensor, %arg2 : index, %arg3 : index, %arg4 : index) -> tensor { %0 = tensor.unpack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 4] into %arg1 : tensor -> tensor %1 = tensor.extract_slice %0[0, 0] [%arg2, %arg3] [%arg4, 1] : tensor to tensor return %1 : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-into-pack-and-unpack ,1 "func.func @pad_pack(%src: tensor<16641x16xf32>) -> tensor<2082x1x8x32xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %padded = tensor.pad %src low[0, 0] high[15, 0] { ^bb0(%arg0: index, %arg1: index): tensor.yield %cst : f32 } : tensor<16641x16xf32> to tensor<16656x16xf32> %empty = tensor.empty() : tensor<2082x1x8x32xf32> %pack = tensor.pack %padded padding_value(%cst : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 32] into %empty : tensor<16656x16xf32> -> tensor<2082x1x8x32xf32> return %pack : tensor<2082x1x8x32xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-into-pack-and-unpack ,1 "func.func @nofold_pad_pack(%src: tensor<16641x16xf32>) -> tensor<2082x1x8x32xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %padded = tensor.pad %src nofold low[0, 0] high[15, 0] { ^bb0(%arg0: index, %arg1: index): tensor.yield %cst : f32 } : tensor<16641x16xf32> to tensor<16656x16xf32> %empty = tensor.empty() : tensor<2082x1x8x32xf32> %pack = tensor.pack %padded padding_value(%cst : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 32] into %empty : tensor<16656x16xf32> -> tensor<2082x1x8x32xf32> return %pack : tensor<2082x1x8x32xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-into-pack-and-unpack ,1 "func.func @pad_pack_different_padding_value(%src: tensor<16641x16xf32>) -> tensor<2082x1x8x32xf32> { %c0 = arith.constant 0 : index %cst0 = arith.constant 0.000000e+00 : f32 %cst1 = arith.constant 1.000000e+00 : f32 %padded = tensor.pad %src low[0, 0] high[15, 0] { ^bb0(%arg0: index, %arg1: index): tensor.yield %cst0 : f32 } : tensor<16641x16xf32> to tensor<16656x16xf32> %empty = tensor.empty() : tensor<2082x1x8x32xf32> %pack = tensor.pack %padded padding_value(%cst1 : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 32] into %empty : tensor<16656x16xf32> -> tensor<2082x1x8x32xf32> return %pack : tensor<2082x1x8x32xf32> }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-fold-into-pack-and-unpack ,1 "func.func @extract_slice(%t: tensor, %idx: index, %f: f32) -> (tensor<5xf32>, tensor) { %0 = tensor.extract_slice %t[10][5][1] : tensor to tensor<5xf32> %1 = tensor.insert %f into %0[%idx] : tensor<5xf32> return %1, %t : tensor<5xf32>, tensor }", mlir-opt -test-tensor-copy-insertion -split-input-file ,1 "func.func @extract_slice(%t: tensor, %idx: index, %f: f32) -> (tensor<5xf32>, tensor) { %0 = tensor.extract_slice %t[10][5][1] : tensor to tensor<5xf32> %1 = tensor.insert %f into %0[%idx] : tensor<5xf32> return %1, %t : tensor<5xf32>, tensor }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @dynamic_pad_tensor_3_4(%input_tensor: tensor, %pad_value: f32) -> tensor { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @dynamic_pad_tensor_0_3(%input_tensor: tensor, %pad_value: f32) -> tensor { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile_to_scf_for %0 [0, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @static_pad_tensor_3_4(%input_tensor: tensor<7x9xf32>, %pad_value: f32) -> tensor<15x16xf32> { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<7x9xf32> to tensor<15x16xf32> return %0 : tensor<15x16xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @static_pad_tensor_0_3(%input_tensor: tensor<7x9xf32>, %pad_value: f32) -> tensor<15x16xf32> { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<7x9xf32> to tensor<15x16xf32> return %0 : tensor<15x16xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile_to_scf_for %0 [0, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @static_pad_tile_evenly_0_3(%input_tensor: tensor<7x9xf32>, %output_tensor: tensor<14x15xf32>, %pad_value: f32) -> tensor<14x15xf32> { %0 = tensor.pad %input_tensor low[0, 0] high[7, 6] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } : tensor<7x9xf32> to tensor<14x15xf32> return %0 : tensor<14x15xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile_to_scf_for %0 [0, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @NC_to_NCnc(%arg0: tensor<128x256xf32>, %arg1: tensor<4x8x32x32xf32>) -> tensor<4x8x32x32xf32> { %0 = tensor.pack %arg0 inner_dims_pos = [0, 1] inner_tiles = [32, 32] into %arg1 : tensor<128x256xf32> -> tensor<4x8x32x32xf32> return %0 : tensor<4x8x32x32xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @KC_to_CKkc(%arg0: tensor<128x256xf32>, %arg1: tensor<32x4x32x8xf32>) -> tensor<32x4x32x8xf32> { %0 = tensor.pack %arg0 outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 8] into %arg1 : tensor<128x256xf32> -> tensor<32x4x32x8xf32> return %0 : tensor<32x4x32x8xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @pad_and_pack_static(%input: tensor<13x15xf32>, %output: tensor<2x8x8x2xf32>, %pad: f32) -> tensor<2x8x8x2xf32> { %0 = tensor.pack %input padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %output : tensor<13x15xf32> -> tensor<2x8x8x2xf32> return %0 : tensor<2x8x8x2xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @pad_and_pack_partially_dynamic(%input: tensor, %output: tensor, %pad: f32) -> tensor { %0 = tensor.pack %input padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %output : tensor -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @pad_and_pack_fully_dynamic(%source: tensor, %dest: tensor, %pad: f32, %tile_n : index, %tile_m : index) -> tensor { %0 = tensor.pack %source padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [%tile_n, %tile_m] into %dest : tensor -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @NCnc_to_NC(%source: tensor<8x8x32x16xf32>, %dest: tensor<256x128xf32>) -> tensor<256x128xf32> { %0 = tensor.unpack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<8x8x32x16xf32> -> tensor<256x128xf32> return %0 : tensor<256x128xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @CKkc_to_KC(%source: tensor<32x4x32x8xf32>, %dest: tensor<128x256xf32>) -> tensor<128x256xf32> { %0 = tensor.unpack %source outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 8] into %dest : tensor<32x4x32x8xf32> -> tensor<128x256xf32> return %0 : tensor<128x256xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @perfect_CKkc_to_KC(%source: tensor<32x4x2x4xf32>, %dest: tensor<8x128xf32>) -> tensor<8x128xf32> { %0 = tensor.unpack %source outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [2, 4] into %dest : tensor<32x4x2x4xf32> -> tensor<8x128xf32> return %0 : tensor<8x128xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @dynamic_perfect_CKkc_to_KC(%source: tensor, %dest: tensor) -> tensor { %0 = tensor.unpack %source outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [2, 2] into %dest : tensor -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @perfect_NKPQk_to_NPQK(%source: tensor<1x4x6x6x2xf32>, %dest: tensor<1x6x6x8xf32>) -> tensor<1x6x6x8xf32> { %0 = tensor.unpack %source outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [2] into %dest : tensor<1x4x6x6x2xf32> -> tensor<1x6x6x8xf32> return %0 : tensor<1x6x6x8xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:4 = transform.structured.tile_to_scf_for %0 [1, 1, 1, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func private @get_dynamic_tile_size() -> index func.func @fully_dynamic_unpack(%source: tensor, %dest: tensor) -> tensor { %0 = func.call @get_dynamic_tile_size() : () -> index %1 = tensor.unpack %source inner_dims_pos = [1, 0] inner_tiles = [%0, %0] into %dest : tensor -> tensor return %1 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [4, 8] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @perfect_NPQK_to_NKPQk(%source: tensor<1x6x6x8xf32>, %dest: tensor<1x4x6x6x2xf32>) -> tensor<1x4x6x6x2xf32> { %0 = tensor.pack %source outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [2] into %dest : tensor<1x6x6x8xf32> -> tensor<1x4x6x6x2xf32> return %0 : tensor<1x4x6x6x2xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:4 = transform.structured.tile_to_scf_for %0 [1, 1, 1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @expand_shape_of_rank_reducing_extract( %t: tensor, %idx: index) -> (tensor, tensor) { %0 = tensor.extract_slice %t[0, 0, 0, 0][%idx, 1, 1, 5][1, 1, 1, 1] : tensor to tensor %1 = tensor.expand_shape %0 [[0], [1, 2], [3]] : tensor into tensor %2 = tensor.expand_shape %0 [[0, 1], [2], [3]] : tensor into tensor return %1, %2 : tensor, tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-reassociative-reshape-folding ,1 "func.func @rank_reducing_insert_of_collapse_shape( %t: tensor, %d: tensor, %sz: index) -> tensor { %0 = tensor.collapse_shape %t [[0, 1], [2], [3]] : tensor into tensor %1 = tensor.insert_slice %0 into %d[0, 0, 0, 0][%sz, 1, 1, 5][1, 1, 1, 1] : tensor into tensor return %1 : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-reassociative-reshape-folding ,1 "func.func @rank_reducing_parallel_insert_of_collapse_shape( %t: tensor, %d: tensor, %sz: index, %thr: index) -> tensor { %0 = tensor.collapse_shape %t [[0, 1], [2], [3]] : tensor into tensor %1 = scf.forall (%iv) in (%thr) shared_outs(%o = %d) -> (tensor) { scf.forall.in_parallel { tensor.parallel_insert_slice %0 into %o[0, 0, 0, 0][%sz, 1, 1, 5][1, 1, 1, 1] : tensor into tensor } } return %1 : tensor }", mlir-opt -split-input-file -test-tensor-transform-patterns=test-reassociative-reshape-folding ,1 "#SparseVector64 = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ], posWidth = 64, crdWidth = 64 }> #SparseVector32 = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ], posWidth = 32, crdWidth = 32 }> #trait_mul = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) * b(i)"" } func.func @mul64(%arga: tensor<32xf64, #SparseVector64>, %argb: tensor<32xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_mul ins(%arga, %argb: tensor<32xf64, #SparseVector64>, tensor<32xf64>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @mul32(%arga: tensor<32xf64, #SparseVector32>, %argb: tensor<32xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_mul ins(%arga, %argb: tensor<32xf64, #SparseVector32>, tensor<32xf64>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> }", mlir-opt -sparsification= ,1 "#SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #trait1 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = OP a(i)"" } #trait2 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) OP b(i)"" } #traitc = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) OP c"" } func.func @abs(%arga: tensor<32xf64, #SV>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf64, #SV>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %x: f64): %0 = math.absf %a : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @ceil(%arga: tensor<32xf64, #SV>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf64, #SV>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %x: f64): %0 = math.ceil %a : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @floor(%arga: tensor<32xf64, #SV>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf64, #SV>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %x: f64): %0 = math.floor %a : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @neg(%arga: tensor<32xf64, #SV>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf64, #SV>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %x: f64): %0 = arith.negf %a : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @add(%arga: tensor<32xf64, #SV>, %argb: tensor<32xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf64, #SV>, tensor<32xf64>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.addf %a, %b : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @sub(%arga: tensor<32xf64, #SV>, %argb: tensor<32xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf64, #SV>, tensor<32xf64>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.subf %a, %b : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @mul(%arga: tensor<32xf64, #SV>, %argb: tensor<32xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf64, #SV>, tensor<32xf64>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @divbyc(%arga: tensor<32xf64, #SV>, %argx: tensor<32xf64>) -> tensor<32xf64> { %c = arith.constant 2.0 : f64 %0 = linalg.generic #traitc ins(%arga: tensor<32xf64, #SV>) outs(%argx: tensor<32xf64>) { ^bb(%a: f64, %x: f64): %0 = arith.divf %a, %c : f64 linalg.yield %0 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @zero_preserving_math(%arga: tensor<32xf64, #SV>) -> tensor<32xf64, #SV> { %c32 = arith.constant 32 : index %xinp = bufferization.alloc_tensor() : tensor<32xf64, #SV> %0 = linalg.generic #trait1 ins(%arga: tensor<32xf64, #SV>) outs(%xinp: tensor<32xf64, #SV>) { ^bb(%a: f64, %x: f64): %0 = math.absf %a : f64 %1 = math.ceil %0 : f64 %2 = math.floor %1 : f64 %3 = math.sqrt %2 : f64 %4 = math.expm1 %3 : f64 %5 = math.log1p %4 : f64 %6 = math.sin %5 : f64 %7 = math.tanh %6 : f64 linalg.yield %7 : f64 } -> tensor<32xf64, #SV> return %0 : tensor<32xf64, #SV> } func.func @complex_divbyc(%arg0: tensor<32xcomplex, #SV>) -> tensor<32xcomplex, #SV> { %c = complex.constant [0.0, 1.0] : complex %init = bufferization.alloc_tensor() : tensor<32xcomplex, #SV> %0 = linalg.generic #traitc ins(%arg0: tensor<32xcomplex, #SV>) outs(%init: tensor<32xcomplex, #SV>) { ^bb(%a: complex, %x: complex): %0 = complex.div %a, %c : complex linalg.yield %0 : complex } -> tensor<32xcomplex, #SV> return %0 : tensor<32xcomplex, #SV> }", mlir-opt -sparsification ,1 "#DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""compressed"" ] }> #trait = { indexing_maps = [ affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)> ], iterator_types = [""parallel"", ""parallel"", ""parallel""] } module @func_sparse { func.func public @main(%arg0: tensor<4x5xi32, #DCSR>) -> tensor<4x3x5xi32, #SparseTensor> { %0 = bufferization.alloc_tensor() : tensor<4x3x5xi32, #SparseTensor> %1 = linalg.generic #trait ins(%arg0 : tensor<4x5xi32, #DCSR>) outs(%0 : tensor<4x3x5xi32, #SparseTensor>) { ^bb0(%in: i32, %out: i32): linalg.yield %in : i32 } -> tensor<4x3x5xi32, #SparseTensor> return %1 : tensor<4x3x5xi32, #SparseTensor> } }", mlir-opt --sparsification --canonicalize --cse ,1 "#Td = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"" ] }> #Tddd = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""dense"" ] }> #Tdds = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""compressed"" ] }> #Tdsd = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"", ""dense"" ] }> #Tdss = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"", ""compressed"" ] }> #Tsdd = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""dense"", ""dense"" ] }> #Tsds = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""dense"", ""compressed"" ] }> #Tssd = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""dense"" ] }> #Tsss = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""compressed"" ] }> #trait3 = { indexing_maps = [ affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> (i,j,k)> ], iterator_types = [""parallel"", ""parallel"", ""parallel""], doc = ""X(i,j,k) = A(i,j,k) OP B(i,j,k)"" } func.func @add_ddd(%arga: tensor<32x16x8xf32, #Tddd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tddd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_ddd(%arga: tensor<32x16x8xf32, #Tddd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tddd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_dds(%arga: tensor<32x16x8xf32, #Tdds>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tdds>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_dds(%arga: tensor<32x16x8xf32, #Tdds>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tdds>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_dsd(%arga: tensor<32x16x8xf32, #Tdsd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tdsd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_dsd(%arga: tensor<32x16x8xf32, #Tdsd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tdsd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_dss(%arga: tensor<32x16x8xf32, #Tdss>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tdss>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_dss(%arga: tensor<32x16x8xf32, #Tdss>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tdss>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_sdd(%arga: tensor<32x16x8xf32, #Tsdd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tsdd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_sdd(%arga: tensor<32x16x8xf32, #Tsdd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tsdd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_sds(%arga: tensor<32x16x8xf32, #Tsds>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tsds>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_sds(%arga: tensor<32x16x8xf32, #Tsds>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tsds>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_ssd(%arga: tensor<32x16x8xf32, #Tssd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tssd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_ssd(%arga: tensor<32x16x8xf32, #Tssd>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tssd>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @add_sss(%arga: tensor<32x16x8xf32, #Tsss>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tsss>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } func.func @mul_sss(%arga: tensor<32x16x8xf32, #Tsss>, %argb: tensor<32x16x8xf32>, %argx: tensor<32x16x8xf32>) -> tensor<32x16x8xf32> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16x8xf32, #Tsss>, tensor<32x16x8xf32>) outs(%argx: tensor<32x16x8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16x8xf32> return %0 : tensor<32x16x8xf32> } #trait_kernel_3d = { indexing_maps = [ affine_map<(i,j,k,l) -> (i,k,l)>, affine_map<(i,j,k,l) -> (k,j)>, affine_map<(i,j,k,l) -> (l,j)>, affine_map<(i,j,k,l) -> (i,j)> ], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""], doc = ""A(i,j) += SUM_k,l B(i,k,l) * C(k,j) * D(l,j)"" } func.func @kernel_3d(%arga: tensor, %argb: tensor, %argc: tensor, %argd: tensor) -> tensor { %0 = linalg.generic #trait_kernel_3d ins(%argb, %argc, %argd: tensor, tensor, tensor) outs(%arga: tensor) { ^bb(%b: f32, %c: f32, %d: f32, %a: f32): %0 = arith.mulf %b, %c : f32 %1 = arith.mulf %0, %d : f32 %2 = arith.addf %1, %a : f32 linalg.yield %2 : f32 } -> tensor return %0 : tensor } #trait_sum_reduction = { indexing_maps = [ affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> ()> ], iterator_types = [""reduction"", ""reduction"", ""reduction""], doc = ""x += SUM_ijk A(i,j,k)"" } func.func @sum_reduction(%arga: tensor<10x20x30xf32, #Tsss>, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction ins(%arga: tensor<10x20x30xf32, #Tsss>) outs(%argx: tensor) { ^bb(%a: f32, %x: f32): %0 = arith.addf %x, %a : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } #trait_sum_reduction_inv = { indexing_maps = [ affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> (i)>, affine_map<(i,j,k) -> ()> ], iterator_types = [""reduction"", ""reduction"", ""reduction""], doc = ""x += SUM_i A(i,j,k) * b(i)"" } func.func @sum_reduction_inv(%arga: tensor, %argb: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction_inv ins(%arga, %argb: tensor, tensor) outs(%argx: tensor) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.addf %x, %0 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor } #trait_invariants = { indexing_maps = [ affine_map<(i,j,k) -> (i)>, affine_map<(i,j,k) -> (j)>, affine_map<(i,j,k) -> (k)>, affine_map<(i,j,k) -> (i,j,k)> ], iterator_types = [""parallel"", ""parallel"", ""parallel""], doc = ""X(i,j,k) = a(i) * b(j) * c(k)"" } func.func @invariants(%arga: tensor<10xf32, #Td>, %argb: tensor<20xf32>, %argc: tensor<30xf32>, %argx: tensor<10x20x30xf32>) -> tensor<10x20x30xf32> { %0 = linalg.generic #trait_invariants ins(%arga, %argb, %argc : tensor<10xf32, #Td>, tensor<20xf32>, tensor<30xf32>) outs(%argx: tensor<10x20x30xf32>) { ^bb(%a: f32, %b: f32, %c: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.mulf %0, %c : f32 linalg.yield %1 : f32 } -> tensor<10x20x30xf32> return %0 : tensor<10x20x30xf32> }", mlir-opt -sparsification ,1 "#DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (i,j)> }> func.func @bufferization_alloc_tensor() -> tensor<20x40xf32, #DCSR> { %0 = bufferization.alloc_tensor() : tensor<20x40xf32, #DCSR> %1 = sparse_tensor.load %0 : tensor<20x40xf32, #DCSR> return %1 : tensor<20x40xf32, #DCSR> } !Filename = !llvm.ptr func.func @sparse_tensor_new(%file: !Filename) -> tensor<20x40xf32, #DCSR> { %0 = sparse_tensor.new %file : !Filename to tensor<20x40xf32, #DCSR> return %0 : tensor<20x40xf32, #DCSR> } func.func @sparse_tensor_convert() -> tensor<20x40xf32> { %0 = bufferization.alloc_tensor() : tensor<20x40xf32, #DCSR> %1 = sparse_tensor.load %0 : tensor<20x40xf32, #DCSR> %2 = sparse_tensor.convert %1 : tensor<20x40xf32, #DCSR> to tensor<20x40xf32> return %2 : tensor<20x40xf32> } #SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #trait = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""] } func.func @update_notinplace(%argb: tensor<10xf32>, %arga: tensor<10xf32, #SV>) -> (tensor<10xf32>, tensor<10xf32>) { %0 = linalg.generic #trait ins(%arga: tensor<10xf32, #SV>) outs(%argb: tensor<10xf32>) { ^bb(%a: f32, %x : f32): %up = arith.addf %a, %x : f32 linalg.yield %up : f32 } -> tensor<10xf32> return %0, %argb : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -test-tensor-copy-insertion=""allow-return-allocs"" ",1 "#DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (i,j)> }> func.func @bufferization_alloc_tensor() -> tensor<20x40xf32, #DCSR> { %0 = bufferization.alloc_tensor() : tensor<20x40xf32, #DCSR> %1 = sparse_tensor.load %0 : tensor<20x40xf32, #DCSR> return %1 : tensor<20x40xf32, #DCSR> } !Filename = !llvm.ptr func.func @sparse_tensor_new(%file: !Filename) -> tensor<20x40xf32, #DCSR> { %0 = sparse_tensor.new %file : !Filename to tensor<20x40xf32, #DCSR> return %0 : tensor<20x40xf32, #DCSR> } func.func @sparse_tensor_convert() -> tensor<20x40xf32> { %0 = bufferization.alloc_tensor() : tensor<20x40xf32, #DCSR> %1 = sparse_tensor.load %0 : tensor<20x40xf32, #DCSR> %2 = sparse_tensor.convert %1 : tensor<20x40xf32, #DCSR> to tensor<20x40xf32> return %2 : tensor<20x40xf32> } #SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #trait = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""] } func.func @update_notinplace(%argb: tensor<10xf32>, %arga: tensor<10xf32, #SV>) -> (tensor<10xf32>, tensor<10xf32>) { %0 = linalg.generic #trait ins(%arga: tensor<10xf32, #SV>) outs(%argb: tensor<10xf32>) { ^bb(%a: f32, %x : f32): %up = arith.addf %a, %x : f32 linalg.yield %up : f32 } -> tensor<10xf32> return %0, %argb : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" ",1 "#SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #trait2 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) OP b(i)"" } #traitc = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) OP c"" } func.func @add(%arga: tensor<32xi64, #SV>, %argb: tensor<32xi64>, %argx: tensor<32xi64>) -> tensor<32xi64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %b: i64, %x: i64): %0 = arith.addi %a, %b : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @sub(%arga: tensor<32xi64, #SV>, %argb: tensor<32xi64>, %argx: tensor<32xi64>) -> tensor<32xi64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %b: i64, %x: i64): %0 = arith.subi %a, %b : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @mul(%arga: tensor<32xi64, #SV>, %argb: tensor<32xi64>, %argx: tensor<32xi64>) -> tensor<32xi64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %b: i64, %x: i64): %0 = arith.muli %a, %b : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @divsbyc(%arga: tensor<32xi64, #SV>, %argx: tensor<32xi64>) -> tensor<32xi64> { %c = arith.constant 2 : i64 %0 = linalg.generic #traitc ins(%arga: tensor<32xi64, #SV>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %x: i64): %0 = arith.divsi %a, %c : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @divubyc(%arga: tensor<32xi64, #SV>, %argx: tensor<32xi64>) -> tensor<32xi64> { %c = arith.constant 2 : i64 %0 = linalg.generic #traitc ins(%arga: tensor<32xi64, #SV>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %x: i64): %0 = arith.divui %a, %c : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @and(%arga: tensor<32xi64, #SV>, %argb: tensor<32xi64>, %argx: tensor<32xi64>) -> tensor<32xi64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %b: i64, %x: i64): %0 = arith.andi %a, %b : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @or(%arga: tensor<32xi64, #SV>, %argb: tensor<32xi64>, %argx: tensor<32xi64>) -> tensor<32xi64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %b: i64, %x: i64): %0 = arith.ori %a, %b : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @xor(%arga: tensor<32xi64, #SV>, %argb: tensor<32xi64>, %argx: tensor<32xi64>) -> tensor<32xi64> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi64, #SV>, tensor<32xi64>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %b: i64, %x: i64): %0 = arith.xori %a, %b : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @ashrbyc(%arga: tensor<32xi64, #SV>, %argx: tensor<32xi64>) -> tensor<32xi64> { %c = arith.constant 2 : i64 %0 = linalg.generic #traitc ins(%arga: tensor<32xi64, #SV>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %x: i64): %0 = arith.shrsi %a, %c : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @lsrbyc(%arga: tensor<32xi64, #SV>, %argx: tensor<32xi64>) -> tensor<32xi64> { %c = arith.constant 2 : i64 %0 = linalg.generic #traitc ins(%arga: tensor<32xi64, #SV>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %x: i64): %0 = arith.shrui %a, %c : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> } func.func @lslbyc(%arga: tensor<32xi64, #SV>, %argx: tensor<32xi64>) -> tensor<32xi64> { %c = arith.constant 2 : i64 %0 = linalg.generic #traitc ins(%arga: tensor<32xi64, #SV>) outs(%argx: tensor<32xi64>) { ^bb(%a: i64, %x: i64): %0 = arith.shli %a, %c : i64 linalg.yield %0 : i64 } -> tensor<32xi64> return %0 : tensor<32xi64> }", mlir-opt -sparsification ,1 "#SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> #trait = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> ()>, affine_map<(i,j) -> ()>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) += A(i,j) * p * q * r * s * 2.2"" } func.func @mul(%arga: tensor<32x16xf32, #SparseMatrix>, %argp: tensor, %argq: f32, %argr: f32, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %s = arith.addf %argq, %argr : f32 %c = arith.constant 2.2 : f32 %0 = linalg.generic #trait ins(%arga, %argp, %argq: tensor<32x16xf32, #SparseMatrix>, tensor, f32) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %p: f32, %q: f32, %x: f32): %0 = arith.mulf %a, %p : f32 %1 = arith.mulf %0, %q : f32 %2 = arith.mulf %1, %argr : f32 %3 = arith.mulf %2, %s : f32 %4 = arith.mulf %3, %c : f32 %5 = arith.addf %4, %x : f32 linalg.yield %5 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> }", mlir-opt -sparsification ,1 "#COO = #sparse_tensor.encoding<{ lvlTypes = [""compressed-nu"", ""singleton""], crdWidth=32 }> func.func @sparse_pack(%values: tensor<6xf64>, %pos:tensor<2xindex>, %coordinates: tensor<6x2xi32>) -> tensor<100x100xf64, #COO> { %0 = sparse_tensor.pack %values, %pos, %coordinates : tensor<6xf64>, tensor<2xindex>, tensor<6x2xi32> to tensor<100x100xf64, #COO> return %0 : tensor<100x100xf64, #COO> } func.func @sparse_unpack(%sp : tensor<100x100xf64, #COO>, %od : tensor<6xf64>, %op : tensor<2xindex>, %oi : tensor<6x2xi32>) -> (tensor<6xf64>, tensor<2xindex>, tensor<6x2xi32>) { %rd, %rp, %ri = sparse_tensor.unpack %sp : tensor<100x100xf64, #COO> outs(%od, %op, %oi : tensor<6xf64>, tensor<2xindex>, tensor<6x2xi32>) -> tensor<6xf64>, tensor<2xindex>, tensor<6x2xi32> return %rd, %rp, %ri : tensor<6xf64>, tensor<2xindex>, tensor<6x2xi32> }"," mlir-opt --canonicalize --post-sparsification-rewrite=""enable-runtime-library=false"" --sparse-tensor-codegen -cse --canonicalize ",1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> func.func @sparse_nop(%arg0: tensor) -> tensor { return %arg0 : tensor }", mlir-opt --sparse-tensor-codegen --sparse-storage-specifier-to-llvm ,1 "#SM = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> #trait_matmul = { indexing_maps = [ affine_map<(d0, d1, d2) -> (d1, d0)>, affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)> ], iterator_types = [""reduction"", ""parallel"", ""parallel""] } #trait_scale = { indexing_maps = [ affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)> ], iterator_types = [""parallel"", ""parallel""] } func.func @fold_yield_arg_zero() -> tensor<1024x1024xf64> { %cst = arith.constant 0.000000e+00 : f64 %0 = bufferization.alloc_tensor() : tensor<1024x1024xf64> %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%cst : f64) outs(%0 : tensor<1024x1024xf64>) { ^bb0(%a: f64, %x: f64): linalg.yield %a : f64 } -> tensor<1024x1024xf64> return %1 : tensor<1024x1024xf64> } func.func @fold_yield_direct_zero() -> tensor<32xf64> { %cst = arith.constant 0.000000e+00 : f64 %0 = bufferization.alloc_tensor() : tensor<32xf64> %1 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%0 : tensor<32xf64>) { ^bb0(%x: f64): linalg.yield %cst : f64 } -> tensor<32xf64> return %1 : tensor<32xf64> } func.func @sampled_dd_unfused(%args: tensor<8x8xf64, #SM>, %arga: tensor<8x8xf64>, %argb: tensor<8x8xf64>) -> tensor<8x8xf64> { %1 = arith.constant dense<0.0> : tensor<8x8xf64> %2 = linalg.generic #trait_matmul ins(%arga, %argb : tensor<8x8xf64>, tensor<8x8xf64>) outs(%1 : tensor<8x8xf64>) { ^bb0(%a: f64, %b: f64, %x: f64): %p = arith.mulf %a, %b : f64 %q = arith.addf %x, %p : f64 linalg.yield %q : f64 } -> tensor<8x8xf64> %3 = linalg.generic #trait_scale ins(%2, %args : tensor<8x8xf64>, tensor<8x8xf64, #SM>) outs(%1 : tensor<8x8xf64>) { ^bb0(%t: f64, %s: f64, %x: f64): %r = arith.mulf %t, %s : f64 linalg.yield %r : f64 } -> tensor<8x8xf64> return %3 : tensor<8x8xf64> } func.func @sparse_sampled_dd_unfused(%args: tensor<8x8xf64, #SM>, %arga: tensor<8x8xf64>, %argb: tensor<8x8xf64>) -> tensor<8x8xf64, #SM> { %1 = arith.constant dense<0.0> : tensor<8x8xf64> %2 = linalg.generic #trait_matmul ins(%arga, %argb : tensor<8x8xf64>, tensor<8x8xf64>) outs(%1 : tensor<8x8xf64>) { ^bb0(%a: f64, %b: f64, %x: f64): %p = arith.mulf %a, %b : f64 %q = arith.addf %x, %p : f64 linalg.yield %q : f64 } -> tensor<8x8xf64> %3 = bufferization.alloc_tensor() : tensor<8x8xf64, #SM> %4 = linalg.generic #trait_scale ins(%2, %args : tensor<8x8xf64>, tensor<8x8xf64, #SM>) outs(%3 : tensor<8x8xf64, #SM>) { ^bb0(%t: f64, %s: f64, %x: f64): %r = arith.mulf %t, %s : f64 linalg.yield %r : f64 } -> tensor<8x8xf64, #SM> return %4 : tensor<8x8xf64, #SM> }", mlir-opt --test-tensor-copy-insertion --pre-sparsification-rewrite --sparsification --cse ,1 "#CSR = #sparse_tensor.encoding<{lvlTypes = [ ""dense"", ""compressed"" ]}> #trait_matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"",""reduction""], doc = ""x(i) += A(i,j) * b(j)"" } func.func @matvec(%arga: tensor<32x64xf64, #CSR>, %argb: tensor<64xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_matvec ins(%arga, %argb : tensor<32x64xf64, #CSR>, tensor<64xf64>) outs(%argx: tensor<32xf64>) { ^bb(%A: f64, %b: f64, %x: f64): %0 = arith.mulf %A, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> }", mlir-opt -sparsification ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> #CSC = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i, j) -> (j, i)> }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed"", ""compressed""], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> func.func @sparse_convert_1d(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_complex(%arg0: tensor<100xcomplex>) -> tensor<100xcomplex, #SparseVector> { %0 = sparse_tensor.convert %arg0 : tensor<100xcomplex> to tensor<100xcomplex, #SparseVector> return %0 : tensor<100xcomplex, #SparseVector> } func.func @sparse_convert_2d(%arg0: tensor<2x4xf64>) -> tensor<2x4xf64, #CSR> { %0 = sparse_tensor.convert %arg0 : tensor<2x4xf64> to tensor<2x4xf64, #CSR> return %0 : tensor<2x4xf64, #CSR> } func.func @sparse_constant() -> tensor<8x7xf32, #CSR>{ %0 = arith.constant sparse<[[0, 0], [1, 6]], [1.0, 5.0]> : tensor<8x7xf32> %1 = sparse_tensor.convert %0 : tensor<8x7xf32> to tensor<8x7xf32, #CSR> return %1 : tensor<8x7xf32, #CSR> } func.func @sparse_constant_csc() -> tensor<8x7xf32, #CSC>{ %0 = arith.constant sparse<[[0, 0], [1, 6]], [1.0, 5.0]> : tensor<8x7xf32> %1 = sparse_tensor.convert %0 : tensor<8x7xf32> to tensor<8x7xf32, #CSC> return %1 : tensor<8x7xf32, #CSC> } func.func @sparse_convert_3d(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor }", mlir-opt --sparse-tensor-conversion --canonicalize --cse ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> #CSC = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i, j) -> (j, i)> }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed"", ""compressed""], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> func.func @sparse_convert_1d(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_complex(%arg0: tensor<100xcomplex>) -> tensor<100xcomplex, #SparseVector> { %0 = sparse_tensor.convert %arg0 : tensor<100xcomplex> to tensor<100xcomplex, #SparseVector> return %0 : tensor<100xcomplex, #SparseVector> } func.func @sparse_convert_2d(%arg0: tensor<2x4xf64>) -> tensor<2x4xf64, #CSR> { %0 = sparse_tensor.convert %arg0 : tensor<2x4xf64> to tensor<2x4xf64, #CSR> return %0 : tensor<2x4xf64, #CSR> } func.func @sparse_constant() -> tensor<8x7xf32, #CSR>{ %0 = arith.constant sparse<[[0, 0], [1, 6]], [1.0, 5.0]> : tensor<8x7xf32> %1 = sparse_tensor.convert %0 : tensor<8x7xf32> to tensor<8x7xf32, #CSR> return %1 : tensor<8x7xf32, #CSR> } func.func @sparse_constant_csc() -> tensor<8x7xf32, #CSC>{ %0 = arith.constant sparse<[[0, 0], [1, 6]], [1.0, 5.0]> : tensor<8x7xf32> %1 = sparse_tensor.convert %0 : tensor<8x7xf32> to tensor<8x7xf32, #CSC> return %1 : tensor<8x7xf32, #CSC> } func.func @sparse_convert_3d(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-foreach=false"" --canonicalize --cse ",1 "#DCSR = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> #DENSE = #sparse_tensor.encoding<{lvlTypes = [""dense"", ""dense""]}> #DENSE_P = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""dense""], dimToLvl = affine_map<(i,j) -> (j,i)> }> func.func @concat_sparse_sparse(%arg0: tensor<2x4xf64, #DCSR>, %arg1: tensor<3x4xf64, #DCSR>, %arg2: tensor<4x4xf64, #DCSR>) -> tensor<9x4xf64, #DCSR> { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2x4xf64, #DCSR>, tensor<3x4xf64, #DCSR>, tensor<4x4xf64, #DCSR> to tensor<9x4xf64, #DCSR> return %0 : tensor<9x4xf64, #DCSR> } func.func @concat_sparse_sparse_dynamic(%arg0: tensor<2x4xf64, #DCSR>, %arg1: tensor<3x4xf64, #DCSR>, %arg2: tensor<4x4xf64, #DCSR>) -> tensor { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2x4xf64, #DCSR>, tensor<3x4xf64, #DCSR>, tensor<4x4xf64, #DCSR> to tensor return %0 : tensor } func.func @concat_sparse_sparse_dense(%arg0: tensor<2x4xf64, #DCSR>, %arg1: tensor<3x4xf64, #DCSR>, %arg2: tensor<4x4xf64, #DCSR>) -> tensor { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2x4xf64, #DCSR>, tensor<3x4xf64, #DCSR>, tensor<4x4xf64, #DCSR> to tensor return %0 : tensor } func.func @concat_sparse_sparse_annotated_dense(%arg0: tensor<2x4xf64, #DCSR>, %arg1: tensor<3x4xf64, #DCSR>, %arg2: tensor<4x4xf64, #DCSR>) -> tensor { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2x4xf64, #DCSR>, tensor<3x4xf64, #DCSR>, tensor<4x4xf64, #DCSR> to tensor return %0 : tensor } func.func @concat_sparse_sparse_annotated_dense_permute(%arg0: tensor<2x4xf64, #DCSR>, %arg1: tensor<3x4xf64, #DCSR>, %arg2: tensor<4x4xf64, #DCSR>) -> tensor { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2x4xf64, #DCSR>, tensor<3x4xf64, #DCSR>, tensor<4x4xf64, #DCSR> to tensor return %0 : tensor }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-convert=false"" ",1 "#Tdd = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"" ] }> #Tds = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> #Tsd = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""dense"" ] }> #Tss = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> #trait2 = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = A(i,j) OP B(i,j)"" } func.func @add_dd(%arga: tensor<32x16xf32, #Tdd>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tdd>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @mul_dd(%arga: tensor<32x16xf32, #Tdd>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tdd>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @add_ds(%arga: tensor<32x16xf32, #Tds>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tds>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @mul_ds(%arga: tensor<32x16xf32, #Tds>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tds>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @add_sd(%arga: tensor<32x16xf32, #Tsd>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tsd>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @mul_sd(%arga: tensor<32x16xf32, #Tsd>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tsd>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @add_ss(%arga: tensor<32x16xf32, #Tss>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tss>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @mul_ss(%arga: tensor<32x16xf32, #Tss>, %argb: tensor<32x16xf32>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tss>, tensor<32x16xf32>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @add_ss_ss(%arga: tensor<32x16xf32, #Tss>, %argb: tensor<32x16xf32, #Tss>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tss>, tensor<32x16xf32, #Tss>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } #BatchedVector = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed-hi"" ], }> func.func @sub_ss_batched(%0: tensor<2x3xf64, #BatchedVector>, %1: tensor<2x3xf64, #BatchedVector>) -> tensor<2x3xf64, #BatchedVector> { %2 = bufferization.alloc_tensor() : tensor<2x3xf64, #BatchedVector> %3 = linalg.generic #trait2 ins(%0, %1 : tensor<2x3xf64, #BatchedVector>, tensor<2x3xf64, #BatchedVector>) outs(%2 : tensor<2x3xf64, #BatchedVector>) { ^bb0(%in: f64, %in_0: f64, %out: f64): %7 = arith.subf %in, %in_0 : f64 linalg.yield %7 : f64 } -> tensor<2x3xf64, #BatchedVector> return %3 : tensor<2x3xf64, #BatchedVector> } func.func @mul_ss_ss(%arga: tensor<32x16xf32, #Tss>, %argb: tensor<32x16xf32, #Tss>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tss>, tensor<32x16xf32, #Tss>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @add_sd_ds(%arga: tensor<32x16xf32, #Tsd>, %argb: tensor<32x16xf32, #Tds>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tsd>, tensor<32x16xf32, #Tds>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @mul_sd_ds(%arga: tensor<32x16xf32, #Tsd>, %argb: tensor<32x16xf32, #Tds>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32x16xf32, #Tsd>, tensor<32x16xf32, #Tds>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } #trait_matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"", ""reduction""], doc = ""x(i) += SUM_j A(i,j) * b(j)"" } func.func @matvec(%argA: tensor<16x32xf32, #Tds>, %argb: tensor<32xf32>, %argx: tensor<16xf32>) -> tensor<16xf32> { %0 = linalg.generic #trait_matvec ins(%argA, %argb: tensor<16x32xf32, #Tds>, tensor<32xf32>) outs(%argx: tensor<16xf32>) { ^bb(%A: f32, %b: f32, %x: f32): %0 = arith.mulf %A, %b : f32 %1 = arith.addf %0, %x : f32 linalg.yield %1 : f32 } -> tensor<16xf32> return %0 : tensor<16xf32> } #trait_sum_reduction = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> ()> ], iterator_types = [""reduction"", ""reduction""], doc = ""x += SUM_ij A(i,j)"" } func.func @sum_reduction(%arga: tensor<10x20xf32, #Tds>, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction ins(%arga: tensor<10x20xf32, #Tds>) outs(%argx: tensor) { ^bb(%a: f32, %x: f32): %0 = arith.addf %x, %a : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } #trait_scale = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = A(i,j) * SCALE"" } func.func @scale(%arga: tensor, %argx: tensor) -> tensor { %0 = arith.constant 2.0 : f64 %1 = linalg.generic #trait_scale ins(%arga: tensor) outs(%argx: tensor) { ^bb(%a: f64, %x: f64): %2 = arith.mulf %a, %0 : f64 linalg.yield %2 : f64 } -> tensor return %1 : tensor } #trait_sampled_dense_dense = { indexing_maps = [ affine_map<(i,j,k) -> (i,j)>, affine_map<(i,j,k) -> (i,k)>, affine_map<(i,j,k) -> (k,j)>, affine_map<(i,j,k) -> (i,j)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""], doc = ""X(i,j) += S(i,j) SUM_k A(i,k) B(k,j)"" } func.func @sampled_dense_dense(%args: tensor, %arga: tensor, %argb: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sampled_dense_dense ins(%args, %arga, %argb: tensor, tensor, tensor) outs(%argx: tensor) { ^bb(%s: f32, %a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.mulf %s, %0 : f32 %2 = arith.addf %x, %1 : f32 linalg.yield %2 : f32 } -> tensor return %0 : tensor } #trait_sum_kernel_with_inv = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i)>, affine_map<(i,j) -> ()>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"", ""reduction""], doc = ""x(i) = SUM_j A(i,j) * B(i,j) * d(i) * e + C(i,j)"" } func.func @sum_kernel_with_inv(%arga: tensor, %argb: tensor, %argc: tensor, %argd: tensor, %arge: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_kernel_with_inv ins(%arga, %argb, %argc, %argd, %arge : tensor, tensor, tensor, tensor, tensor) outs(%argx: tensor) { ^bb(%a: f32, %b: f32, %c: f32, %d: f32, %e: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.mulf %0, %d : f32 %2 = arith.mulf %1, %e : f32 %3 = arith.addf %2, %c : f32 %4 = arith.addf %x, %3 : f32 linalg.yield %4 : f32 } -> tensor return %0 : tensor }", mlir-opt -sparsification ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> func.func @for(%in: tensor<1024xf32, #SparseVector>, %lb: index, %ub: index, %step: index) -> tensor<1024xf32, #SparseVector> { %1 = scf.for %i = %lb to %ub step %step iter_args(%vin = %in) -> tensor<1024xf32, #SparseVector> { scf.yield %vin : tensor<1024xf32, #SparseVector> } return %1 : tensor<1024xf32, #SparseVector> } func.func @if(%t: tensor<1024xf32, #SparseVector>, %f: tensor<1024xf32, #SparseVector>, %c: i1) -> tensor<1024xf32, #SparseVector> { %1 = scf.if %c -> tensor<1024xf32, #SparseVector> { scf.yield %t : tensor<1024xf32, #SparseVector> } else { scf.yield %f : tensor<1024xf32, #SparseVector> } return %1 : tensor<1024xf32, #SparseVector> } func.func @while(%arg0: tensor<1024xf32, #SparseVector>, %c: i1) -> tensor<1024xf32, #SparseVector> { %0 = scf.while (%in = %arg0) : (tensor<1024xf32, #SparseVector>) -> tensor<1024xf32, #SparseVector> { scf.condition(%c) %in : tensor<1024xf32, #SparseVector> } do { ^bb0(%arg1: tensor<1024xf32, #SparseVector>): scf.yield %arg1 : tensor<1024xf32, #SparseVector> } return %0: tensor<1024xf32, #SparseVector> }", mlir-opt -sparse-tensor-codegen -cse ,1 "#CSC = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (j,i)> }> #trait_matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"",""reduction""], doc = ""x(i) += A(i,j) * b(j)"" } func.func @matvec(%arga: tensor<32x64xf64, #CSC>, %argb: tensor<64xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_matvec ins(%arga, %argb : tensor<32x64xf64, #CSC>, tensor<64xf64>) outs(%argx: tensor<32xf64>) { ^bb(%A: f64, %b: f64, %x: f64): %0 = arith.mulf %A, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> }", mlir-opt -sparsification ,1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (i,j)> }> #DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (i,j)> }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""compressed"" ] }> #trait_scale_inpl = { indexing_maps = [ affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) *= 2 or X(i,j) += X(i,j)"" } func.func @sparse_simply_dynamic1(%argx: tensor<32x16xf32, #DCSR>) -> tensor<32x16xf32, #DCSR> { %c = arith.constant 2.0 : f32 %0 = linalg.generic #trait_scale_inpl outs(%argx: tensor<32x16xf32, #DCSR>) { ^bb(%x: f32): %1 = arith.mulf %x, %c : f32 linalg.yield %1 : f32 } -> tensor<32x16xf32, #DCSR> return %0 : tensor<32x16xf32, #DCSR> } func.func @sparse_simply_dynamic2(%argx: tensor<32x16xf32, #DCSR>) -> tensor<32x16xf32, #DCSR> { %0 = linalg.generic #trait_scale_inpl outs(%argx: tensor<32x16xf32, #DCSR>) { ^bb(%x: f32): %1 = arith.addf %x, %x : f32 linalg.yield %1 : f32 } -> tensor<32x16xf32, #DCSR> return %0 : tensor<32x16xf32, #DCSR> } #trait_scale = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = A(i,j) * 2.0"" } func.func @sparse_truly_dynamic(%arga: tensor<10x20xf32, #CSR>) -> tensor<10x20xf32, #DCSR> { %s = arith.constant 2.0 : f32 %xm = bufferization.alloc_tensor() : tensor<10x20xf32, #DCSR> %0 = linalg.generic #trait_scale ins(%arga: tensor<10x20xf32, #CSR>) outs(%xm: tensor<10x20xf32, #DCSR>) { ^bb(%a: f32, %x: f32): %1 = arith.mulf %a, %s : f32 linalg.yield %1 : f32 } -> tensor<10x20xf32, #DCSR> return %0 : tensor<10x20xf32, #DCSR> } #trait_sumred = { indexing_maps = [ affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> (i,j)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""], doc = ""X(i,j) = SUM_k A(i,j,k) * B(i,j,k)"" } func.func @sumred(%arga: tensor, %argb: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arga, %c0 : tensor %d1 = tensor.dim %arga, %c1 : tensor %xinit = bufferization.alloc_tensor(%d0, %d1) : tensor %0 = linalg.generic #trait_sumred ins(%arga, %argb: tensor, tensor) outs(%xinit: tensor) { ^bb(%a: i32, %b: i32, %x: i32): %0 = arith.muli %a, %b : i32 %1 = arith.addi %x, %0 : i32 linalg.yield %1 : i32 } -> tensor return %0 : tensor } #trait_matmat = { indexing_maps = [ affine_map<(i,j,k) -> (i,k)>, affine_map<(i,j,k) -> (k,j)>, affine_map<(i,j,k) -> (i,j)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""], doc = ""C(i,j) = SUM_k A(i,k) * B(k,j)"" } func.func @matmat(%arga: tensor, %argb: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arga, %c0 : tensor %d1 = tensor.dim %argb, %c1 : tensor %cinit = bufferization.alloc_tensor(%d0, %d1) : tensor %0 = linalg.generic #trait_matmat ins(%arga, %argb: tensor, tensor) outs(%cinit: tensor) { ^bb(%a: f32, %b: f32, %c: f32): %1 = arith.mulf %a, %b : f32 %2 = arith.addf %c, %1 : f32 linalg.yield %2 : f32 } -> tensor return %0 : tensor }", mlir-opt -sparsification ,1 "#SparseVector64 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 64, crdWidth = 64 }> #SparseVector32 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 32, crdWidth = 32 }> func.func @sparse_convert(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_value(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor }", mlir-opt --sparse-tensor-codegen --canonicalize --cse ,1 "#SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #SparseVector = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ], crdWidth = 64, posWidth = 32 }> #Dense2D = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"" ], crdWidth = 64, posWidth = 32 }> #Row = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""dense"" ], crdWidth = 64, posWidth = 32 }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], crdWidth = 64, posWidth = 32 }> #UCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed-no"" ] }> #CSC = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i, j) -> (j, i)> }> #DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], crdWidth = 64, posWidth = 32 }> #Dense3D = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""dense"" ], dimToLvl = affine_map<(i, j, k) -> (k, i, j)> }> #Coo = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #CooPNo = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton-no"" ], dimToLvl = affine_map<(i, j) -> (j, i)> }> #ccoo = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed-nu"", ""singleton"" ] }> func.func @sparse_nop(%arg0: tensor) -> tensor { return %arg0 : tensor } func.func @sparse_nop_multi_ret(%arg0: tensor, %arg1: tensor) -> (tensor, tensor) { return %arg0, %arg1 : tensor, tensor } func.func @sparse_nop_call(%arg0: tensor, %arg1: tensor) -> (tensor, tensor) { %1, %2 = call @sparse_nop_multi_ret(%arg0, %arg1) : (tensor, tensor) -> (tensor, tensor) return %1, %2: tensor, tensor } func.func @sparse_nop_cast(%arg0: tensor<64xf32, #SparseVector>) -> tensor { %0 = tensor.cast %arg0 : tensor<64xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_nop_cast_3d(%arg0: tensor<10x20x30xf32, #Dense3D>) -> tensor { %0 = tensor.cast %arg0 : tensor<10x20x30xf32, #Dense3D> to tensor return %0 : tensor } func.func @sparse_dense_2d(%arg0: tensor) { return } func.func @sparse_row(%arg0: tensor) { return } func.func @sparse_csr(%arg0: tensor) { return } func.func @sparse_dcsr(%arg0: tensor) { return } func.func @sparse_dense_3d(%arg0: tensor<10x20x30xf64, #Dense3D>) -> index { %c = arith.constant 1 : index %0 = tensor.dim %arg0, %c : tensor<10x20x30xf64, #Dense3D> return %0 : index } func.func @sparse_dense_3d_dyn(%arg0: tensor) -> index { %c = arith.constant 1 : index %0 = tensor.dim %arg0, %c : tensor return %0 : index } func.func @sparse_positions_dcsr(%arg0: tensor) -> memref { %0 = sparse_tensor.positions %arg0 { level = 1 : index } : tensor to memref return %0 : memref } func.func @sparse_indices_dcsr(%arg0: tensor) -> memref { %0 = sparse_tensor.coordinates %arg0 { level = 1 : index } : tensor to memref return %0 : memref } func.func @sparse_values_dcsr(%arg0: tensor) -> memref { %0 = sparse_tensor.values %arg0 : tensor to memref return %0 : memref } func.func @sparse_values_coo(%arg0: tensor) -> memref { %0 = sparse_tensor.values %arg0 : tensor to memref return %0 : memref } func.func @sparse_indices_coo(%arg0: tensor) -> memref> { %0 = sparse_tensor.coordinates %arg0 { level = 1 : index } : tensor to memref> return %0 : memref> } func.func @sparse_indices_buffer_coo(%arg0: tensor) -> memref { %0 = sparse_tensor.coordinates_buffer %arg0 : tensor to memref return %0 : memref } func.func @sparse_noe(%arg0: tensor<128xf64, #SparseVector>) -> index { %0 = sparse_tensor.number_of_entries %arg0 : tensor<128xf64, #SparseVector> return %0 : index } func.func @sparse_dealloc_csr(%arg0: tensor) { bufferization.dealloc_tensor %arg0 : tensor return } func.func @sparse_alloc_csc(%arg0: index) -> tensor<10x?xf64, #CSC> { %0 = bufferization.alloc_tensor(%arg0) : tensor<10x?xf64, #CSC> %1 = sparse_tensor.load %0 : tensor<10x?xf64, #CSC> return %1 : tensor<10x?xf64, #CSC> } func.func @sparse_alloc_3d() -> tensor<10x20x30xf64, #Dense3D> { %0 = bufferization.alloc_tensor() : tensor<10x20x30xf64, #Dense3D> %1 = sparse_tensor.load %0 : tensor<10x20x30xf64, #Dense3D> return %1 : tensor<10x20x30xf64, #Dense3D> } func.func @sparse_alloc_coo_with_size_hint(%arg0: index) -> tensor<10x20xf64, #Coo> { %0 = bufferization.alloc_tensor() size_hint=%arg0 : tensor<10x20xf64, #Coo> %1 = sparse_tensor.load %0 : tensor<10x20xf64, #Coo> return %1 : tensor<10x20xf64, #Coo> } func.func @sparse_expansion1() -> memref { %0 = bufferization.alloc_tensor() : tensor<4x8xf64, #CSR> %values, %filled, %added, %count = sparse_tensor.expand %0 : tensor<4x8xf64, #CSR> to memref, memref, memref return %added : memref } func.func @sparse_expansion2() -> memref { %0 = bufferization.alloc_tensor() : tensor<4x8xf64, #CSC> %values, %filled, %added, %count = sparse_tensor.expand %0 : tensor<4x8xf64, #CSC> to memref, memref, memref return %added : memref } func.func @sparse_expansion3(%arg0: index, %arg1: index) -> memref { %0 = bufferization.alloc_tensor(%arg0, %arg1) : tensor %values, %filled, %added, %count = sparse_tensor.expand %0 : tensor to memref, memref, memref return %added : memref } func.func @sparse_compression_1d(%tensor: tensor<100xf64, #SV>, %values: memref, %filled: memref, %added: memref, %count: index) -> tensor<100xf64, #SV> { %0 = sparse_tensor.compress %values, %filled, %added, %count into %tensor[] : memref, memref, memref, tensor<100xf64, #SV> %1 = sparse_tensor.load %0 hasInserts : tensor<100xf64, #SV> return %1 : tensor<100xf64, #SV> } func.func @sparse_compression(%tensor: tensor<8x8xf64, #CSR>, %values: memref, %filled: memref, %added: memref, %count: index, %i: index) -> tensor<8x8xf64, #CSR> { %0 = sparse_tensor.compress %values, %filled, %added, %count into %tensor[%i] : memref, memref, memref, tensor<8x8xf64, #CSR> %1 = sparse_tensor.load %0 hasInserts : tensor<8x8xf64, #CSR> return %1 : tensor<8x8xf64, #CSR> } func.func @sparse_compression_unordered(%tensor: tensor<8x8xf64, #UCSR>, %values: memref, %filled: memref, %added: memref, %count: index, %i: index) -> tensor<8x8xf64, #UCSR> { %0 = sparse_tensor.compress %values, %filled, %added, %count into %tensor[%i] : memref, memref, memref, tensor<8x8xf64, #UCSR> %1 = sparse_tensor.load %0 hasInserts : tensor<8x8xf64, #UCSR> return %1 : tensor<8x8xf64, #UCSR> } func.func @sparse_insert(%arg0: tensor<128xf64, #SV>, %arg1: index, %arg2: f64) -> tensor<128xf64, #SV> { %0 = sparse_tensor.insert %arg2 into %arg0[%arg1] : tensor<128xf64, #SV> %1 = sparse_tensor.load %0 hasInserts : tensor<128xf64, #SV> return %1 : tensor<128xf64, #SV> } func.func @sparse_insert_typed(%arg0: tensor<128xf64, #SparseVector>, %arg1: index, %arg2: f64) -> tensor<128xf64, #SparseVector> { %0 = sparse_tensor.insert %arg2 into %arg0[%arg1] : tensor<128xf64, #SparseVector> %1 = sparse_tensor.load %0 hasInserts : tensor<128xf64, #SparseVector> return %1 : tensor<128xf64, #SparseVector> } func.func @sparse_insert_coo(%arg0: tensor<5x6xf64, #Coo>, %arg1: index, %arg2: f64) -> tensor<5x6xf64, #Coo> { %0 = sparse_tensor.insert %arg2 into %arg0[%arg1, %arg1] : tensor<5x6xf64, #Coo> %1 = sparse_tensor.load %0 hasInserts : tensor<5x6xf64, #Coo> return %1 : tensor<5x6xf64, #Coo> } func.func @sparse_nop_convert(%arg0: tensor<32xf32, #SparseVector>) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor<32xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_convert_element_type(%arg0: tensor<32xf32, #SparseVector>) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor<32xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_new_coo(%arg0: !llvm.ptr) -> tensor { %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor return %0 : tensor } func.func @sparse_new_coo_permute_no(%arg0: !llvm.ptr) -> tensor { %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor return %0 : tensor }", mlir-opt --sparse-tensor-codegen --canonicalize -cse ,1 "#SpVec = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> #Row = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""dense"" ] }> #EncDenseVec = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"" ] }> #trait1 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (3)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) += a(i) * b(3)"" } func.func @mul_inv_dense1d(%arga: tensor<32xf32, #SpVec>, %argb: tensor<4xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait1 ins(%arga, %argb: tensor<32xf32, #SpVec>, tensor<4xf32>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.addf %x, %0 : f32 linalg.yield %1 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_inv_sparse1d(%arga: tensor<32xf32, #SpVec>, %argb: tensor<4xf32, #SpVec>) -> tensor<32xf32, #SpVec> { %argx = bufferization.alloc_tensor() : tensor<32xf32, #SpVec> %0 = linalg.generic #trait1 ins(%arga, %argb: tensor<32xf32, #SpVec>, tensor<4xf32, #SpVec>) outs(%argx: tensor<32xf32, #SpVec>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.addf %x, %0 : f32 linalg.yield %1 : f32 } -> tensor<32xf32, #SpVec> return %0 : tensor<32xf32, #SpVec> } func.func @mul_inv_enc_dense1d(%arga: tensor<32xf32, #EncDenseVec>, %argb: tensor<4xf32, #EncDenseVec>) -> tensor<32xf32, #EncDenseVec> { %argx = bufferization.alloc_tensor() : tensor<32xf32, #EncDenseVec> %0 = linalg.generic #trait1 ins(%arga, %argb: tensor<32xf32, #EncDenseVec>, tensor<4xf32, #EncDenseVec>) outs(%argx: tensor<32xf32, #EncDenseVec>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.addf %x, %0 : f32 linalg.yield %1 : f32 } -> tensor<32xf32, #EncDenseVec> return %0 : tensor<32xf32, #EncDenseVec> } #trait2 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i+2)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) & b(i+2)"" } func.func @and_affine_dense1d(%arga: tensor<32xi32, #SpVec>, %argb: tensor<34xi32>, %argx: tensor<32xi32>) -> tensor<32xi32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi32, #SpVec>, tensor<34xi32>) outs(%argx: tensor<32xi32>) { ^bb(%a: i32, %b: i32, %x: i32): %0 = arith.andi %a, %b : i32 linalg.yield %0 : i32 } -> tensor<32xi32> return %0 : tensor<32xi32> } func.func @and_affine_sparse1d(%arga: tensor<32xi32, #SpVec>, %argb: tensor<34xi32, #SpVec>) -> tensor<32xi32, #SpVec> { %argx = bufferization.alloc_tensor() : tensor<32xi32, #SpVec> %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xi32, #SpVec>, tensor<34xi32, #SpVec>) outs(%argx: tensor<32xi32, #SpVec>) { ^bb(%a: i32, %b: i32, %x: i32): %0 = arith.andi %a, %b : i32 linalg.yield %0 : i32 } -> tensor<32xi32, #SpVec> return %0 : tensor<32xi32, #SpVec> } #trait3 = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i+2,j+3)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"",""parallel""], doc = ""x(i,j) += a(i,j) * b(i+2,j+3)"" } func.func @mul_affine_dense2d(%arga: tensor<32x16xf64, #CSR>, %argb: tensor<34x19xf64>, %argx: tensor<32x16xf64>) -> tensor<32x16xf64> { %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16xf64, #CSR>, tensor<34x19xf64>) outs(%argx: tensor<32x16xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32x16xf64> return %0 : tensor<32x16xf64> } func.func @mul_affine_sparse2d(%arga: tensor<32x16xf64, #CSR>, %argb: tensor<34x19xf64, #CSR>) -> tensor<32x16xf64, #CSR> { %argx = bufferization.alloc_tensor() : tensor<32x16xf64, #CSR> %0 = linalg.generic #trait3 ins(%arga, %argb: tensor<32x16xf64, #CSR>, tensor<34x19xf64, #CSR>) outs(%argx: tensor<32x16xf64, #CSR>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32x16xf64, #CSR> return %0 : tensor<32x16xf64, #CSR> } #trait4 = { indexing_maps = [ affine_map<(i,j) -> (i+2,j)>, affine_map<(i,j) -> (i,j+3)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"",""parallel""], doc = ""x(i,j) += a(i+2,j) * b(i,j+3)"" } func.func @mul_affine_dense_dim_2d(%arga: tensor<34x16xf64, #CSR>, %argb: tensor<32x19xf64, #Row>, %argx: tensor<32x16xf64>) -> tensor<32x16xf64> { %0 = linalg.generic #trait4 ins(%arga, %argb: tensor<34x16xf64, #CSR>, tensor<32x19xf64, #Row>) outs(%argx: tensor<32x16xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32x16xf64> return %0 : tensor<32x16xf64> } #trait5 = { indexing_maps = [ affine_map<(i,j) -> (2,j)>, affine_map<(i,j) -> (i,3)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"",""parallel""], doc = ""x(i,j) += a(2,j) * b(i,3)"" } func.func @mul_const_affine_dense_dim_2d(%arga: tensor<34x16xf64, #CSR>, %argb: tensor<32x19xf64, #Row>, %argx: tensor<32x16xf64>) -> tensor<32x16xf64> { %0 = linalg.generic #trait5 ins(%arga, %argb: tensor<34x16xf64, #CSR>, tensor<32x19xf64, #Row>) outs(%argx: tensor<32x16xf64>) { ^bb(%a: f64, %b: f64, %x: f64): %0 = arith.mulf %a, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32x16xf64> return %0 : tensor<32x16xf64> }", mlir-opt -sparsification ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> #trait = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()> ], iterator_types = [""reduction""] } func.func @sparse_reduction_subi(%argx: tensor, %arga: tensor) -> tensor { %0 = linalg.generic #trait ins(%arga: tensor) outs(%argx: tensor) { ^bb(%a: i32, %x: i32): %t = arith.subi %a, %x: i32 linalg.yield %t : i32 } -> tensor return %0 : tensor }", mlir-opt -sparsification ,1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""]}> #CSC = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""], dimToLvl = affine_map<(i,j) -> (j,i)> }> func.func @sparse_convert_permuted(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false"" --sparse-tensor-codegen=create-sparse-deallocs=false --canonicalize --cse ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""]}> #CSC = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""], dimToLvl = affine_map<(i,j) -> (j,i)> }> func.func @sparse_convert_permuted(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false"" --sparse-tensor-codegen=create-sparse-deallocs=true --canonicalize --cse ",1 "#SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> func.func @sparse_alloc_sparse_vector(%arg0: index) -> tensor { %0 = bufferization.alloc_tensor(%arg0) : tensor %1 = sparse_tensor.load %0 : tensor return %1 : tensor }", mlir-opt --sparse-tensor-codegen=enable-buffer-initialization=true --canonicalize --cse ,1 "#DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @fill_zero_after_alloc(%arg0: tensor<100x200xf64, #DCSR>, %arg1: tensor<200x300xf64, #DCSR>) -> tensor<100x300xf64, #DCSR> { %0 = bufferization.alloc_tensor() : tensor<100x300xf64, #DCSR> %cst = arith.constant 0.000000e+00 : f64 %1 = linalg.fill ins(%cst : f64) outs(%0 : tensor<100x300xf64, #DCSR>) -> tensor<100x300xf64, #DCSR> %2 = linalg.matmul ins(%arg0, %arg1 : tensor<100x200xf64, #DCSR>, tensor<200x300xf64, #DCSR>) outs(%1 : tensor<100x300xf64, #DCSR>) -> tensor<100x300xf64, #DCSR> return %2 : tensor<100x300xf64, #DCSR> }", mlir-opt --linalg-generalize-named-ops --pre-sparsification-rewrite --sparsification --sparse-tensor-conversion --canonicalize --cse ,1 "#DenseMatrix = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"" ] }> #trait_2d = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = A(i,j) + 1"" } #trait_3d = { indexing_maps = [ affine_map<(i,j,k) -> (i,j,k)>, affine_map<(i,j,k) -> (i,j)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""], doc = ""X(i,j) += A(i,j,k)"" } func.func @dense1(%arga: tensor<32x16xf32, #DenseMatrix>, %argx: tensor<32x16xf32>) -> tensor<32x16xf32> { %c = arith.constant 1.0 : f32 %0 = linalg.generic #trait_2d ins(%arga: tensor<32x16xf32, #DenseMatrix>) outs(%argx: tensor<32x16xf32>) { ^bb(%a: f32, %x: f32): %1 = arith.addf %a, %c : f32 linalg.yield %1 : f32 } -> tensor<32x16xf32> return %0 : tensor<32x16xf32> } func.func @dense2(%arga: tensor<32x16xf32>, %argx: tensor<32x16xf32, #DenseMatrix>) -> tensor<32x16xf32, #DenseMatrix> { %c = arith.constant 1.0 : f32 %0 = linalg.generic #trait_2d ins(%arga: tensor<32x16xf32>) outs(%argx: tensor<32x16xf32, #DenseMatrix>) { ^bb(%a: f32, %x: f32): %1 = arith.addf %a, %c : f32 linalg.yield %1 : f32 } -> tensor<32x16xf32, #DenseMatrix> return %0 : tensor<32x16xf32, #DenseMatrix> } func.func @dense3(%arga: tensor<32x16x8xf32>, %argx: tensor<32x16xf32, #DenseMatrix>) -> tensor<32x16xf32, #DenseMatrix> { %0 = linalg.generic #trait_3d ins(%arga: tensor<32x16x8xf32>) outs(%argx: tensor<32x16xf32, #DenseMatrix>) { ^bb(%a: f32, %x: f32): %1 = arith.addf %x, %a : f32 linalg.yield %1 : f32 } -> tensor<32x16xf32, #DenseMatrix> return %0 : tensor<32x16xf32, #DenseMatrix> }", mlir-opt -sparsification ,1 "#DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> #transpose_trait = { indexing_maps = [ affine_map<(i,j) -> (j,i)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = A(j,i)"" } func.func @sparse_transpose_auto(%arga: tensor<3x4xf64, #DCSR>) -> tensor<4x3xf64, #DCSR> { %i = bufferization.alloc_tensor() : tensor<4x3xf64, #DCSR> %0 = linalg.generic #transpose_trait ins(%arga: tensor<3x4xf64, #DCSR>) outs(%i: tensor<4x3xf64, #DCSR>) { ^bb(%a: f64, %x: f64): linalg.yield %a : f64 } -> tensor<4x3xf64, #DCSR> return %0 : tensor<4x3xf64, #DCSR> }", mlir-opt -sparsification ,1 "#X = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""dense"" ], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> #trait = { indexing_maps = [ affine_map<(i,j,k) -> (k,i,j)>, affine_map<(i,j,k) -> (i,j,k)> ], iterator_types = [""parallel"", ""parallel"", ""parallel""] } func.func @sparse_static_dims(%arga: tensor<10x20x30xf32, #X>, %argx: tensor<20x30x10xf32>) -> tensor<20x30x10xf32> { %0 = linalg.generic #trait ins(%arga: tensor<10x20x30xf32, #X>) outs(%argx: tensor<20x30x10xf32>) { ^bb(%a : f32, %x: f32): linalg.yield %a : f32 } -> tensor<20x30x10xf32> return %0 : tensor<20x30x10xf32> } func.func @sparse_dynamic_dims(%arga: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait ins(%arga: tensor) outs(%argx: tensor) { ^bb(%a : f32, %x: f32): linalg.yield %a : f32 } -> tensor return %0 : tensor }", mlir-opt -sparsification ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d0 + d2, d1 + d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d2, d3)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> #DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @conv2d_all_sparse_CSR(%arg0: tensor<8x8xi32, #DCSR>, %arg1: tensor<3x3xi32>) -> tensor<6x6xi32, #DCSR> { %0 = bufferization.alloc_tensor() : tensor<6x6xi32, #DCSR> %1 = linalg.generic { indexing_maps = [#map, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0, %arg1 : tensor<8x8xi32, #DCSR>, tensor<3x3xi32>) outs(%0 : tensor<6x6xi32, #DCSR>) { ^bb0(%in: i32, %in_0: i32, %out: i32): %2 = arith.muli %in, %in_0 : i32 %3 = arith.addi %out, %2 : i32 linalg.yield %3 : i32 } -> tensor<6x6xi32, #DCSR> return %1 : tensor<6x6xi32, #DCSR> }"," mlir-opt --sparsification=""enable-index-reduction=true"" --cse ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""]}> #COO = #sparse_tensor.encoding<{ lvlTypes = [""compressed-nu"", ""singleton""]}> func.func @sparse_alloc_copy_CSR(%arg0: tensor<2x2xf32, #CSR>) -> tensor<2x2xf32, #CSR> { %0 = bufferization.alloc_tensor() copy(%arg0) : tensor<2x2xf32, #CSR> ""test.sink""(%0) : (tensor<2x2xf32, #CSR>) -> () } func.func @sparse_alloc_copy_COO(%arg0: tensor<2x2xf32, #COO>) -> tensor<2x2xf32, #COO> { %0 = bufferization.alloc_tensor() copy(%arg0) : tensor<2x2xf32, #COO> ""test.sink""(%0) : (tensor<2x2xf32, #COO>) -> () }", mlir-opt --sparse-tensor-codegen --canonicalize --cse ,1 "#map1 = affine_map<(d0) -> (0, d0)> #map2 = affine_map<(d0) -> (d0)> #SpVec = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> func.func @main(%arg0: tensor<1x77xi1>, %arg1: tensor<1x77xi1>) -> tensor<77xi1, #SpVec> { %0 = bufferization.alloc_tensor() : tensor<77xi1, #SpVec> %1 = linalg.generic { indexing_maps = [#map1, #map1, #map2], iterator_types = [""parallel""]} ins(%arg0, %arg1 : tensor<1x77xi1>, tensor<1x77xi1>) outs(%0 : tensor<77xi1, #SpVec>) { ^bb0(%in: i1, %in_0: i1, %out: i1): %2 = arith.addi %in, %in_0 : i1 linalg.yield %2 : i1 } -> tensor<77xi1, #SpVec> return %1 : tensor<77xi1, #SpVec> }", mlir-opt -sparsification ,1 "#SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @sparse_reshape(%arg0: tensor<4x25xf64, #SparseMatrix>) -> tensor<10x10xf64, #SparseMatrix> { %shape = arith.constant dense <[ 10, 10 ]> : tensor<2xi32> %0 = tensor.reshape %arg0(%shape) : (tensor<4x25xf64, #SparseMatrix>, tensor<2xi32>) -> tensor<10x10xf64, #SparseMatrix> return %0 : tensor<10x10xf64, #SparseMatrix> }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-convert=false"" --cse --canonicalize ",1 "func.func @sparse_push_back(%arg0: index, %arg1: memref, %arg2: f64) -> (memref, index) { %0:2 = sparse_tensor.push_back %arg0, %arg1, %arg2 : index, memref, f64 return %0#0, %0#1 : memref, index }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_push_back_n(%arg0: index, %arg1: memref, %arg2: f64, %arg3: index) -> (memref, index) { %0:2 = sparse_tensor.push_back %arg0, %arg1, %arg2, %arg3 : index, memref, f64, index return %0#0, %0#1 : memref, index }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_push_back_inbound(%arg0: index, %arg1: memref, %arg2: f64) -> (memref, index) { %0:2 = sparse_tensor.push_back inbounds %arg0, %arg1, %arg2 : index, memref, f64 return %0#0, %0#1 : memref, index }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_1d2v_quick(%arg0: index, %arg1: memref<10xi8>, %arg2: memref, %arg3: memref<10xindex>) -> (memref<10xi8>, memref, memref<10xindex>) { sparse_tensor.sort quick_sort %arg0, %arg1 jointly %arg2, %arg3 : memref<10xi8> jointly memref, memref<10xindex> return %arg1, %arg2, %arg3 : memref<10xi8>, memref, memref<10xindex> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_3d_quick(%arg0: index, %arg1: memref<10xindex>, %arg2: memref, %arg3: memref<10xindex>) -> (memref<10xindex>, memref, memref<10xindex>) { sparse_tensor.sort quick_sort %arg0, %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> return %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_3d_hybrid(%arg0: index, %arg1: memref<10xindex>, %arg2: memref, %arg3: memref<10xindex>) -> (memref<10xindex>, memref, memref<10xindex>) { sparse_tensor.sort hybrid_quick_sort %arg0, %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> return %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_3d_stable(%arg0: index, %arg1: memref<10xindex>, %arg2: memref, %arg3: memref<10xindex>) -> (memref<10xindex>, memref, memref<10xindex>) { sparse_tensor.sort insertion_sort_stable %arg0, %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> return %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_3d_heap(%arg0: index, %arg1: memref<10xindex>, %arg2: memref, %arg3: memref<10xindex>) -> (memref<10xindex>, memref, memref<10xindex>) { sparse_tensor.sort heap_sort %arg0, %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> return %arg1, %arg2, %arg3 : memref<10xindex>, memref, memref<10xindex> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_coo_quick(%arg0: index, %arg1: memref<100xindex>, %arg2: memref, %arg3: memref<10xi32>) -> (memref<100xindex>, memref, memref<10xi32>) { sparse_tensor.sort_coo quick_sort %arg0, %arg1 jointly %arg2, %arg3 {nx = 2 : index, ny = 1: index} : memref<100xindex> jointly memref, memref<10xi32> return %arg1, %arg2, %arg3 : memref<100xindex>, memref, memref<10xi32> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_coo_hybrid(%arg0: index, %arg1: memref<100xindex>, %arg2: memref, %arg3: memref<10xi32>) -> (memref<100xindex>, memref, memref<10xi32>) { sparse_tensor.sort_coo hybrid_quick_sort %arg0, %arg1 jointly %arg2, %arg3 {nx = 2 : index, ny = 1: index} : memref<100xindex> jointly memref, memref<10xi32> return %arg1, %arg2, %arg3 : memref<100xindex>, memref, memref<10xi32> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_coo_stable(%arg0: index, %arg1: memref<100xindex>, %arg2: memref, %arg3: memref<10xi32>) -> (memref<100xindex>, memref, memref<10xi32>) { sparse_tensor.sort_coo insertion_sort_stable %arg0, %arg1 jointly %arg2, %arg3 {nx = 2 : index, ny = 1: index} : memref<100xindex> jointly memref, memref<10xi32> return %arg1, %arg2, %arg3 : memref<100xindex>, memref, memref<10xi32> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "func.func @sparse_sort_coo_heap(%arg0: index, %arg1: memref<100xindex>, %arg2: memref, %arg3: memref<10xi32>) -> (memref<100xindex>, memref, memref<10xi32>) { sparse_tensor.sort_coo heap_sort %arg0, %arg1 jointly %arg2, %arg3 {nx = 2 : index, ny = 1: index} : memref<100xindex> jointly memref, memref<10xi32> return %arg1, %arg2, %arg3 : memref<100xindex>, memref, memref<10xi32> }", mlir-opt -split-input-file --sparse-buffer-rewrite --canonicalize --cse ,1 "#DenseMatrix = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""dense""] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [""compressed"", ""compressed""] }> #trait = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = A(i,j) * i * j"" } func.func @dense_index(%arga: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 0 : index %0 = tensor.dim %arga, %c0 : tensor %1 = tensor.dim %arga, %c1 : tensor %init = bufferization.alloc_tensor(%0, %1) : tensor %r = linalg.generic #trait ins(%arga: tensor) outs(%init: tensor) { ^bb(%a: i64, %x: i64): %i = linalg.index 0 : index %j = linalg.index 1 : index %ii = arith.index_cast %i : index to i64 %jj = arith.index_cast %j : index to i64 %m1 = arith.muli %ii, %a : i64 %m2 = arith.muli %jj, %m1 : i64 linalg.yield %m2 : i64 } -> tensor return %r : tensor } func.func @sparse_index(%arga: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 0 : index %0 = tensor.dim %arga, %c0 : tensor %1 = tensor.dim %arga, %c1 : tensor %init = bufferization.alloc_tensor(%0, %1) : tensor %r = linalg.generic #trait ins(%arga: tensor) outs(%init: tensor) { ^bb(%a: i64, %x: i64): %i = linalg.index 0 : index %j = linalg.index 1 : index %ii = arith.index_cast %i : index to i64 %jj = arith.index_cast %j : index to i64 %m1 = arith.muli %ii, %a : i64 %m2 = arith.muli %jj, %m1 : i64 linalg.yield %m2 : i64 } -> tensor return %r : tensor }", mlir-opt -sparsification ,1 "func.func @sparse_foreach_constant() -> () { %cst = arith.constant sparse<[[2, 1], [1, 1], [1, 2]], [1.0, 5.0, 6.0]> : tensor<8x7xf32> sparse_tensor.foreach in %cst { order = affine_map<(d0, d1) -> (d1, d0)> } : tensor<8x7xf32> do { ^bb0(%arg0: index, %arg1: index, %arg2: f32): ""test.use"" (%arg0, %arg1, %arg2): (index,index,f32)->() } sparse_tensor.foreach in %cst : tensor<8x7xf32> do { ^bb0(%arg0: index, %arg1: index, %arg2: f32): ""test.use"" (%arg0, %arg1, %arg2): (index,index,f32)->() } return } #CSR_SLICE = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimSlices = [ (0, 4, 1), (2, 4, 1) ] }> #CSR_SLICE_DYN = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimSlices = [ (?, ?, ?), (?, ?, ?) ] }> func.func @foreach_print_slice_dyn(%A: tensor) { sparse_tensor.foreach in %A : tensor do { ^bb0(%1: index, %2: index, %v: f64) : ""test.use"" (%v) : (f64) -> () } return } func.func @foreach_print_slice(%A: tensor<4x4xf64, #CSR_SLICE>) { sparse_tensor.foreach in %A : tensor<4x4xf64, #CSR_SLICE> do { ^bb0(%1: index, %2: index, %v: f64) : ""test.use"" (%v) : (f64) -> () } return } #BCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed-hi-nu"", ""singleton"" ], }> func.func @foreach_bcoo(%A: tensor<4x4x4xf64, #BCOO>) { sparse_tensor.foreach in %A : tensor<4x4x4xf64, #BCOO> do { ^bb0(%1: index, %2: index, %3: index, %v: f64) : ""test.use"" (%v) : (f64) -> () } return }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-foreach=true"" --canonicalize ",1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #Slice = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], dimSlices = [ (?, 1, 1), (?, 3, 1) ] }> func.func @sparse_nop_cast(%a : tensor) -> tensor { %0 = tensor.cast %a : tensor to tensor %1 = tensor.cast %0 : tensor to tensor %2 = tensor.cast %1 : tensor to tensor return %2 : tensor } func.func @sparse_repair_cast(%a : tensor) -> tensor { %0 = tensor.cast %a : tensor to tensor return %0 : tensor } func.func @sparse_fuse_slice(%a : tensor<2x3xi64, #SortedCOO>) -> tensor<1x3xi64, #SortedCOO> { %extracted_slice = tensor.extract_slice %a[1, 0] [1, 3] [1, 1] : tensor<2x3xi64, #SortedCOO> to tensor<1x3xi64> %cast = tensor.cast %extracted_slice : tensor<1x3xi64> to tensor<1x3xi64, #Slice> %0 = sparse_tensor.convert %cast : tensor<1x3xi64, #Slice> to tensor<1x3xi64, #SortedCOO> return %0 : tensor<1x3xi64, #SortedCOO> }", mlir-opt -pre-sparsification-rewrite ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SparseVector64 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 64, crdWidth = 64 }> #SparseVector32 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 32, crdWidth = 32 }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> #CSC = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""], dimToLvl = affine_map<(i,j) -> (j,i)> }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed"", ""compressed""], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> func.func @sparse_nop(%arg0: tensor) -> tensor { return %arg0 : tensor } func.func @sparse_dim1d(%arg0: tensor) -> index { %c = arith.constant 0 : index %0 = tensor.dim %arg0, %c : tensor return %0 : index } func.func @sparse_dim3d(%arg0: tensor) -> index { %c = arith.constant 1 : index %0 = tensor.dim %arg0, %c : tensor return %0 : index } func.func @sparse_dim3d_const(%arg0: tensor<10x20x30xf64, #SparseTensor>) -> index { %c = arith.constant 1 : index %0 = tensor.dim %arg0, %c : tensor<10x20x30xf64, #SparseTensor> return %0 : index } func.func @sparse_new1d(%arg0: !llvm.ptr) -> tensor<128xf64, #SparseVector> { %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor<128xf64, #SparseVector> return %0 : tensor<128xf64, #SparseVector> } func.func @sparse_new2d(%arg0: !llvm.ptr) -> tensor { %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor return %0 : tensor } func.func @sparse_new3d(%arg0: !llvm.ptr) -> tensor { %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor return %0 : tensor } func.func @sparse_init(%arg0: index, %arg1: index) -> tensor { %0 = bufferization.alloc_tensor(%arg0, %arg1) : tensor %1 = sparse_tensor.load %0 : tensor return %1 : tensor } func.func @sparse_release(%arg0: tensor<128xf64, #SparseVector>) { bufferization.dealloc_tensor %arg0 : tensor<128xf64, #SparseVector> return } func.func @sparse_nop_cast(%arg0: tensor<64xf32, #SparseVector>) -> tensor { %0 = tensor.cast %arg0 : tensor<64xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_positions(%arg0: tensor<128xf64, #SparseVector>) -> memref { %0 = sparse_tensor.positions %arg0 { level = 0 : index } : tensor<128xf64, #SparseVector> to memref return %0 : memref } func.func @sparse_positions64(%arg0: tensor<128xf64, #SparseVector64>) -> memref { %0 = sparse_tensor.positions %arg0 { level = 0 : index } : tensor<128xf64, #SparseVector64> to memref return %0 : memref } func.func @sparse_positions32(%arg0: tensor<128xf64, #SparseVector32>) -> memref { %0 = sparse_tensor.positions %arg0 { level = 0 : index } : tensor<128xf64, #SparseVector32> to memref return %0 : memref } func.func @sparse_indices(%arg0: tensor<128xf64, #SparseVector>) -> memref { %0 = sparse_tensor.coordinates %arg0 { level = 0 : index } : tensor<128xf64, #SparseVector> to memref return %0 : memref } func.func @sparse_indices64(%arg0: tensor<128xf64, #SparseVector64>) -> memref { %0 = sparse_tensor.coordinates %arg0 { level = 0 : index } : tensor<128xf64, #SparseVector64> to memref return %0 : memref } func.func @sparse_indices32(%arg0: tensor<128xf64, #SparseVector32>) -> memref { %0 = sparse_tensor.coordinates %arg0 { level = 0 : index } : tensor<128xf64, #SparseVector32> to memref return %0 : memref } func.func @sparse_valuesf64(%arg0: tensor<128xf64, #SparseVector>) -> memref { %0 = sparse_tensor.values %arg0 : tensor<128xf64, #SparseVector> to memref return %0 : memref } func.func @sparse_valuesf32(%arg0: tensor<128xf32, #SparseVector>) -> memref { %0 = sparse_tensor.values %arg0: tensor<128xf32, #SparseVector> to memref return %0 : memref } func.func @sparse_valuesi32(%arg0: tensor<128xi32, #SparseVector>) -> memref { %0 = sparse_tensor.values %arg0: tensor<128xi32, #SparseVector> to memref return %0 : memref } func.func @sparse_valuesi16(%arg0: tensor<128xi16, #SparseVector>) -> memref { %0 = sparse_tensor.values %arg0: tensor<128xi16, #SparseVector> to memref return %0 : memref } func.func @sparse_valuesi8(%arg0: tensor<128xi8, #SparseVector>) -> memref { %0 = sparse_tensor.values %arg0: tensor<128xi8, #SparseVector> to memref return %0 : memref } func.func @sparse_noe(%arg0: tensor<128xf64, #SparseVector>) -> index { %0 = sparse_tensor.number_of_entries %arg0 : tensor<128xf64, #SparseVector> return %0 : index } func.func @sparse_reconstruct(%arg0: tensor<128xf32, #SparseVector>) -> tensor<128xf32, #SparseVector> { %0 = sparse_tensor.load %arg0 : tensor<128xf32, #SparseVector> return %0 : tensor<128xf32, #SparseVector> } func.func @sparse_reconstruct_ins(%arg0: tensor<128xf32, #SparseVector>) -> tensor<128xf32, #SparseVector> { %0 = sparse_tensor.load %arg0 hasInserts : tensor<128xf32, #SparseVector> return %0 : tensor<128xf32, #SparseVector> } func.func @sparse_insert(%arg0: tensor<128xf32, #SparseVector>, %arg1: index, %arg2: f32) -> tensor<128xf32, #SparseVector> { %0 = sparse_tensor.insert %arg2 into %arg0[%arg1] : tensor<128xf32, #SparseVector> return %0 : tensor<128xf32, #SparseVector> } func.func @sparse_expansion1() -> memref { %0 = bufferization.alloc_tensor() : tensor<4x8xf64, #CSR> %values, %filled, %added, %count = sparse_tensor.expand %0 : tensor<4x8xf64, #CSR> to memref, memref, memref return %added : memref } func.func @sparse_expansion2() -> memref { %0 = bufferization.alloc_tensor() : tensor<4x8xf64, #CSC> %values, %filled, %added, %count = sparse_tensor.expand %0 : tensor<4x8xf64, #CSC> to memref, memref, memref return %added : memref } func.func @sparse_expansion3(%arg0: index, %arg1: index) -> memref { %0 = bufferization.alloc_tensor(%arg0, %arg1) : tensor %values, %filled, %added, %count = sparse_tensor.expand %0 : tensor to memref, memref, memref return %added : memref } func.func @sparse_compression(%tensor: tensor<8x8xf64, #CSR>, %values: memref, %filled: memref, %added: memref, %count: index, %i: index) -> tensor<8x8xf64, #CSR> { %0 = sparse_tensor.compress %values, %filled, %added, %count into %tensor[%i] : memref, memref, memref, tensor<8x8xf64, #CSR> return %0 : tensor<8x8xf64, #CSR> } func.func @sparse_out1(%arg0: tensor, %arg1: !llvm.ptr) { sparse_tensor.out %arg0, %arg1 : tensor, !llvm.ptr return } func.func @sparse_out2(%arg0: tensor, %arg1: !llvm.ptr) { sparse_tensor.out %arg0, %arg1 : tensor, !llvm.ptr return } func.func @sparse_and_dense_init(%arg0: index, %arg1: index) -> (tensor, tensor) { %0 = bufferization.alloc_tensor(%arg0, %arg1) : tensor %1 = sparse_tensor.load %0 : tensor %2 = bufferization.alloc_tensor(%arg0, %arg1) : tensor return %1, %2 : tensor, tensor }", mlir-opt --sparse-tensor-conversion --canonicalize --cse ,1 "func.func private @sparse_1d_tensor(tensor<32xf64, #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }>>)", mlir-opt -split-input-file | mlir-opt ,1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (i,j)>, posWidth = 64, crdWidth = 64 }> func.func private @sparse_csr(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#CSC = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (j,i)>, posWidth = 0, crdWidth = 0 }> func.func private @sparse_csc(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#DCSC = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (j,i)>, posWidth = 0, crdWidth = 64 }> func.func private @sparse_dcsc(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#COO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu-no"", ""singleton-no"" ] }> func.func private @sparse_coo(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#BCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed-hi-nu"", ""singleton"" ] }> func.func private @sparse_bcoo(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> func.func private @sparse_sorted_coo(tensor<10x10xf64, #SortedCOO>)", mlir-opt -split-input-file | mlir-opt ,1 "#BCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""dense"", ""dense"" ], dimToLvl = affine_map<(i, j) -> (i floordiv 2, j floordiv 3, i mod 2, j mod 3)> }> func.func private @sparse_bcsr(tensor<10x60xf64, #BCSR>)", mlir-opt -split-input-file | mlir-opt ,1 "#ELL = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""compressed"" ], dimToLvl = affine_map<(i,j)[c] -> (c*4*i, i, j)> }> func.func private @sparse_ell(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#CSR_SLICE = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimSlices = [ (1, 4, 1), (1, 4, 2) ] }> func.func private @sparse_slice(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#CSR_SLICE = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimSlices = [ (1, 4, 1), (1, 4, 2) ] }> func.func private @sparse_slice(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#CSR_SLICE = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimSlices = [ (1, ?, 1), (?, 4, 2) ] }> func.func private @sparse_slice(tensor)", mlir-opt -split-input-file | mlir-opt ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed"", ""compressed""], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> func.func @sparse_convert_1d(%arg0: tensor<13xi32, #SparseVector>) -> tensor<13xi32> { %0 = sparse_tensor.convert %arg0 : tensor<13xi32, #SparseVector> to tensor<13xi32> return %0 : tensor<13xi32> } func.func @sparse_convert_1d_dyn(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_2d(%arg0: tensor<2x4xf64, #SparseMatrix>) -> tensor<2x4xf64> { %0 = sparse_tensor.convert %arg0 : tensor<2x4xf64, #SparseMatrix> to tensor<2x4xf64> return %0 : tensor<2x4xf64> } func.func @sparse_convert_2d_dyn0(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_2d_dyn1(%arg0: tensor<2x?xf64, #SparseMatrix>) -> tensor<2x?xf64> { %0 = sparse_tensor.convert %arg0 : tensor<2x?xf64, #SparseMatrix> to tensor<2x?xf64> return %0 : tensor<2x?xf64> } func.func @sparse_convert_2d_dyn2(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_3d(%arg0: tensor<2x3x4xf64, #SparseTensor>) -> tensor<2x3x4xf64> { %0 = sparse_tensor.convert %arg0 : tensor<2x3x4xf64, #SparseTensor> to tensor<2x3x4xf64> return %0 : tensor<2x3x4xf64> }", mlir-opt --sparse-tensor-conversion --canonicalize --cse ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> #SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed"", ""compressed""], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> func.func @sparse_convert_1d(%arg0: tensor<13xi32, #SparseVector>) -> tensor<13xi32> { %0 = sparse_tensor.convert %arg0 : tensor<13xi32, #SparseVector> to tensor<13xi32> return %0 : tensor<13xi32> } func.func @sparse_convert_1d_dyn(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_2d(%arg0: tensor<2x4xf64, #SparseMatrix>) -> tensor<2x4xf64> { %0 = sparse_tensor.convert %arg0 : tensor<2x4xf64, #SparseMatrix> to tensor<2x4xf64> return %0 : tensor<2x4xf64> } func.func @sparse_convert_2d_dyn0(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_2d_dyn1(%arg0: tensor<2x?xf64, #SparseMatrix>) -> tensor<2x?xf64> { %0 = sparse_tensor.convert %arg0 : tensor<2x?xf64, #SparseMatrix> to tensor<2x?xf64> return %0 : tensor<2x?xf64> } func.func @sparse_convert_2d_dyn2(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_3d(%arg0: tensor<2x3x4xf64, #SparseTensor>) -> tensor<2x3x4xf64> { %0 = sparse_tensor.convert %arg0 : tensor<2x3x4xf64, #SparseTensor> to tensor<2x3x4xf64> return %0 : tensor<2x3x4xf64> }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-foreach=false"" --canonicalize --cse ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (i,j)> }> func.func @matmul(%A: tensor<4x8xf64, #CSR>, %B: tensor<8x4xf64, #CSR>) -> tensor<4x4xf64, #CSR> { %C = bufferization.alloc_tensor() : tensor<4x4xf64, #CSR> %D = linalg.matmul ins(%A, %B: tensor<4x8xf64, #CSR>, tensor<8x4xf64, #CSR>) outs(%C: tensor<4x4xf64, #CSR>) -> tensor<4x4xf64, #CSR> return %D: tensor<4x4xf64, #CSR> }", mlir-opt --linalg-generalize-named-ops --sparsification --sparse-tensor-codegen --canonicalize --cse ,1 "#SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""dense"", ""compressed"", ""compressed"", ""dense"", ""dense"", ""dense"" ] }> #trait_mul = { indexing_maps = [ affine_map<(i,j,k,l,m,n,o,p) -> (i,j,k,l,m,n,o,p)>, affine_map<(i,j,k,l,m,n,o,p) -> (p,o,n,m,l,k,j,i)>, affine_map<(i,j,k,l,m,n,o,p) -> (i,j,k,l,m,n,o,p)> ], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], doc = ""X(i,j,k,l,m,n,o,p) = A(i,j,k,l,m,n,o,p) * B(p,o,n,m,l,k,j,i)"" } func.func @mul(%arga: tensor<10x20x30x40x50x60x70x80xf32>, %argb: tensor<80x70x60x50x40x30x20x10xf32, #SparseTensor>, %argx: tensor<10x20x30x40x50x60x70x80xf32>) -> tensor<10x20x30x40x50x60x70x80xf32> { %0 = linalg.generic #trait_mul ins(%arga, %argb: tensor<10x20x30x40x50x60x70x80xf32>, tensor<80x70x60x50x40x30x20x10xf32, #SparseTensor>) outs(%argx: tensor<10x20x30x40x50x60x70x80xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<10x20x30x40x50x60x70x80xf32> return %0 : tensor<10x20x30x40x50x60x70x80xf32> }", mlir-opt -sparsification ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @sparse_expand(%arg0: tensor<100xf64, #SparseVector>) -> tensor<10x10xf64, #SparseMatrix> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<100xf64, #SparseVector> into tensor<10x10xf64, #SparseMatrix> return %0 : tensor<10x10xf64, #SparseMatrix> } func.func @sparse_collapse(%arg0: tensor<10x10xf64, #SparseMatrix>) -> tensor<100xf64, #SparseVector> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<10x10xf64, #SparseMatrix> into tensor<100xf64, #SparseVector> return %0 : tensor<100xf64, #SparseVector> } func.func @dynamic_sparse_expand(%arg0: tensor) -> tensor { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor into tensor return %0 : tensor } func.func @dynamic_sparse_collapse(%arg0: tensor<10x?xf64, #SparseMatrix>) -> tensor { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<10x?xf64, #SparseMatrix> into tensor return %0 : tensor }", mlir-opt | mlir-opt ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @sparse_expand(%arg0: tensor<100xf64, #SparseVector>) -> tensor<10x10xf64, #SparseMatrix> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<100xf64, #SparseVector> into tensor<10x10xf64, #SparseMatrix> return %0 : tensor<10x10xf64, #SparseMatrix> } func.func @sparse_collapse(%arg0: tensor<10x10xf64, #SparseMatrix>) -> tensor<100xf64, #SparseVector> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<10x10xf64, #SparseMatrix> into tensor<100xf64, #SparseVector> return %0 : tensor<100xf64, #SparseVector> } func.func @dynamic_sparse_expand(%arg0: tensor) -> tensor { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor into tensor return %0 : tensor } func.func @dynamic_sparse_collapse(%arg0: tensor<10x?xf64, #SparseMatrix>) -> tensor { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<10x?xf64, #SparseMatrix> into tensor return %0 : tensor }", mlir-opt --sparse-tensor-conversion --cse --canonicalize ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @sparse_expand(%arg0: tensor<100xf64, #SparseVector>) -> tensor<10x10xf64, #SparseMatrix> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<100xf64, #SparseVector> into tensor<10x10xf64, #SparseMatrix> return %0 : tensor<10x10xf64, #SparseMatrix> } func.func @sparse_collapse(%arg0: tensor<10x10xf64, #SparseMatrix>) -> tensor<100xf64, #SparseVector> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<10x10xf64, #SparseMatrix> into tensor<100xf64, #SparseVector> return %0 : tensor<100xf64, #SparseVector> } func.func @dynamic_sparse_expand(%arg0: tensor) -> tensor { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor into tensor return %0 : tensor } func.func @dynamic_sparse_collapse(%arg0: tensor<10x?xf64, #SparseMatrix>) -> tensor { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<10x?xf64, #SparseMatrix> into tensor return %0 : tensor }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-convert=false"" --cse --canonicalize ",1 "#CSR = #sparse_tensor.encoding<{lvlTypes = [ ""dense"", ""compressed"" ]}> #trait_matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"",""reduction""], doc = ""x(i) += A(i,j) * b(j)"" } func.func @matvec(%arga: tensor<32x64xf64, #CSR>, %argb: tensor<64xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_matvec ins(%arga, %argb : tensor<32x64xf64, #CSR>, tensor<64xf64>) outs(%argx: tensor<32xf64>) { ^bb(%A: f64, %b: f64, %x: f64): %0 = arith.mulf %A, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> }", mlir-opt -sparsification ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_new(%arg0: !llvm.ptr) -> tensor<128xf64, #SparseVector> { %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor<128xf64, #SparseVector> return %0 : tensor<128xf64, #SparseVector> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""], posWidth=32, crdWidth=32}> func.func @sparse_pack(%data: tensor<6xf64>, %pos: tensor<2xi32>, %index: tensor<6x1xi32>) -> tensor<100xf64, #SparseVector> { %0 = sparse_tensor.pack %data, %pos, %index : tensor<6xf64>, tensor<2xi32>, tensor<6x1xi32> to tensor<100xf64, #SparseVector> return %0 : tensor<100xf64, #SparseVector> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""], crdWidth=32}> func.func @sparse_unpack(%sp : tensor<100xf64, #SparseVector>, %od : tensor<6xf64>, %op : tensor<2xindex>, %oi : tensor<6x1xi32>) -> (tensor<6xf64>, tensor<2xindex>, tensor<6x1xi32>) { %rd, %rp, %ri = sparse_tensor.unpack %sp : tensor<100xf64, #SparseVector> outs(%od, %op, %oi : tensor<6xf64>, tensor<2xindex>, tensor<6x1xi32>) -> tensor<6xf64>, tensor<2xindex>, tensor<6x1xi32> return %rd, %rp, %ri : tensor<6xf64>, tensor<2xindex>, tensor<6x1xi32> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_dealloc(%arg0: tensor<128xf64, #SparseVector>) { bufferization.dealloc_tensor %arg0 : tensor<128xf64, #SparseVector> return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_convert_1d_to_sparse(%arg0: tensor<64xf32>) -> tensor<64xf32, #SparseVector> { %0 = sparse_tensor.convert %arg0 : tensor<64xf32> to tensor<64xf32, #SparseVector> return %0 : tensor<64xf32, #SparseVector> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseTensor = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""compressed"" ] }> func.func @sparse_convert_3d_from_sparse(%arg0: tensor<8x8x8xf64, #SparseTensor>) -> tensor<8x8x8xf64> { %0 = sparse_tensor.convert %arg0 : tensor<8x8x8xf64, #SparseTensor> to tensor<8x8x8xf64> return %0 : tensor<8x8x8xf64> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_positions(%arg0: tensor<128xf64, #SparseVector>) -> memref { %0 = sparse_tensor.positions %arg0 {level = 0 : index} : tensor<128xf64, #SparseVector> to memref return %0 : memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#COO = #sparse_tensor.encoding<{lvlTypes = [""compressed-nu"", ""singleton""]}> func.func @sparse_indices_buffer(%arg0: tensor) -> memref { %0 = sparse_tensor.coordinates_buffer %arg0 : tensor to memref return %0 : memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_indices(%arg0: tensor<128xf64, #SparseVector>) -> memref { %0 = sparse_tensor.coordinates %arg0 {level = 0 : index} : tensor<128xf64, #SparseVector> to memref return %0 : memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_values(%arg0: tensor<128xf64, #SparseVector>) -> memref { %0 = sparse_tensor.values %arg0 : tensor<128xf64, #SparseVector> to memref return %0 : memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#CSR_SLICE = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimSlices = [ (1, 4, 1), (1, 4, 2) ] }> func.func @sparse_slice_offset(%arg0: tensor<2x8xf64, #CSR_SLICE>) -> index { %0 = sparse_tensor.slice.offset %arg0 at 1 : tensor<2x8xf64, #CSR_SLICE> return %0 : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#CSR_SLICE = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], dimSlices = [ (1, 4, 1), (1, 4, 2) ] }> func.func @sparse_slice_stride(%arg0: tensor<2x8xf64, #CSR_SLICE>) -> index { %0 = sparse_tensor.slice.stride %arg0 at 1 : tensor<2x8xf64, #CSR_SLICE> return %0 : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_metadata_init() -> !sparse_tensor.storage_specifier<#SparseVector> { %0 = sparse_tensor.storage_specifier.init : !sparse_tensor.storage_specifier<#SparseVector> return %0 : !sparse_tensor.storage_specifier<#SparseVector> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> #SparseVector_Slice = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], dimSlices = [ (?, ?, ?) ] }> func.func @sparse_metadata_init(%src : !sparse_tensor.storage_specifier<#SparseVector>) -> !sparse_tensor.storage_specifier<#SparseVector_Slice> { %0 = sparse_tensor.storage_specifier.init with %src : from !sparse_tensor.storage_specifier<#SparseVector> to !sparse_tensor.storage_specifier<#SparseVector_Slice> return %0 : !sparse_tensor.storage_specifier<#SparseVector_Slice> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>) -> index { %0 = sparse_tensor.storage_specifier.get %arg0 lvl_sz at 0 : !sparse_tensor.storage_specifier<#SparseVector> return %0 : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector_Slice = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], dimSlices = [ (?, ?, ?) ] }> func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector_Slice>) -> index { %0 = sparse_tensor.storage_specifier.get %arg0 dim_offset at 0 : !sparse_tensor.storage_specifier<#SparseVector_Slice> return %0 : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], dimSlices = [ (?, ?, ?) ] }> func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>) -> index { %0 = sparse_tensor.storage_specifier.get %arg0 dim_stride at 0 : !sparse_tensor.storage_specifier<#SparseVector> return %0 : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_set_md(%arg0: !sparse_tensor.storage_specifier<#SparseVector>, %arg1: index) -> !sparse_tensor.storage_specifier<#SparseVector> { %0 = sparse_tensor.storage_specifier.set %arg0 lvl_sz at 0 with %arg1 : !sparse_tensor.storage_specifier<#SparseVector> return %0 : !sparse_tensor.storage_specifier<#SparseVector> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_noe(%arg0: tensor<128xf64, #SparseVector>) -> index { %0 = sparse_tensor.number_of_entries %arg0 : tensor<128xf64, #SparseVector> return %0 : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#DenseMatrix = #sparse_tensor.encoding<{lvlTypes = [""dense"",""dense""]}> func.func @sparse_load(%arg0: tensor<16x32xf64, #DenseMatrix>) -> tensor<16x32xf64, #DenseMatrix> { %0 = sparse_tensor.load %arg0 : tensor<16x32xf64, #DenseMatrix> return %0 : tensor<16x32xf64, #DenseMatrix> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#DenseMatrix = #sparse_tensor.encoding<{lvlTypes = [""dense"",""dense""]}> func.func @sparse_load_ins(%arg0: tensor<16x32xf64, #DenseMatrix>) -> tensor<16x32xf64, #DenseMatrix> { %0 = sparse_tensor.load %arg0 hasInserts : tensor<16x32xf64, #DenseMatrix> return %0 : tensor<16x32xf64, #DenseMatrix> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_insert(%arg0: tensor<128xf64, #SparseVector>, %arg1: index, %arg2: f64) -> tensor<128xf64, #SparseVector> { %0 = sparse_tensor.insert %arg2 into %arg0[%arg1] : tensor<128xf64, #SparseVector> return %0 : tensor<128xf64, #SparseVector> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_push_back(%arg0: index, %arg1: memref, %arg2: f64) -> (memref, index) { %0:2 = sparse_tensor.push_back %arg0, %arg1, %arg2 : index, memref, f64 return %0#0, %0#1 : memref, index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_push_back_inbound(%arg0: index, %arg1: memref, %arg2: f64) -> (memref, index) { %0:2 = sparse_tensor.push_back inbounds %arg0, %arg1, %arg2 : index, memref, f64 return %0#0, %0#1 : memref, index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_push_back_n(%arg0: index, %arg1: memref, %arg2: f64, %arg3: index) -> (memref, index) { %0:2 = sparse_tensor.push_back %arg0, %arg1, %arg2, %arg3 : index, memref, f64, index return %0#0, %0#1 : memref, index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_expansion(%tensor: tensor<8x8xf64, #SparseMatrix>) -> index { %values, %filled, %added, %count = sparse_tensor.expand %tensor : tensor<8x8xf64, #SparseMatrix> to memref, memref, memref return %count : index }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_compression(%values: memref, %filled: memref, %added: memref, %count: index, %tensor: tensor<8x8xf64, #SparseMatrix>, %index: index) -> tensor<8x8xf64, #SparseMatrix> { %0 = sparse_tensor.compress %values, %filled, %added, %count into %tensor[%index] : memref, memref, memref, tensor<8x8xf64, #SparseMatrix> return %0 : tensor<8x8xf64, #SparseMatrix> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_out(%arg0: tensor, %arg1: !llvm.ptr) { sparse_tensor.out %arg0, %arg1 : tensor, !llvm.ptr return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_binary(%arg0: f64, %arg1: i64) -> f64 { %cf0 = arith.constant 0.0 : f64 %r = sparse_tensor.binary %arg0, %arg1 : f64, i64 to f64 overlap={ ^bb0(%x: f64, %y: i64): sparse_tensor.yield %x : f64 } left=identity right={ ^bb0(%y: i64): sparse_tensor.yield %cf0 : f64 } return %r : f64 }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_unary(%arg0: f64) -> f64 { %r = sparse_tensor.unary %arg0 : f64 to f64 present={ ^bb0(%x: f64): sparse_tensor.yield %x : f64 } absent={ ^bb0: %cf1 = arith.constant -1.0 : f64 sparse_tensor.yield %cf1 : f64 } return %r : f64 }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_unary(%arg0: f64) -> i64 { %r = sparse_tensor.unary %arg0 : f64 to i64 present={ ^bb0(%x: f64): %ret = arith.fptosi %x : f64 to i64 sparse_tensor.yield %ret : i64 } absent={} return %r : i64 }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_reduce_2d_to_1d(%arg0: f64, %arg1: f64) -> f64 { %cf0 = arith.constant 0.0 : f64 %r = sparse_tensor.reduce %arg0, %arg1, %cf0 : f64 { ^bb0(%x: f64, %y: f64): sparse_tensor.yield %x : f64 } return %r : f64 }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_select(%arg0: f64) -> f64 { %cf0 = arith.constant 0.0 : f64 %r = sparse_tensor.select %arg0 : f64 { ^bb0(%x: f64): %cmp = arith.cmpf ""ogt"", %x, %cf0 : f64 sparse_tensor.yield %cmp : i1 } return %r : f64 }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @concat_sparse_sparse(%arg0: tensor<2x4xf64, #SparseMatrix>, %arg1: tensor<3x4xf64, #SparseMatrix>, %arg2: tensor<4x4xf64, #SparseMatrix>) -> tensor<9x4xf64, #SparseMatrix> { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2x4xf64, #SparseMatrix>, tensor<3x4xf64, #SparseMatrix>, tensor<4x4xf64, #SparseMatrix> to tensor<9x4xf64, #SparseMatrix> return %0 : tensor<9x4xf64, #SparseMatrix> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#DCSR = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_tensor_foreach(%arg0: tensor<2x4xf64, #DCSR>) -> () { sparse_tensor.foreach in %arg0 : tensor<2x4xf64, #DCSR> do { ^bb0(%1: index, %2: index, %v: f64) : } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#DCSR = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> func.func @sparse_tensor_foreach(%arg0: tensor<2x4xf64, #DCSR>, %arg1: f32) -> () { %ret = sparse_tensor.foreach in %arg0 init(%arg1): tensor<2x4xf64, #DCSR>, f32 -> f32 do { ^bb0(%1: index, %2: index, %v: f64, %r: f32) : sparse_tensor.yield %r : f32 } return }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_sort_1d0v(%arg0: index, %arg1: memref) -> (memref) { sparse_tensor.sort hybrid_quick_sort %arg0, %arg1 : memref return %arg1 : memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_sort_1d2v(%arg0: index, %arg1: memref<20xindex>, %arg2: memref<10xindex>, %arg3: memref) -> (memref<20xindex>, memref<10xindex>, memref) { sparse_tensor.sort hybrid_quick_sort %arg0, %arg1 jointly %arg2, %arg3 : memref<20xindex> jointly memref<10xindex>, memref return %arg1, %arg2, %arg3 : memref<20xindex>, memref<10xindex>, memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_sort_2d1v(%arg0: index, %arg1: memref<10xi8>, %arg2: memref<20xi8>, %arg3: memref<10xf64>) -> (memref<10xi8>, memref<20xi8>, memref<10xf64>) { sparse_tensor.sort hybrid_quick_sort %arg0, %arg1, %arg2 jointly %arg3 : memref<10xi8>, memref<20xi8> jointly memref<10xf64> return %arg1, %arg2, %arg3 : memref<10xi8>, memref<20xi8>, memref<10xf64> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_sort_stable(%arg0: index, %arg1: memref<10xi8>, %arg2: memref<20xi8>, %arg3: memref<10xf64>) -> (memref<10xi8>, memref<20xi8>, memref<10xf64>) { sparse_tensor.sort insertion_sort_stable %arg0, %arg1, %arg2 jointly %arg3 : memref<10xi8>, memref<20xi8> jointly memref<10xf64> return %arg1, %arg2, %arg3 : memref<10xi8>, memref<20xi8>, memref<10xf64> }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_sort_coo(%arg0: index, %arg1: memref) -> (memref) { sparse_tensor.sort_coo hybrid_quick_sort %arg0, %arg1 {nx = 2 : index, ny = 1 : index}: memref return %arg1 : memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @sparse_sort_coo_stable(%arg0: index, %arg1: memref, %arg2: memref) -> (memref, memref) { sparse_tensor.sort_coo insertion_sort_stable %arg0, %arg1 jointly %arg2 {nx = 2 : index, ny = 1 : index}: memref jointly memref return %arg1, %arg2 : memref, memref }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "#DV = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"" ] }> #SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #trait1 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) OP b"" } func.func @add_d(%arga: tensor<32xf32, #DV>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf32, #DV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %x: f32): %0 = arith.addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @add_d_init(%arga: tensor<32xf32, #DV>, %argb: f32) -> tensor<32xf32> { %u = tensor.empty() : tensor<32xf32> %0 = linalg.generic #trait1 ins(%arga: tensor<32xf32, #DV>) outs(%u: tensor<32xf32>) { ^bb(%a: f32, %x: f32): %0 = arith.addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_d(%arga: tensor<32xf32, #DV>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf32, #DV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %x: f32): %0 = arith.mulf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @add_s(%arga: tensor<32xf32, #SV>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %x: f32): %0 = arith.addf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @repeated_add_s(%arga: tensor<32xf32, #SV>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %x: f32): %0 = arith.addf %a, %a : f32 %1 = arith.addf %a, %a : f32 %2 = arith.addf %0, %1 : f32 linalg.yield %2 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_s(%arga: tensor<32xf32, #SV>, %argb: f32, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait1 ins(%arga: tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %x: f32): %0 = arith.mulf %a, %argb : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } #trait2 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""x(i) = a(i) OP b(i)"" } func.func @add_dd(%arga: tensor<32xf32, #DV>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32, #DV>, tensor<32xf32>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_dd(%arga: tensor<32xf32, #DV>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32, #DV>, tensor<32xf32>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @add_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32, #SV>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32>, tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_ds(%arga: tensor<32xf32>, %argb: tensor<32xf32, #SV>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32>, tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @add_sd(%arga: tensor<32xf32, #SV>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32, #SV>, tensor<32xf32>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_sd(%arga: tensor<32xf32, #SV>, %argb: tensor<32xf32>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32, #SV>, tensor<32xf32>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @add_ss(%arga: tensor<32xf32, #SV>, %argb: tensor<32xf32, #SV>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32, #SV>, tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @mul_ss(%arga: tensor<32xf32, #SV>, %argb: tensor<32xf32, #SV>, %argx: tensor<32xf32>) -> tensor<32xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<32xf32, #SV>, tensor<32xf32, #SV>) outs(%argx: tensor<32xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %b : f32 linalg.yield %0 : f32 } -> tensor<32xf32> return %0 : tensor<32xf32> } func.func @two_way_inv(%arga: tensor<16xf32, #SV>, %argb: tensor<16xf32, #SV>, %argc: f32, %argx: tensor<16xf32>) -> tensor<16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<16xf32, #SV>, tensor<16xf32, #SV>) outs(%argx: tensor<16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.mulf %a, %argc : f32 %1 = arith.mulf %b, %argc : f32 %2 = arith.addf %0, %1 : f32 linalg.yield %2 : f32 } -> tensor<16xf32> return %0 : tensor<16xf32> } func.func @two_way_inv_alt(%arga: tensor<16xf32, #SV>, %argb: tensor<16xf32, #SV>, %argc: f32, %argx: tensor<16xf32>) -> tensor<16xf32> { %0 = linalg.generic #trait2 ins(%arga, %argb: tensor<16xf32, #SV>, tensor<16xf32, #SV>) outs(%argx: tensor<16xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 %1 = arith.mulf %0, %argc : f32 linalg.yield %1 : f32 } -> tensor<16xf32> return %0 : tensor<16xf32> } #trait_sum_reduction = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()> ], iterator_types = [""reduction""], doc = ""x += SUM_i a(i)"" } func.func @sum_reduction(%arga: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction ins(%arga: tensor) outs(%argx: tensor) { ^bb(%a: f32, %x: f32): %0 = arith.addf %x, %a : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } #trait_sum_reduction2 = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i)-> ()> ], iterator_types = [""reduction""], doc = ""x += SUM_i a(i) + b(i)"" } func.func @sum_reduction_ss(%arga: tensor<16xf32, #SV>, %argb: tensor<16xf32, #SV>, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction2 ins(%arga, %argb: tensor<16xf32, #SV>, tensor<16xf32, #SV>) outs(%argx: tensor) { ^bb(%a: f32, %b: f32, %x: f32): %0 = arith.addf %a, %b : f32 %1 = arith.addf %x, %0 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor } #trait_sum_reduction_inv = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()>, affine_map<(i) -> (i)>, affine_map<(i) -> ()> ], iterator_types = [""reduction""], doc = ""x += SUM_i a(i) * b + c(i)"" } func.func @sum_reduction_inv(%arga: tensor<16xf32, #SV>, %argb: tensor, %argc: tensor<16xf32, #SV>, %argx: tensor) -> tensor { %0 = linalg.generic #trait_sum_reduction_inv ins(%arga, %argb, %argc : tensor<16xf32, #SV>, tensor, tensor<16xf32, #SV>) outs(%argx: tensor) { ^bb(%a: f32, %b: f32, %c: f32, %x: f32): %0 = arith.mulf %a, %b : f32 %1 = arith.addf %0, %c : f32 %2 = arith.addf %x, %1 : f32 linalg.yield %2 : f32 } -> tensor return %0 : tensor } #trait_four_tensors = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""], doc = ""X(i) = A(i) + B(i) + C(i) + D(i)"" } func.func @four_tensors_op(%arga: tensor, %argb: tensor, %argc: tensor, %argd: tensor, %argx: tensor) -> tensor { %r = linalg.generic #trait_four_tensors ins(%arga, %argb, %argc, %argd: tensor, tensor, tensor, tensor) outs(%argx: tensor) { ^bb(%a: f64, %b: f64, %c: f64, %d: f64, %x: f64): %0 = arith.addf %a, %b : f64 %1 = arith.addf %c, %d : f64 %2 = arith.addf %0, %1 : f64 linalg.yield %2 : f64 } -> tensor return %r : tensor } #trait_red3s = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> ()> ], iterator_types = [""reduction""], doc = ""x += a(i) + b(i) + c(i)"" } func.func @red3s(%arga: tensor, %argb: tensor, %argc: tensor, %argx: tensor) ->tensor{ %0 = linalg.generic #trait_red3s ins(%arga, %argb, %argc: tensor, tensor, tensor) outs(%argx: tensor) { ^bb(%a: f64,%b: f64,%c: f64,%x: f64): %0 = arith.addf %x, %a : f64 %1 = arith.addf %0, %b : f64 %2 = arith.addf %1, %c : f64 linalg.yield %2 : f64 } -> tensor return %0 : tensor }", mlir-opt -sparsification ,1 "#COO_2D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], posWidth = 32, crdWidth = 32 }> #COO_3D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton-nu"", ""singleton"" ], posWidth = 32, crdWidth = 32 }> func.func @sparse_reshape_fused(%arg0: tensor<5x6xf32>, %arg1: tensor<6x2x3xf32, #COO_3D>) -> tensor { %collapsed = tensor.collapse_shape %arg1 [[0], [1, 2]] : tensor<6x2x3xf32, #COO_3D> into tensor<6x6xf32, #COO_2D> %0 = tensor.empty() : tensor<5x6xf32> %2 = linalg.matmul ins(%arg0, %collapsed : tensor<5x6xf32>, tensor<6x6xf32, #COO_2D>) outs(%0 : tensor<5x6xf32>) -> tensor<5x6xf32> %expanded = tensor.expand_shape %2 [[0], [1, 2]] : tensor<5x6xf32> into tensor<5x2x3xf32> %ret1 = tensor.cast %expanded : tensor<5x2x3xf32> to tensor return %ret1 : tensor }", mlir-opt --linalg-generalize-named-ops --sparsification --cse --canonicalize ,1 "#X = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"", ""dense"" ], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> #trait = { indexing_maps = [ affine_map<(i,j,k) -> (k,i,j)>, affine_map<(i,j,k) -> ()> ], iterator_types = [""reduction"", ""reduction"", ""reduction""] } func.func @sparse_dynamic_dims(%arga: tensor, %argx: tensor) -> tensor { %0 = linalg.generic #trait ins(%arga: tensor) outs(%argx: tensor) { ^bb(%a : f32, %x: f32): %0 = arith.addf %x, %a : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor }", mlir-opt -sparsification --canonicalize ,1 "#SparseVector = #sparse_tensor.encoding<{lvlTypes = [""compressed""]}> func.func @sparse_nop_dense2dense_convert(%arg0: tensor<64xf32>) -> tensor<64xf32> { %0 = sparse_tensor.convert %arg0 : tensor<64xf32> to tensor<64xf32> return %0 : tensor<64xf32> } func.func @sparse_dce_convert(%arg0: tensor<64xf32>) { %0 = sparse_tensor.convert %arg0 : tensor<64xf32> to tensor<64xf32, #SparseVector> return } func.func @sparse_dce_getters(%arg0: tensor<64xf32, #SparseVector>) { %0 = sparse_tensor.positions %arg0 { level = 0 : index } : tensor<64xf32, #SparseVector> to memref %1 = sparse_tensor.coordinates %arg0 { level = 0 : index } : tensor<64xf32, #SparseVector> to memref %2 = sparse_tensor.values %arg0 : tensor<64xf32, #SparseVector> to memref return } func.func @sparse_concat_dce(%arg0: tensor<2xf64, #SparseVector>, %arg1: tensor<3xf64, #SparseVector>, %arg2: tensor<4xf64, #SparseVector>) { %0 = sparse_tensor.concatenate %arg0, %arg1, %arg2 {dimension = 0 : index} : tensor<2xf64, #SparseVector>, tensor<3xf64, #SparseVector>, tensor<4xf64, #SparseVector> to tensor<9xf64, #SparseVector> return } func.func @sparse_get_specifier_dce_fold(%arg0: !sparse_tensor.storage_specifier<#SparseVector>, %arg1: index, %arg2: index) -> index { %0 = sparse_tensor.storage_specifier.set %arg0 lvl_sz at 0 with %arg1 : !sparse_tensor.storage_specifier<#SparseVector> %1 = sparse_tensor.storage_specifier.set %0 pos_mem_sz at 0 with %arg2 : !sparse_tensor.storage_specifier<#SparseVector> %2 = sparse_tensor.storage_specifier.get %1 lvl_sz at 0 : !sparse_tensor.storage_specifier<#SparseVector> return %2 : index }", mlir-opt --canonicalize --cse ,1 "#CSR = #sparse_tensor.encoding<{lvlTypes = [""dense"", ""compressed""]}> func.func @sparse_metadata_init() -> !sparse_tensor.storage_specifier<#CSR> { %0 = sparse_tensor.storage_specifier.init : !sparse_tensor.storage_specifier<#CSR> return %0 : !sparse_tensor.storage_specifier<#CSR> } func.func @sparse_get_md(%arg0: !sparse_tensor.storage_specifier<#CSR>) -> index { %0 = sparse_tensor.storage_specifier.get %arg0 lvl_sz at 0 : !sparse_tensor.storage_specifier<#CSR> return %0 : index } func.func @sparse_set_md(%arg0: !sparse_tensor.storage_specifier<#CSR>, %arg1: index) -> !sparse_tensor.storage_specifier<#CSR> { %0 = sparse_tensor.storage_specifier.set %arg0 lvl_sz at 0 with %arg1 : !sparse_tensor.storage_specifier<#CSR> return %0 : !sparse_tensor.storage_specifier<#CSR> }", mlir-opt -sparse-storage-specifier-to-llvm --cse --canonicalize ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SparseMatrix = #sparse_tensor.encoding<{ lvlTypes = [""compressed"", ""compressed""] }> func.func @expand_dense(%arg0: tensor<12xf64>) -> tensor<3x4xf64> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64> into tensor<3x4xf64> return %0 : tensor<3x4xf64> } func.func @expand_from_sparse(%arg0: tensor<12xf64, #SparseVector>) -> tensor<3x4xf64> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64, #SparseVector> into tensor<3x4xf64> return %0 : tensor<3x4xf64> } func.func @expand_to_sparse(%arg0: tensor<12xf64>) -> tensor<3x4xf64, #SparseMatrix> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64> into tensor<3x4xf64, #SparseMatrix> return %0 : tensor<3x4xf64, #SparseMatrix> } func.func @expand_sparse2sparse(%arg0: tensor<12xf64, #SparseVector>) -> tensor<3x4xf64, #SparseMatrix> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64, #SparseVector> into tensor<3x4xf64, #SparseMatrix> return %0 : tensor<3x4xf64, #SparseMatrix> } func.func @collapse_dense(%arg0: tensor<3x4xf64>) -> tensor<12xf64> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<3x4xf64> into tensor<12xf64> return %0 : tensor<12xf64> } func.func @collapse_from_sparse(%arg0: tensor<3x4xf64, #SparseMatrix>) -> tensor<12xf64> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<3x4xf64, #SparseMatrix> into tensor<12xf64> return %0 : tensor<12xf64> } func.func @collapse_to_sparse(%arg0: tensor<3x4xf64>) -> tensor<12xf64, #SparseVector> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<3x4xf64> into tensor<12xf64, #SparseVector> return %0 : tensor<12xf64, #SparseVector> } func.func @collapse_sparse2sparse(%arg0: tensor<3x4xf64, #SparseMatrix>) -> tensor<12xf64, #SparseVector> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<3x4xf64, #SparseMatrix> into tensor<12xf64, #SparseVector> return %0 : tensor<12xf64, #SparseVector> }", mlir-opt -post-sparsification-rewrite ,1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #trait_scale = { indexing_maps = [ affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = X(i,j) * 2.0"" } #trait_matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"",""reduction""], doc = ""x(i) += A(i,j) * b(j)"" } #trait_mul = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""Z(i,j) = X(i,j) * Y(i,j)"" } func.func @sparse_scale(%argx: tensor) -> tensor { %c = arith.constant 2.0 : f32 %0 = linalg.generic #trait_scale outs(%argx: tensor) { ^bb(%x: f32): %1 = arith.mulf %x, %c : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor } func.func @matvec(%arga: tensor<32x64xf64, #SortedCOO>, %argb: tensor<64xf64>, %argx: tensor<32xf64>) -> tensor<32xf64> { %0 = linalg.generic #trait_matvec ins(%arga, %argb : tensor<32x64xf64, #SortedCOO>, tensor<64xf64>) outs(%argx: tensor<32xf64>) { ^bb(%A: f64, %b: f64, %x: f64): %0 = arith.mulf %A, %b : f64 %1 = arith.addf %x, %0 : f64 linalg.yield %1 : f64 } -> tensor<32xf64> return %0 : tensor<32xf64> } func.func @mateltmul(%argx: tensor<32x64xf64, #SortedCOO>, %argy: tensor<32x64xf64, #SortedCOO>, %argz: tensor<32x64xf64>) -> tensor<32x64xf64> { %0 = linalg.generic #trait_mul ins(%argx, %argy : tensor<32x64xf64, #SortedCOO>, tensor<32x64xf64, #SortedCOO>) outs(%argz: tensor<32x64xf64>) { ^bb(%x: f64, %y: f64, %z: f64): %1 = arith.mulf %x, %y : f64 linalg.yield %1 : f64 } -> tensor<32x64xf64> return %0 : tensor<32x64xf64> }", mlir-opt -sparsification --canonicalize ,1 "#SparseVector64 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 64, crdWidth = 64 }> #SparseVector32 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 32, crdWidth = 32 }> #SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SortedCOO2D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], }> #SortedCOO3D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton-nu"", ""singleton"" ] }> #TsssPermuted = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> #COOSlice = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], dimSlices = [ (2, 2, 1), (12, 13, 1) ] }> func.func @sparse_nop_convert(%arg0: tensor<64xf32, #SparseVector>) -> tensor<64xf32, #SparseVector> { %0 = sparse_tensor.convert %arg0 : tensor<64xf32, #SparseVector> to tensor<64xf32, #SparseVector> return %0 : tensor<64xf32, #SparseVector> } func.func @sparse_hidden_nop_cast(%arg0: tensor<32xf32, #SparseVector>) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor<32xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_convert_1d_ss(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } #SparseSingleton64 = #sparse_tensor.encoding<{ lvlTypes = [""singleton""], posWidth = 64, crdWidth = 64 }> #SparseSingleton32 = #sparse_tensor.encoding<{ lvlTypes = [""singleton""], posWidth = 32, crdWidth = 32 }> func.func @sparse_convert_singleton(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_permuted(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_slice(%arg0: tensor<2x13xi32, #COOSlice>) -> (tensor<2x13xi32, #SortedCOO2D>) { %0 = sparse_tensor.convert %arg0 : tensor<2x13xi32, #COOSlice> to tensor<2x13xi32, #SortedCOO2D> return %0 : tensor<2x13xi32, #SortedCOO2D> }"," mlir-opt --sparse-tensor-conversion=""s2s-strategy=1"" --canonicalize --cse ",1 "#SparseVector64 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 64, crdWidth = 64 }> #SparseVector32 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 32, crdWidth = 32 }> #SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SortedCOO2D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], }> #SortedCOO3D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton-nu"", ""singleton"" ] }> #TsssPermuted = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> #COOSlice = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], dimSlices = [ (2, 2, 1), (12, 13, 1) ] }> func.func @sparse_nop_convert(%arg0: tensor<64xf32, #SparseVector>) -> tensor<64xf32, #SparseVector> { %0 = sparse_tensor.convert %arg0 : tensor<64xf32, #SparseVector> to tensor<64xf32, #SparseVector> return %0 : tensor<64xf32, #SparseVector> } func.func @sparse_hidden_nop_cast(%arg0: tensor<32xf32, #SparseVector>) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor<32xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_convert_1d_ss(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } #SparseSingleton64 = #sparse_tensor.encoding<{ lvlTypes = [""singleton""], posWidth = 64, crdWidth = 64 }> #SparseSingleton32 = #sparse_tensor.encoding<{ lvlTypes = [""singleton""], posWidth = 32, crdWidth = 32 }> func.func @sparse_convert_singleton(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_permuted(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_slice(%arg0: tensor<2x13xi32, #COOSlice>) -> (tensor<2x13xi32, #SortedCOO2D>) { %0 = sparse_tensor.convert %arg0 : tensor<2x13xi32, #COOSlice> to tensor<2x13xi32, #SortedCOO2D> return %0 : tensor<2x13xi32, #SortedCOO2D> }"," mlir-opt --sparse-tensor-conversion=""s2s-strategy=0"" --canonicalize --cse ",1 "#SparseVector64 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 64, crdWidth = 64 }> #SparseVector32 = #sparse_tensor.encoding<{ lvlTypes = [""compressed""], posWidth = 32, crdWidth = 32 }> #SparseVector = #sparse_tensor.encoding<{ lvlTypes = [""compressed""] }> #SortedCOO2D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], }> #SortedCOO3D = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton-nu"", ""singleton"" ] }> #TsssPermuted = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j,k) -> (k,i,j)> }> #COOSlice = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ], dimSlices = [ (2, 2, 1), (12, 13, 1) ] }> func.func @sparse_nop_convert(%arg0: tensor<64xf32, #SparseVector>) -> tensor<64xf32, #SparseVector> { %0 = sparse_tensor.convert %arg0 : tensor<64xf32, #SparseVector> to tensor<64xf32, #SparseVector> return %0 : tensor<64xf32, #SparseVector> } func.func @sparse_hidden_nop_cast(%arg0: tensor<32xf32, #SparseVector>) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor<32xf32, #SparseVector> to tensor return %0 : tensor } func.func @sparse_convert_1d_ss(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } #SparseSingleton64 = #sparse_tensor.encoding<{ lvlTypes = [""singleton""], posWidth = 64, crdWidth = 64 }> #SparseSingleton32 = #sparse_tensor.encoding<{ lvlTypes = [""singleton""], posWidth = 32, crdWidth = 32 }> func.func @sparse_convert_singleton(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_permuted(%arg0: tensor) -> tensor { %0 = sparse_tensor.convert %arg0 : tensor to tensor return %0 : tensor } func.func @sparse_convert_slice(%arg0: tensor<2x13xi32, #COOSlice>) -> (tensor<2x13xi32, #SortedCOO2D>) { %0 = sparse_tensor.convert %arg0 : tensor<2x13xi32, #COOSlice> to tensor<2x13xi32, #SortedCOO2D> return %0 : tensor<2x13xi32, #SortedCOO2D> }"," mlir-opt --post-sparsification-rewrite=""enable-runtime-library=false enable-foreach=false"" --canonicalize --cse ",1 "#Dense = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"" , ""dense"" ] }> #trait_scale = { indexing_maps = [ affine_map<(i,j) -> (i,j)> ], iterator_types = [""parallel"", ""parallel""], doc = ""X(i,j) = X(i,j) * 2.0"" } func.func @sparse_scale(%argx: tensor<1x1xf32, #Dense>) -> tensor<1x1xf32, #Dense> { %c = arith.constant 2.0 : f32 %0 = linalg.generic #trait_scale outs(%argx: tensor<1x1xf32, #Dense>) { ^bb(%x: f32): %1 = arith.mulf %x, %c : f32 linalg.yield %1 : f32 } -> tensor<1x1xf32, #Dense> return %0 : tensor<1x1xf32, #Dense> }", mlir-opt -sparsification -cse ,1 "#SV = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #trait = { indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ], iterator_types = [""parallel""] } func.func @allout_inplace(%arga: tensor<10xi32, #SV>, %argb: tensor<10xf32>) -> tensor<10xf32> { %0 = linalg.generic #trait ins(%arga: tensor<10xi32, #SV>) outs(%argb: tensor<10xf32>) { ^bb(%a: i32, %x : f32): %cst = arith.sitofp %a : i32 to f32 linalg.yield %cst : f32 } -> tensor<10xf32> return %0 : tensor<10xf32> } func.func @allout_materialize(%arga: tensor<10xi32, #SV>) -> tensor<10xf32> { %m = bufferization.alloc_tensor() : tensor<10xf32> %0 = linalg.generic #trait ins(%arga: tensor<10xi32, #SV>) outs(%m: tensor<10xf32>) { ^bb(%a: i32, %x : f32): %cst = arith.sitofp %a : i32 to f32 linalg.yield %cst : f32 } -> tensor<10xf32> return %0 : tensor<10xf32> } func.func @update_inplace(%arga: tensor<10xf32, #SV>, %argb: tensor<10xf32>) -> tensor<10xf32> { %0 = linalg.generic #trait ins(%arga: tensor<10xf32, #SV>) outs(%argb: tensor<10xf32>) { ^bb(%a: f32, %x : f32): %up = arith.addf %a, %x : f32 linalg.yield %up : f32 } -> tensor<10xf32> return %0 : tensor<10xf32> }", mlir-opt -sparsification ,1 "#SparseMatrix = #sparse_tensor.encoding<{lvlTypes = [""compressed"", ""compressed""]}> #SparseMatrix_P = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ], dimToLvl = affine_map<(i,j) -> (j,i)> }> #SparseMatrix_D_P = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""dense"" ], dimToLvl = affine_map<(i,j) -> (j,i)> }> func.func @concat_mix_dense(%arg0: tensor<2x4xf64>, %arg1: tensor<3x4xf64, #SparseMatrix>) -> tensor<5x4xf64> { %0 = sparse_tensor.concatenate %arg0, %arg1 {dimension = 0 : index} : tensor<2x4xf64>, tensor<3x4xf64, #SparseMatrix> to tensor<5x4xf64> return %0 : tensor<5x4xf64> } func.func @concat_mix_sparse(%arg0: tensor<2x4xf64>, %arg1: tensor<3x4xf64, #SparseMatrix>) -> tensor<5x4xf64, #SparseMatrix> { %0 = sparse_tensor.concatenate %arg0, %arg1 {dimension = 0 : index} : tensor<2x4xf64>, tensor<3x4xf64, #SparseMatrix> to tensor<5x4xf64, #SparseMatrix> return %0 : tensor<5x4xf64, #SparseMatrix> } func.func @concat_mix_sparse_perm_dim1(%arg0: tensor<4x2xf64>, %arg1: tensor<4x3xf64, #SparseMatrix_P>) -> tensor<4x5xf64, #SparseMatrix_P> { %0 = sparse_tensor.concatenate %arg0, %arg1 {dimension = 1 : index} : tensor<4x2xf64>, tensor<4x3xf64, #SparseMatrix_P> to tensor<4x5xf64, #SparseMatrix_P> return %0 : tensor<4x5xf64, #SparseMatrix_P> } func.func @concat_mix_dense_perm_dim1(%arg0: tensor<4x2xf64>, %arg1: tensor<4x3xf64, #SparseMatrix_P>) -> tensor<4x5xf64> { %0 = sparse_tensor.concatenate %arg0, %arg1 {dimension = 1 : index} : tensor<4x2xf64>, tensor<4x3xf64, #SparseMatrix_P> to tensor<4x5xf64> return %0 : tensor<4x5xf64> } func.func @concat_mix_dense_perm_dim1_dyn(%arg0: tensor<3x2xf64>, %arg1: tensor<3x3xf64, #SparseMatrix>) -> tensor { %0 = sparse_tensor.concatenate %arg0, %arg1 {dimension = 1 : index} : tensor<3x2xf64>, tensor<3x3xf64, #SparseMatrix> to tensor return %0 : tensor } func.func @concat_annotated_dense(%arg0: tensor<4x2xf64>, %arg1: tensor<4x3xf64, #SparseMatrix_P>) -> tensor<4x5xf64, #SparseMatrix_D_P> { %0 = sparse_tensor.concatenate %arg0, %arg1 {dimension = 1 : index} : tensor<4x2xf64>, tensor<4x3xf64, #SparseMatrix_P> to tensor<4x5xf64, #SparseMatrix_D_P> return %0 : tensor<4x5xf64, #SparseMatrix_D_P> }", mlir-opt --sparse-tensor-conversion --canonicalize --cse ,1 "#SM = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> #trait_matmul = { indexing_maps = [ affine_map<(d0, d1, d2) -> (d1, d0)>, affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)> ], iterator_types = [""reduction"", ""parallel"", ""parallel""] } #trait_scale = { indexing_maps = [ affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)> ], iterator_types = [""parallel"", ""parallel""] } func.func @sparse_sampled_dd_unfused(%args: tensor<8x8xf64, #SM>, %arga: tensor<8x8xf64>, %argb: tensor<8x8xf64>) -> tensor<8x8xf64, #SM> { %1 = arith.constant dense<0.0> : tensor<8x8xf64> %2 = linalg.generic #trait_matmul ins(%arga, %argb : tensor<8x8xf64>, tensor<8x8xf64>) outs(%1 : tensor<8x8xf64>) { ^bb0(%a: f64, %b: f64, %x: f64): %p = arith.mulf %a, %b : f64 %q = arith.addf %x, %p : f64 linalg.yield %q : f64 } -> tensor<8x8xf64> %3 = bufferization.alloc_tensor() : tensor<8x8xf64, #SM> %4 = linalg.generic #trait_scale ins(%2, %args : tensor<8x8xf64>, tensor<8x8xf64, #SM>) outs(%3 : tensor<8x8xf64, #SM>) { ^bb0(%t: f64, %s: f64, %x: f64): %r = arith.mulf %t, %s : f64 linalg.yield %r : f64 } -> tensor<8x8xf64, #SM> return %4 : tensor<8x8xf64, #SM> }", mlir-opt --pre-sparsification-rewrite --sparsification --cse ,1 "#SparseVector = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"" ] }> #DCSR = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed"", ""compressed"" ] }> func.func @matmul1(%a: tensor<10x20xf32, #DCSR>, %b: tensor<20x30xf32>, %c: tensor<10x30xf32>) -> tensor<10x30xf32> { %0 = linalg.matmul ins(%a, %b: tensor<10x20xf32, #DCSR>, tensor<20x30xf32>) outs(%c: tensor<10x30xf32>) -> tensor<10x30xf32> return %0 : tensor<10x30xf32> } func.func @matmul_sparse_rhs(%a: tensor<10x20xf32>, %b: tensor<20x30xf32, #DCSR>, %c: tensor<10x30xf32>) -> tensor<10x30xf32> { %0 = linalg.matmul ins(%a, %b: tensor<10x20xf32>, tensor<20x30xf32,#DCSR>) outs(%c: tensor<10x30xf32>) -> tensor<10x30xf32> return %0 : tensor<10x30xf32> } func.func @matmul2(%A: tensor<4x8xf64, #DCSR>, %B: tensor<8x4xf64, #DCSR>) -> tensor<4x4xf64, #DCSR> { %c4 = arith.constant 4 : index %C = bufferization.alloc_tensor() : tensor<4x4xf64, #DCSR> %D = linalg.matmul ins(%A, %B: tensor<4x8xf64, #DCSR>, tensor<8x4xf64, #DCSR>) outs(%C: tensor<4x4xf64, #DCSR>) -> tensor<4x4xf64, #DCSR> return %D: tensor<4x4xf64, #DCSR> } func.func @conv2d(%input: tensor<8x8xi32>, %filter: tensor<3x3xi32, #DCSR>, %output: tensor<6x6xi32>) -> tensor<6x6xi32> { %0 = linalg.conv_2d ins (%input, %filter: tensor<8x8xi32>, tensor<3x3xi32, #DCSR>) outs (%output: tensor<6x6xi32>) -> tensor<6x6xi32> return %0 : tensor<6x6xi32> } func.func @quantized_matmul(%input1: tensor<5x3xi8>, %input2: tensor<3x6xi8, #DCSR>, %output: tensor<5x6xi64>) -> tensor<5x6xi64> { %c0 = arith.constant 0 : i32 %c2 = arith.constant 2 : i32 %0 = linalg.quantized_matmul ins(%input1, %input2, %c2, %c0 : tensor<5x3xi8>, tensor<3x6xi8, #DCSR>, i32, i32) outs(%output : tensor<5x6xi64>) -> tensor<5x6xi64> return %0: tensor<5x6xi64> } func.func @sparse_dot(%a: tensor<1024xf32, #SparseVector>, %b: tensor<1024xf32, #SparseVector>, %x: tensor) -> tensor { %dot = linalg.dot ins(%a, %b: tensor<1024xf32, #SparseVector>, tensor<1024xf32, #SparseVector>) outs(%x: tensor) -> tensor return %dot : tensor }", mlir-opt --linalg-generalize-named-ops --linalg-fuse-elementwise-ops --sparsification ,1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> func.func @matvec(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor }"," mlir-opt --linalg-generalize-named-ops --pre-sparsification-rewrite --sparsification=""parallelization-strategy=dense-outer-loop"" --sparse-gpu-codegen ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> func.func @matmul(%A: tensor, %B: tensor, %C_in: tensor) -> tensor { %C_out = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C_in: tensor) -> tensor return %C_out : tensor }"," mlir-opt --linalg-generalize-named-ops --sparsification=""enable-gpu-libgen"" ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> func.func @matmul(%A: tensor, %B: tensor, %C_in: tensor) -> tensor { %C_out = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C_in: tensor) -> tensor return %C_out : tensor }"," mlir-opt --linalg-generalize-named-ops --pre-sparsification-rewrite --sparsification=""parallelization-strategy=dense-outer-loop"" --sparse-gpu-codegen ",1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> module { func.func @matvec(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor } }"," mlir-opt --linalg-generalize-named-ops --sparsification=""enable-gpu-libgen"" ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> func.func @matmuls(%A: tensor<1024x8xf64>, %B: tensor<8x1024xf64, #CSR>, %C: tensor<1024x1024xf64, #CSR>) -> tensor<1024x1024xf64> { %Z = arith.constant dense<0.0> : tensor<1024x1024xf64> %T = linalg.matmul ins(%A, %B: tensor<1024x8xf64>, tensor<8x1024xf64, #CSR>) outs(%Z: tensor<1024x1024xf64>) -> tensor<1024x1024xf64> %D = linalg.matmul ins(%T, %C: tensor<1024x1024xf64>, tensor<1024x1024xf64, #CSR>) outs(%Z: tensor<1024x1024xf64>) -> tensor<1024x1024xf64> return %D : tensor<1024x1024xf64> }"," mlir-opt --linalg-generalize-named-ops --pre-sparsification-rewrite --sparsification=""parallelization-strategy=dense-outer-loop"" --sparse-gpu-codegen ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> func.func @test_clone(%buf : memref<*xf32>) -> memref<*xf32> { %clone = bufferization.clone %buf : memref<*xf32> to memref<*xf32> return %clone : memref<*xf32> } func.func @test_to_memref(%arg0: tensor, %arg1: tensor<*xi64>) -> (memref (d0 + 7)>>, memref<*xi64, 1>) { %0 = bufferization.to_memref %arg0 : memref (d0 + 7)>> %1 = bufferization.to_memref %arg1 : memref<*xi64, 1> return %0, %1 : memref (d0 + 7)>>, memref<*xi64, 1> } func.func @test_to_tensor(%buf : memref<2xf32>) -> tensor<2xf32> { %tensor = bufferization.to_tensor %buf restrict writable : memref<2xf32> return %tensor : tensor<2xf32> } func.func @test_alloc_tensor_op(%t: tensor, %sz: index) -> tensor { %0 = bufferization.alloc_tensor(%sz) : tensor %1 = bufferization.alloc_tensor() copy(%t) : tensor %2 = bufferization.alloc_tensor() : tensor<5x6xf32> %3 = bufferization.alloc_tensor(%sz, %sz) : tensor %4 = bufferization.alloc_tensor() copy(%t) {escape = true} : tensor %5 = bufferization.alloc_tensor() copy(%t) {escape = false} : tensor %c100 = arith.constant 100 : index %6 = bufferization.alloc_tensor() size_hint=%c100 : tensor<100x100xf64, #CSR> %7 = bufferization.alloc_tensor(%sz) {memory_space = ""foo""} : tensor return %1 : tensor } func.func @test_dealloc_tensor_op(%arg0: tensor<4xi32>) { bufferization.dealloc_tensor %arg0 : tensor<4xi32> return }", mlir-opt | mlir-opt ,1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> func.func @test_clone(%buf : memref<*xf32>) -> memref<*xf32> { %clone = bufferization.clone %buf : memref<*xf32> to memref<*xf32> return %clone : memref<*xf32> } func.func @test_to_memref(%arg0: tensor, %arg1: tensor<*xi64>) -> (memref (d0 + 7)>>, memref<*xi64, 1>) { %0 = bufferization.to_memref %arg0 : memref (d0 + 7)>> %1 = bufferization.to_memref %arg1 : memref<*xi64, 1> return %0, %1 : memref (d0 + 7)>>, memref<*xi64, 1> } func.func @test_to_tensor(%buf : memref<2xf32>) -> tensor<2xf32> { %tensor = bufferization.to_tensor %buf restrict writable : memref<2xf32> return %tensor : tensor<2xf32> } func.func @test_alloc_tensor_op(%t: tensor, %sz: index) -> tensor { %0 = bufferization.alloc_tensor(%sz) : tensor %1 = bufferization.alloc_tensor() copy(%t) : tensor %2 = bufferization.alloc_tensor() : tensor<5x6xf32> %3 = bufferization.alloc_tensor(%sz, %sz) : tensor %4 = bufferization.alloc_tensor() copy(%t) {escape = true} : tensor %5 = bufferization.alloc_tensor() copy(%t) {escape = false} : tensor %c100 = arith.constant 100 : index %6 = bufferization.alloc_tensor() size_hint=%c100 : tensor<100x100xf64, #CSR> %7 = bufferization.alloc_tensor(%sz) {memory_space = ""foo""} : tensor return %1 : tensor } func.func @test_dealloc_tensor_op(%arg0: tensor<4xi32>) { bufferization.dealloc_tensor %arg0 : tensor<4xi32> return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @test_inline(%buf : memref<*xf32>) -> memref<*xf32> { %0 = call @inner_func(%buf) : (memref<*xf32>) -> memref<*xf32> return %0 : memref<*xf32> } func.func @inner_func(%buf : memref<*xf32>) -> memref<*xf32> { %clone = bufferization.clone %buf : memref<*xf32> to memref<*xf32> return %clone : memref<*xf32> }", mlir-opt -inline ,1 "func.func @unknown_op_aliasing(%f: f32, %f2: f32, %pos: index) -> f32 { %0 = tensor.empty() : tensor<10xf32> %1 = linalg.fill ins(%f : f32) outs(%0 : tensor<10xf32>) -> tensor<10xf32> %alias = ""dummy.dummy_op""(%1) : (tensor<10xf32>) -> (tensor<10xf32>) %2 = linalg.fill ins(%f2 : f32) outs(%1 : tensor<10xf32>) -> tensor<10xf32> %3 = tensor.extract %alias[%pos] : tensor<10xf32> return %3 : f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only"" -allow-unregistered-dialect -split-input-file ",1 "func.func @unknown_op_writing(%f: f32, %f2: f32, %pos: index) -> f32 { %0 = tensor.empty() : tensor<10xf32> %1 = linalg.fill ins(%f : f32) outs(%0 : tensor<10xf32>) -> tensor<10xf32> ""dummy.dummy_op""(%1) : (tensor<10xf32>) -> () %3 = tensor.extract %1[%pos] : tensor<10xf32> return %3 : f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only"" -allow-unregistered-dialect -split-input-file ",1 "func.func @read_of_undef_is_not_a_conflict(%f: f32, %idx: index) -> f32 { %0 = tensor.empty() : tensor<10xf32> %1 = tensor.insert %f into %0[%idx] : tensor<10xf32> %2 = tensor.extract %0[%idx] : tensor<10xf32> return %2 : f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only"" -allow-unregistered-dialect -split-input-file ",1 "func.func @read_of_alloc_tensor_is_not_a_conflict(%f: f32, %idx: index) -> f32 { %0 = bufferization.alloc_tensor() : tensor<10xf32> %1 = tensor.insert %f into %0[%idx] : tensor<10xf32> %2 = tensor.extract %0[%idx] : tensor<10xf32> return %2 : f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only"" -allow-unregistered-dialect -split-input-file ",1 "func.func @buffer_forwarding_conflict( %t: tensor {bufferization.buffer_layout = affine_map<(d0) -> (d0)>, bufferization.writable = true}, %sz: index) -> (tensor, tensor) { %f0 = arith.constant 0.0: f32 %a = tensor.empty(%sz) : tensor %f = linalg.fill ins(%f0 : f32) outs(%a : tensor) -> tensor %r0 = tensor.insert_slice %f into %t[0][%sz][1]: tensor into tensor %r1 = tensor.insert_slice %f into %t[42][%sz][1]: tensor into tensor return %r0, %r1: tensor, tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @buffer_forwarding_no_conflict( %t: tensor {bufferization.buffer_layout = affine_map<(d0) -> (d0)>, bufferization.writable = true}, %sz: index) -> (tensor) { %f0 = arith.constant 0.0: f32 %a = tensor.empty(%sz) : tensor %f = linalg.fill ins(%f0 : f32) outs(%a : tensor) -> tensor %r1 = tensor.insert_slice %f into %t[42][%sz][1]: tensor into tensor return %r1: tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @insertion_point_inside_loop(%t : tensor, %sz : index) -> (tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c5 = arith.constant 5 : index %blank = tensor.empty() : tensor<5xf32> %r = scf.for %iv = %c0 to %sz step %c5 iter_args(%bb = %t) -> (tensor) { %iv_i32 = arith.index_cast %iv : index to i32 %f = arith.sitofp %iv_i32 : i32 to f32 %filled = linalg.fill ins(%f : f32) outs(%blank : tensor<5xf32>) -> tensor<5xf32> %inserted = tensor.insert_slice %filled into %bb[%iv][5][1] : tensor<5xf32> into tensor scf.yield %inserted : tensor } return %r : tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @insertion_point_outside_loop(%t : tensor, %sz : index, %idx : index) -> (tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c5 = arith.constant 5 : index %blank = tensor.empty() : tensor<5xf32> %r = scf.for %iv = %c0 to %sz step %c5 iter_args(%bb = %t) -> (tensor) { %iv_i32 = arith.index_cast %iv : index to i32 %f = arith.sitofp %iv_i32 : i32 to f32 %filled = linalg.fill ins(%f : f32) outs(%blank : tensor<5xf32>) -> tensor<5xf32> %inserted = tensor.insert_slice %filled into %bb[%idx][5][1] : tensor<5xf32> into tensor scf.yield %inserted : tensor } return %r : tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @shape_mismatch(%t: tensor<5x6x128xf32>) -> tensor<5x6x128xf32> { %cst = arith.constant 8.0 : f32 %0 = tensor.empty() : tensor<128xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<128xf32>) -> tensor<128xf32> %2 = tensor.expand_shape %1 [[0, 1, 2]] : tensor<128xf32> into tensor<1x1x128xf32> %3 = tensor.insert_slice %2 into %t[2, 3, 0][1, 1, 128][1, 1, 1] : tensor<1x1x128xf32> into tensor<5x6x128xf32> return %3 : tensor<5x6x128xf32> }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @parallel_insert_slice( %t: tensor {bufferization.buffer_layout = affine_map<(d0) -> (d0)>, bufferization.writable = true}, %sz: index) -> (tensor) { %f0 = arith.constant 0.0: f32 %c512 = arith.constant 512 : index %r1 = scf.forall (%iv) in (%c512) shared_outs(%o = %t) -> (tensor) { %a = tensor.empty(%sz) : tensor %f = linalg.fill ins(%f0 : f32) outs(%a : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %f into %o[42][%sz][1]: tensor into tensor } } return %r1: tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @eleminate_multiple_ops(%t: tensor {bufferization.buffer_layout = affine_map<(d0) -> (d0)>}, %sz: index, %c: i1) -> (tensor) { %cst1 = arith.constant 0.0: f32 %cst2 = arith.constant 1.0: f32 %if = scf.if %c -> tensor { %a1 = tensor.empty(%sz) : tensor %f1 = linalg.fill ins(%cst1 : f32) outs(%a1 : tensor) -> tensor scf.yield %f1 : tensor } else { %a2 = tensor.empty(%sz) : tensor %f2 = linalg.fill ins(%cst2 : f32) outs(%a2 : tensor) -> tensor scf.yield %f2 : tensor } %r1 = tensor.insert_slice %if into %t[42][%sz][1]: tensor into tensor return %r1: tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @regression_do_not_eliminate_non_empty( %t: tensor<10xf32>, %t2: tensor<10xf32>) -> tensor<10xf32> { %1 = tensor.extract_slice %t[0] [5] [1] : tensor<10xf32> to tensor<5xf32> %2 = tensor.insert_slice %1 into %t2[1] [5] [1] : tensor<5xf32> into tensor<10xf32> return %2 : tensor<10xf32> }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @regression_insert_of_bbarg(%t0: tensor<5xf32>, %t1: tensor<10xf32>) -> tensor<10xf32> { %0 = tensor.insert_slice %t0 into %t1 [2] [5] [1] : tensor<5xf32> into tensor<10xf32> return %0 : tensor<10xf32> }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @regression_eliminate_equivalent_only(%sz: index, %p: index, %t0: tensor) -> tensor { %c0 = arith.constant 0 : index %c8 = arith.constant 8 : index %c16 = arith.constant 16 : index %27 = tensor.empty(%sz) : tensor %extracted_slice = tensor.extract_slice %27[0, 0] [%p, 8] [1, 1] : tensor to tensor %28 = scf.for %arg4 = %c0 to %c16 step %c8 iter_args(%arg5 = %t0) -> (tensor) { %inserted_slice = tensor.insert_slice %extracted_slice into %27[0, 0] [%sz, 8] [1, 1] : tensor into tensor %extracted_slice_2 = tensor.extract_slice %arg5[%p, %p] [%sz, 8] [1, 1] : tensor to tensor %32 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%inserted_slice : tensor) outs(%extracted_slice_2 : tensor) { ^bb0(%in: i32, %out: i8): %tr = arith.trunci %in : i32 to i8 linalg.yield %tr : i8 } -> tensor %inserted_slice_3 = tensor.insert_slice %32 into %arg5[%p, %arg4] [%sz, 8] [1, 1] : tensor into tensor scf.yield %inserted_slice_3 : tensor } func.return %28 : tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @buffer_not_deallocated(%t : tensor, %c : i1) -> tensor { %r = scf.if %c -> tensor { %sz = ""test.some_op""() : () -> (index) %0 = bufferization.alloc_tensor(%sz) : tensor scf.yield %0 : tensor } else { scf.yield %t : tensor } return %r : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -buffer-deallocation -canonicalize -split-input-file ",1 "func.func @write_to_alloc_tensor_or_readonly_tensor(%arg0: tensor, %cond: i1, %val: i32) -> tensor { %3 = scf.if %cond -> (tensor) { scf.yield %arg0 : tensor } else { %7 = bufferization.alloc_tensor() : tensor %8 = tensor.insert %val into %7[] : tensor scf.yield %8 : tensor } return %3 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -buffer-deallocation -canonicalize -split-input-file ",1 "func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @condBranchDynamicType( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.br ^bb3(%1 : memref) ^bb3(%2: memref): test.copy(%2, %arg2) : (memref, memref) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @condBranchDynamicTypeNested( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb6(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.cond_br %arg0, ^bb3, ^bb4 ^bb3: cf.br ^bb5(%1 : memref) ^bb4: cf.br ^bb5(%1 : memref) ^bb5(%2: memref): cf.br ^bb6(%2 : memref) ^bb6(%3: memref): cf.br ^bb7(%3 : memref) ^bb7(%4: memref): test.copy(%4, %arg2) : (memref, memref) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): %7 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%7: memref<2xf32>) test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): test.copy(%arg1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @redundantOperations(%arg0: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @moving_alloc_and_inserting_missing_dealloc( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^exit(%0 : memref<2xf32>) ^bb2: %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @moving_invalid_dealloc_op_complex( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: cf.br ^exit(%arg0 : memref<2xf32>) ^bb2: %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) memref.dealloc %1 : memref<2xf32> cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @nested_regions_and_cond_branch( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @nested_region_control_flow( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @nested_region_control_flow_div( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %3 : memref } return %2 : memref }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @nested_region_control_flow_div_nested( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { %3 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %4 = memref.alloc(%arg0, %arg1) : memref scf.yield %4 : memref } scf.yield %3 : memref } else { %5 = memref.alloc(%arg1, %arg1) : memref scf.yield %5 : memref } return %2 : memref }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @nested_region_control_flow_div_nested_dependencies( %arg0: i32, %arg1: i1, %arg2: index) -> memref { %0 = scf.if %arg1 -> (memref) { %1 = arith.constant 1 : i32 %2 = arith.addi %arg0, %1 : i32 %3 = arith.index_cast %2 : i32 to index %4 = memref.alloc(%arg2, %3) : memref scf.yield %4 : memref } else { %1 = arith.constant 2 : i32 %2 = arith.addi %arg0, %1 : i32 %3 = arith.index_cast %2 : i32 to index %4 = memref.alloc(%arg2, %3) : memref scf.yield %4 : memref } return %0 : memref }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @inner_region_control_flow(%arg0 : index) -> memref { %0 = memref.alloc(%arg0, %arg0) : memref %1 = test.region_if %0 : memref -> (memref) then { ^bb0(%arg1 : memref): test.region_if_yield %arg1 : memref } else { ^bb0(%arg1 : memref): test.region_if_yield %arg1 : memref } join { ^bb0(%arg1 : memref): test.region_if_yield %arg1 : memref } return %1 : memref }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @inner_region_control_flow_div( %arg0 : index, %arg1 : index) -> memref { %0 = memref.alloc(%arg0, %arg0) : memref %1 = test.region_if %0 : memref -> (memref) then { ^bb0(%arg2 : memref): test.region_if_yield %arg2 : memref } else { ^bb0(%arg2 : memref): %2 = memref.alloc(%arg0, %arg1) : memref test.region_if_yield %2 : memref } join { ^bb0(%arg2 : memref): test.region_if_yield %arg2 : memref } return %1 : memref }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloca() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @ifElseNestedAlloca( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloca() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @nestedRegionsAndCondBranchAlloca( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloca() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @loop_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @loop_nested_if_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>) -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { %4 = memref.alloc() : memref<2xf32> scf.yield %4 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } scf.yield %3 : memref<2xf32> } return %1 : memref<2xf32> }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @loop_nested_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> { %3 = scf.for %i3 = %lb to %ub step %step iter_args(%iterBuf3 = %iterBuf2) -> memref<2xf32> { %4 = memref.alloc() : memref<2xf32> %5 = arith.cmpi eq, %i, %ub : index %6 = scf.if %5 -> (memref<2xf32>) { %7 = memref.alloc() : memref<2xf32> scf.yield %7 : memref<2xf32> } else { scf.yield %iterBuf3 : memref<2xf32> } scf.yield %6 : memref<2xf32> } scf.yield %3 : memref<2xf32> } scf.yield %2 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @loop_nested_alloc_dyn_dependency( %lb: index, %ub: index, %step: index, %arg0: index, %buf: memref, %res: memref) { %0 = memref.alloc(%arg0) : memref %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref { %3 = scf.for %i3 = %lb to %ub step %step iter_args(%iterBuf3 = %iterBuf2) -> memref { %5 = arith.cmpi eq, %i, %ub : index %6 = scf.if %5 -> (memref) { %7 = memref.alloc(%i3) : memref scf.yield %7 : memref } else { scf.yield %iterBuf3 : memref } scf.yield %6 : memref } scf.yield %3 : memref } scf.yield %0 : memref } test.copy(%1, %res) : (memref, memref) return }", mlir-opt -buffer-hoisting -split-input-file ,1 "func.func @buffer_forwarding_conflict(%arg0: tensor {bufferization.writable = true}, %arg1: index) -> (tensor, tensor) { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty(%arg1) : tensor %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor) -> tensor %2 = tensor.insert_slice %1 into %arg0[0] [%arg1] [1] : tensor into tensor %3 = tensor.insert_slice %1 into %arg0[42] [%arg1] [1] : tensor into tensor return %2, %3 : tensor, tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @buffer_forwarding_no_conflict(%arg0: tensor {bufferization.writable = true}, %arg1: index) -> (tensor, tensor) { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty(%arg1) : tensor %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor) -> tensor %2 = tensor.insert_slice %1 into %arg0[42] [%arg1] [1] : tensor into tensor return %2, %2 : tensor, tensor }"," mlir-opt -eliminate-empty-tensors -empty-tensor-to-alloc-tensor -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @use_of_unknown_op_1(%t1: tensor) -> vector<5xf32> { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @use_of_unknown_op_1(%t1: tensor) -> vector<5xf32> { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @use_of_unknown_op_1(%t1: tensor) -> vector<5xf32> { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_1(%t1: tensor) -> vector<5xf32> { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_2(%t1: tensor) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @use_of_unknown_op_2(%t1: tensor) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @use_of_unknown_op_2(%t1: tensor) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_2(%t1: tensor) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_3(%t1: tensor) -> (vector<5xf32>, vector<5xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %2 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1, %2 : vector<5xf32>, vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @use_of_unknown_op_3(%t1: tensor) -> (vector<5xf32>, vector<5xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %2 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1, %2 : vector<5xf32>, vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @use_of_unknown_op_3(%t1: tensor) -> (vector<5xf32>, vector<5xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %2 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1, %2 : vector<5xf32>, vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_3(%t1: tensor) -> (vector<5xf32>, vector<5xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %2 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> return %1, %2 : vector<5xf32>, vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_4(%t1: tensor) -> (vector<5xf32>, tensor) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> %2 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1, %2 : vector<5xf32>, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @use_of_unknown_op_4(%t1: tensor) -> (vector<5xf32>, tensor) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> %2 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1, %2 : vector<5xf32>, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @use_of_unknown_op_4(%t1: tensor) -> (vector<5xf32>, tensor) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> %2 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1, %2 : vector<5xf32>, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_unknown_op_4(%t1: tensor) -> (vector<5xf32>, tensor) { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0 = ""test.dummy_op""(%t1) : (tensor) -> tensor %1 = vector.transfer_read %0[%idx], %cst : tensor, vector<5xf32> %2 = ""test.another_dummy_op""(%0) : (tensor) -> tensor return %1, %2 : vector<5xf32>, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_bufferizable_op_in_unbufferizable_op( %t1: tensor, %o: index, %s: index) -> (tensor, tensor) { %0 = tensor.extract_slice %t1[%o][%s][1] : tensor to tensor %1 = ""test.dummy_op""(%0) : (tensor) -> tensor return %0, %1 : tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @use_of_bufferizable_op_in_unbufferizable_op( %t1: tensor, %o: index, %s: index) -> (tensor, tensor) { %0 = tensor.extract_slice %t1[%o][%s][1] : tensor to tensor %1 = ""test.dummy_op""(%0) : (tensor) -> tensor return %0, %1 : tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @use_of_bufferizable_op_in_unbufferizable_op( %t1: tensor, %o: index, %s: index) -> (tensor, tensor) { %0 = tensor.extract_slice %t1[%o][%s][1] : tensor to tensor %1 = ""test.dummy_op""(%0) : (tensor) -> tensor return %0, %1 : tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @use_of_bufferizable_op_in_unbufferizable_op( %t1: tensor, %o: index, %s: index) -> (tensor, tensor) { %0 = tensor.extract_slice %t1[%o][%s][1] : tensor to tensor %1 = ""test.dummy_op""(%0) : (tensor) -> tensor return %0, %1 : tensor, tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @unused_unknown_op(%t1 : tensor) -> vector<5xf32> { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> ""test.dummy_op""(%t1) : (tensor) -> () return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @unused_unknown_op(%t1 : tensor) -> vector<5xf32> { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> ""test.dummy_op""(%t1) : (tensor) -> () return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @unused_unknown_op(%t1 : tensor) -> vector<5xf32> { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> ""test.dummy_op""(%t1) : (tensor) -> () return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @unused_unknown_op(%t1 : tensor) -> vector<5xf32> { %idx = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %1 = vector.transfer_read %t1[%idx], %cst : tensor, vector<5xf32> ""test.dummy_op""(%t1) : (tensor) -> () return %1 : vector<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @unknown_op_may_read(%v: vector<5xf32>) -> (tensor<10xf32>, tensor<10xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 5.0 : f32 %t1 = bufferization.alloc_tensor() : tensor<10xf32> %filled = linalg.fill ins(%cst : f32) outs(%t1 : tensor<10xf32>) -> tensor<10xf32> %1 = vector.transfer_write %v, %filled[%idx] : vector<5xf32>, tensor<10xf32> %2 = ""test.dummy_op""(%filled) : (tensor<10xf32>) -> (tensor<10xf32>) return %1, %2 : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @unknown_op_may_read(%v: vector<5xf32>) -> (tensor<10xf32>, tensor<10xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 5.0 : f32 %t1 = bufferization.alloc_tensor() : tensor<10xf32> %filled = linalg.fill ins(%cst : f32) outs(%t1 : tensor<10xf32>) -> tensor<10xf32> %1 = vector.transfer_write %v, %filled[%idx] : vector<5xf32>, tensor<10xf32> %2 = ""test.dummy_op""(%filled) : (tensor<10xf32>) -> (tensor<10xf32>) return %1, %2 : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @unknown_op_may_read(%v: vector<5xf32>) -> (tensor<10xf32>, tensor<10xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 5.0 : f32 %t1 = bufferization.alloc_tensor() : tensor<10xf32> %filled = linalg.fill ins(%cst : f32) outs(%t1 : tensor<10xf32>) -> tensor<10xf32> %1 = vector.transfer_write %v, %filled[%idx] : vector<5xf32>, tensor<10xf32> %2 = ""test.dummy_op""(%filled) : (tensor<10xf32>) -> (tensor<10xf32>) return %1, %2 : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @unknown_op_may_read(%v: vector<5xf32>) -> (tensor<10xf32>, tensor<10xf32>) { %idx = arith.constant 0 : index %cst = arith.constant 5.0 : f32 %t1 = bufferization.alloc_tensor() : tensor<10xf32> %filled = linalg.fill ins(%cst : f32) outs(%t1 : tensor<10xf32>) -> tensor<10xf32> %1 = vector.transfer_write %v, %filled[%idx] : vector<5xf32>, tensor<10xf32> %2 = ""test.dummy_op""(%filled) : (tensor<10xf32>) -> (tensor<10xf32>) return %1, %2 : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @unknown_op_not_writable( %t1 : tensor, %v : vector<5xf32>, %idx : index) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> (tensor) %1 = vector.transfer_write %v, %0[%idx] : vector<5xf32>, tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @unknown_op_not_writable( %t1 : tensor, %v : vector<5xf32>, %idx : index) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> (tensor) %1 = vector.transfer_write %v, %0[%idx] : vector<5xf32>, tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @unknown_op_not_writable( %t1 : tensor, %v : vector<5xf32>, %idx : index) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> (tensor) %1 = vector.transfer_write %v, %0[%idx] : vector<5xf32>, tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @unknown_op_not_writable( %t1 : tensor, %v : vector<5xf32>, %idx : index) -> tensor { %0 = ""test.dummy_op""(%t1) : (tensor) -> (tensor) %1 = vector.transfer_write %v, %0[%idx] : vector<5xf32>, tensor return %1 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @simple_tensor_test(%t1 : tensor, %f : f32) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t1[%c0] : tensor return %0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @simple_tensor_test(%t1 : tensor, %f : f32) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t1[%c0] : tensor return %0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @simple_tensor_test(%t1 : tensor, %f : f32) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t1[%c0] : tensor return %0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @simple_tensor_test(%t1 : tensor, %f : f32) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t1[%c0] : tensor return %0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @simple_scf_if(%t1: tensor {bufferization.writable = true}, %c: i1, %pos: index, %f: f32) -> (tensor, index) { %r1, %r2 = scf.if %c -> (tensor, index) { scf.yield %t1, %pos : tensor, index } else { %1 = tensor.insert %f into %t1[%pos] : tensor scf.yield %1, %pos : tensor, index } return %r1, %r2 : tensor, index }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops"" -split-input-file ",1 "func.func @simple_scf_if(%t1: tensor {bufferization.writable = true}, %c: i1, %pos: index, %f: f32) -> (tensor, index) { %r1, %r2 = scf.if %c -> (tensor, index) { scf.yield %t1, %pos : tensor, index } else { %1 = tensor.insert %f into %t1[%pos] : tensor scf.yield %1, %pos : tensor, index } return %r1, %r2 : tensor, index }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs allow-unknown-ops unknown-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @simple_scf_if(%t1: tensor {bufferization.writable = true}, %c: i1, %pos: index, %f: f32) -> (tensor, index) { %r1, %r2 = scf.if %c -> (tensor, index) { scf.yield %t1, %pos : tensor, index } else { %1 = tensor.insert %f into %t1[%pos] : tensor scf.yield %1, %pos : tensor, index } return %r1, %r2 : tensor, index }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // RUN: mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=tensor,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @simple_scf_if(%t1: tensor {bufferization.writable = true}, %c: i1, %pos: index, %f: f32) -> (tensor, index) { %r1, %r2 = scf.if %c -> (tensor, index) { scf.yield %t1, %pos : tensor, index } else { %1 = tensor.insert %f into %t1[%pos] : tensor scf.yield %1, %pos : tensor, index } return %r1, %r2 : tensor, index }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""dialect-filter=scf,bufferization allow-unknown-ops allow-return-allocs"" -canonicalize -split-input-file ",1 "func.func @read_after_write_conflict(%t: tensor, %idx: index, %f: f32) -> (tensor, tensor) { %0 = tensor.insert %f into %t[%idx] : tensor return %0, %t : tensor, tensor }", mlir-opt -test-tensor-copy-insertion -split-input-file ,1 "func.func @read_after_write_conflict(%t: tensor, %idx: index, %f: f32) -> (tensor, tensor) { %0 = tensor.insert %f into %t[%idx] : tensor return %0, %t : tensor, tensor }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @read_after_write_conflict(%t: tensor, %idx: index, %f: f32) -> (tensor, tensor) { %0 = tensor.insert %f into %t[%idx] : tensor return %0, %t : tensor, tensor }"," mlir-opt -test-tensor-copy-insertion=""create-deallocs=0"" -split-input-file ",1 "func.func @return_alloc_tensor() -> (tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> return %0 : tensor<5xf32> }", mlir-opt -test-tensor-copy-insertion -split-input-file ,1 "func.func @return_alloc_tensor() -> (tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @return_alloc_tensor() -> (tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -test-tensor-copy-insertion=""create-deallocs=0"" -split-input-file ",1 "func.func @do_not_copy_undefined_tensor(%f: f32, %idx: index) -> (tensor<5xf32>, tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> %1 = tensor.insert %f into %0[%idx] : tensor<5xf32> return %0, %1 : tensor<5xf32>, tensor<5xf32> }", mlir-opt -test-tensor-copy-insertion -split-input-file ,1 "func.func @do_not_copy_undefined_tensor(%f: f32, %idx: index) -> (tensor<5xf32>, tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> %1 = tensor.insert %f into %0[%idx] : tensor<5xf32> return %0, %1 : tensor<5xf32>, tensor<5xf32> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @do_not_copy_undefined_tensor(%f: f32, %idx: index) -> (tensor<5xf32>, tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> %1 = tensor.insert %f into %0[%idx] : tensor<5xf32> return %0, %1 : tensor<5xf32>, tensor<5xf32> }"," mlir-opt -test-tensor-copy-insertion=""create-deallocs=0"" -split-input-file ",1 "func.func @do_not_copy_when_overwritten(%t: tensor<5xf32>, %f: f32) -> (tensor<5xf32>, tensor<5xf32>) { %r = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%t : tensor<5xf32>) { ^bb0(%arg0 : f32) : linalg.yield %f : f32 } -> tensor<5xf32> return %t, %r : tensor<5xf32>, tensor<5xf32> }", mlir-opt -test-tensor-copy-insertion -split-input-file ,1 "func.func @do_not_copy_when_overwritten(%t: tensor<5xf32>, %f: f32) -> (tensor<5xf32>, tensor<5xf32>) { %r = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%t : tensor<5xf32>) { ^bb0(%arg0 : f32) : linalg.yield %f : f32 } -> tensor<5xf32> return %t, %r : tensor<5xf32>, tensor<5xf32> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @do_not_copy_when_overwritten(%t: tensor<5xf32>, %f: f32) -> (tensor<5xf32>, tensor<5xf32>) { %r = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%t : tensor<5xf32>) { ^bb0(%arg0 : f32) : linalg.yield %f : f32 } -> tensor<5xf32> return %t, %r : tensor<5xf32>, tensor<5xf32> }"," mlir-opt -test-tensor-copy-insertion=""create-deallocs=0"" -split-input-file ",1 "func.func @do_not_copy_when_result_not_read(%t: tensor<5xf32>, %f: f32) -> (tensor<3xf32>) { %0 = tensor.extract_slice %t[0][3][1] : tensor<5xf32> to tensor<3xf32> %r = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%0 : tensor<3xf32>) { ^bb0(%arg0 : f32) : linalg.yield %f : f32 } -> tensor<3xf32> return %r : tensor<3xf32> }", mlir-opt -test-tensor-copy-insertion -split-input-file ,1 "func.func @do_not_copy_when_result_not_read(%t: tensor<5xf32>, %f: f32) -> (tensor<3xf32>) { %0 = tensor.extract_slice %t[0][3][1] : tensor<5xf32> to tensor<3xf32> %r = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%0 : tensor<3xf32>) { ^bb0(%arg0 : f32) : linalg.yield %f : f32 } -> tensor<3xf32> return %r : tensor<3xf32> }"," mlir-opt -test-tensor-copy-insertion=""bufferize-function-boundaries allow-return-allocs"" -split-input-file ",1 "func.func @do_not_copy_when_result_not_read(%t: tensor<5xf32>, %f: f32) -> (tensor<3xf32>) { %0 = tensor.extract_slice %t[0][3][1] : tensor<5xf32> to tensor<3xf32> %r = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%0 : tensor<3xf32>) { ^bb0(%arg0 : f32) : linalg.yield %f : f32 } -> tensor<3xf32> return %r : tensor<3xf32> }"," mlir-opt -test-tensor-copy-insertion=""create-deallocs=0"" -split-input-file ",1 "func.func @eliminate_materializations(%arg0: memref) -> memref { %0 = bufferization.to_tensor %arg0 : memref %1 = bufferization.to_memref %0 : memref return %1 : memref }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @unable_to_convert_lone_buffer_cast() -> memref { %0 = ""test.source""() : () -> tensor %1 = bufferization.to_memref %0 : memref return %1 : memref }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @unable_to_convert_lone_tensor_load(%arg0: memref) { %0 = bufferization.to_tensor %arg0 : memref ""test.sink""(%0) : (tensor) -> () return }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @dyn_layout_to_no_layout_cast(%m: memref>) -> memref { %0 = bufferization.to_tensor %m : memref> %1 = bufferization.to_memref %0 : memref return %1 : memref }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @fancy_layout_to_no_layout_cast(%m: memref>) -> memref { %0 = bufferization.to_tensor %m : memref> %1 = bufferization.to_memref %0 : memref return %1 : memref }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @static_layout_to_no_layout_cast(%m: memref>) -> memref { %0 = bufferization.to_tensor %m : memref> %1 = bufferization.to_memref %0 : memref return %1 : memref }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @no_layout_to_dyn_layout_cast(%m: memref) -> memref> { %0 = bufferization.to_tensor %m : memref %1 = bufferization.to_memref %0 : memref> return %1 : memref> }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @illegal_unranked_to_rank(%m: memref<*xf32>) -> memref { %0 = bufferization.to_tensor %m : memref<*xf32> %1 = bufferization.to_memref %0 : memref return %1 : memref }", mlir-opt -finalizing-bufferize -split-input-file -verify-diagnostics ,1 "func.func @callee(%t: tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 8.0 : f32 %1 = tensor.insert %cst into %t[%c0] : tensor<5xf32> return %t, %1 : tensor<5xf32>, tensor<5xf32> } func.func @main(%t: tensor<5xf32>) -> (f32, f32) { %c0 = arith.constant 0 : index %0, %1 = func.call @callee(%t) : (tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) %2 = tensor.extract %0[%c0] : tensor<5xf32> %3 = tensor.extract %1[%c0] : tensor<5xf32> return %2, %3 : f32, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -drop-equivalent-buffer-results -buffer-results-to-out-params -buffer-deallocation -split-input-file ",1 "func.func @callee(%t: tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 8.0 : f32 %1 = tensor.insert %cst into %t[%c0] : tensor<5xf32> return %t, %1 : tensor<5xf32>, tensor<5xf32> } func.func @main(%t: tensor<5xf32>) -> (f32, f32) { %c0 = arith.constant 0 : index %0, %1 = func.call @callee(%t) : (tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) %2 = tensor.extract %0[%c0] : tensor<5xf32> %3 = tensor.extract %1[%c0] : tensor<5xf32> return %2, %3 : f32, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=identity-layout-map"" -drop-equivalent-buffer-results -buffer-results-to-out-params -buffer-deallocation -split-input-file ",1 "func.func @callee(%t: tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 8.0 : f32 %1 = tensor.insert %cst into %t[%c0] : tensor<5xf32> return %t, %1 : tensor<5xf32>, tensor<5xf32> } func.func @main(%t: tensor<5xf32>) -> (f32, f32) { %c0 = arith.constant 0 : index %0, %1 = func.call @callee(%t) : (tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) %2 = tensor.extract %0[%c0] : tensor<5xf32> %3 = tensor.extract %1[%c0] : tensor<5xf32> return %2, %3 : f32, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=infer-layout-map"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @callee(%idx: index) -> tensor<2x5xf32> { %0 = bufferization.alloc_tensor() : tensor<10x20xf32> %1 = tensor.extract_slice %0[%idx, %idx][2, 5][1, 1] : tensor<10x20xf32> to tensor<2x5xf32> return %1 : tensor<2x5xf32> } func.func @main(%idx: index) -> f32 { %c0 = arith.constant 0 : index %0 = func.call @callee(%idx) : (index) -> (tensor<2x5xf32>) %1 = tensor.extract %0[%c0, %c0] : tensor<2x5xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -drop-equivalent-buffer-results -buffer-results-to-out-params -buffer-deallocation -split-input-file ",1 "func.func @callee(%idx: index) -> tensor<2x5xf32> { %0 = bufferization.alloc_tensor() : tensor<10x20xf32> %1 = tensor.extract_slice %0[%idx, %idx][2, 5][1, 1] : tensor<10x20xf32> to tensor<2x5xf32> return %1 : tensor<2x5xf32> } func.func @main(%idx: index) -> f32 { %c0 = arith.constant 0 : index %0 = func.call @callee(%idx) : (index) -> (tensor<2x5xf32>) %1 = tensor.extract %0[%c0, %c0] : tensor<2x5xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=identity-layout-map"" -drop-equivalent-buffer-results -buffer-results-to-out-params -buffer-deallocation -split-input-file ",1 "func.func @callee(%idx: index) -> tensor<2x5xf32> { %0 = bufferization.alloc_tensor() : tensor<10x20xf32> %1 = tensor.extract_slice %0[%idx, %idx][2, 5][1, 1] : tensor<10x20xf32> to tensor<2x5xf32> return %1 : tensor<2x5xf32> } func.func @main(%idx: index) -> f32 { %c0 = arith.constant 0 : index %0 = func.call @callee(%idx) : (index) -> (tensor<2x5xf32>) %1 = tensor.extract %0[%c0, %c0] : tensor<2x5xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries allow-return-allocs function-boundary-type-conversion=infer-layout-map"" -drop-equivalent-buffer-results -buffer-deallocation -split-input-file ",1 "func.func @read_after_write_conflict(%cst : f32, %idx : index, %idx2 : index) -> (f32, f32) { %t = ""test.dummy_op""() : () -> (tensor<10xf32>) %write = tensor.insert %cst into %t[%idx2] : tensor<10xf32> %read = ""test.some_use""(%t) : (tensor<10xf32>) -> (f32) %read2 = tensor.extract %write[%idx] : tensor<10xf32> return %read, %read2 : f32, f32 }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -mlir-pass-statistics 2>&1 ",1 "func.func @create_tensor() -> tensor<10xf32> { %0 = bufferization.alloc_tensor() : tensor<10xf32> return %0 : tensor<10xf32> } func.func @caller(%idx: index) -> f32 { %0 = call @create_tensor() : () -> (tensor<10xf32>) %1 = tensor.extract %0[%idx] : tensor<10xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @create_tensor() -> tensor<10xf32> { %0 = bufferization.alloc_tensor() : tensor<10xf32> return %0 : tensor<10xf32> } func.func @caller(%idx: index) -> f32 { %0 = call @create_tensor() : () -> (tensor<10xf32>) %1 = tensor.extract %0[%idx] : tensor<10xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -split-input-file ",1 "func.func @return_slice(%t: tensor, %sz: index) -> (tensor) { %0 = tensor.extract_slice %t[4][%sz][1] : tensor to tensor return %0 : tensor } func.func @main(%t: tensor, %sz: index, %idx: index) -> (f32, f32) { %cst = arith.constant 1.0 : f32 %0 = call @return_slice(%t, %sz) : (tensor, index) -> (tensor) %filled = linalg.fill ins(%cst : f32) outs(%t : tensor) -> tensor %r1 = tensor.extract %0[%idx] : tensor %r2 = tensor.extract %filled[%idx] : tensor return %r1, %r2 : f32, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @return_slice(%t: tensor, %sz: index) -> (tensor) { %0 = tensor.extract_slice %t[4][%sz][1] : tensor to tensor return %0 : tensor } func.func @main(%t: tensor, %sz: index, %idx: index) -> (f32, f32) { %cst = arith.constant 1.0 : f32 %0 = call @return_slice(%t, %sz) : (tensor, index) -> (tensor) %filled = linalg.fill ins(%cst : f32) outs(%t : tensor) -> tensor %r1 = tensor.extract %0[%idx] : tensor %r2 = tensor.extract %filled[%idx] : tensor return %r1, %r2 : f32, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -split-input-file ",1 "func.func @return_arg(%A: tensor) -> tensor { func.return %A : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @return_arg(%A: tensor) -> tensor { func.return %A : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -split-input-file ",1 "func.func @no_conflict(%fill: f32, %f: f32, %idx: index) -> tensor<3xf32> { %t = tensor.from_elements %fill, %fill, %fill : tensor<3xf32> %i = tensor.insert %f into %t[%idx] : tensor<3xf32> return %i : tensor<3xf32> }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @no_conflict(%fill: f32, %f: f32, %idx: index) -> tensor<3xf32> { %t = tensor.from_elements %fill, %fill, %fill : tensor<3xf32> %i = tensor.insert %f into %t[%idx] : tensor<3xf32> return %i : tensor<3xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @no_conflict(%fill: f32, %f: f32, %idx: index) -> tensor<3xf32> { %t = tensor.from_elements %fill, %fill, %fill : tensor<3xf32> %i = tensor.insert %f into %t[%idx] : tensor<3xf32> return %i : tensor<3xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @use_tensor_func_arg(%A : tensor) -> (vector<4xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0], %f0 : tensor, vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @use_tensor_func_arg(%A : tensor) -> (vector<4xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0], %f0 : tensor, vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @use_tensor_func_arg(%A : tensor) -> (vector<4xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0], %f0 : tensor, vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @return_tensor(%A : tensor, %v : vector<4xf32>) -> (tensor) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%c0] : vector<4xf32>, tensor return %0 : tensor }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @return_tensor(%A : tensor, %v : vector<4xf32>) -> (tensor) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%c0] : vector<4xf32>, tensor return %0 : tensor }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @return_tensor(%A : tensor, %v : vector<4xf32>) -> (tensor) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%c0] : vector<4xf32>, tensor return %0 : tensor }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @func_without_tensor_args(%v : vector<10xf32>) -> () { %0 = bufferization.alloc_tensor() : tensor<10xf32> %c0 = arith.constant 0 : index %1 = vector.transfer_write %v, %0[%c0] : vector<10xf32>, tensor<10xf32> %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<11xf32> vector.print %r : vector<11xf32> return }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @func_without_tensor_args(%v : vector<10xf32>) -> () { %0 = bufferization.alloc_tensor() : tensor<10xf32> %c0 = arith.constant 0 : index %1 = vector.transfer_write %v, %0[%c0] : vector<10xf32>, tensor<10xf32> %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<11xf32> vector.print %r : vector<11xf32> return }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @func_without_tensor_args(%v : vector<10xf32>) -> () { %0 = bufferization.alloc_tensor() : tensor<10xf32> %c0 = arith.constant 0 : index %1 = vector.transfer_write %v, %0[%c0] : vector<10xf32>, tensor<10xf32> %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<11xf32> vector.print %r : vector<11xf32> return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func private @private_func(tensor) -> () func.func @empty_func() -> () { return }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func private @private_func(tensor) -> () func.func @empty_func() -> () { return }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func private @private_func(tensor) -> () func.func @empty_func() -> () { return }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @read_after_write_conflict(%cst : f32, %idx : index, %idx2 : index) -> (f32, f32) { %t = ""test.dummy_op""() : () -> (tensor<10xf32>) %write = tensor.insert %cst into %t[%idx2] : tensor<10xf32> %read = ""test.some_use""(%t) : (tensor<10xf32>) -> (f32) %read2 = tensor.extract %write[%idx] : tensor<10xf32> return %read, %read2 : f32, f32 }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @read_after_write_conflict(%cst : f32, %idx : index, %idx2 : index) -> (f32, f32) { %t = ""test.dummy_op""() : () -> (tensor<10xf32>) %write = tensor.insert %cst into %t[%idx2] : tensor<10xf32> %read = ""test.some_use""(%t) : (tensor<10xf32>) -> (f32) %read2 = tensor.extract %write[%idx] : tensor<10xf32> return %read, %read2 : f32, f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @read_after_write_conflict(%cst : f32, %idx : index, %idx2 : index) -> (f32, f32) { %t = ""test.dummy_op""() : () -> (tensor<10xf32>) %write = tensor.insert %cst into %t[%idx2] : tensor<10xf32> %read = ""test.some_use""(%t) : (tensor<10xf32>) -> (f32) %read2 = tensor.extract %write[%idx] : tensor<10xf32> return %read, %read2 : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @copy_deallocated() -> tensor<10xf32> { %0 = bufferization.alloc_tensor() : tensor<10xf32> return %0 : tensor<10xf32> }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @copy_deallocated() -> tensor<10xf32> { %0 = bufferization.alloc_tensor() : tensor<10xf32> return %0 : tensor<10xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @copy_deallocated() -> tensor<10xf32> { %0 = bufferization.alloc_tensor() : tensor<10xf32> return %0 : tensor<10xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @select_different_tensors(%t: tensor, %sz: index, %pos: index, %c: i1) -> f32 { %0 = bufferization.alloc_tensor(%sz) : tensor %1 = arith.select %c, %0, %t : tensor %2 = tensor.extract %1[%pos] : tensor return %2 : f32 }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @select_different_tensors(%t: tensor, %sz: index, %pos: index, %c: i1) -> f32 { %0 = bufferization.alloc_tensor(%sz) : tensor %1 = arith.select %c, %0, %t : tensor %2 = tensor.extract %1[%pos] : tensor return %2 : f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @select_different_tensors(%t: tensor, %sz: index, %pos: index, %c: i1) -> f32 { %0 = bufferization.alloc_tensor(%sz) : tensor %1 = arith.select %c, %0, %t : tensor %2 = tensor.extract %1[%pos] : tensor return %2 : f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @alloc_tensor_with_copy(%t: tensor<5xf32>) -> tensor<5xf32> { %0 = bufferization.alloc_tensor() copy(%t) : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @alloc_tensor_with_copy(%t: tensor<5xf32>) -> tensor<5xf32> { %0 = bufferization.alloc_tensor() copy(%t) : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @alloc_tensor_with_copy(%t: tensor<5xf32>) -> tensor<5xf32> { %0 = bufferization.alloc_tensor() copy(%t) : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @alloc_tensor_with_memory_space() -> tensor<5xf32> { %0 = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @alloc_tensor_with_memory_space() -> tensor<5xf32> { %0 = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @alloc_tensor_with_memory_space() -> tensor<5xf32> { %0 = bufferization.alloc_tensor() {memory_space = 1 : i64} : tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @read_of_alias(%t: tensor<100xf32>, %pos1: index, %pos2: index, %pos3: index, %pos4: index, %sz: index, %f: f32) -> (f32, f32) { %0 = tensor.insert %f into %t[%pos1] : tensor<100xf32> %1 = tensor.extract_slice %t[%pos2][%sz][1] : tensor<100xf32> to tensor %2 = tensor.extract %1[%pos3] : tensor %3 = tensor.extract %0[%pos3] : tensor<100xf32> return %2, %3 : f32, f32 }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @read_of_alias(%t: tensor<100xf32>, %pos1: index, %pos2: index, %pos3: index, %pos4: index, %sz: index, %f: f32) -> (f32, f32) { %0 = tensor.insert %f into %t[%pos1] : tensor<100xf32> %1 = tensor.extract_slice %t[%pos2][%sz][1] : tensor<100xf32> to tensor %2 = tensor.extract %1[%pos3] : tensor %3 = tensor.extract %0[%pos3] : tensor<100xf32> return %2, %3 : f32, f32 }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @read_of_alias(%t: tensor<100xf32>, %pos1: index, %pos2: index, %pos3: index, %pos4: index, %sz: index, %f: f32) -> (f32, f32) { %0 = tensor.insert %f into %t[%pos1] : tensor<100xf32> %1 = tensor.extract_slice %t[%pos2][%sz][1] : tensor<100xf32> to tensor %2 = tensor.extract %1[%pos3] : tensor %3 = tensor.extract %0[%pos3] : tensor<100xf32> return %2, %3 : f32, f32 }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "func.func @from_unranked_to_unranked(%arg0: tensor<*xi32>) -> tensor<*xi32> { %0 = tensor.cast %arg0 : tensor<*xi32> to tensor<*xi32> return %0 : tensor<*xi32> }"," mlir-opt -one-shot-bufferize=""allow-unknown-ops"" -split-input-file ",1 "func.func @from_unranked_to_unranked(%arg0: tensor<*xi32>) -> tensor<*xi32> { %0 = tensor.cast %arg0 : tensor<*xi32> to tensor<*xi32> return %0 : tensor<*xi32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Run with top-down analysis. // RUN: mlir-opt -one-shot-bufferize=""allow-unknown-ops analysis-heuristic=top-down"" -split-input-file ",1 "func.func @from_unranked_to_unranked(%arg0: tensor<*xi32>) -> tensor<*xi32> { %0 = tensor.cast %arg0 : tensor<*xi32> to tensor<*xi32> return %0 : tensor<*xi32> }"," mlir-opt -allow-unregistered-dialect -one-shot-bufferize=""allow-unknown-ops copy-before-write"" -split-input-file ",1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.bufferization.one_shot_bufferize %0 : (!transform.any_op) -> !transform.any_op } func.func @test_function(%A : tensor, %v : vector<4xf32>) -> (tensor) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%c0] : vector<4xf32>, tensor return %0 : tensor }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.bufferization.one_shot_bufferize %0 {test_analysis_only = true} : (!transform.any_op) -> !transform.any_op } func.func @test_function_analysis(%A : tensor, %v : vector<4xf32>) -> (tensor) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%c0] : vector<4xf32>, tensor return %0 : tensor }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.bufferization.one_shot_bufferize %0 : (!transform.any_op) -> !transform.any_op } func.func @test_unknown_op_failure() -> (tensor) { %0 = ""test.dummy_op""() : () -> (tensor) return %0 : tensor }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.bufferization.one_shot_bufferize %arg1 : (!transform.any_op) -> !transform.any_op } module { func.func @test_function(%A : tensor, %v : vector<4xf32>) -> (tensor) { %c0 = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%c0] : vector<4xf32>, tensor return %0 : tensor } }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.bufferization.one_shot_bufferize layout{IdentityLayoutMap} %arg1 { bufferize_function_boundaries = true } : (!transform.any_op) -> !transform.any_op } func.func @matmul(%A: tensor<12x9xf32>, %B: tensor<9x6xf32>, %C: tensor<12x6xf32>) -> tensor<12x6xf32> { %D = linalg.matmul ins(%A, %B: tensor<12x9xf32>, tensor<9x6xf32>) outs(%C: tensor<12x6xf32>) -> tensor<12x6xf32> return %D : tensor<12x6xf32> }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.empty""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.cast %0 : !transform.any_op to !transform.op<""tensor.empty""> transform.bufferization.empty_tensor_to_alloc_tensor %1 : (!transform.op<""tensor.empty"">) -> !transform.op<""bufferization.alloc_tensor""> } func.func @empty_to_tensor_alloc() -> tensor<2x2xf32> { %0 = tensor.empty() : tensor<2x2xf32> return %0 : tensor<2x2xf32> }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.bufferization.eliminate_empty_tensors %0 : !transform.any_op } func.func @empty_tensor_elimination( %t: tensor<10xf32>, %f: f32) -> tensor<10xf32> { %0 = tensor.empty() : tensor<5xf32> %1 = linalg.fill ins(%f : f32) outs(%0 : tensor<5xf32>) -> tensor<5xf32> %2 = tensor.insert_slice %1 into %t [1][5][1] : tensor<5xf32> into tensor<10xf32> return %2 : tensor<10xf32> }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func private @private_func(tensor) -> () func.func private @private_func_2d(tensor) -> () func.func @empty_func() -> () { return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @private_func(tensor) -> () func.func private @private_func_2d(tensor) -> () func.func @empty_func() -> () { return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @private_func(tensor) -> () func.func private @private_func_2d(tensor) -> () func.func @empty_func() -> () { return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 func.func private @external_func_with_return_val(tensor<4xi32>) -> f32," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 func.func private @external_func_with_return_val(tensor<4xi32>) -> f32," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 func.func private @external_func_with_return_val(tensor<4xi32>) -> f32," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @return_extract_slice(%idx: index, %sz: index) -> (tensor<2x?xf32>) { %t = bufferization.alloc_tensor() : tensor<20x10xf32> %0 = tensor.extract_slice %t[%idx, %idx][2, %sz][1, 1] : tensor<20x10xf32> to tensor<2x?xf32> return %0 : tensor<2x?xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @return_extract_slice(%idx: index, %sz: index) -> (tensor<2x?xf32>) { %t = bufferization.alloc_tensor() : tensor<20x10xf32> %0 = tensor.extract_slice %t[%idx, %idx][2, %sz][1, 1] : tensor<20x10xf32> to tensor<2x?xf32> return %0 : tensor<2x?xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @return_extract_slice(%idx: index, %sz: index) -> (tensor<2x?xf32>) { %t = bufferization.alloc_tensor() : tensor<20x10xf32> %0 = tensor.extract_slice %t[%idx, %idx][2, %sz][1, 1] : tensor<20x10xf32> to tensor<2x?xf32> return %0 : tensor<2x?xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @private_func(tensor) -> (f32) func.func @main(%t: tensor {bufferization.writable = true}) -> (f32) { %0 = call @private_func(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @private_func(tensor) -> (f32) func.func @main(%t: tensor {bufferization.writable = true}) -> (f32) { %0 = call @private_func(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @private_func(tensor) -> (f32) func.func @main(%t: tensor {bufferization.writable = true}) -> (f32) { %0 = call @private_func(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @private_func(tensor) -> (f32) func.func @main(%t: tensor {bufferization.writable = false}) -> (f32) { %0 = call @private_func(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @private_func(tensor) -> (f32) func.func @main(%t: tensor {bufferization.writable = false}) -> (f32) { %0 = call @private_func(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @private_func(tensor) -> (f32) func.func @main(%t: tensor {bufferization.writable = false}) -> (f32) { %0 = call @private_func(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @func_without_tensor_args(%v : vector<10xf32>) -> () { %0 = bufferization.alloc_tensor() : tensor<10xf32> %c0 = arith.constant 0 : index %1 = vector.transfer_write %v, %0[%c0] : vector<10xf32>, tensor<10xf32> %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<11xf32> vector.print %r : vector<11xf32> return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @func_without_tensor_args(%v : vector<10xf32>) -> () { %0 = bufferization.alloc_tensor() : tensor<10xf32> %c0 = arith.constant 0 : index %1 = vector.transfer_write %v, %0[%c0] : vector<10xf32>, tensor<10xf32> %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<11xf32> vector.print %r : vector<11xf32> return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @func_without_tensor_args(%v : vector<10xf32>) -> () { %0 = bufferization.alloc_tensor() : tensor<10xf32> %c0 = arith.constant 0 : index %1 = vector.transfer_write %v, %0[%c0] : vector<10xf32>, tensor<10xf32> %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %1[%c0], %cst : tensor<10xf32>, vector<11xf32> vector.print %r : vector<11xf32> return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> (tensor, f32) { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.insert %f into %t[%c0] : tensor %1 = tensor.extract %0[%c1] : tensor return %0, %1 : tensor, f32 } func.func @call_func_with_non_tensor_return( %t0: tensor {bufferization.writable = true}) -> (f32, tensor) { %0, %1 = call @inner_func(%t0) : (tensor) -> (tensor, f32) return %1, %0 : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @inner_func(%t: tensor) -> (tensor, f32) { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.insert %f into %t[%c0] : tensor %1 = tensor.extract %0[%c1] : tensor return %0, %1 : tensor, f32 } func.func @call_func_with_non_tensor_return( %t0: tensor {bufferization.writable = true}) -> (f32, tensor) { %0, %1 = call @inner_func(%t0) : (tensor) -> (tensor, f32) return %1, %0 : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> (tensor, f32) { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.insert %f into %t[%c0] : tensor %1 = tensor.extract %0[%c1] : tensor return %0, %1 : tensor, f32 } func.func @call_func_with_non_tensor_return( %t0: tensor {bufferization.writable = true}) -> (f32, tensor) { %0, %1 = call @inner_func(%t0) : (tensor) -> (tensor, f32) return %1, %0 : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> (tensor, f32) { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.insert %f into %t[%c0] : tensor %1 = tensor.extract %0[%c1] : tensor return %0, %1 : tensor, f32 } func.func @call_func_with_non_tensor_return( %t0: tensor {bufferization.writable = false}) -> (f32, tensor) { %0, %1 = call @inner_func(%t0) : (tensor) -> (tensor, f32) return %1, %0 : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @inner_func(%t: tensor) -> (tensor, f32) { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.insert %f into %t[%c0] : tensor %1 = tensor.extract %0[%c1] : tensor return %0, %1 : tensor, f32 } func.func @call_func_with_non_tensor_return( %t0: tensor {bufferization.writable = false}) -> (f32, tensor) { %0, %1 = call @inner_func(%t0) : (tensor) -> (tensor, f32) return %1, %0 : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> (tensor, f32) { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.insert %f into %t[%c0] : tensor %1 = tensor.extract %0[%c1] : tensor return %0, %1 : tensor, f32 } func.func @call_func_with_non_tensor_return( %t0: tensor {bufferization.writable = false}) -> (f32, tensor) { %0, %1 = call @inner_func(%t0) : (tensor) -> (tensor, f32) return %1, %0 : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @f0(tensor) -> (f32) func.func @f1(%t: tensor) -> (f32) { %0 = call @f0(%t) : (tensor) -> (f32) return %0 : f32 } func.func @f2(%t: tensor) -> (f32) { %0 = call @f1(%t) : (tensor) -> (f32) return %0 : f32 } func.func @main(%t: tensor {bufferization.writable = false}) -> (f32) { %0 = call @f2(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @f0(tensor) -> (f32) func.func @f1(%t: tensor) -> (f32) { %0 = call @f0(%t) : (tensor) -> (f32) return %0 : f32 } func.func @f2(%t: tensor) -> (f32) { %0 = call @f1(%t) : (tensor) -> (f32) return %0 : f32 } func.func @main(%t: tensor {bufferization.writable = false}) -> (f32) { %0 = call @f2(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @f0(tensor) -> (f32) func.func @f1(%t: tensor) -> (f32) { %0 = call @f0(%t) : (tensor) -> (f32) return %0 : f32 } func.func @f2(%t: tensor) -> (f32) { %0 = call @f1(%t) : (tensor) -> (f32) return %0 : f32 } func.func @main(%t: tensor {bufferization.writable = false}) -> (f32) { %0 = call @f2(%t) : (tensor) -> (f32) return %0 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @does_not_read(%t: tensor) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%t : tensor) -> tensor return %r : tensor } func.func @main(%t: tensor {bufferization.writable = false}) -> f32 { %0 = call @does_not_read(%t) : (tensor) -> (tensor) %idx = arith.constant 4 : index %r = tensor.extract %0[%idx] : tensor return %r : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @does_not_read(%t: tensor) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%t : tensor) -> tensor return %r : tensor } func.func @main(%t: tensor {bufferization.writable = false}) -> f32 { %0 = call @does_not_read(%t) : (tensor) -> (tensor) %idx = arith.constant 4 : index %r = tensor.extract %0[%idx] : tensor return %r : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @does_not_read(%t: tensor) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%t : tensor) -> tensor return %r : tensor } func.func @main(%t: tensor {bufferization.writable = false}) -> f32 { %0 = call @does_not_read(%t) : (tensor) -> (tensor) %idx = arith.constant 4 : index %r = tensor.extract %0[%idx] : tensor return %r : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @some_external_func(tensor<4xi32>) func.func @main() { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> call @some_external_func(%A) : (tensor<4xi32>) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @some_external_func(tensor<4xi32>) func.func @main() { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> call @some_external_func(%A) : (tensor<4xi32>) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @some_external_func(tensor<4xi32>) func.func @main() { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> call @some_external_func(%A) : (tensor<4xi32>) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @some_external_func_within_scf_execute(tensor<4xi32>) func.func @main() { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> scf.execute_region { func.call @some_external_func_within_scf_execute(%A) : (tensor<4xi32>) -> () scf.yield } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @some_external_func_within_scf_execute(tensor<4xi32>) func.func @main() { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> scf.execute_region { func.call @some_external_func_within_scf_execute(%A) : (tensor<4xi32>) -> () scf.yield } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @some_external_func_within_scf_execute(tensor<4xi32>) func.func @main() { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> scf.execute_region { func.call @some_external_func_within_scf_execute(%A) : (tensor<4xi32>) -> () scf.yield } return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @execute_region_test(%t1 : tensor) -> (f32, tensor, f32) { %f1 = arith.constant 0.0 : f32 %f2 = arith.constant 1.0 : f32 %idx = arith.constant 7 : index %0, %1, %2 = scf.execute_region -> (f32, tensor, f32) { %t2 = tensor.insert %f2 into %t1[%idx] : tensor scf.yield %f1, %t2, %f2 : f32, tensor, f32 } return %0, %1, %2 : f32, tensor, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @execute_region_test(%t1 : tensor) -> (f32, tensor, f32) { %f1 = arith.constant 0.0 : f32 %f2 = arith.constant 1.0 : f32 %idx = arith.constant 7 : index %0, %1, %2 = scf.execute_region -> (f32, tensor, f32) { %t2 = tensor.insert %f2 into %t1[%idx] : tensor scf.yield %f1, %t2, %f2 : f32, tensor, f32 } return %0, %1, %2 : f32, tensor, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @execute_region_test(%t1 : tensor) -> (f32, tensor, f32) { %f1 = arith.constant 0.0 : f32 %f2 = arith.constant 1.0 : f32 %idx = arith.constant 7 : index %0, %1, %2 = scf.execute_region -> (f32, tensor, f32) { %t2 = tensor.insert %f2 into %t1[%idx] : tensor scf.yield %f1, %t2, %f2 : f32, tensor, f32 } return %0, %1, %2 : f32, tensor, f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @some_external_func(tensor) func.func @scf_for_with_tensor_insert_slice( %A : tensor, %B : tensor, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[%i][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[%i][4][1] : tensor<4xf32> into tensor scf.yield %ttA, %ttB : tensor, tensor } return %r0#1, %r0#0: tensor, tensor } func.func @bar( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = call @scf_for_with_tensor_insert_slice(%A, %B, %C, %lb, %ub, %step) : (tensor, tensor, tensor<4xf32>, index, index, index) -> (tensor, tensor) call @some_external_func(%r0#0) : (tensor) -> () return %r0#0, %r0#1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @some_external_func(tensor) func.func @scf_for_with_tensor_insert_slice( %A : tensor, %B : tensor, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[%i][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[%i][4][1] : tensor<4xf32> into tensor scf.yield %ttA, %ttB : tensor, tensor } return %r0#1, %r0#0: tensor, tensor } func.func @bar( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = call @scf_for_with_tensor_insert_slice(%A, %B, %C, %lb, %ub, %step) : (tensor, tensor, tensor<4xf32>, index, index, index) -> (tensor, tensor) call @some_external_func(%r0#0) : (tensor) -> () return %r0#0, %r0#1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @some_external_func(tensor) func.func @scf_for_with_tensor_insert_slice( %A : tensor, %B : tensor, %C : tensor<4xf32>, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = scf.for %i = %lb to %ub step %step iter_args(%tA = %A, %tB = %B) -> (tensor, tensor) { %ttA = tensor.insert_slice %C into %tA[%i][4][1] : tensor<4xf32> into tensor %ttB = tensor.insert_slice %C into %tB[%i][4][1] : tensor<4xf32> into tensor scf.yield %ttA, %ttB : tensor, tensor } return %r0#1, %r0#0: tensor, tensor } func.func @bar( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = true}, %lb : index, %ub : index, %step : index) -> (tensor, tensor) { %r0:2 = call @scf_for_with_tensor_insert_slice(%A, %B, %C, %lb, %ub, %step) : (tensor, tensor, tensor<4xf32>, index, index, index) -> (tensor, tensor) call @some_external_func(%r0#0) : (tensor) -> () return %r0#0, %r0#1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @init_and_dot(%a: tensor<64xf32>, %b: tensor<64xf32>, %c: tensor) -> tensor { %v0 = arith.constant 0.0 : f32 %d = linalg.fill ins(%v0 : f32) outs(%c : tensor) -> tensor %e = linalg.dot ins(%a, %b : tensor<64xf32>,tensor<64xf32>) outs(%d: tensor) -> tensor return %e : tensor } func.func @main() { %v0 = arith.constant 0.0 : f32 %v1 = arith.constant 1.0 : f32 %v2 = arith.constant 2.0 : f32 %A = bufferization.alloc_tensor() : tensor<64xf32> %B = bufferization.alloc_tensor() : tensor<64xf32> %C = bufferization.alloc_tensor() : tensor %AA = linalg.fill ins(%v1 : f32) outs(%A : tensor<64xf32>) -> tensor<64xf32> %BB = linalg.fill ins(%v2 : f32) outs(%B : tensor<64xf32>) -> tensor<64xf32> %CC = linalg.fill ins(%v0 : f32) outs(%C : tensor) -> tensor %res = call @init_and_dot(%AA, %BB, %CC) : (tensor<64xf32>, tensor<64xf32>, tensor) -> tensor %res2 = tensor.cast %res: tensor to tensor<*xf32> call @printMemrefF32(%res2) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(tensor<*xf32>)"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @init_and_dot(%a: tensor<64xf32>, %b: tensor<64xf32>, %c: tensor) -> tensor { %v0 = arith.constant 0.0 : f32 %d = linalg.fill ins(%v0 : f32) outs(%c : tensor) -> tensor %e = linalg.dot ins(%a, %b : tensor<64xf32>,tensor<64xf32>) outs(%d: tensor) -> tensor return %e : tensor } func.func @main() { %v0 = arith.constant 0.0 : f32 %v1 = arith.constant 1.0 : f32 %v2 = arith.constant 2.0 : f32 %A = bufferization.alloc_tensor() : tensor<64xf32> %B = bufferization.alloc_tensor() : tensor<64xf32> %C = bufferization.alloc_tensor() : tensor %AA = linalg.fill ins(%v1 : f32) outs(%A : tensor<64xf32>) -> tensor<64xf32> %BB = linalg.fill ins(%v2 : f32) outs(%B : tensor<64xf32>) -> tensor<64xf32> %CC = linalg.fill ins(%v0 : f32) outs(%C : tensor) -> tensor %res = call @init_and_dot(%AA, %BB, %CC) : (tensor<64xf32>, tensor<64xf32>, tensor) -> tensor %res2 = tensor.cast %res: tensor to tensor<*xf32> call @printMemrefF32(%res2) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(tensor<*xf32>)"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @init_and_dot(%a: tensor<64xf32>, %b: tensor<64xf32>, %c: tensor) -> tensor { %v0 = arith.constant 0.0 : f32 %d = linalg.fill ins(%v0 : f32) outs(%c : tensor) -> tensor %e = linalg.dot ins(%a, %b : tensor<64xf32>,tensor<64xf32>) outs(%d: tensor) -> tensor return %e : tensor } func.func @main() { %v0 = arith.constant 0.0 : f32 %v1 = arith.constant 1.0 : f32 %v2 = arith.constant 2.0 : f32 %A = bufferization.alloc_tensor() : tensor<64xf32> %B = bufferization.alloc_tensor() : tensor<64xf32> %C = bufferization.alloc_tensor() : tensor %AA = linalg.fill ins(%v1 : f32) outs(%A : tensor<64xf32>) -> tensor<64xf32> %BB = linalg.fill ins(%v2 : f32) outs(%B : tensor<64xf32>) -> tensor<64xf32> %CC = linalg.fill ins(%v0 : f32) outs(%C : tensor) -> tensor %res = call @init_and_dot(%AA, %BB, %CC) : (tensor<64xf32>, tensor<64xf32>, tensor) -> tensor %res2 = tensor.cast %res: tensor to tensor<*xf32> call @printMemrefF32(%res2) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(tensor<*xf32>)"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func private @external_func(tensor) func.func @callee( %A : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>}, %B : tensor, %C : tensor) { call @external_func(%A) : (tensor) -> () call @external_func(%B) : (tensor) -> () call @external_func(%C) : (tensor) -> () return } func.func @entry(%A : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>, bufferization.writable = false}, %B : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>, bufferization.writable = false}, %C : tensor {bufferization.writable = false}) { call @callee(%A, %B, %C) : (tensor, tensor, tensor) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func private @external_func(tensor) func.func @callee( %A : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>}, %B : tensor, %C : tensor) { call @external_func(%A) : (tensor) -> () call @external_func(%B) : (tensor) -> () call @external_func(%C) : (tensor) -> () return } func.func @entry(%A : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>, bufferization.writable = false}, %B : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>, bufferization.writable = false}, %C : tensor {bufferization.writable = false}) { call @callee(%A, %B, %C) : (tensor, tensor, tensor) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func private @external_func(tensor) func.func @callee( %A : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>}, %B : tensor, %C : tensor) { call @external_func(%A) : (tensor) -> () call @external_func(%B) : (tensor) -> () call @external_func(%C) : (tensor) -> () return } func.func @entry(%A : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>, bufferization.writable = false}, %B : tensor {bufferization.buffer_layout = affine_map<(i)[s0, s1] -> (i)>, bufferization.writable = false}, %C : tensor {bufferization.writable = false}) { call @callee(%A, %B, %C) : (tensor, tensor, tensor) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg(%t0: tensor {bufferization.writable = true}, %c0: index, %c10: index, %c1: index) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func(%t1) : (tensor) -> tensor scf.yield %3 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @inner_func(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg(%t0: tensor {bufferization.writable = true}, %c0: index, %c10: index, %c1: index) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func(%t1) : (tensor) -> tensor scf.yield %3 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg(%t0: tensor {bufferization.writable = true}, %c0: index, %c10: index, %c1: index) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func(%t1) : (tensor) -> tensor scf.yield %3 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @inner_func_2(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg_2(%t0: tensor {bufferization.writable = true}, %c0: index, %c10: index, %c1: index) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func_2(%t1) : (tensor) -> tensor scf.yield %t1 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @inner_func_2(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg_2(%t0: tensor {bufferization.writable = true}, %c0: index, %c10: index, %c1: index) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func_2(%t1) : (tensor) -> tensor scf.yield %t1 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @inner_func_2(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg_2(%t0: tensor {bufferization.writable = true}, %c0: index, %c10: index, %c1: index) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func_2(%t1) : (tensor) -> tensor scf.yield %t1 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @transfer_read( %A : tensor {bufferization.writable = false}) -> (vector<4xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0], %f0 : tensor, vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @transfer_read( %A : tensor {bufferization.writable = false}) -> (vector<4xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0], %f0 : tensor, vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @transfer_read( %A : tensor {bufferization.writable = false}) -> (vector<4xf32>) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0], %f0 : tensor, vector<4xf32> return %0 : vector<4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @main() { %t = arith.constant dense<[1.0, 2.0, 3.0]> : tensor<3xf32> %unranked = tensor.cast %t : tensor<3xf32> to tensor<*xf32> func.call @maybe_writing_func(%unranked) : (tensor<*xf32>) -> () return } func.func private @maybe_writing_func(%ptr : tensor<*xf32>)"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @main() { %t = arith.constant dense<[1.0, 2.0, 3.0]> : tensor<3xf32> %unranked = tensor.cast %t : tensor<3xf32> to tensor<*xf32> func.call @maybe_writing_func(%unranked) : (tensor<*xf32>) -> () return } func.func private @maybe_writing_func(%ptr : tensor<*xf32>)"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "func.func @main() { %t = arith.constant dense<[1.0, 2.0, 3.0]> : tensor<3xf32> %unranked = tensor.cast %t : tensor<3xf32> to tensor<*xf32> func.call @maybe_writing_func(%unranked) : (tensor<*xf32>) -> () return } func.func private @maybe_writing_func(%ptr : tensor<*xf32>)"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "llvm.func @llvm_func() func.func @call_llvm_func() { llvm.call @llvm_func() : () -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs"" -drop-equivalent-buffer-results -split-input-file ",1 "llvm.func @llvm_func() func.func @call_llvm_func() { llvm.call @llvm_func() : () -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=23"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=59"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs test-analysis-only analysis-fuzzer-seed=91"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map"" -split-input-file ",1 "llvm.func @llvm_func() func.func @call_llvm_func() { llvm.call @llvm_func() : () -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 allow-return-allocs function-boundary-type-conversion=fully-dynamic-layout-map"" -split-input-file ",1 "func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @condBranchDynamicType( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.br ^bb3(%1 : memref) ^bb3(%2: memref): test.copy(%2, %arg2) : (memref, memref) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @nested_regions_and_cond_branch( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @nested_region_control_flow( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @loop_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @loop_nested_if_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>) -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { %4 = memref.alloc() : memref<2xf32> scf.yield %4 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } scf.yield %3 : memref<2xf32> } return %1 : memref<2xf32> }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @loop_nested_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> { %3 = scf.for %i3 = %lb to %ub step %step iter_args(%iterBuf3 = %iterBuf2) -> memref<2xf32> { %4 = memref.alloc() : memref<2xf32> %5 = arith.cmpi eq, %i, %ub : index %6 = scf.if %5 -> (memref<2xf32>) { %7 = memref.alloc() : memref<2xf32> %8 = memref.alloc() : memref<2xf32> scf.yield %8 : memref<2xf32> } else { scf.yield %iterBuf3 : memref<2xf32> } %9 = memref.alloc() : memref<2xf32> scf.yield %6 : memref<2xf32> } scf.yield %3 : memref<2xf32> } scf.yield %2 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @loop_nested_alloc_dyn_dependency( %lb: index, %ub: index, %step: index, %arg0: index, %buf: memref, %res: memref) { %0 = memref.alloc(%arg0) : memref %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref { %3 = scf.for %i3 = %lb to %ub step %step iter_args(%iterBuf3 = %iterBuf2) -> memref { %4 = memref.alloc(%i3) : memref %5 = arith.cmpi eq, %i, %ub : index %6 = scf.if %5 -> (memref) { %7 = memref.alloc(%i3) : memref scf.yield %7 : memref } else { scf.yield %iterBuf3 : memref } %8 = memref.alloc(%i3) : memref scf.yield %6 : memref } scf.yield %3 : memref } scf.yield %0 : memref } test.copy(%1, %res) : (memref, memref) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @hoist_one_loop( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = memref.alloc() : memref<2xf32> scf.yield %0 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @no_hoist_one_loop( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %1 = memref.alloc() : memref<2xf32> scf.yield %1 : memref<2xf32> } test.copy(%0, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @hoist_multiple_loop( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> { %3 = memref.alloc() : memref<2xf32> scf.yield %0 : memref<2xf32> } scf.yield %0 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @no_hoist_one_loop_conditional( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %1 = arith.cmpi eq, %i, %ub : index %2 = scf.if %1 -> (memref<2xf32>) { %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } else { scf.yield %iterBuf : memref<2xf32> } scf.yield %2 : memref<2xf32> } test.copy(%0, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @hoist_one_loop_conditional( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = arith.cmpi eq, %lb, %ub : index %2 = scf.if %1 -> (memref<2xf32>) { %3 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %4 = memref.alloc() : memref<2xf32> scf.yield %0 : memref<2xf32> } scf.yield %0 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } test.copy(%2, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @no_hoist_one_loop_dependency( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = memref.alloc(%i) : memref scf.yield %0 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @partial_hoist_multiple_loop_dependency( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> { %3 = memref.alloc(%i) : memref scf.yield %0 : memref<2xf32> } scf.yield %0 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @hoist_alloca( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloca() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> { %3 = memref.alloca() : memref<2xf32> scf.yield %0 : memref<2xf32> } scf.yield %0 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -buffer-loop-hoisting -split-input-file ,1 "func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @condBranchDynamicType( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.br ^bb3(%1 : memref) ^bb3(%2: memref): test.copy(%2, %arg2) : (memref, memref) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @condBranchUnrankedType( %arg0: i1, %arg1: memref<*xf32>, %arg2: memref<*xf32>, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref<*xf32>) ^bb2(%0: index): %1 = memref.alloc(%0) : memref %2 = memref.cast %1 : memref to memref<*xf32> test.buffer_based in(%arg1: memref<*xf32>) out(%2: memref<*xf32>) cf.br ^bb3(%2 : memref<*xf32>) ^bb3(%3: memref<*xf32>): test.copy(%3, %arg2) : (memref<*xf32>, memref<*xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @condBranchDynamicTypeNested( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb6(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.cond_br %arg0, ^bb3, ^bb4 ^bb3: cf.br ^bb5(%1 : memref) ^bb4: cf.br ^bb5(%1 : memref) ^bb5(%2: memref): cf.br ^bb6(%2 : memref) ^bb6(%3: memref): cf.br ^bb7(%3 : memref) ^bb7(%4: memref): test.copy(%4, %arg2) : (memref, memref) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @emptyUsesValue(%arg0: memref<4xf32>) { %0 = memref.alloc() : memref<4xf32> return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): %7 = memref.alloc() : memref<2xf32> test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>) test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): test.copy(%arg1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @redundantOperations(%arg0: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @moving_alloc_and_inserting_missing_dealloc( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^exit(%0 : memref<2xf32>) ^bb2: %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @moving_invalid_dealloc_op_complex( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { %1 = memref.alloc() : memref<2xf32> cf.cond_br %cond, ^bb1, ^bb2 ^bb1: cf.br ^exit(%arg0 : memref<2xf32>) ^bb2: test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) memref.dealloc %1 : memref<2xf32> cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @inserting_missing_dealloc_simple( %arg0 : memref<2xf32>, %arg1: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) test.copy(%0, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @moving_invalid_dealloc_op(%arg0 : memref<2xf32>, %arg1: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) memref.dealloc %0 : memref<2xf32> test.copy(%0, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @nested_regions_and_cond_branch( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @memref_in_function_results( %arg0: memref<5xf32>, %arg1: memref<10xf32>, %arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) { %x = memref.alloc() : memref<15xf32> %y = memref.alloc() : memref<5xf32> test.buffer_based in(%arg0: memref<5xf32>) out(%y: memref<5xf32>) test.copy(%y, %arg2) : (memref<5xf32>, memref<5xf32>) return %arg1, %x : memref<10xf32>, memref<15xf32> }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @nested_region_control_flow( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @nested_region_control_flow_div( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %3 : memref } return %2 : memref }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @inner_region_control_flow(%arg0 : index) -> memref { %0 = memref.alloc(%arg0, %arg0) : memref %1 = test.region_if %0 : memref -> (memref) then { ^bb0(%arg1 : memref): test.region_if_yield %arg1 : memref } else { ^bb0(%arg1 : memref): test.region_if_yield %arg1 : memref } join { ^bb0(%arg1 : memref): test.region_if_yield %arg1 : memref } return %1 : memref }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @subview(%arg0 : index, %arg1 : index, %arg2 : memref) { %0 = memref.alloc() : memref<64x4xf32, strided<[4, 1], offset: 0>> %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref> test.copy(%1, %arg2) : (memref>, memref) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @condBranchAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloca() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @ifElseAlloca(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): %7 = memref.alloca() : memref<2xf32> test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>) test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @ifElseNestedAlloca( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloca() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @nestedRegionsAndCondBranchAlloca( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloca() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @nestedRegionControlFlowAlloca( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloca(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @loop_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @loop_nested_if_no_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { scf.yield %0 : memref<2xf32> } else { scf.yield %iterBuf : memref<2xf32> } scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @loop_nested_if_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>) -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { %4 = memref.alloc() : memref<2xf32> scf.yield %4 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } scf.yield %3 : memref<2xf32> } return %1 : memref<2xf32> }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @loop_nested_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = scf.for %i2 = %lb to %ub step %step iter_args(%iterBuf2 = %iterBuf) -> memref<2xf32> { %3 = scf.for %i3 = %lb to %ub step %step iter_args(%iterBuf3 = %iterBuf2) -> memref<2xf32> { %4 = memref.alloc() : memref<2xf32> %5 = arith.cmpi eq, %i, %ub : index %6 = scf.if %5 -> (memref<2xf32>) { %7 = memref.alloc() : memref<2xf32> scf.yield %7 : memref<2xf32> } else { scf.yield %iterBuf3 : memref<2xf32> } scf.yield %6 : memref<2xf32> } scf.yield %3 : memref<2xf32> } scf.yield %2 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @affine_loop() { %buffer = memref.alloc() : memref<1024xf32> %sum_init_0 = arith.constant 0.0 : f32 %res = affine.for %i = 0 to 10 step 2 iter_args(%sum_iter = %sum_init_0) -> f32 { %t = affine.load %buffer[%i] : memref<1024xf32> %sum_next = arith.addf %sum_iter, %t : f32 affine.yield %sum_next : f32 } return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @loop_dynalloc( %arg0 : i32, %arg1 : i32, %arg2: memref, %arg3: memref) { %const0 = arith.constant 0 : i32 cf.br ^loopHeader(%const0, %arg2 : i32, memref) ^loopHeader(%i : i32, %buff : memref): %lessThan = arith.cmpi slt, %i, %arg1 : i32 cf.cond_br %lessThan, ^loopBody(%i, %buff : i32, memref), ^exit(%buff : memref) ^loopBody(%val : i32, %buff2: memref): %const1 = arith.constant 1 : i32 %inc = arith.addi %val, %const1 : i32 %size = arith.index_cast %inc : i32 to index %alloc1 = memref.alloc(%size) : memref cf.br ^loopHeader(%inc, %alloc1 : i32, memref) ^exit(%buff3 : memref): test.copy(%buff3, %arg3) : (memref, memref) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @do_loop_alloc( %arg0 : i32, %arg1 : i32, %arg2: memref<2xf32>, %arg3: memref<2xf32>) { %const0 = arith.constant 0 : i32 cf.br ^loopBody(%const0, %arg2 : i32, memref<2xf32>) ^loopBody(%val : i32, %buff2: memref<2xf32>): %const1 = arith.constant 1 : i32 %inc = arith.addi %val, %const1 : i32 %alloc1 = memref.alloc() : memref<2xf32> cf.br ^loopHeader(%inc, %alloc1 : i32, memref<2xf32>) ^loopHeader(%i : i32, %buff : memref<2xf32>): %lessThan = arith.cmpi slt, %i, %arg1 : i32 cf.cond_br %lessThan, ^loopBody(%i, %buff : i32, memref<2xf32>), ^exit(%buff : memref<2xf32>) ^exit(%buff3 : memref<2xf32>): test.copy(%buff3, %arg3) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @assumingOp( %arg0: !shape.witness, %arg2: memref<2xf32>, %arg3: memref<2xf32>) { %1 = shape.assuming %arg0 -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> shape.assuming_yield %arg2 : memref<2xf32> } %3 = shape.assuming %arg0 -> memref<2xf32> { %2 = memref.alloc() : memref<2xf32> shape.assuming_yield %2 : memref<2xf32> } test.copy(%3, %arg3) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @noRegionBranchOpInterface() { %0 = ""test.bar""() ({ %1 = ""test.bar""() ({ ""test.yield""() : () -> () }) : () -> (i32) ""test.yield""() : () -> () }) : () -> (i32) ""test.terminator""() : () -> () }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @dealloc_existing_clones(%arg0: memref, %arg1: memref) -> memref { %0 = bufferization.clone %arg0 : memref to memref %1 = bufferization.clone %arg1 : memref to memref return %0 : memref }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @while_two_arg(%arg0: index) { %a = memref.alloc(%arg0) : memref scf.while (%arg1 = %a, %arg2 = %a) : (memref, memref) -> (memref, memref) { %0 = ""test.make_condition""() : () -> i1 scf.condition(%0) %arg1, %arg2 : memref, memref } do { ^bb0(%arg1: memref, %arg2: memref): %b = memref.alloc(%arg0) : memref scf.yield %arg1, %b : memref, memref } return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @while_three_arg(%arg0: index) { %a = memref.alloc(%arg0) : memref scf.while (%arg1 = %a, %arg2 = %a, %arg3 = %a) : (memref, memref, memref) -> (memref, memref, memref) { %0 = ""test.make_condition""() : () -> i1 scf.condition(%0) %arg1, %arg2, %arg3 : memref, memref, memref } do { ^bb0(%arg1: memref, %arg2: memref, %arg3: memref): %b = memref.alloc(%arg0) : memref %q = memref.alloc(%arg0) : memref scf.yield %q, %b, %arg2: memref, memref, memref } return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @select_aliases(%arg0: index, %arg1: memref, %arg2: i1) { %0 = memref.alloc(%arg0) : memref %1 = memref.alloc(%arg0) : memref %2 = arith.select %arg2, %0, %1 : memref test.copy(%2, %arg1) : (memref, memref) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @f(%arg0: memref) -> memref { return %arg0 : memref } func.func @function_call() { %alloc = memref.alloc() : memref %alloc2 = memref.alloc() : memref %ret = call @f(%alloc) : (memref) -> memref test.copy(%ret, %alloc2) : (memref, memref) return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "#set = affine_set<() : (0 >= 0)> func.func @test_affine_if_1(%arg0: memref<10xf32>) -> memref<10xf32> { %0 = affine.if #set() -> memref<10xf32> { %alloc = memref.alloc() : memref<10xf32> affine.yield %alloc : memref<10xf32> } else { affine.yield %arg0 : memref<10xf32> } return %0 : memref<10xf32> }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "#set = affine_set<() : (0 >= 0)> func.func @test_affine_if_2() -> memref<10xf32> { %alloc0 = memref.alloc() : memref<10xf32> %0 = affine.if #set() -> memref<10xf32> { affine.yield %alloc0 : memref<10xf32> } else { %alloc = memref.alloc() : memref<10xf32> affine.yield %alloc : memref<10xf32> } return %0 : memref<10xf32> }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "#set = affine_set<() : (0 >= 0)> func.func @test_affine_if_3() -> memref<10xf32> { %alloc0 = memref.alloc() : memref<10xf32> %0 = affine.if #set() -> memref<10xf32> { %alloc = memref.alloc() : memref<10xf32> affine.yield %alloc : memref<10xf32> } else { affine.yield %alloc0 : memref<10xf32> } return %0 : memref<10xf32> }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "#set = affine_set<() : (0 >= 0)> func.func @test_affine_if_4(%arg0 : memref<10xf32>) -> memref<10xf32> { %alloc0 = memref.alloc() : memref<10xf32> %0 = affine.if #set() -> memref<10xf32> { affine.yield %arg0 : memref<10xf32> } else { %alloc = memref.alloc() : memref<10xf32> affine.yield %alloc : memref<10xf32> } return %0 : memref<10xf32> }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @auto_dealloc() { %c10 = arith.constant 10 : index %c100 = arith.constant 100 : index %alloc = memref.alloc(%c10) : memref %realloc = memref.realloc %alloc(%c100) : memref to memref return }", mlir-opt -verify-diagnostics -buffer-deallocation -split-input-file ,1 "func.func @unknown_op_copy() -> (tensor<10xf32>, tensor<10xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %t = ""test.dummy_op""() : () -> tensor<10xf32> %s = tensor.insert %cst into %t[%c0] : tensor<10xf32> return %s, %t : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -test-tensor-copy-insertion=""must-infer-memory-space"" -split-input-file ",1 "func.func @alloc_tensor_copy() -> (tensor<10xf32>, tensor<10xf32>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %t = bufferization.alloc_tensor() {memory_space = 1 : ui64} : tensor<10xf32> %s = tensor.insert %cst into %t[%c0] : tensor<10xf32> return %s, %t : tensor<10xf32>, tensor<10xf32> }"," mlir-opt -test-tensor-copy-insertion=""must-infer-memory-space"" -split-input-file ",1 "module { func.func @foo(%arg0: tensor) -> tensor { %cst = arith.constant 1.000000e+00 : f32 %c0 = arith.constant 0 : index %inserted = tensor.insert %cst into %arg0[%c0] : tensor return %inserted : tensor } func.func @contains_to_memref_op(%arg0: tensor {bufferization.writable = true}, %arg1: index) -> vector<5xf32> { %0 = bufferization.to_memref %arg0 : memref %cst = arith.constant 0.000000e+00 : f32 %1 = vector.transfer_read %0[%arg1], %cst : memref, vector<5xf32> return %1 : vector<5xf32> } }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 no-analysis-func-filter=contains_to_memref_op"" -drop-equivalent-buffer-results --split-input-file ",1 "module { func.func @foo(%arg0: tensor) -> tensor { %cst = arith.constant 1.000000e+00 : f32 %c0 = arith.constant 0 : index %inserted = tensor.insert %cst into %arg0[%c0] : tensor return %inserted : tensor } func.func @contains_to_memref_op(%arg0: tensor {bufferization.writable = true}, %arg1: index) -> vector<5xf32> { %0 = bufferization.to_memref %arg0 : memref %cst = arith.constant 0.000000e+00 : f32 %1 = vector.transfer_read %0[%arg1], %cst : memref, vector<5xf32> return %1 : vector<5xf32> } }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries=1 copy-before-write=1"" -drop-equivalent-buffer-results --split-input-file ",1 "func.func @extract_slice_fun(%A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}) -> (tensor<4xf32>, tensor<8xf32>) { %r0 = tensor.extract_slice %A[0][4][1] : tensor to tensor<4xf32> %r1 = tensor.extract_slice %B[0][8][1] : tensor to tensor<8xf32> return %r0, %r1: tensor<4xf32>, tensor<8xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @insert_slice_fun(%A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %C : tensor<4xf32> {bufferization.writable = false}) -> (tensor, tensor) { %r0 = tensor.insert_slice %C into %A[0][4][1] : tensor<4xf32> into tensor %r1 = tensor.insert_slice %C into %B[0][4][1] : tensor<4xf32> into tensor return %r0, %r1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @conflict_on_B(%A : tensor<4x4xf32> {bufferization.writable = true}, %B : tensor<4x4xf32> {bufferization.writable = true}) -> (tensor<4x4xf32>, tensor<4x4xf32>, tensor<4x4xf32>) { %C = linalg.matmul ins(%A, %B: tensor<4x4xf32>, tensor<4x4xf32>) outs(%B: tensor<4x4xf32>) -> tensor<4x4xf32> %D = linalg.matmul ins(%B, %A: tensor<4x4xf32>, tensor<4x4xf32>) outs(%B: tensor<4x4xf32>) -> tensor<4x4xf32> %E = linalg.matmul ins(%A, %A: tensor<4x4xf32>, tensor<4x4xf32>) outs(%B: tensor<4x4xf32>) -> tensor<4x4xf32> return %C, %D, %E: tensor<4x4xf32>, tensor<4x4xf32>, tensor<4x4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_slice_extract_slice( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = false}) -> (tensor<2xf32>, tensor<2xf32>) { %r0 = tensor.extract_slice %A[0][4][1] : tensor to tensor<4xf32> %r1 = tensor.extract_slice %r0[0][2][1] : tensor<4xf32> to tensor<2xf32> %r2 = tensor.extract_slice %B[0][4][1] : tensor to tensor<4xf32> %r3 = tensor.extract_slice %r2[0][2][1] : tensor<4xf32> to tensor<2xf32> return %r1, %r3: tensor<2xf32>, tensor<2xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @insert_slice_insert_slice( %A : tensor {bufferization.writable = true}, %A2 : tensor<4xf32> {bufferization.writable = true}, %A3 : tensor<2xf32> {bufferization.writable = true}, %B : tensor {bufferization.writable = false}, %B2 : tensor<4xf32> {bufferization.writable = false}, %B3 : tensor<2xf32> {bufferization.writable = false}) -> (tensor, tensor) { %r0 = tensor.insert_slice %A3 into %A2[0][2][1] : tensor<2xf32> into tensor<4xf32> %r1 = tensor.insert_slice %r0 into %A[0][4][1] : tensor<4xf32> into tensor %r2 = tensor.insert_slice %B3 into %B2[0][2][1] : tensor<2xf32> into tensor<4xf32> %r3 = tensor.insert_slice %r2 into %B[0][4][1] : tensor<4xf32> into tensor return %r1, %r3: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_slice_nonmatching_insert_slice( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = false}, %idx: index) -> (tensor, tensor) { %r0 = tensor.extract_slice %A[0][4][1] : tensor to tensor<4xf32> %r1 = tensor.insert_slice %r0 into %A[%idx][4][1] : tensor<4xf32> into tensor %r2 = tensor.extract_slice %B[0][4][1] : tensor to tensor<4xf32> %r3 = tensor.insert_slice %r2 into %B[%idx][4][1] : tensor<4xf32> into tensor return %r1, %r3: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_slice_matching_insert_slice( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = false}) -> (tensor, tensor) { %r0 = tensor.extract_slice %A[0][4][1] : tensor to tensor<4xf32> %r1 = tensor.insert_slice %r0 into %A[0][4][1] : tensor<4xf32> into tensor %r2 = tensor.extract_slice %B[0][4][1] : tensor to tensor<4xf32> %r3 = tensor.insert_slice %r2 into %B[0][4][1] : tensor<4xf32> into tensor return %r1, %r3: tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @read_of_matching_insert_slice_source( %A : tensor {bufferization.writable = true}, %idx : index, %idx2 : index) -> (tensor, vector<5xf32>) { %cst = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 %0 = tensor.extract_slice %A[%idx][%idx][1] : tensor to tensor %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor) -> tensor %2 = tensor.insert_slice %1 into %A[%idx][%idx][1] : tensor into tensor %3 = vector.transfer_read %1[%idx2], %cst2 : tensor, vector<5xf32> return %2, %3 : tensor, vector<5xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @read_of_matching_insert_slice_source_interleaved( %A : tensor {bufferization.writable = true}, %idx : index, %idx2 : index, %idx3 : index) -> (tensor, vector<5xf32>) { %cst = arith.constant 0.0 : f32 %cst2 = arith.constant 1.0 : f32 %0 = tensor.extract_slice %A[%idx][%idx][1] : tensor to tensor %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor) -> tensor %2 = tensor.insert_slice %1 into %A[%idx][%idx][1] : tensor into tensor %4 = tensor.extract_slice %2[%idx3][%idx3][1] : tensor to tensor %5 = linalg.fill ins(%cst : f32) outs(%4 : tensor) -> tensor %3 = vector.transfer_read %1[%idx2], %cst2 : tensor, vector<5xf32> %6 = tensor.insert_slice %5 into %2[%idx3][%idx3][1] : tensor into tensor return %6, %3 : tensor, vector<5xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_slice_linalg_readonly_use( %A : tensor {bufferization.writable = false}, %B : tensor<4x4xf32> {bufferization.writable = false}, %C : tensor<4x4xf32> {bufferization.writable = true}) -> (tensor<4x4xf32>, tensor<4x4xf32>) { %sA = tensor.extract_slice %A[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %D = linalg.matmul ins(%sA, %B: tensor<4x4xf32>, tensor<4x4xf32>) outs(%B: tensor<4x4xf32>) -> tensor<4x4xf32> %E = linalg.matmul ins(%sA, %B: tensor<4x4xf32>, tensor<4x4xf32>) outs(%C: tensor<4x4xf32>) -> tensor<4x4xf32> return %D, %E: tensor<4x4xf32>, tensor<4x4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_slice_to_linalg_write_use( %A : tensor<4x4xf32> {bufferization.writable = false}, %B : tensor {bufferization.writable = false}, %C : tensor {bufferization.writable = true}) -> (tensor<4x4xf32>, tensor<4x4xf32>) { %sB = tensor.extract_slice %B[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %D = linalg.matmul ins(%B, %C: tensor, tensor) outs(%sB: tensor<4x4xf32>) -> tensor<4x4xf32> %sC = tensor.extract_slice %C[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %E = linalg.matmul ins(%A, %sB: tensor<4x4xf32>, tensor<4x4xf32>) outs(%sC: tensor<4x4xf32>) -> tensor<4x4xf32> return %D, %E: tensor<4x4xf32>, tensor<4x4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @insert_slice_double_extract_slice( %s1: index, %s2: index, %s3: index, %s4: index, %A: tensor<8x6xf32> {bufferization.writable = false}, %B: tensor<6x6xf32> {bufferization.writable = false}, %C: tensor<30x20xf32> {bufferization.writable = true}) -> tensor<30x20xf32> { %15 = tensor.extract_slice %C[%s3, %s4] [%s1, %s2] [1, 1] : tensor<30x20xf32> to tensor %18 = linalg.matmul ins(%A, %B : tensor<8x6xf32>, tensor<6x6xf32>) outs(%15 : tensor) -> tensor %19 = tensor.extract_slice %18[0, 0] [%s1, %s2] [1, 1] : tensor to tensor %20 = tensor.insert_slice %19 into %C[%s3, %s4] [%s1, %s2] [1, 1] : tensor into tensor<30x20xf32> return %20 : tensor<30x20xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_slice_to_linalg_write_use( %A : tensor<4x4xf32> {bufferization.writable = false}, %B : tensor {bufferization.writable = false}, %C : tensor {bufferization.writable = true}) -> (tensor<4x4xf32>, tensor<4x4xf32>) { %sB = tensor.extract_slice %B[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %D = linalg.matmul ins(%B, %C: tensor, tensor) outs(%sB: tensor<4x4xf32>) -> tensor<4x4xf32> %sC = tensor.extract_slice %C[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %E = linalg.matmul ins(%A, %A: tensor<4x4xf32>, tensor<4x4xf32>) outs(%sC: tensor<4x4xf32>) -> tensor<4x4xf32> return %D, %E: tensor<4x4xf32>, tensor<4x4xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @nested_extract_slice_and_insert( %A : tensor {bufferization.writable = false}, %B : tensor {bufferization.writable = true}, %C : tensor {bufferization.writable = true}, %idx : index, %sz1 : index, %sz2 : index) -> (tensor, tensor, tensor) { %f0 = arith.constant 0.0 : f32 %sA = tensor.extract_slice %A[0, 0][%idx, %idx][1, 1] : tensor to tensor %ssA = tensor.extract_slice %sA[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %FA = linalg.fill ins(%f0 : f32) outs(%ssA : tensor<4x4xf32>) -> tensor<4x4xf32> %rsA = tensor.insert_slice %FA into %sA[0, 0][4, 4][1, 1] : tensor<4x4xf32> into tensor %rA = tensor.insert_slice %rsA into %A[0, 0][%idx, %idx][1, 1] : tensor into tensor %sB = tensor.extract_slice %B[0, 0][%idx, %idx][1, 1] : tensor to tensor %ssB = tensor.extract_slice %sB[0, 0][4, %idx][1, 1] : tensor to tensor<4x?xf32> %sssB = tensor.extract_slice %ssB[0, 0][4, 4][1, 1] : tensor<4x?xf32> to tensor<4x4xf32> %FB = linalg.fill ins(%f0 : f32) outs(%sssB : tensor<4x4xf32>) -> tensor<4x4xf32> %rssB = tensor.insert_slice %FB into %ssB[0, 0][4, 4][1, 1] : tensor<4x4xf32> into tensor<4x?xf32> %rsB = tensor.insert_slice %rssB into %sB[0, 0][4, %idx][1, 1] : tensor<4x?xf32> into tensor %rB = tensor.insert_slice %rsB into %B[0, 0][%idx, %idx][1, 1] : tensor into tensor %sC = tensor.extract_slice %C[0, 0][%idx, %idx][1, 1] : tensor to tensor %ssC = tensor.extract_slice %sC[0, 0][%sz1, 4][1, 1] : tensor to tensor %FC = linalg.fill ins(%f0 : f32) outs(%ssC : tensor) -> tensor %rsC = tensor.insert_slice %FC into %sC[0, 0][%sz2, 4][1, 1] : tensor into tensor %rC = tensor.insert_slice %rsC into %C[0, 0][%idx, %idx][1, 1] : tensor into tensor return %rA, %rB, %rC: tensor, tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @foo(tensor<64xf32>) func.func @dependence_through_call(%I : tensor<64xf32> {bufferization.writable = true}) { %f1 = arith.constant 1.000000e+00 : f32 %f2 = arith.constant 2.000000e+00 : f32 %A = linalg.fill ins(%f1 : f32) outs(%I : tensor<64xf32>) -> tensor<64xf32> %B = linalg.fill ins(%f2 : f32) outs(%I : tensor<64xf32>) -> tensor<64xf32> call @foo(%A) : (tensor<64xf32>) -> () call @foo(%B) : (tensor<64xf32>) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @foo(tensor<64xf32>) func.func private @bar(%A : tensor<64xf32>) { call @foo(%A) : (tensor<64xf32>) -> () return } func.func @read_dependence_through_scf_and_call( %I : tensor<64xf32> {bufferization.writable = true}, %I2 : tensor<64xf32> {bufferization.writable = true}) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index %f1 = arith.constant 1.000000e+00 : f32 %f2 = arith.constant 2.000000e+00 : f32 %A = linalg.fill ins(%f1 : f32) outs(%I : tensor<64xf32>) -> tensor<64xf32> %B = linalg.fill ins(%f2 : f32) outs(%I : tensor<64xf32>) -> tensor<64xf32> %r:2 = scf.for %i = %c0 to %c10 step %c1 iter_args(%0 = %A, %1 = %B) -> (tensor<64xf32>, tensor<64xf32>) { scf.yield %0, %1 : tensor<64xf32>, tensor<64xf32> } call @foo(%r#0) : (tensor<64xf32>) -> () call @foo(%r#1) : (tensor<64xf32>) -> () %A2 = linalg.fill ins(%f1 : f32) outs(%I2 : tensor<64xf32>) -> tensor<64xf32> %B2 = linalg.fill ins(%f2 : f32) outs(%I2 : tensor<64xf32>) -> tensor<64xf32> call @bar(%A2) : (tensor<64xf32>) -> () call @bar(%B2) : (tensor<64xf32>) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_into_constant_via_alias(%v : vector<5xi32>, %s1 : index, %s2 : index, %s3 : index) -> tensor { %A = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> %b = tensor.extract_slice %A[%s1][%s2][1] : tensor<4xi32> to tensor %r = vector.transfer_write %v, %b[%s3] : vector<5xi32>, tensor return %r : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @matmul_on_tensors( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst_0 = arith.constant 0.000000e+00 : f32 %cst_1 = arith.constant 1.000000e+00 : f32 %7 = bufferization.alloc_tensor() : tensor<256x256xf32> %8 = linalg.fill ins(%cst_0 : f32) outs(%7 : tensor<256x256xf32>) -> tensor<256x256xf32> %11 = linalg.fill ins(%cst_1 : f32) outs(%7 : tensor<256x256xf32>) -> tensor<256x256xf32> %sA = tensor.extract_slice %8[0, 0][256, 16][1, 1]: tensor<256x256xf32> to tensor<256x16xf32> %sB = tensor.extract_slice %11[0, 0][16, 256][1, 1]: tensor<256x256xf32> to tensor<16x256xf32> %r = linalg.matmul ins(%sA, %sB : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %r : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @matmul_on_tensors( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst_0 = arith.constant 0.000000e+00 : f32 %cst_1 = arith.constant 1.000000e+00 : f32 %7 = bufferization.alloc_tensor() : tensor<256x256xf32> %8 = linalg.fill ins(%cst_0 : f32) outs(%7 : tensor<256x256xf32>) -> tensor<256x256xf32> %9 = vector.transfer_read %arg0[%c0, %c0], %cst_0 {in_bounds = [false, true]} : tensor<518x518xf32>, vector<256x256xf32> %10 = vector.transfer_write %9, %8[%c0, %c0] {in_bounds = [true, true]} : vector<256x256xf32>, tensor<256x256xf32> %11 = linalg.fill ins(%cst_1 : f32) outs(%7 : tensor<256x256xf32>) -> tensor<256x256xf32> %12 = vector.transfer_read %arg1[%c0, %c0], %cst_0 {in_bounds = [false, true]} : tensor<518x518xf32>, vector<256x256xf32> %13 = vector.transfer_write %12, %11[%c0, %c0] {in_bounds = [true, true]} : vector<256x256xf32>, tensor<256x256xf32> %sA = tensor.extract_slice %10[0, 0][256, 16][1, 1]: tensor<256x256xf32> to tensor<256x16xf32> %sB = tensor.extract_slice %13[0, 0][16, 256][1, 1]: tensor<256x256xf32> to tensor<16x256xf32> %r = linalg.matmul ins(%sA, %sB : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %r : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @insert_slice_chain( %v1: vector<32x90xf32>, %v2: vector<30x90xf32>, %arg0: tensor<62x126xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<126x90xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<62x90xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<62x90xf32> attributes {passthrough = [[""target-cpu"", ""skylake-avx512""], [""prefer-vector-width"", ""512""]]} { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = linalg.fill ins(%cst : f32) outs(%arg2 : tensor<62x90xf32>) -> tensor<62x90xf32> %2 = tensor.extract_slice %0[0, 0] [32, 90] [1, 1] : tensor<62x90xf32> to tensor<32x90xf32> %7 = vector.transfer_write %v1, %2[%c0, %c0] {in_bounds = [true, true]} : vector<32x90xf32>, tensor<32x90xf32> %8 = tensor.insert_slice %7 into %0[0, 0] [32, 90] [1, 1] : tensor<32x90xf32> into tensor<62x90xf32> %10 = tensor.extract_slice %8[32, 0] [30, 90] [1, 1] : tensor<62x90xf32> to tensor<30x90xf32> %14 = vector.transfer_write %v2, %10[%c0, %c0] {in_bounds = [true, true]} : vector<30x90xf32>, tensor<30x90xf32> %15 = tensor.insert_slice %14 into %8[32, 0] [30, 90] [1, 1] : tensor<30x90xf32> into tensor<62x90xf32> return %15 : tensor<62x90xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @ip(%t: tensor<10x20xf32> {bufferization.writable = true}, %x: index, %y: index, %v: vector<5x6xf32>) -> tensor<10x20xf32> { %c0 = arith.constant 0 : index %c256 = arith.constant 256 : index %c257 = arith.constant 257 : index %r = scf.for %arg0 = %c0 to %c257 step %c256 iter_args(%arg1 = %t) -> (tensor<10x20xf32>) { %t1 = tensor.extract_slice %arg1[%x, 0] [5, %y] [1, 1] : tensor<10x20xf32> to tensor<5x?xf32> %t11 = tensor.extract_slice %t1[0, 0] [5, %y] [1, 1] : tensor<5x?xf32> to tensor<5x?xf32> %t2 = vector.transfer_write %v, %t11[%c0, %c0] : vector<5x6xf32>, tensor<5x?xf32> %t3 = tensor.insert_slice %t2 into %arg1[%x, 0] [5, %y] [1, 1] : tensor<5x?xf32> into tensor<10x20xf32> scf.yield %t3 : tensor<10x20xf32> } return %r : tensor<10x20xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @linalg_op_same_out_tensors( %t1: tensor {bufferization.writable = true}, %t2: tensor {bufferization.writable = true}) -> (tensor, tensor){ %o:2 = linalg.generic #trait ins(%t1 : tensor) outs (%t2, %t2 : tensor, tensor) { ^bb(%0: f32, %1: f32, %2 : f32) : linalg.yield %0, %0 : f32, f32 } -> (tensor, tensor) return %o#0, %o#1 : tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @linalg_op_same_out_tensors_2( %t1: tensor {bufferization.writable = true}, %t2: tensor {bufferization.writable = true}) -> (tensor, tensor, tensor){ %o:3 = linalg.generic #trait ins(%t1 : tensor) outs (%t2, %t2, %t2 : tensor, tensor, tensor) { ^bb(%0: f32, %1: f32, %2 : f32, %3 : f32) : linalg.yield %0, %0, %0 : f32, f32, f32 } -> (tensor, tensor, tensor) return %o#0, %o#1, %o#2 : tensor, tensor, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @double_insert_slice_into_alias( %v1: vector<32x90xf32>, %v2: vector<30x90xf32>, %arg2: tensor<62x90xf32> {bufferization.writable = true}, %s1: index, %s2: index, %s3: index, %s4: index) -> (tensor<62x90xf32>, tensor) { %c0 = arith.constant 0 : index %e = tensor.extract_slice %arg2[%s1, %s2][%s3, %s4][1, 1] : tensor<62x90xf32> to tensor %2 = tensor.extract_slice %arg2[0, 0] [32, 90] [1, 1] : tensor<62x90xf32> to tensor<32x90xf32> %7 = vector.transfer_write %v1, %2[%c0, %c0] {in_bounds = [true, true]} : vector<32x90xf32>, tensor<32x90xf32> %8 = tensor.insert_slice %7 into %arg2[0, 0] [32, 90] [1, 1] : tensor<32x90xf32> into tensor<62x90xf32> %10 = tensor.extract_slice %e[32, 0] [30, 90] [1, 1] : tensor to tensor<30x90xf32> %14 = vector.transfer_write %v2, %10[%c0, %c0] {in_bounds = [true, true]} : vector<30x90xf32>, tensor<30x90xf32> %15 = tensor.insert_slice %14 into %e[32, 0] [30, 90] [1, 1] : tensor<30x90xf32> into tensor return %8, %15 : tensor<62x90xf32>, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @interleaved_extract_insert_slice_chain_1( %arg2: tensor<62x90xf32> {bufferization.writable = true}) -> (tensor<62x90xf32>) { %2 = tensor.extract_slice %arg2[0, 0] [32, 90] [1, 1] : tensor<62x90xf32> to tensor<32x90xf32> %10 = tensor.extract_slice %arg2[32, 0] [30, 90] [1, 1] : tensor<62x90xf32> to tensor<30x90xf32> %8 = tensor.insert_slice %2 into %arg2[0, 0] [32, 90] [1, 1] : tensor<32x90xf32> into tensor<62x90xf32> %15 = tensor.insert_slice %10 into %8[32, 0] [30, 90] [1, 1] : tensor<30x90xf32> into tensor<62x90xf32> return %15 : tensor<62x90xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @interleaved_extract_insert_slice_chain_2( %arg2: tensor<62x90xf32> {bufferization.writable = true}) -> (tensor<62x90xf32>) { %2 = tensor.extract_slice %arg2[0, 0] [32, 90] [1, 1] : tensor<62x90xf32> to tensor<32x90xf32> %10 = tensor.extract_slice %arg2[31, 0] [30, 90] [1, 1] : tensor<62x90xf32> to tensor<30x90xf32> %8 = tensor.insert_slice %2 into %arg2[0, 0] [32, 90] [1, 1] : tensor<32x90xf32> into tensor<62x90xf32> %15 = tensor.insert_slice %10 into %8[31, 0] [30, 90] [1, 1] : tensor<30x90xf32> into tensor<62x90xf32> return %15 : tensor<62x90xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @extract_once_insert_twice( %arg2: tensor<62x90xf32> {bufferization.writable = true}) -> (tensor<62x90xf32>) { %2 = tensor.extract_slice %arg2[0, 0] [32, 90] [1, 1] : tensor<62x90xf32> to tensor<32x90xf32> %8 = tensor.insert_slice %2 into %arg2[0, 0] [32, 90] [1, 1] : tensor<32x90xf32> into tensor<62x90xf32> %15 = tensor.insert_slice %2 into %8[15, 0] [32, 90] [1, 1] : tensor<32x90xf32> into tensor<62x90xf32> return %15 : tensor<62x90xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @some_use(%A : tensor {bufferization.writable = true}, %v : vector<5xf32>) -> (tensor) { %idx = arith.constant 0 : index %0 = vector.transfer_write %v, %A[%idx] : vector<5xf32>, tensor return %0 : tensor } func.func @main_func(%A : tensor {bufferization.writable = true}, %v : vector<5xf32>) -> (tensor) { %0 = call @some_use(%A, %v) : (tensor, vector<5xf32>) -> (tensor) return %0 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @to_tensor_op_not_writable(%m: memref, %v: vector<5xf32>, %idx1: index, %idx2: index) -> vector<10xf32> { %0 = bufferization.to_tensor %m restrict : memref %w = vector.transfer_write %v, %0[%idx1] : vector<5xf32>, tensor %cst = arith.constant 0.0 : f32 %r = vector.transfer_read %w[%idx2], %cst : tensor, vector<10xf32> return %r : vector<10xf32> }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @inner_func(%t: tensor) -> tensor { return %t : tensor } func.func @equivalent_func_arg(%c0: index, %c10: index, %c1: index, %t0: tensor) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func(%t1) : (tensor) -> tensor scf.yield %3 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @inner_func_2(%t: tensor) -> tensor { %f = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %0 = tensor.insert %f into %t[%c0] : tensor return %0 : tensor } func.func @equivalent_func_arg_2(%c0: index, %c10: index, %c1: index, %t0: tensor) -> tensor { %1 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%t1 = %t0) -> (tensor) { %3 = func.call @inner_func_2(%t1) : (tensor) -> tensor scf.yield %3 : tensor } return %1: tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_after_select_read_one( %t1 : tensor {bufferization.writable = true}, %t2 : tensor {bufferization.writable = true}, %c : i1) -> (f32, tensor) { %cst = arith.constant 0.0 : f32 %idx = arith.constant 0 : index %s = arith.select %c, %t1, %t2 : tensor %w = tensor.insert %cst into %s[%idx] : tensor %f = tensor.extract %t1[%idx] : tensor return %f, %w : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_after_select_read_both( %t1 : tensor {bufferization.writable = true}, %t2 : tensor {bufferization.writable = true}, %c : i1) -> (f32, f32, tensor) { %cst = arith.constant 0.0 : f32 %idx = arith.constant 0 : index %s = arith.select %c, %t1, %t2 : tensor %w = tensor.insert %cst into %s[%idx] : tensor %f = tensor.extract %t1[%idx] : tensor %f2 = tensor.extract %t2[%idx] : tensor return %f, %f2, %w : f32, f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_after_select_no_conflict( %t1 : tensor {bufferization.writable = true}, %t2 : tensor {bufferization.writable = true}, %c : i1) -> (f32, tensor) { %cst = arith.constant 0.0 : f32 %idx = arith.constant 0 : index %s = arith.select %c, %t1, %t2 : tensor %w = tensor.insert %cst into %s[%idx] : tensor %f = tensor.extract %w[%idx] : tensor return %f, %w : f32, tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_to_same_tensor_in_loop_out_of_place( %A : tensor {bufferization.writable = true}, %B : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index, %sz: index) -> (tensor) { %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { %i2 = arith.index_cast %i : index to i32 %i3 = arith.sitofp %i2 : i32 to f32 %B2 = tensor.insert %i3 into %B[%i] : tensor %A2 = tensor.insert_slice %B2 into %t[%i][%sz][1] : tensor into tensor scf.yield %A2 : tensor } return %r0 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_to_same_alloc_tensor_in_place( %A : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index, %sz: index, %sz2: index) -> (tensor) { %B = bufferization.alloc_tensor(%sz2) : tensor %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { %i2 = arith.index_cast %i : index to i32 %i3 = arith.sitofp %i2 : i32 to f32 %B2 = tensor.insert %i3 into %B[%i] : tensor %A2 = tensor.insert_slice %B2 into %t[%i][%sz][1] : tensor into tensor scf.yield %A2 : tensor } return %r0 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func @write_to_same_alloc_tensor_out_of_place( %A : tensor {bufferization.writable = true}, %lb : index, %ub : index, %step : index, %sz: index, %sz2: index, %f: f32) -> (tensor) { %B = bufferization.alloc_tensor(%sz2) : tensor %C = tensor.insert %f into %B[%lb] : tensor %r0 = scf.for %i = %lb to %ub step %step iter_args(%t = %A) -> (tensor) { %i2 = arith.index_cast %i : index to i32 %i3 = arith.sitofp %i2 : i32 to f32 %B2 = tensor.insert %i3 into %C[%i] : tensor %A2 = tensor.insert_slice %B2 into %t[%i][%sz][1] : tensor into tensor scf.yield %A2 : tensor } return %r0 : tensor }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @ext_func(%t: tensor) func.func @private_func_read_write(%t: tensor<5xf32>) -> f32 { %c0 = arith.constant 0 : index %0 = tensor.cast %t : tensor<5xf32> to tensor func.call @ext_func(%0) : (tensor) -> () %1 = tensor.extract %t[%c0] : tensor<5xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @print_buffer(%t: tensor<*xf32> {bufferization.access = ""read""}) func.func @private_func_read(%t: tensor<5xf32>) -> f32 { %c0 = arith.constant 0 : index %0 = tensor.cast %t : tensor<5xf32> to tensor<*xf32> func.call @print_buffer(%0) : (tensor<*xf32>) -> () %1 = tensor.extract %t[%c0] : tensor<5xf32> return %1 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @ext_func(%t1: tensor, %t2: tensor) func.func @private_func_two_params_writing(%t: tensor) { func.call @ext_func(%t, %t) : (tensor, tensor) -> () return }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 "func.func private @ext_func(%t: tensor) -> (tensor<5xf32>, tensor<6xf32>) func.func @private_func_aliasing(%t: tensor) -> f32 { %c0 = arith.constant 0 : index %0, %1 = func.call @ext_func(%t) : (tensor) -> (tensor<5xf32>, tensor<6xf32>) %2 = tensor.extract %1[%c0] : tensor<6xf32> return %2 : f32 }"," mlir-opt -one-shot-bufferize=""bufferize-function-boundaries test-analysis-only allow-return-allocs"" -split-input-file ",1 func.func @arm_streaming() { return }, mlir-opt -enable-arm-streaming -verify-diagnostics ,1 func.func @arm_streaming() { return }, mlir-opt -enable-arm-streaming=mode=locally -verify-diagnostics ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @vectorize_1d_tensor_extract(%arg0: tensor<3xf32>, %arg1: tensor<4x3xi32>, %arg2: tensor<4x7x3x2xf32>) -> tensor<4x7x3x2xf32> { %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } ins(%arg1 : tensor<4x3xi32>) outs(%arg2 : tensor<4x7x3x2xf32>) { ^bb0(%arg3: i32, %arg4: f32): %2 = arith.index_cast %arg3 : i32 to index %3 = tensor.extract %arg0[%2] : tensor<3xf32> linalg.yield %3 : f32 } -> tensor<4x7x3x2xf32> return %1 : tensor<4x7x3x2xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @vectorize_nd_tensor_extract_constant_idx(%arg0: tensor<3x3xf32>, %arg2: tensor<1x1x3xf32>) -> tensor<1x1x3xf32> { %c0 = arith.constant 1 : index %c1 = arith.constant 2 : index %2 = linalg.generic { indexing_maps = [#map1], iterator_types = [""parallel"", ""parallel"", ""parallel""] } outs(%arg2 : tensor<1x1x3xf32>) { ^bb0(%arg4: f32): %7 = tensor.extract %arg0[%c0, %c1] : tensor<3x3xf32> linalg.yield %7 : f32 } -> tensor<1x1x3xf32> return %2 : tensor<1x1x3xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @vectorize_nd_tensor_extract_transfer_read_basic(%arg0: tensor<3x3x3xf32>, %arg2: tensor<1x1x3xf32>) -> tensor<1x1x3xf32> { %1 = linalg.generic { indexing_maps = [#map1], iterator_types = [""parallel"", ""parallel"", ""parallel""] } outs(%arg2 : tensor<1x1x3xf32>) { ^bb0(%arg4: f32): %2 = linalg.index 0 : index %3 = linalg.index 1 : index %4 = linalg.index 2 : index %5 = tensor.extract %arg0[%2, %3, %4] : tensor<3x3x3xf32> linalg.yield %5 : f32 } -> tensor<1x1x3xf32> return %1 : tensor<1x1x3xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_nd_tensor_extract_transfer_read_complex(%6: tensor<45x80x16xf32>, %arg0: index, %arg2: index, %arg1: index, %arg4: index, %extracted_slice : tensor<1x4xf32>) -> tensor<1x4xf32> { %c79 = arith.constant 79 : index %25 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x4xf32>) { ^bb0(%out: f32): %26 = linalg.index 0 : index %27 = arith.addi %arg0, %26 : index %28 = arith.addi %27, %arg2 : index %29 = linalg.index 1 : index %30 = arith.addi %arg1, %29 : index %31 = arith.addi %30, %arg4 : index %extracted = tensor.extract %6[%28, %c79, %31] : tensor<45x80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x4xf32> return %25 : tensor<1x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d3)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @vectorize_nd_tensor_extract_index_from_tensor(%arg0: tensor<3x3xf32>, %arg1: tensor<4x3xi32>, %arg2: tensor<4x3xi32>, %arg3: tensor<4x7x2xf32>, %arg4: tensor<4x7x3x2xf32>) -> tensor<4x7x3x2xf32> { %2 = linalg.generic { indexing_maps = [#map0, #map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } ins(%arg1, %arg2, %arg3 : tensor<4x3xi32>, tensor<4x3xi32>, tensor<4x7x2xf32>) outs(%arg4 : tensor<4x7x3x2xf32>) { ^bb0(%arg5: i32, %arg6: i32, %arg7: f32, %arg8: f32): %3 = arith.index_cast %arg5 : i32 to index %4 = arith.index_cast %arg6 : i32 to index %7 = tensor.extract %arg0[%3, %4] : tensor<3x3xf32> linalg.yield %7 : f32 } -> tensor<4x7x3x2xf32> return %2 : tensor<4x7x3x2xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map = affine_map<(d0) -> (d0)> func.func @vectorize_nd_tensor_extract_contiguous_and_gather(%arg0: tensor<6xf32>, %arg1: tensor<5xi32>) -> tensor<5xf32> { %c5 = arith.constant 5 : index %c0 = arith.constant 0 : index %0 = tensor.empty() : tensor<5xf32> %1 = linalg.generic {indexing_maps = [#map], iterator_types = [""parallel""]} outs(%0 : tensor<5xf32>) { ^bb0(%out: f32): %2 = linalg.index 0 : index %extracted = tensor.extract %arg1[%2] : tensor<5xi32> %3 = arith.index_cast %extracted : i32 to index %4 = arith.maxsi %3, %c0 : index %5 = arith.minsi %4, %c5 : index %extracted_0 = tensor.extract %arg0[%5] : tensor<6xf32> linalg.yield %extracted_0 : f32 } -> tensor<5xf32> return %1 : tensor<5xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_nd_tensor_extract_with_affine_apply_contiguous(%6: tensor<80x16xf32>, %arg0: index, %extracted_slice : tensor<1x4xf32>) -> tensor<1x4xf32> { %c79 = arith.constant 79 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x4xf32>) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %arg0) %extracted = tensor.extract %6[%c79, %3] : tensor<80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x4xf32> return %1 : tensor<1x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_nd_tensor_extract_with_tensor_extract(%input_1: tensor<1x20xi32>, %input_2: tensor<257x24xf32>, %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index) -> tensor<1x1x4xf32> { %c0 = arith.constant 0 : index %c256 = arith.constant 256 : index %output = tensor.empty() : tensor<1x1x4xf32> %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} outs(%output : tensor<1x1x4xf32>) { ^bb0(%out: f32): %13 = linalg.index 0 : index %14 = affine.apply affine_map<(d0, d1, d2) -> (d0 + d1 + d2)>(%arg0, %13, %arg2) %15 = linalg.index 2 : index %16 = linalg.index 1 : index %17 = affine.apply affine_map<(d0, d1, d2, d3) -> (d0 + d1 * 24 + d2 + d3)>(%arg1, %16, %15, %arg3) %extracted_0 = tensor.extract %input_1[%c0, %14] : tensor<1x20xi32> %18 = arith.index_cast %extracted_0 : i32 to index %19 = arith.maxsi %18, %c0 : index %20 = arith.minsi %19, %c256 : index %extracted_1 = tensor.extract %input_2[%20, %17] : tensor<257x24xf32> linalg.yield %extracted_1 : f32 } -> tensor<1x1x4xf32> return %1 : tensor<1x1x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_nd_tensor_extract_with_affine_apply_gather(%6: tensor<80x16xf32>, %arg0: index, %extracted_slice : tensor<1x4xf32>) -> tensor<1x4xf32> { %c16 = arith.constant 16 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x4xf32>) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %arg0) %extracted = tensor.extract %6[%3, %c16] : tensor<80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x4xf32> return %1 : tensor<1x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_nd_tensor_extract_with_maxsi_gather(%arg0: tensor<80x16xf32>, %extracted_slice : tensor<1x4xf32>) -> tensor<1x4xf32> { %c79 = arith.constant 79 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x4xf32>) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = arith.maxsi %2, %c79 : index %extracted = tensor.extract %arg0[%3, %2] : tensor<80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x4xf32> return %1 : tensor<1x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_nd_tensor_extract_with_maxsi_contiguous(%arg0: tensor<80x16xf32>, %extracted_slice : tensor<1x4xf32>) -> tensor<1x4xf32> { %c16 = arith.constant 16 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x4xf32>) { ^bb0(%out: f32): %2 = linalg.index 0 : index %3 = linalg.index 1 : index %4 = arith.maxsi %2, %c16 : index %extracted = tensor.extract %arg0[%4, %3] : tensor<80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x4xf32> return %1 : tensor<1x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map = affine_map<(d0) -> (d0)> func.func @vectorize_nd_tensor_extract_block_arg(%arg0: tensor<5x6xf32>, %arg1: tensor<5xindex>) -> tensor<5xf32> { %0 = tensor.empty() : tensor<5xf32> %1 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel""]} ins(%arg1: tensor<5xindex>) outs(%0 : tensor<5xf32>) { ^bb0(%in: index, %out: f32): %2 = linalg.index 0 : index %extracted_0 = tensor.extract %arg0[%in, %2] : tensor<5x6xf32> linalg.yield %extracted_0 : f32 } -> tensor<5xf32> return %1 : tensor<5xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @fill_extract_matmul_1234( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %5 = linalg.matmul ins(%3, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_1243( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %5 = linalg.matmul ins(%3, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_1324( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %5 = linalg.matmul ins(%3, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_1342( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %5 = linalg.matmul ins(%3, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_1423( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %5 = linalg.matmul ins(%3, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_1432( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %5 = linalg.matmul ins(%3, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_2134( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %5 = linalg.matmul ins(%3, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_2143( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %5 = linalg.matmul ins(%3, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_2314( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %5 = linalg.matmul ins(%1, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_2341( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %5 = linalg.matmul ins(%1, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_2413( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %5 = linalg.matmul ins(%3, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_2431( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %5 = linalg.matmul ins(%1, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_3124( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %5 = linalg.matmul ins(%1, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_3142( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %5 = linalg.matmul ins(%1, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_3214( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %5 = linalg.matmul ins(%1, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_3241( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %4 = tensor.extract_slice %2[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %5 = linalg.matmul ins(%1, %4 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_3412( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %5 = linalg.matmul ins(%1, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_3421( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %5 = linalg.matmul ins(%1, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_4123( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %5 = linalg.matmul ins(%3, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_4132( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %5 = linalg.matmul ins(%3, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_4213( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor<256x256xf32>) -> tensor<256x256xf32> %3 = tensor.extract_slice %1[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %5 = linalg.matmul ins(%3, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_4231( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %5 = linalg.matmul ins(%1, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_4312( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %5 = linalg.matmul ins(%1, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @fill_extract_matmul_4321( %arg0: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg1: tensor<518x518xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %arg2: tensor<256x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<256x256xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = bufferization.alloc_tensor() : tensor<256x256xf32> %4 = tensor.extract_slice %0[0, 0] [16, 256] [1, 1] : tensor<256x256xf32> to tensor<16x256xf32> %3 = tensor.extract_slice %0[0, 0] [256, 16] [1, 1] : tensor<256x256xf32> to tensor<256x16xf32> %2 = linalg.fill ins(%cst_0 : f32) outs(%4 : tensor<16x256xf32>) -> tensor<16x256xf32> %1 = linalg.fill ins(%cst : f32) outs(%3 : tensor<256x16xf32>) -> tensor<256x16xf32> %5 = linalg.matmul ins(%1, %2 : tensor<256x16xf32>, tensor<16x256xf32>) outs(%arg2 : tensor<256x256xf32>) -> tensor<256x256xf32> return %5 : tensor<256x256xf32> }"," mlir-opt -one-shot-bufferize=""test-analysis-only bufferize-function-boundaries"" -split-input-file ",1 "func.func @dot(%x: memref>, %y: memref>, %v: memref) { linalg.dot ins(%x, %y: memref>, memref>) outs(%v: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.dot""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile %0 [8000] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -test-linalg-transform-patterns=test-patterns -split-input-file ,1 "func.func @matvec(%A: memref>, %x: memref>, %y: memref>) { linalg.matvec ins(%A, %x: memref>, memref>) outs(%y: memref>) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matvec""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile %0 [5, 6] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -test-linalg-transform-patterns=test-patterns -split-input-file ,1 "func.func @matmul(%A: memref>, %B: memref>, %C: memref>) { linalg.matmul ins(%A, %B: memref>, memref>) outs(%C: memref>) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2000, 3000, 4000] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2, %loops_2:3 = transform.structured.tile %1 [200, 300, 400] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %3, %loops_3:3 = transform.structured.tile %2 [20, 30, 40] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %4, %loops_4:3 = transform.structured.tile %3 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -test-linalg-transform-patterns=test-patterns -split-input-file ,1 "#matmul_accesses = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (m, n)> ] #generic_matmul_trait = { args_in = 2, args_out = 1, indexing_maps = #matmul_accesses, library_call = ""linalg_matmul"", iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @permute_generic(%A: memref>, %B: memref>, %C: memref>) { linalg.generic #generic_matmul_trait ins(%A, %B : memref>, memref>) outs(%C : memref>) { ^bb(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b: f32 %e = arith.addf %c, %d: f32 linalg.yield %e: f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.interchange %0 iterator_interchange = [1, 2, 0] : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -test-linalg-transform-patterns=test-patterns -split-input-file ,1 "func.func @matvec_perm(%A: memref>, %x: memref>, %y: memref>) { linalg.matvec ins(%A, %x: memref>, memref>) outs(%y: memref>) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matvec""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile %0 [5, 6] {interchange = [1, 0]} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -test-linalg-transform-patterns=test-patterns -split-input-file ,1 "func.func @matmul_perm(%A: memref>, %B: memref>, %C: memref>) { linalg.matmul ins(%A, %B: memref>, memref>) outs(%C : memref>) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2000, 3000, 4000] {interchange = [1, 2, 0]} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2, %loops_2:3 = transform.structured.tile %1 [200, 300, 400] {interchange = [1, 0, 2]} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %3, %loops_3:3 = transform.structured.tile %2 [20, 30, 40] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -test-linalg-transform-patterns=test-patterns -split-input-file ,1 "transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): transform.match.structured %arg0 : !transform.any_op { ^bb1(%arg1: !transform.any_op): transform.match.structured.dim %arg1[all] : !transform.any_op transform.match.structured.dim %arg1[0] : !transform.any_op transform.match.structured.dim %arg1[0, 1, -2] : !transform.any_op transform.match.structured.dim %arg1[except(0)] : !transform.any_op transform.match.structured.dim %arg1[except(0, -1, 2)] : !transform.any_op transform.match.structured.yield } transform.match.structured %arg0 : !transform.any_op { ^bb1(%arg1: !transform.any_op): transform.match.structured.yield } transform.match.structured %arg0 : (!transform.any_op) -> !transform.any_op { ^bb1(%arg1: !transform.any_op): transform.match.structured.yield %arg1 : !transform.any_op } transform.match.structured %arg0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) { ^bb1(%arg1: !transform.any_op): transform.match.structured.yield %arg1, %arg1 : !transform.any_op, !transform.any_op } transform.yield }", mlir-opt | mlir-opt ,1 "func.func @depthwise_conv(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.depthwise_conv_2d_nhwc_hwcm {_someattr, dilations = dense<1> : tensor<2xi64>, strides = dense<2> : tensor<2xi64>} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor return %0 : tensor }", mlir-opt -linalg-named-op-conversion -split-input-file ,1 "func.func @depthwise_conv_q(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3 : i32, %arg4 : i32) -> tensor { %0 = linalg.depthwise_conv_2d_nhwc_hwcm_q {_someattr, dilations = dense<1> : tensor<2xi64>, strides = dense<2> : tensor<2xi64>} ins(%arg0, %arg1, %arg3, %arg4 : tensor, tensor, i32, i32) outs(%arg2 : tensor) -> tensor return %0 : tensor }", mlir-opt -linalg-named-op-conversion -split-input-file ,1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main(%farg0: tensor, %farg1: tensor) -> tensor attributes {} { cf.br ^bb1(%farg0 : tensor) ^bb1(%0: tensor): %1 = tensor.empty() : tensor %2 = linalg.generic #attrs ins(%0, %farg1 : tensor, tensor) outs(%1 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %3 = tensor.extract %2[] : tensor cf.cond_br %3, ^bb2(%0 : tensor), ^bb3(%0 : tensor) ^bb2(%4: tensor): %5 = tensor.empty() : tensor %6 = linalg.generic #attrs ins(%4, %4 : tensor, tensor) outs(%5 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i32): %8 = arith.addi %arg0, %arg1 : i32 linalg.yield %8 : i32 } -> tensor cf.br ^bb1(%6 : tensor) ^bb3(%7: tensor): return %7 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(linalg-detensorize{aggressive-mode}))"" ",1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main(%farg0: tensor, %farg1: tensor) -> tensor attributes {} { cf.br ^bb1(%farg0 : tensor) ^bb1(%0: tensor): %1 = tensor.empty() : tensor %2 = linalg.generic #attrs ins(%0, %farg1 : tensor, tensor) outs(%1 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %3 = tensor.extract %2[] : tensor cf.cond_br %3, ^bb2(%0 : tensor), ^bb3(%0 : tensor) ^bb2(%4: tensor): %5 = tensor.empty() : tensor %6 = linalg.generic #attrs ins(%4, %4 : tensor, tensor) outs(%5 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i32): %8 = arith.addi %arg0, %arg1 : i32 linalg.yield %8 : i32 } -> tensor cf.br ^bb1(%6 : tensor) ^bb3(%7: tensor): return %7 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "func.func @masked_static_vectorize_nd_tensor_extract_with_affine_apply_contiguous(%6: tensor<80x16xf32>, %arg0: index, %extracted_slice : tensor<1x3xf32>) -> tensor<1x3xf32> { %c79 = arith.constant 79 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x3xf32>) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %arg0) %extracted = tensor.extract %6[%c79, %3] : tensor<80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x3xf32> return %1 : tensor<1x3xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [1, 4] { vectorize_nd_extract } : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @masked_dynamic_vectorize_nd_tensor_extract_with_affine_apply_contiguous(%6: tensor, %arg0: index, %extracted_slice : tensor) -> tensor { %c79 = arith.constant 79 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %arg0) %extracted = tensor.extract %6[%c79, %3] : tensor linalg.yield %extracted : f32 } -> tensor return %1 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [1, 4] { vectorize_nd_extract } : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @masked_vectorize_nd_tensor_extract_with_affine_apply_gather(%6: tensor<80x16xf32>, %arg0: index, %extracted_slice : tensor<1x3xf32>) -> tensor<1x3xf32> { %c16 = arith.constant 16 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor<1x3xf32>) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %arg0) %extracted = tensor.extract %6[%3, %c16] : tensor<80x16xf32> linalg.yield %extracted : f32 } -> tensor<1x3xf32> return %1 : tensor<1x3xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [1, 4] { vectorize_nd_extract } : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @masked_dynamic_vectorize_nd_tensor_extract_with_affine_apply_gather(%6: tensor, %arg0: index, %extracted_slice : tensor) -> tensor { %c16 = arith.constant 16 : index %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%extracted_slice : tensor) { ^bb0(%out: f32): %2 = linalg.index 1 : index %3 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %arg0) %extracted = tensor.extract %6[%3, %c16] : tensor linalg.yield %extracted : f32 } -> tensor return %1 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [1, 4] { vectorize_nd_extract } : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map1 = affine_map<(d0, d1) -> (d0, d1)> func.func @extract_masked_vectorize(%arg0: tensor, %arg1: tensor) -> tensor { %c0 = arith.constant 1 : index %c1 = arith.constant 2 : index %2 = linalg.generic { indexing_maps = [#map1], iterator_types = [""parallel"", ""parallel""] } outs(%arg1 : tensor) { ^bb0(%arg3: f32): %7 = tensor.extract %arg0[%c0, %c1] : tensor linalg.yield %7 : f32 } -> tensor return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [3, 3] { vectorize_nd_extract } : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @simple_KCRS_to_KCRSsr(%arg0: tensor<1x1x32x8xf32>, %arg1: tensor<1x1x1x1x8x32xf32>) -> tensor<1x1x1x1x8x32xf32> { %0 = tensor.pack %arg0 inner_dims_pos = [3, 2] inner_tiles = [8, 32] into %arg1 : tensor<1x1x32x8xf32> -> tensor<1x1x1x1x8x32xf32> return %0 : tensor<1x1x1x1x8x32xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @simple_pad_and_pack(%input: tensor<5x1xf32>, %output: tensor<1x1x8x2xf32>, %pad: f32) -> tensor<1x1x8x2xf32> { %0 = tensor.pack %input padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %output : tensor<5x1xf32> -> tensor<1x1x8x2xf32> return %0 : tensor<1x1x8x2xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @simple_NC_to_CNnc(%arg0: tensor<32x8xf32>, %arg1: tensor<1x1x32x8xf32>) -> tensor<1x1x32x8xf32>{ %0 = tensor.pack %arg0 outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 8] into %arg1 : tensor<32x8xf32> -> tensor<1x1x32x8xf32> return %0 : tensor<1x1x32x8xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @simple_CHW_to_CHWhwc(%arg0: tensor<3x5x7xf32>, %arg1: tensor<1x1x1x5x7x3xf32>) -> tensor<1x1x1x5x7x3xf32> { %0 = tensor.pack %arg0 inner_dims_pos = [1, 2, 0] inner_tiles = [5, 7, 3] into %arg1 : tensor<3x5x7xf32> -> tensor<1x1x1x5x7x3xf32> return %0 : tensor<1x1x1x5x7x3xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @simple_KCRS_to_KRSCsr(%arg0: tensor<3x1x32x8xf32>, %arg1: tensor<3x1x1x1x8x32xf32>) -> tensor<3x1x1x1x8x32xf32> { %0 = tensor.pack %arg0 outer_dims_perm = [0, 2, 3, 1] inner_dims_pos = [3, 2] inner_tiles = [8, 32] into %arg1 : tensor<3x1x32x8xf32> -> tensor<3x1x1x1x8x32xf32> return %0 : tensor<3x1x1x1x8x32xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @tensor_pad_constant(%t: tensor, %l2: index, %h1: index, %h2: index) -> tensor { %0 = tensor.pad %t low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): %c = arith.constant 50 : index tensor.yield %c : index } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.get_result %0[0] : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 }", mlir-opt -split-input-file -test-transform-dialect-interpreter -canonicalize -allow-unregistered-dialect -split-input-file ,1 "func.func @tensor_pad_constant(%t: tensor, %l2: index, %h1: index, %h2: index) -> tensor { %0 = tensor.pad %t low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): %c = arith.constant 50 : index tensor.yield %c : index } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.get_result %0[0] : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 %3 = transform.bufferization.one_shot_bufferize %arg1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -split-input-file -test-transform-dialect-interpreter -canonicalize -allow-unregistered-dialect -split-input-file ,1 "func.func @materialization_of_bbarg(%t: tensor, %idx: index) -> index { %r = tensor.extract %t[%idx, %idx] : tensor return %r : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.extract""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = test_produce_value_handle_to_argument_of_parent_block %0, 0 : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 {memory_space = 4} }", mlir-opt -split-input-file -test-transform-dialect-interpreter -canonicalize -allow-unregistered-dialect -split-input-file ,1 "func.func @materialization_of_bbarg(%t: tensor, %idx: index) -> index { %r = tensor.extract %t[%idx, %idx] : tensor return %r : index } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.extract""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = test_produce_value_handle_to_argument_of_parent_block %0, 0 : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 {memory_space = 4} %3 = transform.bufferization.one_shot_bufferize %arg1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -split-input-file -test-transform-dialect-interpreter -canonicalize -allow-unregistered-dialect -split-input-file ,1 "func.func @materialization_of_opresult(%idx: index) -> tensor { %t = ""dummy.some_op""() : () -> (tensor) return %t : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""dummy.some_op""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.get_result %0[0] : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 {memory_space = 4} }", mlir-opt -split-input-file -test-transform-dialect-interpreter -canonicalize -allow-unregistered-dialect -split-input-file ,1 "#map = affine_map<() -> ()> func.func @main(%arg0: tensor) -> tensor { %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [#map, #map], iterator_types = []} ins(%arg0 : tensor) outs(%0 : tensor) { ^bb0(%in: f32, %out: f32): linalg.yield %in : f32 } -> tensor cf.br ^bb1(%1 : tensor) ^bb1(%2: tensor): return %2 : tensor }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "func.func @contraction_dot(%A: memref<1584xf32>, %B: memref<1584xf32>, %C: memref) { linalg.dot ins(%A, %B: memref<1584xf32>, memref<1584xf32>) outs(%C: memref) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.dot""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @contraction_matvec(%A: memref<1584x1584xf32>, %B: memref<1584xf32>, %C: memref<1584xf32>) { linalg.matvec ins(%A, %B: memref<1584x1584xf32>, memref<1584xf32>) outs(%C: memref<1584xf32>) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matvec""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @contraction_matmul(%A: memref<1584x1584xf32>, %B: memref<1584x1584xf32>, %C: memref<1584x1584xf32>) { linalg.matmul ins(%A, %B: memref<1584x1584xf32>, memref<1584x1584xf32>) outs(%C: memref<1584x1584xf32>) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @contraction_batch_matmul(%A: memref<1584x1584x1584xf32>, %B: memref<1584x1584x1584xf32>, %C: memref<1584x1584x1584xf32>) { linalg.batch_matmul ins(%A, %B: memref<1584x1584x1584xf32>, memref<1584x1584x1584xf32>) outs(%C: memref<1584x1584x1584xf32>) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.batch_matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#matmul_trait = { args_in = 2, args_out = 1, indexing_maps = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (m, n)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @vectorization_test(%A: memref<8x16xf32>, %B: memref<16x32xf32>, %C: memref<8x32xf32>) { linalg.generic #matmul_trait ins(%A, %B : memref<8x16xf32>, memref<16x32xf32>) outs(%C : memref<8x32xf32>) { ^bb(%a: f32, %b: f32, %c: f32) : %d = arith.mulf %a, %b: f32 %e = arith.addf %c, %d: f32 linalg.yield %e : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#matmul_transpose_out_trait = { args_in = 2, args_out = 1, indexing_maps = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (n, m)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @generic_output_transpose(%A: memref<8x16xf32>, %B: memref<16x32xf32>, %C: memref<32x8xf32>) { linalg.generic #matmul_transpose_out_trait ins(%A, %B : memref<8x16xf32>, memref<16x32xf32>) outs(%C : memref<32x8xf32>) { ^bb(%a: f32, %b: f32, %c: f32) : %d = arith.mulf %a, %b: f32 %e = arith.addf %c, %d: f32 linalg.yield %e : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> func.func @generic_interchanged_transpose(%arg0: tensor<12x128x32xf32>) -> tensor<128x12x32xf32> { %0 = tensor.empty() : tensor<128x12x32xf32> %1 = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<12x128x32xf32>) outs(%0 : tensor<128x12x32xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } -> tensor<128x12x32xf32> return %1 : tensor<128x12x32xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#matmul_trait = { args_in = 2, args_out = 1, indexing_maps = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (m, n)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @vectorization_test_integer(%A: memref<8x16xi32>, %B: memref<16x32xi32>, %C: memref<8x32xi32>) { linalg.generic #matmul_trait ins(%A, %B : memref<8x16xi32>, memref<16x32xi32>) outs(%C : memref<8x32xi32>) { ^bb(%a: i32, %b: i32, %c: i32) : %d = arith.muli %a, %b: i32 %e = arith.addi %c, %d: i32 linalg.yield %e : i32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorization_test_2(%A: memref<8x16xf32>, %B: memref<16x32xf32>, %C: memref<8x32xf32>) { linalg.matmul ins(%A, %B: memref<8x16xf32>, memref<16x32xf32>) outs(%C: memref<8x32xf32>) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_scalar_input(%A : memref<8x16xf32>, %arg0 : f32) { linalg.generic { indexing_maps = [affine_map<(m, n) -> ()>, affine_map<(m, n) -> (m, n)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : f32) outs(%A: memref<8x16xf32>) { ^bb(%0: f32, %1: f32) : linalg.yield %0 : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_do_not_vectorize_unsupported_element_types(%A : memref<8x16xcomplex>, %arg0 : complex) { linalg.generic { indexing_maps = [affine_map<(m, n) -> ()>, affine_map<(m, n) -> (m, n)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : complex) outs(%A: memref<8x16xcomplex>) { ^bb(%0: complex, %1: complex) : linalg.yield %0 : complex } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @vectorize_affine_apply(%arg0: tensor<5xf32>, %arg3: index) -> tensor<5xi32> { %0 = tensor.empty() : tensor<5xi32> %1 = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel""]} ins(%arg0 : tensor<5xf32>) outs(%0 : tensor<5xi32>) { ^bb0(%arg1: f32, %arg2: i32): %2 = linalg.index 0 : index %11 = affine.apply affine_map<() -> (123)>() %12 = affine.apply affine_map<(d0, d1) -> (d0 + d1)>(%2, %11) %13 = affine.apply affine_map<(d0)[s0] -> (d0 + s0)>(%12)[%arg3] %14 = affine.apply affine_map<(d0) -> (d0 + 1)>(%13) %15 = affine.apply affine_map<(d0, d1, d2) -> (d0 + d1 + d2)>(%13, %14, %12) %3 = arith.index_cast %15 : index to i32 linalg.yield %3 : i32 } -> tensor<5xi32> return %1 : tensor<5xi32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_nd_extract } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_fill(%A : memref<8x16xf32>, %arg0 : f32) { linalg.fill ins(%arg0 : f32) outs(%A : memref<8x16xf32>) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_fill_scalar(%A : memref, %arg0 : f32) { linalg.fill ins(%arg0 : f32) outs(%A : memref) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_copy(%A : memref<8x16xf32>, %B : memref<8x16xf32>) { memref.copy %A, %B : memref<8x16xf32> to memref<8x16xf32> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.copy""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_copy_scalar(%A : memref, %B : memref) { memref.copy %A, %B : memref to memref return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.copy""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_copy_complex(%A : memref<8x16xcomplex>, %B : memref<8x16xcomplex>) { memref.copy %A, %B : memref<8x16xcomplex> to memref<8x16xcomplex> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""memref.copy""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_trailing_index(%arg0: memref<1x2x4x8xindex>) { linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} outs(%arg0: memref<1x2x4x8xindex>) { ^bb0(%arg1: index): %0 = linalg.index 3 : index linalg.yield %0 : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_vectorize_inner_index(%arg0: memref<1x2x4x8xindex>) { linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} outs(%arg0: memref<1x2x4x8xindex>) { ^bb0(%arg1: index): %0 = linalg.index 1 : index linalg.yield %0 : index } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @generic_vectorize(%arg0: memref<4x256xf32>, %arg1: memref<4x256xf32>, %arg2: memref<256xf32>, %i: f32) { %c1_f32 = arith.constant 1.0 : f32 linalg.generic { args_in = 0 : i64, args_out = 10 : i64, indexing_maps = [ affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg1, %arg2: memref<4x256xf32>, memref<256xf32>) outs( %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0 : memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>, memref<4x256xf32>) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5: f32, %arg6: f32, %arg7: f32, %arg8: f32, %arg9 : f32, %arg10 : f32, %arg11 : f32, %arg12 : f32, %arg13 : f32, %arg14 : f32): %6 = arith.addf %arg4, %arg6 : f32 %7 = arith.cmpf ogt, %arg3, %arg6 : f32 %8 = arith.constant 2.0 : f32 %9 = arith.divf %arg5, %i : f32 %10 = math.exp2 %arg5 : f32 %11 = arith.mulf %arg5, %8 : f32 %12 = math.rsqrt %arg5 : f32 %13 = arith.select %7, %arg5, %arg6 : f32 %14 = arith.subf %arg5, %arg4 : f32 %15 = math.tanh %arg5 : f32 linalg.yield %6, %8, %c1_f32, %9, %10, %11, %12, %13, %14, %15 : f32, f32, f32, f32, f32, f32, f32, f32, f32, f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @generic_vectorize_tensor(%arg0: tensor<4x256xf32>, %arg1: tensor<4x256xf32>, %arg2: tensor<256xf32>, %i: f32) -> (tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>) { %c1_f32 = arith.constant 1.0 : f32 %r:10 = linalg.generic { indexing_maps = [ affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg1, %arg2: tensor<4x256xf32>, tensor<256xf32>) outs( %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0, %arg0 : tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5: f32, %arg6: f32, %arg7: f32, %arg8: f32, %arg9 : f32, %arg10 : f32, %arg11 : f32, %arg12 : f32, %arg13 : f32, %arg14 : f32): %6 = arith.addf %arg4, %arg6 : f32 %7 = arith.cmpf ogt, %arg3, %arg6 : f32 %8 = arith.constant 2.0 : f32 %9 = arith.divf %arg5, %i : f32 %10 = math.exp2 %arg5 : f32 %11 = arith.mulf %arg5, %8 : f32 %12 = math.rsqrt %arg5 : f32 %13 = arith.select %7, %arg5, %arg6 : f32 %14 = arith.subf %arg5, %arg4 : f32 %15 = math.tanh %arg5 : f32 linalg.yield %6, %8, %c1_f32, %9, %10, %11, %12, %13, %14, %15 : f32, f32, f32, f32, f32, f32, f32, f32, f32, f32 } -> (tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>) return %r#0, %r#1, %r#2, %r#3, %r#4, %r#5, %r#6, %r#7, %r#8, %r#9: tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32>, tensor<4x256xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @generic_vectorize_broadcast_transpose( %A: memref<4xf32>, %B: memref<4x4xf32>, %C: memref<4x4x4x4xf32>) { linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d3)>, affine_map<(d0, d1, d2, d3) -> (d0)>, affine_map<(d0, d1, d2, d3) -> (d2)>, affine_map<(d0, d1, d2, d3) -> (d2, d0)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%B, %A, %A, %B: memref<4x4xf32>, memref<4xf32>, memref<4xf32>, memref<4x4xf32>) outs(%C : memref<4x4x4x4xf32>) { ^bb0(%arg0: f32, %arg1: f32, %arg2: f32, %arg3: f32, %arg4: f32): %s = arith.subf %arg0, %arg1 : f32 %a = arith.addf %arg2, %s : f32 %b = arith.addf %arg3, %a : f32 linalg.yield %b : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#matmul_trait = { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d1, d0)>, affine_map<(d0, d1, d2, d3) -> (d3, d1)>, affine_map<(d0, d1, d2, d3) -> (d3, d1, d0, d2)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> ], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } func.func @vectorization_transpose(%A: memref<14x7xf32>, %B: memref<16x14xf32>, %C: memref<16x14x7x8xf32>, %D: memref<7x14x8x16xf32>) { linalg.generic #matmul_trait ins(%A, %B, %C : memref<14x7xf32>, memref<16x14xf32>, memref<16x14x7x8xf32>) outs(%D : memref<7x14x8x16xf32>) { ^bb(%a: f32, %b: f32, %c: f32, %d: f32) : %e = arith.addf %a, %b: f32 %f = arith.addf %e, %c: f32 linalg.yield %f : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @matmul_tensors( %arg0: tensor<8x4xf32>, %arg1: tensor<4x12xf32>, %arg2: tensor<8x12xf32>) -> tensor<8x12xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<8x4xf32>, tensor<4x12xf32>) outs(%arg2: tensor<8x12xf32>) -> tensor<8x12xf32> return %0 : tensor<8x12xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @pad_static(%arg0: tensor<2x?x2xf32>, %pad_value: f32) -> tensor<2x3x4xf32> { %0 = tensor.pad %arg0 low[0, 0, 2] high[0, 1, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %pad_value : f32 } : tensor<2x?x2xf32> to tensor<2x3x4xf32> return %0 : tensor<2x3x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @pad_static_source(%arg0: tensor<2x5x2xf32>, %pad_value: f32) -> tensor<2x6x4xf32> { %0 = tensor.pad %arg0 low[0, 0, 2] high[0, 1, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %pad_value : f32 } : tensor<2x5x2xf32> to tensor<2x6x4xf32> return %0 : tensor<2x6x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @pad_static_dynamic(%arg0: tensor<1x2x2x?xf32>, %low: index, %high: index, %pad_value: f32) -> tensor<6x?x?x?xf32> { %0 = tensor.pad %arg0 low[2, %low, 3, 3] high[3, 3, %high, 2] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %pad_value : f32 } : tensor<1x2x2x?xf32> to tensor<6x?x?x?xf32> return %0 : tensor<6x?x?x?xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @pad_static_complex(%arg0: tensor<2x5x2xcomplex>, %pad_value: complex) -> tensor<2x6x4xcomplex> { %0 = tensor.pad %arg0 low[0, 0, 2] high[0, 1, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %pad_value : complex } : tensor<2x5x2xcomplex> to tensor<2x6x4xcomplex> return %0 : tensor<2x6x4xcomplex> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @pad_and_transfer_read(%arg0: tensor<5x6xf32>) -> vector<7x9xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5.0 : f32 %c6 = arith.constant 6.0 : f32 %0 = tensor.pad %arg0 low[0, 0] high[5, 7] { ^bb0(%arg1: index, %arg2: index): tensor.yield %c5 : f32 } : tensor<5x6xf32> to tensor<10x13xf32> %1 = vector.transfer_read %0[%c0, %c0], %c6 : tensor<10x13xf32>, vector<7x9xf32> return %1 : vector<7x9xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func private @make_vector() -> vector<7x9xf32> func.func @pad_and_transfer_write_static( %arg0: tensor<5x6xf32>) -> tensor<5x6xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5.0 : f32 %0 = tensor.pad %arg0 low[0, 0] high[5, 7] { ^bb0(%arg2: index, %arg3: index): tensor.yield %c5 : f32 } : tensor<5x6xf32> to tensor<10x13xf32> %1 = call @make_vector() : () -> vector<7x9xf32> %2 = vector.transfer_write %1, %0[%c0, %c0] : vector<7x9xf32>, tensor<10x13xf32> %3 = tensor.extract_slice %2[0, 0] [5, 6] [1, 1] : tensor<10x13xf32> to tensor<5x6xf32> return %3 : tensor<5x6xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func private @make_vector() -> vector<7x9xf32> func.func @pad_and_transfer_write_dynamic_static( %arg0: tensor, %size: index, %padding: index) -> tensor { %c0 = arith.constant 0 : index %c5 = arith.constant 5.0 : f32 %s = tensor.extract_slice %arg0[0, 0] [%size, 6] [1, 1] : tensor to tensor %0 = tensor.pad %s low[0, 0] high[%padding, 7] { ^bb0(%arg2: index, %arg3: index): tensor.yield %c5 : f32 } : tensor to tensor %1 = call @make_vector() : () -> vector<7x9xf32> %2 = vector.transfer_write %1, %0[%c0, %c0] : vector<7x9xf32>, tensor %3 = tensor.extract_slice %2[0, 0] [%size, 6] [1, 1] : tensor to tensor return %3 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func private @make_vector() -> tensor<12x13xf32> func.func @pad_and_insert_slice_source( %arg0: tensor<5x6xf32>) -> tensor<12x13xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5.0 : f32 %0 = tensor.pad %arg0 low[0, 0] high[2, 3] { ^bb0(%arg2: index, %arg3: index): tensor.yield %c5 : f32 } : tensor<5x6xf32> to tensor<7x9xf32> %1 = call @make_vector() : () -> tensor<12x13xf32> %r = tensor.insert_slice %0 into %1[0, 0][7, 9][1, 1] : tensor<7x9xf32> into tensor<12x13xf32> return %r : tensor<12x13xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func private @make_vector() -> tensor<12x13xf32> func.func @pad_and_insert_slice_dest( %arg0: tensor<1x5x6xf32>) -> tensor<1x12x13xf32> { %c5 = arith.constant 5.0 : f32 %0 = tensor.pad %arg0 low[0, 0, 0] high[0, 7, 7] { ^bb0(%arg2: index, %arg3: index, %arg4: index): tensor.yield %c5 : f32 } : tensor<1x5x6xf32> to tensor<1x12x13xf32> %1 = call @make_vector() : () -> tensor<12x13xf32> %r = tensor.insert_slice %1 into %0[0, 0, 0][1, 12, 13][1, 1, 1] : tensor<12x13xf32> into tensor<1x12x13xf32> return %r : tensor<1x12x13xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @pad_tensor_non_const_pad_value(%arg0: tensor<5x6xf32>) -> tensor<12x13xf32> { %c0 = arith.constant 0 : index %c5 = arith.constant 5.0 : f32 %0 = tensor.pad %arg0 low[3, 4] high[4, 3] { ^bb0(%arg1: index, %arg2: index): %i1 = arith.index_cast %arg1 : index to i32 %i2 = arith.index_cast %arg2 : index to i32 %f1 = arith.sitofp %i1 : i32 to f32 %f2 = arith.sitofp %i2 : i32 to f32 %m = arith.mulf %f1, %f2 : f32 tensor.yield %m : f32 } : tensor<5x6xf32> to tensor<12x13xf32> return %0 : tensor<12x13xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @sum_exp(%input: tensor<4x16x8xf32>, %output: tensor<4x16xf32>) -> tensor<4x16xf32> { %0 = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)> ], iterator_types = [""parallel"", ""parallel"", ""reduction""] } ins(%input : tensor<4x16x8xf32>) outs(%output : tensor<4x16xf32>) { ^bb0(%arg0: f32, %arg1: f32): %1 = math.exp %arg0 : f32 %2 = arith.addf %1, %arg1 : f32 linalg.yield %2 : f32 } -> tensor<4x16xf32> return %0 : tensor<4x16xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @sum_exp_2(%input: tensor<3x2xf32>, %input_2: tensor<5x4xf32>, %output: tensor<5x2xf32>) -> tensor<5x2xf32> { %0 = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d1, d0)>, affine_map<(d0, d1, d2, d3) -> (d3, d2)>, affine_map<(d0, d1, d2, d3) -> (d3, d0)> ], iterator_types = [""parallel"", ""reduction"", ""reduction"", ""parallel""] } ins(%input, %input_2 : tensor<3x2xf32>, tensor<5x4xf32>) outs(%output : tensor<5x2xf32>) { ^bb0(%arg0: f32, %arg1: f32, %arg2: f32): %1 = math.exp %arg0 : f32 %2 = math.exp %arg1 : f32 %3 = arith.addf %1, %2 : f32 %4 = arith.addf %3, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<5x2xf32> return %0 : tensor<5x2xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @red_max_2d(%arg0: tensor<4x4xf32>) -> tensor<4xf32> { %ident = arith.constant -3.40282e+38 : f32 %init = tensor.empty() : tensor<4xf32> %fill = linalg.fill ins(%ident : f32) outs(%init : tensor<4xf32>) -> tensor<4xf32> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<4x4xf32>) outs(%fill : tensor<4xf32>) { ^bb0(%in0: f32, %out0: f32): %max = arith.maxf %in0, %out0 : f32 linalg.yield %max : f32 } -> tensor<4xf32> return %red : tensor<4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @red_min_2d(%arg0: tensor<4x4xf32>) -> tensor<4xf32> { %maxf32 = arith.constant 3.40282e+38 : f32 %init = tensor.empty() : tensor<4xf32> %fill = linalg.fill ins(%maxf32 : f32) outs(%init : tensor<4xf32>) -> tensor<4xf32> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<4x4xf32>) outs(%fill : tensor<4xf32>) { ^bb0(%in0: f32, %out0: f32): %min = arith.minf %out0, %in0 : f32 linalg.yield %min : f32 } -> tensor<4xf32> return %red : tensor<4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @red_mul_2d(%arg0: tensor<4x4xf32>) -> tensor<4xf32> { %ident = arith.constant 1.0 : f32 %init = tensor.empty() : tensor<4xf32> %fill = linalg.fill ins(%ident : f32) outs(%init : tensor<4xf32>) -> tensor<4xf32> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<4x4xf32>) outs(%fill : tensor<4xf32>) { ^bb0(%in0: f32, %out0: f32): %mul = arith.mulf %in0, %out0 : f32 linalg.yield %mul : f32 } -> tensor<4xf32> return %red : tensor<4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @red_or_2d(%arg0: tensor<4x4xi1>) -> tensor<4xi1> { %ident = arith.constant false %init = tensor.empty() : tensor<4xi1> %fill = linalg.fill ins(%ident : i1) outs(%init : tensor<4xi1>) -> tensor<4xi1> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<4x4xi1>) outs(%fill : tensor<4xi1>) { ^bb0(%in0: i1, %out0: i1): %or = arith.ori %in0, %out0 : i1 linalg.yield %or : i1 } -> tensor<4xi1> return %red : tensor<4xi1> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @red_and_2d(%arg0: tensor<4x4xi1>) -> tensor<4xi1> { %ident = arith.constant true %init = tensor.empty() : tensor<4xi1> %fill = linalg.fill ins(%ident : i1) outs(%init : tensor<4xi1>) -> tensor<4xi1> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<4x4xi1>) outs(%fill : tensor<4xi1>) { ^bb0(%in0: i1, %out0: i1): %and = arith.andi %in0, %out0 : i1 linalg.yield %and : i1 } -> tensor<4xi1> return %red : tensor<4xi1> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @red_xor_2d(%arg0: tensor<4x4xi1>) -> tensor<4xi1> { %ident = arith.constant false %init = tensor.empty() : tensor<4xi1> %fill = linalg.fill ins(%ident : i1) outs(%init : tensor<4xi1>) -> tensor<4xi1> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<4x4xi1>) outs(%fill : tensor<4xi1>) { ^bb0(%in0: i1, %out0: i1): %xor = arith.xori %in0, %out0 : i1 linalg.yield %xor : i1 } -> tensor<4xi1> return %red : tensor<4xi1> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @explicit_broadcast(%arg0: tensor<4x4xf32>, %arg1: tensor<4x1xf32>) -> tensor<4x4xf32> { %c0 = arith.constant 0.0 : f32 %init = tensor.empty() : tensor<4x4xf32> %fill = linalg.fill ins(%c0 : f32) outs(%init : tensor<4x4xf32>) -> tensor<4x4xf32> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, 0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor<4x4xf32>, tensor<4x1xf32>) outs(%fill : tensor<4x4xf32>) { ^bb0(%arg7: f32, %arg8: f32, %arg9: f32): %40 = arith.subf %arg7, %arg8 : f32 linalg.yield %40 : f32 } -> tensor<4x4xf32> return %red : tensor<4x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @fused_broadcast_red_2d(%arg0: tensor<4x4xf32>, %arg1: tensor<4x1xf32>) -> tensor<4xf32> { %c0 = arith.constant 0.0 : f32 %init = tensor.empty() : tensor<4xf32> %fill = linalg.fill ins(%c0 : f32) outs(%init : tensor<4xf32>) -> tensor<4xf32> %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, 0)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0, %arg1 : tensor<4x4xf32>, tensor<4x1xf32>) outs(%fill : tensor<4xf32>) { ^bb0(%arg7: f32, %arg8: f32, %arg9: f32): %40 = arith.subf %arg7, %arg8 : f32 %41 = math.exp %40 : f32 %42 = arith.addf %41, %arg9 : f32 linalg.yield %42 : f32 } -> tensor<4xf32> return %red : tensor<4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op %3 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %4 = get_closest_isolated_parent %3 : (!transform.any_op) -> !transform.any_op %5 = transform.structured.vectorize %4 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @reduce_1d(%arg0: tensor<32xf32>) -> tensor { %f0 = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor %1 = linalg.fill ins(%f0 : f32) outs(%0 : tensor) -> tensor %2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0 : tensor<32xf32>) outs(%1 : tensor) { ^bb0(%a: f32, %b: f32): %3 = arith.addf %a, %b : f32 linalg.yield %3 : f32 } -> tensor return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @not_projected_permutation(%arg0: tensor<8x8xf32>) -> tensor<6x6x3x3xf32> { %c0 = arith.constant 0.0 : f32 %init = tensor.empty() : tensor<6x6x3x3xf32> %fill = linalg.fill ins(%c0 : f32) outs(%init : tensor<6x6x3x3xf32>) -> tensor<6x6x3x3xf32> %result = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0 + d2, d1 + d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<8x8xf32>) outs(%fill : tensor<6x6x3x3xf32>) { ^bb0(%arg7: f32, %arg9: f32): linalg.yield %arg7 : f32 } -> tensor<6x6x3x3xf32> return %result : tensor<6x6x3x3xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @mixed_parallel_reduced_results(%arg0 : tensor<2x4x8xf32>, %arg1 : tensor<2x4xf32>, %arg2 : tensor<2x4x8xf32>, %arg3 : tensor<2x4xf32>) -> (tensor<2x4x8xf32>, tensor<2x4xf32>) { %0:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%arg0, %arg1 : tensor<2x4x8xf32>, tensor<2x4xf32>) outs(%arg2, %arg3 : tensor<2x4x8xf32>, tensor<2x4xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32): %1 = arith.mulf %b0, %b1 : f32 %2 = arith.addf %1, %b3 : f32 linalg.yield %1, %2 : f32, f32 } -> (tensor<2x4x8xf32>, tensor<2x4xf32>) return %0#0, %0#1 : tensor<2x4x8xf32>, tensor<2x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { disable_multi_reduction_to_contract_patterns, disable_transfer_permutation_map_lowering_patterns } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_map(%arg0: memref<64xf32>, %arg1: memref<64xf32>, %arg2: memref<64xf32>) { linalg.map ins(%arg0, %arg1 : memref<64xf32>, memref<64xf32>) outs(%arg2 : memref<64xf32>) (%in: f32, %in_0: f32) { %0 = arith.addf %in, %in_0 : f32 linalg.yield %0 : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.map""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_transpose(%arg0: memref<16x32x64xf32>, %arg1: memref<32x64x16xf32>) { linalg.transpose ins(%arg0 : memref<16x32x64xf32>) outs(%arg1 : memref<32x64x16xf32>) permutation = [1, 2, 0] return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.transpose""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_reduce(%arg0: memref<16x32x64xf32>, %arg1: memref<16x64xf32>) { linalg.reduce ins(%arg0 : memref<16x32x64xf32>) outs(%arg1 : memref<16x64xf32>) dimensions = [1] (%in: f32, %init: f32) { %0 = arith.addf %in, %init : f32 linalg.yield %0 : f32 } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.reduce""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map = affine_map<(d0) -> (d0)> func.func @not_vectorizable(%arg0: tensor<1x?xf32>, %arg1: index, %arg2: index, %arg3: index) -> tensor<1x128xf32> { %0 = tensor.empty() : tensor<1x128xf32> %1 = scf.for %arg5 = %arg2 to %arg1 step %arg3 iter_args(%arg6 = %0) -> (tensor<1x128xf32>) { %extracted_slice = tensor.extract_slice %arg6[0, 0] [1, %arg1] [1, 1] : tensor<1x128xf32> to tensor %expanded = tensor.expand_shape %extracted_slice [[0, 1]] : tensor into tensor<1x?xf32> %extracted_slice_0 = tensor.extract_slice %arg0[0, %arg3] [1, %arg2] [1, 1] : tensor<1x?xf32> to tensor %extracted_slice_1 = tensor.extract_slice %expanded[0, %arg3] [1, %arg2] [1, 1] : tensor<1x?xf32> to tensor %2 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel""]} ins(%extracted_slice_0 : tensor) outs(%extracted_slice_1 : tensor) { ^bb0(%in: f32, %out: f32): %3 = arith.addf %in, %out : f32 linalg.yield %3 : f32 } -> tensor %inserted_slice = tensor.insert_slice %2 into %expanded[0, %arg3] [1, %arg2] [1, 1] : tensor into tensor<1x?xf32> %collapsed = tensor.collapse_shape %inserted_slice [[0, 1]] : tensor<1x?xf32> into tensor %inserted_slice_2 = tensor.insert_slice %collapsed into %arg6[0, 0] [1, %arg1] [1, 1] : tensor into tensor<1x128xf32> scf.yield %inserted_slice_2 : tensor<1x128xf32> } return %1 : tensor<1x128xf32> } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg0 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.vectorize %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @wrong_reduction_detection(%input: tensor<120x64xf32>) -> tensor<120x64xf32> { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %c64 = arith.constant 64 : index %cst_6 = arith.constant 4.000000e+00 : f32 %1 = scf.for %arg0 = %c0 to %c64 step %c4 iter_args(%arg1 = %input) -> (tensor<120x64xf32>) { %extracted_slice = tensor.extract_slice %arg1[%c0, %arg0] [1, 4] [1, 1] : tensor<120x64xf32> to tensor<1x4xf32> %10 = linalg.fill {__internal_linalg_transform__ = ""1""} ins(%cst_6 : f32) outs(%extracted_slice : tensor<1x4xf32>) -> tensor<1x4xf32> %11 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} outs(%10 : tensor<1x4xf32>) { ^bb0(%out: f32): %12 = linalg.index 0 : index %13 = arith.addi %arg0, %12 : index %18 = arith.index_cast %13 : index to i32 %20 = arith.uitofp %18 : i32 to f32 %67 = arith.mulf %out, %20 : f32 linalg.yield %67 : f32 } -> tensor<1x4xf32> %inserted_slice = tensor.insert_slice %11 into %arg1[%c0, %arg0] [1, 4] [1, 1] : tensor<1x4xf32> into tensor<120x64xf32> scf.yield %inserted_slice : tensor<120x64xf32> } return %1 : tensor<120x64xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @tensor_size0(%arg0: tensor<0xf32>, %arg1: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0 : tensor<0xf32>) outs(%arg1 : tensor) { ^bb0(%in: f32, %out: f32): %12 = arith.addf %out, %in : f32 linalg.yield %12 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_masked_pad_static_dynamic(%arg0: tensor<1x2x2x?xf32>, %low: index, %high: index, %pad_value: f32) -> tensor<6x?x?x?xf32> { %0 = tensor.pad %arg0 low[2, %low, 3, 3] high[3, 3, %high, 2] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %pad_value : f32 } : tensor<1x2x2x?xf32> to tensor<6x?x?x?xf32> return %0 : tensor<6x?x?x?xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 { vectorize_padding } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @add_mul_fusion(%arg0: tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %4 = arith.addf %arg3, %arg4 : f32 linalg.yield %4 : f32 } -> tensor %4 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%3, %arg2 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %5 = arith.mulf %arg5, %arg6 : f32 linalg.yield %5 : f32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> ()> func.func @scalar_add_mul_fusion(%arg0: tensor, %arg1 : f32, %arg2 : f32) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, f32) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %4 = arith.addf %arg3, %arg4 : f32 linalg.yield %4 : f32 } -> tensor %4 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%3, %arg2 : tensor, f32) outs(%2 : tensor) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %5 = arith.mulf %arg5, %arg6 : f32 linalg.yield %5 : f32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @transpose_add_mul_fusion(%arg0: tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %4 = arith.addf %arg3, %arg4 : f32 linalg.yield %4 : f32 } -> tensor %4 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%3, %arg2 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %5 = arith.mulf %arg5, %arg6 : f32 linalg.yield %5 : f32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @add_transpose_mul_fusion(%arg0: tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %4 = arith.addf %arg3, %arg4 : f32 linalg.yield %4 : f32 } -> tensor %4 = linalg.generic {indexing_maps = [#map1, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%3, %arg2 : tensor, tensor) outs(%2 : tensor){ ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %5 = arith.mulf %arg5, %arg6 : f32 linalg.yield %5 : f32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #map2 = affine_map<(d0) -> (d0)> func.func @add_broadcast_mul_fusion(%arg0: tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.empty(%0) : tensor %2 = linalg.generic {indexing_maps = [#map2, #map2, #map2], iterator_types = [""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%1 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %3 = arith.addf %arg3, %arg4 : f32 linalg.yield %3 : f32 } -> tensor %3 = tensor.dim %arg2, %c1 : tensor %4 = tensor.empty(%0, %3) : tensor %5 = linalg.generic {indexing_maps = [#map1, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%2, %arg2 : tensor, tensor) outs(%4 : tensor){ ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %6 = arith.mulf %arg5, %arg6 : f32 linalg.yield %6 : f32 } -> tensor return %5 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<() -> ()> func.func @add_mul_scalar_fusion(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = []} ins(%arg0, %arg1 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %2 = arith.addf %arg3, %arg4 : f32 linalg.yield %2 : f32 } -> tensor %2 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = []} ins(%1, %arg2 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %3 = arith.mulf %arg3, %arg4 : f32 linalg.yield %3 : f32 } -> tensor return %2 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @generic_op_constant_fusion(%arg0 : tensor<5x?x?xf32>) -> tensor<5x?x?xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %cst = arith.constant dense<42.0> : tensor<5xf32> %0 = tensor.dim %arg0, %c1 : tensor<5x?x?xf32> %1 = tensor.dim %arg0, %c2 : tensor<5x?x?xf32> %2 = tensor.empty(%0, %1) : tensor<5x?x?xf32> %3 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%cst, %arg0 : tensor<5xf32>, tensor<5x?x?xf32>) outs(%2 : tensor<5x?x?xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %4 = arith.mulf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<5x?x?xf32> return %3 : tensor<5x?x?xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> ()> #map1 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @generic_op_zero_dim_constant_fusion(%arg0 : tensor<5x?x?xf32>) -> tensor<5x?x?xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %cst = arith.constant dense<42.0> : tensor %0 = tensor.dim %arg0, %c1 : tensor<5x?x?xf32> %1 = tensor.dim %arg0, %c2 : tensor<5x?x?xf32> %2 = tensor.empty(%0, %1) : tensor<5x?x?xf32> %3 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%cst, %arg0 : tensor, tensor<5x?x?xf32>) outs(%2 : tensor<5x?x?xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %4 = arith.mulf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<5x?x?xf32> return %3 : tensor<5x?x?xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @producer_indexed_consumer_fusion(%arg0: tensor, %arg1: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg2: i32, %arg3: i32, %arg4: i32): %10 = arith.addi %arg2, %arg3 : i32 linalg.yield %10 : i32 } -> tensor %4 = linalg.generic { indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%3 : tensor) outs(%2 : tensor) { ^bb0(%arg2: i32, %arg3: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %5 = arith.index_cast %idx0 : index to i32 %6 = arith.index_cast %idx1 : index to i32 %7 = arith.addi %arg2, %5 : i32 %8 = arith.subi %7, %6 : i32 linalg.yield %8 : i32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @indexed_producer_consumer_fusion(%arg0: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic { indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%2 : tensor) { ^bb0(%arg4: i32, %arg5: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %4 = arith.index_cast %idx0 : index to i32 %5 = arith.index_cast %idx1 : index to i32 %6 = arith.addi %arg4, %4 : i32 %7 = arith.subi %6, %5 : i32 linalg.yield %7 : i32 } -> tensor %4 = linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%3, %arg0 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg2: i32, %arg3: i32, %arg4: i32): %10 = arith.addi %arg2, %arg3 : i32 linalg.yield %10 : i32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1) -> (d0, d1)> func.func @indexed_producer_indexed_consumer_fusion(%arg0: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic { indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%2 : tensor) { ^bb0(%arg2: i32, %arg3: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %4 = arith.index_cast %idx0 : index to i32 %5 = arith.index_cast %idx1 : index to i32 %6 = arith.addi %arg2, %4 : i32 %7 = arith.subi %5, %6 : i32 linalg.yield %7 : i32 } -> tensor %4= linalg.generic { indexing_maps = [#map1, #map1], iterator_types = [""parallel"", ""parallel""] } ins(%3 : tensor) outs(%2 : tensor) { ^bb0(%arg2: i32, %arg3: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %5 = arith.index_cast %idx0 : index to i32 %6 = arith.index_cast %idx1 : index to i32 %7 = arith.addi %arg2, %5 : i32 %8 = arith.subi %7, %6 : i32 linalg.yield %8 : i32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map1 = affine_map<(d0) -> (d0)> #map2 = affine_map<(d0, d1) -> (d0, d1)> #map3 = affine_map<(d0, d1) -> (d1)> func.func @one_dim_indexed_producer_consumer_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %0 = tensor.empty(%d0) : tensor %1 = linalg.generic {indexing_maps = [#map1, #map1], iterator_types = [""parallel""]} ins(%arg0 : tensor) outs(%0 : tensor) { ^bb0(%arg2 : i32, %arg3 : i32): %2 = linalg.index 0 : index %3 = arith.index_cast %2 : index to i32 %4 = arith.addi %arg2, %3 : i32 linalg.yield %4 : i32 } -> tensor %2 = tensor.dim %arg1, %c0 : tensor %3 = tensor.dim %arg1, %c1 : tensor %4 = tensor.empty(%2, %3) : tensor %5 = linalg.generic {indexing_maps = [#map2, #map3, #map2], iterator_types = [""parallel"", ""parallel""]} ins(%arg1, %1 : tensor, tensor) outs(%4 : tensor) { ^bb0(%arg2 : i32, %arg3 : i32, %arg4: i32): %6 = arith.addi %arg2, %arg3 : i32 linalg.yield %6 : i32 } -> tensor return %5 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @scalar_generic_fusion (%arg0: tensor<5x1x1xf32>, %arg1 : tensor) -> tensor<10xf32> { %c0 = arith.constant 0 : index %cst = arith.constant dense<1.000000e+00> : tensor<10xf32> %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%arg1 : tensor) outs(%0 : tensor) { ^bb0(%arg2: i32, %arg3: f32): %3 = arith.index_cast %arg2 : i32 to index %4 = tensor.extract %arg0[%3, %c0, %c0] : tensor<5x1x1xf32> linalg.yield %4 : f32 } -> tensor %2 = tensor.empty() : tensor<10xf32> %3 = linalg.generic {indexing_maps = [affine_map<(d0) -> ()>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins(%1, %cst : tensor, tensor<10xf32>) outs(%2 : tensor<10xf32>) { ^bb0(%arg2: f32, %arg3: f32, %arg4: f32): %4 = arith.mulf %arg2, %arg3 : f32 linalg.yield %4 : f32 } -> tensor<10xf32> return %3 : tensor<10xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @constant_fusion(%arg0 : tensor<4xf32>) -> (tensor<4xf32>) { %cst = arith.constant dense<1.0> : tensor<4xf32> %1 = tensor.empty() : tensor<4xf32> %2 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins (%arg0, %cst : tensor<4xf32>, tensor<4xf32>) outs (%1 : tensor<4xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %3 = arith.addf %arg1, %arg2 : f32 linalg.yield %3 : f32 } -> tensor<4xf32> return %2 : tensor<4xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0) -> (0, d0)> #map2 = affine_map<(d0) -> (0)> func.func @consumer_with_reduction(%arg0: tensor<1x10xf32>, %arg1: tensor<1x10xf32>, %arg2: tensor<1xf32>) -> tensor<1xf32> { %init = tensor.empty() : tensor<1x10xf32> %0 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor<1x10xf32>, tensor<1x10xf32>) outs(%init : tensor<1x10xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %2 = arith.addf %arg3, %arg4 : f32 linalg.yield %2 : f32 } -> tensor<1x10xf32> %1 = linalg.generic {indexing_maps = [#map1, #map2], iterator_types = [""reduction""]} ins(%0 : tensor<1x10xf32>) outs(%arg2 : tensor<1xf32>) { ^bb0(%arg3: f32, %arg4: f32): %2 = arith.addf %arg3, %arg4 : f32 linalg.yield %2 : f32 } -> tensor<1xf32> return %1 : tensor<1xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @sigmoid_dynamic_dim(%0: tensor) -> tensor { %cp5 = arith.constant 5.000000e-01 : f32 %c0 = arith.constant 0 : index %shape = shape.shape_of %0 : tensor -> tensor %extend = shape.to_extent_tensor %shape : tensor -> tensor<2xindex> %extracted = tensor.extract %extend[%c0] : tensor<2xindex> %init0 = tensor.empty(%extracted) : tensor %1 = linalg.generic {indexing_maps = [ affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } outs(%init0 : tensor) { ^bb0(%a: f32): linalg.yield %cp5 : f32 } -> tensor %d0 = tensor.dim %0, %c0 : tensor %init1 = tensor.empty(%d0) : tensor %2 = linalg.generic {indexing_maps = [ affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%0, %1 : tensor, tensor) outs(%init1 : tensor) { ^bb0(%a: f32, %b: f32, %c: f32): %m = arith.mulf %a, %b : f32 linalg.yield %m : f32 } -> tensor return %2 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func private @compute1(%a: f64) -> f64 func.func private @compute2(%a: f64, %b: i32) -> i32 func.func @generic_index_op2(%arg0: tensor<1x8xf64>, %arg1: tensor<1x8xi32>) -> tensor<1x8xi32> { %0 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""]} outs(%arg0 : tensor<1x8xf64>) { ^bb0(%a: f64): %r = func.call @compute1(%a) : (f64) -> f64 linalg.yield %r : f64 } -> tensor<1x8xf64> %1 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""]} ins(%0 : tensor<1x8xf64>) outs(%arg1 : tensor<1x8xi32>) { ^bb0(%a: f64, %b: i32): %r = func.call @compute2(%a, %b) : (f64, i32) -> i32 linalg.yield %r : i32 } -> tensor<1x8xi32> return %1 : tensor<1x8xi32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @no_fuse_constant_with_reduction() -> tensor<3xf32> { %three = arith.constant dense<3.0> : tensor<3x2xf32> %init = tensor.empty() : tensor<3xf32> %result = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%three : tensor<3x2xf32>) outs(%init : tensor<3xf32>) { ^bb0(%arg0 : f32, %arg1 : f32): %0 = arith.addf %arg0, %arg1 : f32 linalg.yield %0 : f32 } -> tensor<3xf32> return %result : tensor<3xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> #trait = { indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel""] } func.func @break_outs_dependency(%arg0 : tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0 : tensor) outs(%arg0 : tensor) { ^bb0(%arg1 : f32, %arg2 : f32) : %1 = arith.addf %arg1, %arg1 : f32 linalg.yield %1 : f32 } -> tensor %2 = linalg.generic #trait ins(%0 : tensor) outs(%0 : tensor) { ^bb0(%arg1 : f32, %arg2 : f32) : %3 = arith.mulf %arg1, %arg1 : f32 linalg.yield %3 : f32 } -> tensor return %2 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @fuse_scalar_constant(%arg0 : tensor) -> (tensor, tensor) { %cst = arith.constant 4.0 : f32 %c42 = arith.constant 42 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %0 = tensor.empty(%d0, %d1) : tensor %1 = tensor.empty(%d0, %d1) : tensor %2:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %cst, %c42 : tensor, f32, i32) outs(%0, %1 : tensor, tensor) { ^bb0(%arg1 : f32, %arg2 : f32, %arg3 : i32, %arg4 : f32, %arg5 : i32) : %3 = arith.addf %arg1, %arg2 : f32 linalg.yield %3, %arg3 : f32, i32 } -> (tensor, tensor) return %2#0, %2#1 : tensor, tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_fold_2d_fp32(%init: tensor<3x2xf32>) -> tensor<3x2xf32> { %input = arith.constant dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf32> %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%input : tensor<2x3xf32>) outs(%init : tensor<3x2xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } -> tensor<3x2xf32> return %1 : tensor<3x2xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_fold_2d_fp64(%init: tensor<3x2xf64>) -> tensor<3x2xf64> { %input = arith.constant dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf64> %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%input : tensor<2x3xf64>) outs(%init : tensor<3x2xf64>) { ^bb0(%arg1: f64, %arg2: f64): linalg.yield %arg1 : f64 } -> tensor<3x2xf64> return %1 : tensor<3x2xf64> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_fold_4d_i32(%init: tensor<3x1x4x2xi32>) -> tensor<3x1x4x2xi32> { %input = arith.constant dense<[[ [[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]], [[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]] ]]> : tensor<1x2x3x4xi32> %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d2, d0, d3, d1)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } ins(%input : tensor<1x2x3x4xi32>) outs(%init : tensor<3x1x4x2xi32>) { ^bb0(%arg1: i32, %arg2: i32): linalg.yield %arg1 : i32 } -> tensor<3x1x4x2xi32> return %1 : tensor<3x1x4x2xi32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_fold_4d_i16(%init: tensor<3x1x4x2xi16>) -> tensor<3x1x4x2xi16> { %input = arith.constant dense<[[ [[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]], [[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23]] ]]> : tensor<1x2x3x4xi16> %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d2, d0, d3, d1)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } ins(%input : tensor<1x2x3x4xi16>) outs(%init : tensor<3x1x4x2xi16>) { ^bb0(%arg1: i16, %arg2: i16): linalg.yield %arg1 : i16 } -> tensor<3x1x4x2xi16> return %1 : tensor<3x1x4x2xi16> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_nofold_non_cst_input(%input: tensor<2x3xf32>, %init: tensor<3x2xf32>) -> tensor<3x2xf32> { %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%input : tensor<2x3xf32>) outs(%init : tensor<3x2xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } -> tensor<3x2xf32> return %1 : tensor<3x2xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_nofold_yield_const(%init: tensor<3x2xf32>) -> tensor<3x2xf32> { %input = arith.constant dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf32> %cst = arith.constant 8.0 : f32 %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%input : tensor<2x3xf32>) outs(%init : tensor<3x2xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %cst : f32 } -> tensor<3x2xf32> return %1 : tensor<3x2xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @transpose_nofold_multi_ops_in_region(%init: tensor<3x2xf32>) -> tensor<3x2xf32> { %input = arith.constant dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> : tensor<2x3xf32> %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%input : tensor<2x3xf32>) outs(%init : tensor<3x2xf32>) { ^bb0(%arg1: f32, %arg2: f32): %add = arith.addf %arg1, %arg1 : f32 linalg.yield %add : f32 } -> tensor<3x2xf32> return %1 : tensor<3x2xf32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> ()> #map1 = affine_map<(d0, d1) -> (d0, d1)> #map2 = affine_map<(d0, d1) -> (d1, d0)> #map3 = affine_map<(d0, d1) -> (d0)> func.func @no_fusion_missing_reduction_shape(%arg0: tensor, %arg1: index) -> tensor { %cst = arith.constant 0xFF800000 : f32 %4 = tensor.empty(%arg1, %arg1) : tensor %5 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%4 : tensor) { ^bb0(%arg2: f32, %arg3: f32): linalg.yield %arg2 : f32 } -> tensor %6 = tensor.empty(%arg1) : tensor %7 = linalg.fill ins(%cst : f32) outs(%6 : tensor) -> tensor %8 = linalg.generic { indexing_maps = [#map2, #map3], iterator_types = [""parallel"", ""reduction""] } ins(%5 : tensor) outs(%7 : tensor) { ^bb0(%arg2: f32, %arg3: f32): %9 = arith.maxf %arg2, %arg3 : f32 linalg.yield %9 : f32 } -> tensor return %8 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @fusion_different_axes(%arg0 : tensor<5000xi64>, %arg1 : tensor<5000xi32>) -> tensor<5000xi32> { %c1_i32 = arith.constant 1 : i32 %0 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%arg0 : tensor<5000xi64>) { ^bb0(%arg3: i64): %22 = linalg.index 0 : index %23 = arith.index_cast %22 : index to i64 linalg.yield %23 : i64 } -> tensor<5000xi64> %1 = tensor.empty() : tensor<5000xi32> %2 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%0 : tensor<5000xi64>) outs(%1 : tensor<5000xi32>) { ^bb0(%arg3: i64, %arg5: i32): %22 = arith.index_cast %arg3 : i64 to index %23 = tensor.extract %arg1[%22] : tensor<5000xi32> linalg.yield %23 : i32 } -> tensor<5000xi32> return %2 : tensor<5000xi32> }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @fold_fill_generic_basic(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %cst = arith.constant 7.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.empty(%0) : tensor %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor) -> tensor %3 = tensor.empty(%0) : tensor %4 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types=[""parallel""]} ins(%arg0, %2 : tensor, tensor) outs (%3:tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %5 = arith.addf %arg1, %arg2 : f32 linalg.yield %5 : f32 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @fold_fill_generic_different_dtype(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %cst = arith.constant 7.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.empty(%0) : tensor %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor) -> tensor %3 = tensor.empty(%0) : tensor %4 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types=[""parallel""]} ins(%arg0, %2 : tensor, tensor) outs (%3:tensor) { ^bb0(%arg1: f16, %arg2: f16, %arg3: f16): %5 = arith.addf %arg1, %arg2 : f16 linalg.yield %5 : f16 } -> tensor return %4 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @fold_fill_generic_mixedaccess(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 0 : index %cst1 = arith.constant 7.0 : f32 %cst2 = arith.constant 6.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.fill ins(%cst1 : f32) outs(%2 : tensor) -> tensor %4 = tensor.empty(%1, %0) : tensor %5 = linalg.fill ins(%cst2 : f32) outs(%4 : tensor) -> tensor %6 = tensor.empty(%0, %1) : tensor %7 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types=[""parallel"",""parallel""]} ins(%3, %5 : tensor, tensor) outs (%6:tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %8 = arith.divf %arg1, %arg2 : f32 linalg.yield %8 : f32 } -> tensor return %7 : tensor }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map = affine_map<() -> ()> module { func.func @fuse_multi_result_producer(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor, %arg4: tensor) -> tensor { %0 = tensor.empty() : tensor %1 = tensor.empty() : tensor %2:2 = linalg.generic { indexing_maps = [#map, #map, #map, #map, #map], iterator_types = []} ins(%arg0, %arg1, %arg1 : tensor, tensor, tensor) outs(%0, %1 : tensor, tensor) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32, %arg8: f32, %arg9: f32): %4 = arith.addf %arg5, %arg6 : f32 %5 = arith.addf %4, %arg7 : f32 linalg.yield %4, %5 : f32, f32 } -> (tensor, tensor) %3 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = []} ins(%2#1, %arg1 : tensor, tensor) outs(%arg4 : tensor) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %4 = arith.addf %arg5, %arg6 : f32 %5 = arith.addf %4, %arg6 : f32 linalg.yield %5 : f32 } -> tensor return %3 : tensor } }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @mixed_fusion(%arg0: tensor, %arg1 : tensor, %arg2 : tensor, %arg8 : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %4 = arith.addf %arg3, %arg4 : f32 linalg.yield %4 : f32 } -> tensor linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%3, %arg2 : tensor, tensor) outs(%arg8 : memref) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %5 = arith.mulf %arg5, %arg6 : f32 linalg.yield %5 : f32 } return }", mlir-opt -linalg-fuse-elementwise-ops -split-input-file ,1 "func.func @static_data_only(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<2x1xf32> { %0 = tensor.pad %arg0 low[0, 0] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<11x13xf32> %1 = tensor.extract_slice %0[1, 2] [2, 1] [1, 1] : tensor<11x13xf32> to tensor<2x1xf32> return %1 : tensor<2x1xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @static_high_pad_only(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<2x4xf32> { %0 = tensor.pad %arg0 low[0, 0] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<11x13xf32> %1 = tensor.extract_slice %0[4, 5] [2, 4] [1, 1] : tensor<11x13xf32> to tensor<2x4xf32> return %1 : tensor<2x4xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @static_low_pad_only(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<2x3xf32> { %0 = tensor.pad %arg0 low[3, 7] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<14x20xf32> %1 = tensor.extract_slice %0[1, 3] [2, 3] [1, 1] : tensor<14x20xf32> to tensor<2x3xf32> return %1 : tensor<2x3xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @static_low_pad_only_2(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<1x3xf32> { %0 = tensor.pad %arg0 low[3, 7] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<14x20xf32> %1 = tensor.extract_slice %0[1, 3] [1, 3] [1, 1] : tensor<14x20xf32> to tensor<1x3xf32> return %1 : tensor<1x3xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @static_mixed_data_high_pad(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<3x4xf32> { %0 = tensor.pad %arg0 low[0, 0] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<11x13xf32> %1 = tensor.extract_slice %0[2, 4] [3, 4] [1, 1] : tensor<11x13xf32> to tensor<3x4xf32> return %1 : tensor<3x4xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @static_mixed_data_low_pad(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<3x4xf32> { %0 = tensor.pad %arg0 low[3, 7] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<14x20xf32> %1 = tensor.extract_slice %0[2, 4] [3, 4] [1, 1] : tensor<14x20xf32> to tensor<3x4xf32> return %1 : tensor<3x4xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @static_mixed_data_low_high_pad(%arg0 : tensor<4x5xf32>, %pad : f32) -> tensor<7x9xf32> { %0 = tensor.pad %arg0 low[2, 3] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor<4x5xf32> to tensor<13x16xf32> %1 = tensor.extract_slice %0[1, 2] [7, 9] [1, 1] : tensor<13x16xf32> to tensor<7x9xf32> return %1 : tensor<7x9xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @dynamic_high_pad(%arg0 : tensor, %h1: index, %pad : f32) -> tensor<3x4xf32> { %0 = tensor.pad %arg0 low[0, 0] high[%h1, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor to tensor %1 = tensor.extract_slice %0[2, 4] [3, 4] [1, 1] : tensor to tensor<3x4xf32> return %1 : tensor<3x4xf32> }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @dynamic_extract_size(%arg0 : tensor, %s1: index, %pad : f32) -> tensor { %0 = tensor.pad %arg0 low[0, 0] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor to tensor %1 = tensor.extract_slice %0[2, 4] [%s1, 4] [1, 1] : tensor to tensor return %1 : tensor }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @dynamic_zero_low_padding(%arg0 : tensor, %pad : f32, %o1 : index, %o2 : index, %s1 : index, %s2 : index) -> tensor { %0 = tensor.pad %arg0 low[0, 0] high[7, 8] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor to tensor %1 = tensor.extract_slice %0[%o1, %o2] [%s1, %s2] [1, 1] : tensor to tensor return %1 : tensor }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @dynamic_zero_high_padding(%arg0 : tensor, %pad : f32, %o1 : index, %o2 : index, %s1 : index, %s2 : index) -> tensor { %0 = tensor.pad %arg0 low[7, 8] high[0, 0] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad : f32 } : tensor to tensor %1 = tensor.extract_slice %0[%o1, %o2] [%s1, %s2] [1, 1] : tensor to tensor return %1 : tensor }", mlir-opt -test-linalg-transform-patterns=test-swap-subtensor-padtensor -canonicalize -split-input-file ,1 "func.func @linalg_fill(%t: tensor, %f: f32) -> index { %0 = linalg.fill ins(%f : f32) outs(%t : tensor) -> tensor %1 = ""test.reify_bound""(%0) {dim = 0} : (tensor) -> (index) return %1 : index }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "#accesses = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel"", ""parallel""] } func.func @linalg_index(%arg0: memref, %arg1: memref) { linalg.generic #trait ins(%arg0 : memref) outs(%arg1 : memref) { ^bb(%a: f32, %b: f32): %0 = linalg.index 0 : index %ub_0 = ""test.reify_bound""(%0) {type = ""UB""} : (index) -> (index) ""test.some_use""(%ub_0) : (index) -> () %lb_0 = ""test.reify_bound""(%0) {type = ""LB""} : (index) -> (index) ""test.some_use""(%lb_0) : (index) -> () %1 = linalg.index 1 : index %ub_1 = ""test.reify_bound""(%1) {type = ""UB""} : (index) -> (index) ""test.some_use""(%ub_1) : (index) -> () %2 = linalg.index 2 : index %ub_2 = ""test.reify_bound""(%2) {type = ""UB""} : (index) -> (index) ""test.some_use""(%ub_2) : (index) -> () linalg.yield %b : f32 } return }", mlir-opt -test-affine-reify-value-bounds -verify-diagnostics -split-input-file ,1 "#map = affine_map<() -> ()> func.func @detensor_simple(%arg1: tensor, %arg2: tensor) -> tensor attributes {iree.module.export} { %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%arg1, %arg2 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %2 = arith.addf %arg3, %arg4 : f32 linalg.yield %2 : f32 } -> tensor return %1: tensor } func.func @detensor_op_sequence(%arg1: tensor, %arg2: tensor) -> tensor attributes {iree.module.export} { %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%arg1, %arg2 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %2 = arith.addf %arg3, %arg4 : f32 linalg.yield %2 : f32 } -> tensor %3 = tensor.empty() : tensor %4 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%arg1, %1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %5 = arith.mulf %arg3, %arg4 : f32 linalg.yield %5 : f32 } -> tensor %6 = tensor.empty() : tensor %7 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%1, %4 : tensor, tensor) outs(%6 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %5 = arith.divf %arg3, %arg4 : f32 linalg.yield %5 : f32 } -> tensor return %7: tensor } func.func @detensor_multiple_ops(%arg1: tensor, %arg2: tensor) -> tensor attributes {iree.module.export} { %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%arg1, %arg2 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %2 = arith.addf %arg3, %arg4 : f32 %3 = arith.mulf %2, %arg4 : f32 linalg.yield %3 : f32 } -> tensor return %1: tensor } func.func @detensor_foreign_op(%arg1: tensor, %arg2: tensor) -> tensor attributes {iree.module.export} { %0 = tensor.empty() : tensor %1 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%arg1, %arg2 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %2 = ""foreign.do_something""(%arg3, %arg4) {} : (f32, f32) -> f32 linalg.yield %2 : f32 } -> tensor return %1: tensor }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize{aggressive-mode}))"" ",1 "func.func @fuse_unary(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.elemwise_unary ins(%arg0 : tensor) outs(%arg1: tensor) -> tensor %1 = linalg.elemwise_binary ins(%0, %arg0 : tensor, tensor) outs(%arg1: tensor) -> tensor return %1 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.elemwise_binary""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [32, 32], tile_interchange = [0, 1]} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @fuse_unary(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.elemwise_unary ins(%arg0 : tensor) outs(%arg1: tensor) -> tensor %1 = linalg.elemwise_binary ins(%0, %arg0 : tensor, tensor) outs(%arg1: tensor) -> tensor return %1 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.elemwise_binary""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [32, 32], tile_interchange = [0, 1]} : (!transform.any_op) -> (!transform.any_op, !transform.op<""scf.for"">, !transform.any_op) transform.loop.peel %loops#0 : (!transform.op<""scf.for"">) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @interchange_reduction(%input: tensor<12x7x25xf32>) -> tensor<12x25xf32> { %five = arith.constant 5.0 : f32 %init = tensor.empty() : tensor<12x25xf32> %fill = linalg.fill ins(%five : f32) outs(%init : tensor<12x25xf32>) -> tensor<12x25xf32> %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d2)>], iterator_types = [""parallel"", ""reduction"", ""parallel""] } ins(%input : tensor<12x7x25xf32>) outs(%fill : tensor<12x25xf32>) { ^bb0(%arg0: f32, %arg1: f32): %2 = arith.addf %arg0, %arg1 : f32 linalg.yield %2 : f32 } -> tensor<12x25xf32> func.return %0 : tensor<12x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [5, 0, 7], tile_interchange = [0, 2, 1]} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) %2, %loops_2 = transform.structured.tile %1 [0, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @unpack_elemwise(%arg0: tensor<16x48x8x8xf32>, %arg1: tensor<128x384xf32>) -> tensor<128x384xf32> { %0 = tensor.empty() : tensor<128x384xf32> %1 = tensor.unpack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 8] into %0 : tensor<16x48x8x8xf32> -> tensor<128x384xf32> %2 = linalg.elemwise_unary ins(%1: tensor<128x384xf32>) outs(%arg1: tensor<128x384xf32>) -> tensor<128x384xf32> return %2 : tensor<128x384xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.elemwise_unary""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.fuse %0 {tile_sizes = [16, 32], tile_interchange = [0, 1]} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @gemm(%a : memref, %b : memref, %c : memref) { linalg.matmul ins(%a, %b: memref, memref) outs(%c: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [16, 16, 16] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2 = transform.structured.promote %1 { operands_to_promote = [0, 2], force_full_tiles = [false, false], use_full_tiles_by_default } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -canonicalize -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> #map1 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map2 = affine_map<(d0, d1, d2) -> ()> func.func @generic_op_reshape_producer_fusion(%arg0 : tensor, %arg1 : tensor, %arg2 : f32) -> tensor { %0 = tensor.collapse_shape %arg0 [[0], [1, 2], [3]] : tensor into tensor %1 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1, %arg2 : tensor, tensor, f32) outs(%arg1 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32, %s: f32): %1 = arith.mulf %arg3, %arg4 : f32 %2 = arith.addf %1, %arg5 : f32 linalg.yield %2 : f32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> ()> func.func @generic_op_reshape_consumer_fusion(%arg0 : tensor, %arg1 : tensor, %arg2 : f32) -> tensor { %0 = linalg.generic { indexing_maps = [#map0, #map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor, tensor, f32) outs(%arg0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32, %s: f32): %1 = arith.mulf %arg3, %arg4 : f32 %2 = arith.addf %1, %arg5 : f32 linalg.yield %2 : f32 } -> tensor %1 = tensor.expand_shape %0 [[0], [1, 2, 3]] : tensor into tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @reshape_as_consumer_permutation (%a : tensor, %b : tensor) -> tensor { %c = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d2, d1)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%a, %b : tensor, tensor) outs(%a : tensor) { ^bb0(%arg0 : f32, %arg1: f32, %s: f32): %1 = arith.addf %arg0, %arg1 : f32 linalg.yield %1 : f32 } -> tensor %d = tensor.expand_shape %c [[0, 1], [2], [3, 4, 5]] : tensor into tensor return %d : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1, d2) -> (d0, d1)> #map2 = affine_map<(d0, d1, d2) -> (d2)> func.func @generic_op_reshape_consumer_static(%arg0: tensor<264x4xf32>) -> tensor<8x33x4xf32> { %cst = arith.constant dense<2.000000e+00> : tensor<264x4xf32> %0 = tensor.empty() : tensor<264x4xf32> %1 = linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %cst : tensor<264x4xf32>, tensor<264x4xf32>) outs(%0 : tensor<264x4xf32>) { ^bb0(%arg1: f32, %arg2: f32, %s: f32): %2 = arith.mulf %arg1, %arg2 : f32 linalg.yield %2 : f32 } -> tensor<264x4xf32> %2 = tensor.expand_shape %1 [[0, 1], [2]] : tensor<264x4xf32> into tensor<8x33x4xf32> return %2 : tensor<8x33x4xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> #map1 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> func.func @indexed_consumer_reshape_producer_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %0 = tensor.collapse_shape %arg0 [[0], [1, 2], [3]]: tensor into tensor %1 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3: i32, %arg4: i32, %s: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %1 = arith.muli %arg3, %arg4 : i32 %2 = arith.index_cast %idx0 : index to i32 %3 = arith.addi %1, %2 : i32 %4 = arith.index_cast %idx1 : index to i32 %5 = arith.addi %3, %4 : i32 %6 = arith.index_cast %idx2 : index to i32 %7 = arith.addi %5, %6 : i32 linalg.yield %7 : i32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @indexed_producer_reshape_consumer_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %0 = linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg3: i32, %arg4: i32, %s: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %1 = arith.muli %arg3, %arg4 : i32 %2 = arith.index_cast %idx0 : index to i32 %3 = arith.addi %1, %2 : i32 %4 = arith.index_cast %idx1 : index to i32 %5 = arith.addi %3, %4 : i32 linalg.yield %5 : i32 } -> tensor %1 = tensor.expand_shape %0 [[0], [1, 2, 3]] : tensor into tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @reshape_as_consumer_permutation (%a : tensor<210x6x4xi32>, %b : tensor<210x4xi32>) -> tensor<2x3x4x5x6x7xi32> { %shape = tensor.empty() : tensor<6x4x210xi32> %c = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d2, d1)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%a, %b : tensor<210x6x4xi32>, tensor<210x4xi32>) outs(%shape : tensor<6x4x210xi32>) { ^bb0(%arg3 : i32, %arg4: i32, %s: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %1 = arith.addi %arg3, %arg4 : i32 %2 = arith.index_cast %idx0 : index to i32 %3 = arith.addi %1, %2 : i32 %4 = arith.index_cast %idx1 : index to i32 %5 = arith.addi %3, %4 : i32 %6 = arith.index_cast %idx2 : index to i32 %7 = arith.addi %5, %6 : i32 linalg.yield %7 : i32 } -> tensor<6x4x210xi32> %d = tensor.expand_shape %c [[0, 1], [2], [3, 4, 5]] : tensor<6x4x210xi32> into tensor<2x3x4x5x6x7xi32> return %d : tensor<2x3x4x5x6x7xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @reshape_as_producer_projected_permutation( %arg0 : tensor<33x8x?xi32>, %shape : tensor<264x?x4xi32>) -> tensor<264x?x4xi32> { %0 = tensor.collapse_shape %arg0 [[0, 1], [2]] : tensor<33x8x?xi32> into tensor<264x?xi32> %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%0 : tensor<264x?xi32>) outs(%shape : tensor<264x?x4xi32>) { ^bb0(%arg1: i32, %s: i32): %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %2 = arith.index_cast %idx0 : index to i32 %3 = arith.addi %arg1, %2 : i32 %4 = arith.index_cast %idx1 : index to i32 %5 = arith.addi %3, %4 : i32 %6 = arith.index_cast %idx2 : index to i32 %7 = arith.addi %5, %6 : i32 linalg.yield %7 : i32 } -> tensor<264x?x4xi32> return %1 : tensor<264x?x4xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @generic_op_reshape_consumer_fusion_projected(%arg0 : tensor, %arg1 : tensor) -> tensor { %0 = linalg.generic { indexing_maps = [#map0, #map0, #map1], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %s: f32): %1 = arith.mulf %arg3, %arg4 : f32 linalg.yield %1 : f32 } -> tensor %1 = tensor.expand_shape %0 [[0], [1, 2, 3]] : tensor into tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @no_fuse_dynamic_dims(%arg0: tensor) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor into tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.empty(%1) : tensor %3 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins(%0 : tensor) outs(%2 : tensor) { ^bb0(%arg1 : f32, %arg2: f32): %4 = arith.addf %arg1, %arg1 : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @no_fuse_mismatched_dynamism(%arg0: tensor<2x1xi64>, %arg1: tensor) -> tensor<2xi64> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<2x1xi64> into tensor<2xi64> %1 = tensor.empty() : tensor<2xi64> %2 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins(%0, %arg1 : tensor<2xi64>, tensor) outs(%1 : tensor<2xi64>) { ^bb0(%arg4: i64, %arg5: i64, %arg6: i64): %3 = arith.addi %arg4, %arg5 : i64 linalg.yield %3 : i64 } -> tensor<2xi64> return %2 : tensor<2xi64> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @reshape_as_consumer_permutation_with_multiple_results (%a : tensor, %b : tensor) -> (tensor, tensor) { %c:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d0, d2)>, affine_map<(d0, d1, d2) -> (d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d2, d1)>, affine_map<(d0, d1, d2) -> (d2, d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%a, %b : tensor, tensor) outs(%a, %a : tensor, tensor) { ^bb0(%arg0 : f32, %arg1: f32, %s: f32, %t : f32): %1 = arith.addf %arg0, %arg1 : f32 linalg.yield %1, %1 : f32, f32 } -> (tensor, tensor) %d = tensor.expand_shape %c#0 [[0, 1], [2], [3, 4, 5]] : tensor into tensor %e = tensor.expand_shape %c#1 [[0], [1, 2], [3, 4, 5]] : tensor into tensor return %d, %e : tensor, tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d1)> #map1 = affine_map<(d0, d1) -> (d0, d1)> module { func.func @multi_result_op_expansion(%arg0: tensor<512xf32>, %arg1: tensor<512xf32>, %arg2: tensor<512xf32>, %arg3: tensor<200x512xf32>) -> tensor<25x8x1x512xf32> { %0:2 = linalg.generic { indexing_maps = [#map0, #map0, #map0, #map1], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor<512xf32>, tensor<512xf32>) outs(%arg2, %arg3 : tensor<512xf32>, tensor<200x512xf32>) { ^bb0(%arg4: f32, %arg5: f32, %arg6: f32, %arg7: f32): %2 = arith.addf %arg4, %arg5 : f32 linalg.yield %2, %2 : f32, f32 } -> (tensor<512xf32>, tensor<200x512xf32>) %1 = tensor.expand_shape %0#1 [[0, 1, 2], [3]] : tensor<200x512xf32> into tensor<25x8x1x512xf32> return %1 : tensor<25x8x1x512xf32> } }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-expansion -split-input-file ,1 "func.func @conv_non_static(%arg0: tensor, %arg1: tensor<3x3x4x16xf32>, %arg2: tensor) -> tensor { %0 = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%arg0, %arg1: tensor, tensor<3x3x4x16xf32>) outs(%arg2: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nhwc_hwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @conv_16433136(%arg0: tensor<1x16x16x4xf32>, %arg1: tensor<3x3x4x16xf32>, %arg2: tensor<1x14x14x16xf32>) -> tensor<1x14x14x16xf32> { %0 = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%arg0, %arg1: tensor<1x16x16x4xf32>, tensor<3x3x4x16xf32>) outs(%arg2: tensor<1x14x14x16xf32>) -> tensor<1x14x14x16xf32> return %0 : tensor<1x14x14x16xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nhwc_hwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %img2col_tensor_producer, %transformed = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.print %img2col_tensor_producer {name = ""tensor_producer""}: !transform.any_op transform.print %transformed {name = ""transformed""}: !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_hwc_114x16x3(%input: tensor<1x114x114x16xf32>, %filter: tensor<3x3x16xf32>, %output: tensor<1x112x112x16xf32>) -> tensor<1x112x112x16xf32> { %0 = linalg.depthwise_conv_2d_nhwc_hwc { dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : tensor<1x114x114x16xf32>, tensor<3x3x16xf32>) outs(%output : tensor<1x112x112x16xf32>) -> tensor<1x112x112x16xf32> return %0 : tensor<1x112x112x16xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.depthwise_conv_2d_nhwc_hwc""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @batch_nhwc_conv(%arg0: tensor<8x16x16x4xf32>, %arg1: tensor<3x3x4x16xf32>, %arg2: tensor<8x14x14x16xf32>) -> tensor<8x14x14x16xf32> { %0 = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%arg0, %arg1: tensor<8x16x16x4xf32>, tensor<3x3x4x16xf32>) outs(%arg2: tensor<8x14x14x16xf32>) -> tensor<8x14x14x16xf32> return %0 : tensor<8x14x14x16xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nhwc_hwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @batch_nchw_conv(%arg0: tensor<8x4x16x16xf32>, %arg1: tensor<16x4x3x3xf32>, %arg2: tensor<8x16x14x14xf32>) -> tensor<8x16x14x14xf32> { %0 = linalg.conv_2d_nchw_fchw {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%arg0, %arg1: tensor<8x4x16x16xf32>, tensor<16x4x3x3xf32>) outs(%arg2: tensor<8x16x14x14xf32>) -> tensor<8x16x14x14xf32> return %0 : tensor<8x16x14x14xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nchw_fchw""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @conv_integer_extend(%arg0: tensor<1x16x16x4xi8>, %arg1: tensor<3x3x4x16xi8>, %arg2: tensor<1x14x14x16xi32>) -> tensor<1x14x14x16xi32> { %0 = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%arg0, %arg1: tensor<1x16x16x4xi8>, tensor<3x3x4x16xi8>) outs(%arg2: tensor<1x14x14x16xi32>) -> tensor<1x14x14x16xi32> return %0 : tensor<1x14x14x16xi32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nhwc_hwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %img2col_tensor_producer, %transformed = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.print %img2col_tensor_producer {name = ""tensor_producer""}: !transform.any_op transform.print %transformed {name = ""transformed""}: !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @memref_cast(%a: index, %b: index) -> memref { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c8 = arith.constant 8 : index %c16 = arith.constant 16 : index %1 = memref.alloc (%b) : memref %2 = memref.view %1[%c0][] : memref to memref<16x16xf32> %3 = memref.cast %2 : memref<16x16xf32> to memref linalg.matmul ins(%3, %3: memref, memref) outs(%3: memref) return %3: memref }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @dce_zero_memref(%arg0 : memref<0xf32>, %arg1: tensor<0xf32>) -> tensor<0xf32> { memref.copy %arg0, %arg0 : memref<0xf32> to memref<0xf32> %1 = linalg.generic #trait outs(%arg1 : tensor<0xf32>) { ^bb(%0: f32) : linalg.yield %0 : f32 } -> tensor<0xf32> return %1: tensor<0xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @tensor.cast(%a : tensor<3x4xf32>, %b : tensor<4x?xf32>, %c : tensor<3x?xf32>) -> tensor<3x?xf32> { %ta = tensor.cast %a : tensor<3x4xf32> to tensor %tb = tensor.cast %b : tensor<4x?xf32> to tensor %tc = tensor.cast %c : tensor<3x?xf32> to tensor %0 = linalg.matmul ins(%ta, %tb: tensor, tensor) outs(%tc: tensor) -> tensor %1 = tensor.cast %0 : tensor to tensor<3x?xf32> return %1: tensor<3x?xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @tensor.cast.unranked(%a : tensor<*xf32>, %b : tensor<*xf32>, %c : tensor<*xf32>) -> tensor<*xf32> { %ta = tensor.cast %a : tensor<*xf32> to tensor %tb = tensor.cast %b : tensor<*xf32> to tensor %tc = tensor.cast %c : tensor<*xf32> to tensor %0 = linalg.matmul ins(%ta, %tb: tensor, tensor) outs(%tc: tensor) -> tensor %1 = tensor.cast %0 : tensor to tensor<*xf32> return %1: tensor<*xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @linalg_effects(%a : tensor, %b : memref, %c : tensor) { %t = linalg.matmul ins(%a, %b : tensor, memref) outs(%c : tensor) -> tensor linalg.matmul ins(%a, %c : tensor, tensor) outs(%b : memref) return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @remove_no_op(%arg0 : tensor, %arg1 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.dim %arg0, %c2 : tensor %3 = tensor.empty(%0, %1, %2) : tensor %4, %5 = linalg.generic { indexing_maps = [#map, #map, #map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor, tensor) outs(%3, %3 : tensor, tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32, %arg5 : f32): linalg.yield %arg3, %arg2 : f32, f32 } -> (tensor, tensor) return %4, %5 : tensor, tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @remove_no_op_mismatched_types(%arg0 : tensor) -> tensor<1x2x3xf32> { %out = tensor.empty() : tensor<1x2x3xf32> %g = linalg.generic { indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%out : tensor<1x2x3xf32>) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } -> (tensor<1x2x3xf32>) return %g : tensor<1x2x3xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<() -> ()> func.func @cant_fold_to_tensor_cast(%arg0 : f32) -> tensor { %out = tensor.empty() : tensor %g = linalg.generic { indexing_maps = [#map, #map], iterator_types = [] } ins(%arg0 : f32) outs(%out : tensor) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } -> (tensor) return %g : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @keep_not_noop(%arg0 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 1.000000e+00 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor cf.br ^bb1(%cst : f32) ^bb1(%arg1 : f32): %3 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%2 : tensor) { ^bb0(%arg2: f32, %arg3 : f32): linalg.yield %arg1 : f32 } -> tensor return %3 : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @keep_not_noop(%arg0 : tensor, %arg1 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 1.000000e+00 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor cf.br ^bb1(%cst : f32) ^bb1(%arg2 : f32): %3:2 = linalg.generic {indexing_maps = [#map, #map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%2, %2 : tensor, tensor) { ^bb0(%arg3: f32, %arg4 : f32, %arg5 : f32, %arg6 : f32): linalg.yield %arg2, %arg4 : f32, f32 } -> (tensor, tensor) return %3#0, %3#1 : tensor, tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#accesses = [ affine_map<(i, j) -> (i, j)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""] } func.func @dead_linalg_tensor(%arg0 : tensor<7x7xi32>, %arg1 : tensor<7x7xf32>, %arg2: tensor, %high : index) { %c0_i32 = arith.constant 0 : i32 %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = linalg.fill ins(%c0_i32 : i32) outs(%arg0 : tensor<7x7xi32>) -> tensor<7x7xi32> %1 = linalg.matmul ins(%arg1, %arg1: tensor<7x7xf32>, tensor<7x7xf32>) outs(%arg1: tensor<7x7xf32>) -> tensor<7x7xf32> %2 = linalg.generic #trait outs(%arg0 : tensor<7x7xi32>) { ^bb(%3: i32) : linalg.yield %3 : i32 } -> tensor<7x7xi32> %3 = tensor.pad %arg2 low[%c0, %c0] high[%high, %high] { ^bb0(%arg9: index, %arg10: index): tensor.yield %cst : f32 } : tensor to tensor<2x4xf32> return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @propogate_casts(%arg0 : tensor, %arg1 : f32, %arg2 : index, %arg3 : index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c21 = arith.constant 21 : index %c42 = arith.constant 42 : index %0 = tensor.empty(%c21, %c42) : tensor %1 = linalg.fill ins(%arg1 : f32) outs(%0 : tensor) -> tensor %2 = tensor.dim %arg0, %c0 : tensor %3 = tensor.dim %arg0, %c1 : tensor %4 = tensor.insert_slice %arg0 into %1[%arg2, %arg3] [%2, %3] [1, 1] : tensor into tensor return %4 : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @self_copy(%arg0 : memref<2x3x?x4xf32>) { memref.copy %arg0, %arg0 : memref<2x3x?x4xf32> to memref<2x3x?x4xf32> return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_fill_reshape() -> tensor<6x4xf32> { %zero = arith.constant 0.0 : f32 %empty = tensor.empty() : tensor<1x2x3x4xf32> %fill = linalg.fill ins(%zero : f32) outs(%empty : tensor<1x2x3x4xf32>) -> tensor<1x2x3x4xf32> %reshape = tensor.collapse_shape %fill [[0, 1, 2], [3]] : tensor<1x2x3x4xf32> into tensor<6x4xf32> return %reshape : tensor<6x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_fill_reshape_dynamic(%arg0 : tensor) -> tensor { %zero = arith.constant 0.0 : f32 %0 = linalg.fill ins(%zero : f32) outs(%arg0 : tensor) -> tensor %1 = tensor.collapse_shape %0 [[0, 1, 2], [3, 4]] : tensor into tensor return %1 : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_self_copy(%0 : memref<4x16xf32>) { linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%0 : memref<4x16xf32>) outs(%0 : memref<4x16xf32>) { ^bb0(%arg4: f32, %arg5: f32): linalg.yield %arg4 : f32 } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_static_pad_fill() -> tensor<412x276xf32> { %f0 = arith.constant 0.0 : f32 %empty = tensor.empty() : tensor<400x273xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<400x273xf32>) -> tensor<400x273xf32> %pad = tensor.pad %fill low[4, 1] high[8, 2] { ^bb0(%arg1: index, %arg2: index): tensor.yield %f0 : f32 } : tensor<400x273xf32> to tensor<412x276xf32> return %pad : tensor<412x276xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_dynamic_pad_fill(%empty: tensor<8x?x16x32xf32>, %low0: index, %low3: index, %high2: index, %high3: index) -> tensor { %f0 = arith.constant 0.0 : f32 %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<8x?x16x32xf32>) -> tensor<8x?x16x32xf32> %pad = tensor.pad %fill low[%low0, 8, 7, %low3] high[1, 2, %high2, %high3] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %f0 : f32 } : tensor<8x?x16x32xf32> to tensor return %pad : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @no_fold_pad_fill_value_mismatch() -> tensor<412x276xf32> { %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %empty = tensor.empty() : tensor<400x273xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<400x273xf32>) -> tensor<400x273xf32> %pad = tensor.pad %fill low[4, 1] high[8, 2] { ^bb0(%arg1: index, %arg2: index): tensor.yield %f1 : f32 } : tensor<400x273xf32> to tensor<412x276xf32> return %pad : tensor<412x276xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @static_input_without_cast(%arg0 : tensor<2x3x4xf32>, %arg1: tensor) -> tensor<2x3x4xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c0 : tensor<2x3x4xf32> %1 = tensor.dim %arg0, %c1 : tensor<2x3x4xf32> %2 = tensor.dim %arg0, %c2 : tensor<2x3x4xf32> %3 = tensor.empty(%0, %1, %2) : tensor %4 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor<2x3x4xf32>, tensor) outs(%3 : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32): %9 = arith.addf %arg2, %arg3 : f32 linalg.yield %9 : f32 } -> (tensor) %5 = tensor.cast %4 : tensor to tensor<2x3x4xf32> return %5 : tensor<2x3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @static_input_with_cast(%arg0 : tensor<2x3x4xf32>, %arg1: tensor) -> tensor<2x3x4xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c0 : tensor<2x3x4xf32> %1 = tensor.dim %arg0, %c1 : tensor<2x3x4xf32> %2 = tensor.dim %arg0, %c2 : tensor<2x3x4xf32> %3 = tensor.empty(%0, %1, %2) : tensor %4 = tensor.cast %arg1 : tensor to tensor<2x?x?xf32> %5 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%arg0, %4 : tensor<2x3x4xf32>, tensor<2x?x?xf32>) outs(%3 : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32): %9 = arith.addf %arg2, %arg3 : f32 linalg.yield %9 : f32 } -> (tensor) %6 = tensor.cast %5 : tensor to tensor<2x3x4xf32> return %6: tensor<2x3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @static_output_with_cast(%arg0 : tensor, %arg1: tensor, %arg2: tensor<2x3x4xf32>) -> tensor<2x3x4xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.dim %arg2, %c0 : tensor<2x3x4xf32> %1 = tensor.dim %arg2, %c1 : tensor<2x3x4xf32> %2 = tensor.dim %arg2, %c2 : tensor<2x3x4xf32> %3 = tensor.empty(%0, %1, %2) : tensor %4 = tensor.cast %3 : tensor to tensor<2x3x4xf32> %5 = tensor.cast %arg1 : tensor to tensor<2x?x?xf32> %6 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%arg0, %5 : tensor, tensor<2x?x?xf32>) outs(%4 : tensor<2x3x4xf32>) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5 : f32): %9 = arith.addf %arg3, %arg4 : f32 linalg.yield %9 : f32 } -> (tensor<2x3x4xf32>) return %6: tensor<2x3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @cast_source(%arg0 : tensor<2x3x4xf32>, %arg1: tensor<2x3x4xf32>) -> tensor<2x3x4xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c0 : tensor<2x3x4xf32> %1 = tensor.dim %arg0, %c1 : tensor<2x3x4xf32> %2 = tensor.dim %arg0, %c2 : tensor<2x3x4xf32> %3 = tensor.empty(%0, %1, %2) : tensor %4 = tensor.cast %arg0 : tensor<2x3x4xf32> to tensor<2x?x?xf32> %5 = tensor.cast %arg1 : tensor<2x3x4xf32> to tensor<2x?x?xf32> %6 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%4, %5 : tensor<2x?x?xf32>, tensor<2x?x?xf32>) outs(%3 : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32): %9 = arith.addf %arg2, %arg3 : f32 linalg.yield %9 : f32 } -> (tensor) %7 = tensor.cast %6 : tensor to tensor<2x3x4xf32> return %7: tensor<2x3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @cast_dest(%arg0: tensor, %arg1: tensor<1x?x?xf32>, %arg2: index, %arg3: index, %arg4: index) -> tensor { %0 = tensor.empty(%arg2, %arg3, %arg4) : tensor %1 = tensor.cast %arg1 : tensor<1x?x?xf32> to tensor %2 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor, tensor<1x?x?xf32>) outs(%0 : tensor) { ^bb0(%arg5: f32, %arg6: f32, %arg7: f32): %3 = arith.subf %arg5, %arg6 : f32 linalg.yield %3 : f32 } -> tensor return %2 : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @insert_pad_into_fill(%input: tensor, %low0: index, %low1: index, %high1: index, %high2: index) -> tensor<8x384x384xf32> { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %pad = tensor.pad %input low[%low0, %low1, %c0] high[%c0, %high1, %high2] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %f0 : f32 } : tensor to tensor<8x128x128xf32> %empty = tensor.empty() : tensor<8x384x384xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<8x384x384xf32>) -> tensor<8x384x384xf32> %0 = tensor.insert_slice %pad into %fill[0, 1, 2] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> return %0: tensor<8x384x384xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @multi_insert_pad_into_fill(%input: tensor<7x123x124xf32>, %a: tensor<8x128x128xf32>, %offset: index) -> tensor<8x384x384xf32> { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %pad = tensor.pad %input low[1, 2, 0] high[0, 3, 4] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %f0 : f32 } : tensor<7x123x124xf32> to tensor<8x128x128xf32> %empty = tensor.empty() : tensor<8x384x384xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<8x384x384xf32>) -> tensor<8x384x384xf32> %0 = tensor.insert_slice %a into %fill[%offset, 0, 0] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %1 = tensor.insert_slice %a into %0 [0, 128, %offset][8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %2 = tensor.insert_slice %pad into %1 [0, 0, 256] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> return %2: tensor<8x384x384xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @multi_insert_pad_into_fill_overlap(%input: tensor<7x123x124xf32>, %a: tensor<8x128x128xf32>, %offset: index) -> tensor<8x384x384xf32> { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %pad = tensor.pad %input low[1, 2, 0] high[0, 3, 4] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %f0 : f32 } : tensor<7x123x124xf32> to tensor<8x128x128xf32> %empty = tensor.empty() : tensor<8x384x384xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<8x384x384xf32>) -> tensor<8x384x384xf32> %0 = tensor.insert_slice %a into %fill[%offset, 0, 0] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %1 = tensor.insert_slice %a into %0 [0, 0, 129] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %2 = tensor.insert_slice %pad into %1 [0, 0, 256] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> return %2: tensor<8x384x384xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @multi_insert_pad_into_fill_overlap(%input: tensor<7x123x124xf32>, %a: tensor<8x128x128xf32>, %offset: index) -> tensor<8x384x384xf32> { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %pad = tensor.pad %input low[1, 2, 0] high[0, 3, 4] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %f0 : f32 } : tensor<7x123x124xf32> to tensor<8x128x128xf32> %empty = tensor.empty() : tensor<8x384x384xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<8x384x384xf32>) -> tensor<8x384x384xf32> %0 = tensor.insert_slice %a into %fill[0, 0, %offset] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %1 = tensor.insert_slice %a into %0 [0, 128, 255] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %2 = tensor.insert_slice %pad into %1 [0, 0, 256] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> return %2: tensor<8x384x384xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @multi_insert_pad_into_fill(%input: tensor<7x123x124xf32>, %a: tensor<8x128x128xf32>, %offset: index) -> tensor<8x384x384xf32> { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %pad = tensor.pad %input low[1, 2, 0] high[0, 3, 4] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %f0 : f32 } : tensor<7x123x124xf32> to tensor<8x128x128xf32> %empty = tensor.empty() : tensor<8x384x384xf32> %fill = linalg.fill ins(%f0 : f32) outs(%empty : tensor<8x384x384xf32>) -> tensor<8x384x384xf32> %0 = tensor.insert_slice %a into %fill[0, 0, %offset] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %1 = tensor.insert_slice %a into %0 [0, 1, %offset] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %2 = tensor.insert_slice %pad into %1 [0, 256, 256] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> return %2: tensor<8x384x384xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @multi_insert_pad_into_fill_mismatch(%input: tensor<7x123x124xf32>, %a: tensor<8x128x128xf32>, %offset: index) -> tensor<8x384x384xf32> { %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %c0 = arith.constant 0 : index %pad = tensor.pad %input low[1, 2, 0] high[0, 3, 4] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %f0 : f32 } : tensor<7x123x124xf32> to tensor<8x128x128xf32> %empty = tensor.empty() : tensor<8x384x384xf32> %fill = linalg.fill ins(%f1 : f32) outs(%empty : tensor<8x384x384xf32>) -> tensor<8x384x384xf32> %0 = tensor.insert_slice %a into %fill[%offset, 0, 0] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %1 = tensor.insert_slice %a into %0 [0, 128, %offset][8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> %2 = tensor.insert_slice %pad into %1 [0, 0, 256] [8, 128, 128] [1, 1, 1] : tensor<8x128x128xf32> into tensor<8x384x384xf32> return %2: tensor<8x384x384xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_linalgop_with_cast_consumer(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor<4x8xf32>, tensor) { %0 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor %1 = tensor.cast %0 : tensor to tensor<4x8xf32> return %1, %0 : tensor<4x8xf32>, tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func private @some_use(%0 : tensor<4x8xf32>) func.func @linalgop_with_cond_cast_consumer(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : i1) -> tensor { %0 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor scf.if %arg3 { %1 = tensor.cast %0 : tensor to tensor<4x8xf32> func.call @some_use(%1) : (tensor<4x8xf32>) -> () } return %0 : tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_conv_op_with_cast_consumer(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor<4x8x12x16xf32>, tensor) { %0 = linalg.conv_2d_nchw_fchw ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor %1 = tensor.cast %0 : tensor to tensor<4x8x12x16xf32> return %1, %0 : tensor<4x8x12x16xf32>, tensor }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @fold_multi_use_generic_op_with_consumer(%arg0 : tensor) -> (tensor, tensor<2x3x4xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %d2 = tensor.dim %arg0, %c2 : tensor %empty1 = tensor.empty(%d1, %d2, %d0) : tensor %empty2 = tensor.empty(%d2, %d1, %d0) : tensor %0:2 = linalg.generic { iterator_types = [""parallel"", ""parallel"", ""parallel""], indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d1, d2, d0)>, affine_map<(d0, d1, d2) -> (d2, d1, d0)>]} ins(%arg0 : tensor) outs(%empty1, %empty2 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32) : linalg.yield %b0, %b0 : f32, f32 } -> (tensor, tensor) %1 = tensor.cast %0#1 : tensor to tensor<2x3x4xf32> return %0#0, %1 : tensor, tensor<2x3x4xf32> }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0) -> (d0)> func.func @identity_mixed(%arg0 : tensor, %arg1: memref) { linalg.generic { indexing_maps = [#map, #map], iterator_types = [""parallel""] } ins(%arg0 : tensor) outs(%arg1 : memref) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @dedeplicate_regression_test(%0: tensor<4xf32>, %1: memref<4xf32>) { %36 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins(%1, %1 : memref<4xf32>, memref<4xf32>) outs(%0 : tensor<4xf32>) { ^bb0(%in: f32, %in_24: f32, %out: f32): linalg.yield %in : f32 } -> tensor<4xf32> %53 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} outs(%36 : tensor<4xf32>) { ^bb0(%out: f32): linalg.yield %out : f32 } -> tensor<4xf32> return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "#map = affine_map<(d0) -> (d0)> func.func @cast_producer_mixed(%arg0 : tensor<5xf32>, %arg1: memref) { %0 = tensor.cast %arg0 : tensor<5xf32> to tensor linalg.generic { indexing_maps = [#map, #map], iterator_types = [""parallel""] } ins(%0 : tensor) outs(%arg1 : memref) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } return }"," mlir-opt -canonicalize=""test-convergence"" -split-input-file ",1 "func.func @conv(%arg0 : memref, %arg1 : memref, %arg2 : memref) { linalg.conv_2d ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop:2 = transform.structured.tile %0 [2, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize ,1 "func.func @generalize_unary(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.elemwise_unary ins(%arg0 : tensor) outs(%arg1: tensor) -> tensor return %0 : tensor } func.func @map_no_inputs(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.generalize %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter ,1 "func.func @linalg_indexcast_dim_0_i8(%arg0: tensor) -> tensor<128xf16> { %init = tensor.empty() : tensor<128xf16> %res = linalg.generic { indexing_maps = [affine_map<(d0) -> ()>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%arg0 : tensor) outs(%init : tensor<128xf16>) { ^bb0(%in: f16, %out: f16): %idx = linalg.index 0 : index %int = arith.index_cast %idx : index to i64 %fp = arith.sitofp %int : i64 to f16 linalg.yield %fp : f16 } -> tensor<128xf16> return %res : tensor<128xf16> } func.func @linalg_indexcast_dim_1_i16(%arg0: tensor, %arg1: tensor) -> tensor { %res = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%in: f16, %out: f16): %idx = linalg.index 1 : index %int = arith.index_cast %idx : index to i64 %fp = arith.sitofp %int : i64 to f16 linalg.yield %fp : f16 } -> tensor return %res : tensor } func.func @linalg_indexcast_dynamic_dim_i64(%arg0: tensor, %arg1: tensor) -> tensor { %res = linalg.generic { indexing_maps = [affine_map<(d0) -> ()>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%in: f16, %out: f16): %idx = linalg.index 0 : index %int = arith.index_cast %idx : index to i64 %fp = arith.sitofp %int : i64 to f16 linalg.yield %fp : f16 } -> tensor return %res : tensor } func.func @linalg_indexcastui_dim_0_i8(%arg0: tensor) -> tensor<256xf16> { %init = tensor.empty() : tensor<256xf16> %res = linalg.generic { indexing_maps = [affine_map<(d0) -> ()>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%arg0 : tensor) outs(%init : tensor<256xf16>) { ^bb0(%in: f16, %out: f16): %idx = linalg.index 0 : index %int = arith.index_castui %idx : index to i64 %fp = arith.uitofp %int : i64 to f16 linalg.yield %fp : f16 } -> tensor<256xf16> return %res : tensor<256xf16> } func.func @linalg_indexcastui_dim_1_i16(%arg0: tensor, %arg1: tensor) -> tensor { %res = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> ()>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%in: f16, %out: f16): %idx = linalg.index 1 : index %int = arith.index_castui %idx : index to i64 %fp = arith.uitofp %int : i64 to f16 linalg.yield %fp : f16 } -> tensor return %res : tensor } func.func @linalg_indexcastui_dynamic_dim_i64(%arg0: tensor, %arg1: tensor) -> tensor { %res = linalg.generic { indexing_maps = [affine_map<(d0) -> ()>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%in: f16, %out: f16): %idx = linalg.index 0 : index %int = arith.index_castui %idx : index to i64 %fp = arith.uitofp %int : i64 to f16 linalg.yield %fp : f16 } -> tensor return %res : tensor }"," mlir-opt --arith-int-narrowing=""int-bitwidths-supported=1,8,16,32"" --verify-diagnostics ",1 "func.func @empty_tensor_static_dim() -> (index, index) { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %c6 = arith.constant 6 : index %0 = tensor.empty(%c6) : tensor<4x5x?xf32> %1 = tensor.dim %0, %c2 : tensor<4x5x?xf32> %2 = tensor.dim %0, %c0 : tensor<4x5x?xf32> return %1, %2 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @empty_tensor_dynamic_dim(%arg0 : index) -> (index) { %c2 = arith.constant 2 : index %0 = tensor.empty(%arg0) : tensor<4x5x?xf32> %1 = tensor.dim %0, %c2 : tensor<4x5x?xf32> return %1 : index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @empty_tensor_dynamic_dim2(%arg0 : index, %arg1 : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.empty(%arg0, %arg1) : tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor return %1, %2 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @remove_dim_result_uses (%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d0 + d1, d1 - d0)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5 : f32): %1 = arith.mulf %arg3, %arg4 : f32 %2 = arith.addf %1, %arg5 : f32 linalg.yield %2 : f32 } -> tensor %3 = tensor.dim %0, %c0 : tensor %4 = tensor.dim %0, %c1 : tensor return %3, %4 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @remove_dim_result_uses_outs (%arg0 : tensor, %arg1 : index) -> (index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %0 = tensor.empty(%d0, %arg1) : tensor %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%0 : tensor) { ^bb0(%arg2: f32, %arg3: f32) : linalg.yield %arg2 : f32 } -> tensor %2 = tensor.dim %1, %c1 : tensor return %2 : index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @remove_dim_result_uses_sequence (%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (index, index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor %3 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d1, d0)>, affine_map<(d0, d1, d2) -> (d0, d2)>, affine_map<(d0, d1, d2) -> (d0, d2)>], iterator_types = [""parallel"", ""reduction"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%0 : tensor) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5 : f32): %4 = arith.mulf %arg3, %arg4 : f32 %5 = arith.addf %4, %arg5 : f32 linalg.yield %5 : f32 } -> tensor %6 = tensor.dim %3, %c0 : tensor %7 = tensor.dim %3, %c1 : tensor return %1, %2, %6, %7 : index, index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @keep_result_dim_uses_sequence2 (%arg0 : tensor, %arg1 : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %0 = tensor.empty(%d0, %arg1) : tensor %1 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%0 : tensor) { ^bb0(%arg2: f32, %arg3 : f32): linalg.yield %arg2 : f32 } -> tensor %2 = tensor.dim %1, %c0 : tensor %3 = tensor.dim %1, %c1 : tensor return %2, %3 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "#map = affine_map<(d0) -> (d0)> func.func @empty_tensor_dim_of_linalg_result(%arg_0 : tensor, %arg_1: tensor) -> (index, index) { %0, %1 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel""] } ins(%arg_0 : tensor) outs(%arg_0, %arg_1 : tensor, tensor) { ^bb0(%in: f32, %out_0: f32, %out_1: f32): linalg.yield %in, %in : f32, f32 } -> (tensor, tensor) %c0 = arith.constant 0 : index %num_elem_0 = tensor.dim %0, %c0 : tensor %num_elem_1 = tensor.dim %1, %c0 : tensor return %num_elem_0, %num_elem_1 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @dim_reshape_expansion(%arg0 : tensor<6x5x?xf32>) -> (index, index, index) { %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %0 = tensor.expand_shape %arg0 [[0, 1], [2], [3, 4, 5]] : tensor<6x5x?xf32> into tensor<2x3x5x4x?x7xf32> %1 = tensor.dim %0, %c1 : tensor<2x3x5x4x?x7xf32> %2 = tensor.dim %0, %c3 : tensor<2x3x5x4x?x7xf32> %3 = tensor.dim %0, %c4 : tensor<2x3x5x4x?x7xf32> return %1, %2, %3 : index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @dim_reshape_collapse(%arg0 : tensor<2x3x5x4x?x7xf32>) -> (index, index) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.collapse_shape %arg0 [[0, 1], [2], [3, 4, 5]] : tensor<2x3x5x4x?x7xf32> into tensor<6x5x?xf32> %1 = tensor.dim %0, %c1 : tensor<6x5x?xf32> %2 = tensor.dim %0, %c2 : tensor<6x5x?xf32> return %1, %2 : index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @dim_of_pad_op(%arg0 : tensor<2x?x?xf32>, %arg1 : index, %arg2 : index, %arg3: f32) -> (index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %0 = tensor.pad %arg0 low[%c3, %arg1, %c4] high[7, %c5, %arg2] { ^bb0(%arg4: index, %arg5: index, %arg6: index): tensor.yield %arg3 : f32 } : tensor<2x?x?xf32> to tensor %1 = tensor.dim %0, %c0 : tensor %2 = tensor.dim %0, %c1 : tensor %3 = tensor.dim %0, %c2 : tensor return %1, %2, %3 : index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @matmul(%A: memref, %B: memref) -> (memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %f0 = arith.constant 0.0 : f32 %x = memref.dim %A, %c0 : memref %y = memref.dim %B, %c1 : memref %C = memref.alloc(%x, %y) : memref linalg.fill ins(%f0 : f32) outs(%C : memref) linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) return %C : memref }", mlir-opt -convert-linalg-to-std -split-input-file ,1 "#accesses = [ affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)> ] #trait = { doc = ""..."", indexing_maps = #accesses, library_call = ""test"", iterator_types = [""parallel""] } module { func.func @helper(%arg7: memref<32xf16, 1>, %arg8: memref<32xf16, 1>, %arg9: memref<32xf16, 1>) { %localA = memref.alloca() : memref<32xf16, 6> %localB = memref.alloca() : memref<32xf16, 6> %localOut = memref.alloca() : memref<32xf16, 6> linalg.copy ins(%arg8 : memref<32xf16, 1>) outs(%localA : memref<32xf16, 6>) linalg.copy ins(%arg9 : memref<32xf16, 1>) outs(%localB : memref<32xf16, 6>) linalg.generic #trait ins(%localA, %localB : memref<32xf16, 6>, memref<32xf16, 6>) outs(%localOut : memref<32xf16, 6>) { ^bb0(%0: f16, %1: f16, %2: f16) : %e = arith.addf %1, %0: f16 linalg.yield %e : f16 } linalg.copy ins(%localOut : memref<32xf16, 6>) outs(%arg7 : memref<32xf16, 1>) return } }", mlir-opt -convert-linalg-to-std -split-input-file ,1 "func.func @test_neg(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memref<16xf32>, %D: memref<16xf32>) { linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%A: memref<16x8xf32>) outs(%B: memref<16x8xf32>) linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%C: memref<16xf32>) outs(%D: memref<16xf32>) return }", mlir-opt -convert-linalg-to-std -split-input-file ,1 "func.func @test_exp(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memref<16xf32>, %D: memref<16xf32>) { linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%A: memref<16x8xf32>) outs(%B: memref<16x8xf32>) linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%C: memref<16xf32>) outs(%D: memref<16xf32>) return }", mlir-opt -convert-linalg-to-std -split-input-file ,1 "func.func @test_add(%A : memref<16x8xf32>, %B: memref<16x8xf32>, %C: memref<16x8xf32>, %D: memref<16xf32>, %E: memref<16xf32>, %F: memref<16xf32>) { linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%A, %B: memref<16x8xf32>, memref<16x8xf32>) outs(%C: memref<16x8xf32>) linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%D, %E: memref<16xf32>, memref<16xf32>) outs(%F: memref<16xf32>) return }", mlir-opt -convert-linalg-to-std -split-input-file ,1 "func.func @dynamic_pad_fusion(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : f32) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %init = tensor.empty(%d0, %d1) : tensor %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%init : tensor) { ^bb0(%arg6 : f32, %arg7 : f32): %1 = arith.mulf %arg6, %arg6 : f32 linalg.yield %1 : f32 } -> tensor %1 = tensor.pad %0 low [%arg1, %arg2] high [%arg3, %arg4] { ^bb0(%arg6: index, %arg7 : index): tensor.yield %arg5 : f32 } : tensor to tensor return %1 : tensor }", mlir-opt -test-linalg-pad-fusion -split-input-file ,1 "func.func @mixed_pad_fusion(%arg0 : tensor, %arg1 : index, %arg2 : index, %arg3 : f32) -> tensor<49x?xf32> { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %init = tensor.empty(%d0) : tensor<42x?xf32> %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%init : tensor<42x?xf32>) { ^bb0(%arg4 : f32, %arg5 : f32): %1 = arith.mulf %arg4, %arg4 : f32 linalg.yield %1 : f32 } -> tensor<42x?xf32> %1 = tensor.pad %0 low [3, %arg1] high [4, %arg2] { ^bb0(%arg4: index, %arg5 : index): tensor.yield %arg3 : f32 } : tensor<42x?xf32> to tensor<49x?xf32> return %1 : tensor<49x?xf32> }", mlir-opt -test-linalg-pad-fusion -split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @basic(%arg0: tensor<4xf32>) -> tensor<4xf32> { %0 = linalg.generic { indexing_maps = [#map0, #map0], iterator_types = [""parallel""] } ins(%arg0 : tensor<4xf32>) outs(%arg0 : tensor<4xf32>) { ^bb0(%gen_arg1: f32, %out: f32): %tmp1 = math.exp %gen_arg1 : f32 linalg.yield %tmp1 : f32 } -> tensor<4xf32> return %0 : tensor<4xf32> }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @empty_tensor(%in : tensor, %size: index) -> tensor { %init = tensor.empty(%size) : tensor %0 = linalg.generic { indexing_maps = [#map0, #map0], iterator_types = [""parallel""] } ins(%in : tensor) outs(%init : tensor) { ^bb0(%gen_arg1: f32, %out: f32): %tmp1 = math.exp %gen_arg1 : f32 linalg.yield %tmp1 : f32 } -> tensor return %0 : tensor }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @multiple_results(%arg0: tensor<4xf32>) -> (tensor<4xf32>, tensor<4xf32>) { %0, %1 = linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel""] } ins(%arg0 : tensor<4xf32>) outs (%arg0, %arg0 : tensor<4xf32>, tensor<4xf32>) { ^bb0(%gen_arg1: f32, %out1: f32, %out2: f32): %tmp1 = math.exp %gen_arg1 : f32 linalg.yield %tmp1, %tmp1 : f32, f32 } -> (tensor<4xf32>, tensor<4xf32>) return %0, %1 : tensor<4xf32>, tensor<4xf32> }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "#map_2d = affine_map<(d0, d1) -> (d0, d1)> func.func @dynamic_results(%arg0: tensor) -> (tensor, tensor) { %0, %1 = linalg.generic { indexing_maps = [#map_2d, #map_2d, #map_2d], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs (%arg0, %arg0 : tensor, tensor) { ^bb0(%gen_arg1: f32, %out1: f32, %out2: f32): %tmp1 = math.exp %gen_arg1 : f32 linalg.yield %tmp1, %tmp1 : f32, f32 } -> (tensor, tensor) return %0, %1 : tensor, tensor }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "#accesses = [ affine_map<(i, j, k) -> (j, i, k)>, affine_map<(i, j, k) -> (i, j)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @generic_with_init_tensor(%arg0: tensor<2x3x4xvector<3x4xi4>>, %arg1: tensor<3x2xf32>) -> (tensor<3x2xf32>) { %0 = linalg.generic #trait ins(%arg0 : tensor<2x3x4xvector<3x4xi4>>) outs(%arg1 : tensor<3x2xf32>) { ^bb(%v0: vector<3x4xi4>, %v1: f32) : linalg.yield %v1 : f32 } -> tensor<3x2xf32> return %0 : tensor<3x2xf32> }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "func.func @bufferize_fill(%arg0: tensor) -> tensor { %c0 = arith.constant 0.0 : f32 %0 = linalg.fill ins(%c0 : f32) outs(%arg0 : tensor) -> tensor return %0 : tensor }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "func.func @bufferize_dot(%in: tensor<4xf32>, %out: tensor) -> tensor { %dot = linalg.dot ins(%in, %in : tensor<4xf32>, tensor<4xf32>) outs(%out : tensor) -> tensor return %dot : tensor }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "func.func private @csum(%arg0: tensor<6xi64>) -> tensor<6xi64> func.func public @main(%arg0: tensor<2x3xi1>) -> tensor<6xi64> { %0 = tensor.collapse_shape %arg0 [[0, 1]] : tensor<2x3xi1> into tensor<6xi1> %1 = tensor.empty() : tensor<6xi64> %2 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins(%0 : tensor<6xi1>) outs(%1 : tensor<6xi64>) { ^bb0(%arg1: i1, %arg2: i64): %4 = arith.extui %arg1 : i1 to i64 linalg.yield %4 : i64 } -> tensor<6xi64> %3 = func.call @csum(%2) : (tensor<6xi64>) -> tensor<6xi64> return %3 : tensor<6xi64> }", mlir-opt -linalg-bufferize -canonicalize -cse -split-input-file ,1 "func.func @simple_KCRSsr_to_KCRS(%arg0: tensor<1x1x1x1x8x32xf32>, %arg1: tensor<1x1x32x8xf32>) -> tensor<1x1x32x8xf32> { %0 = tensor.unpack %arg0 inner_dims_pos = [3, 2] inner_tiles = [8, 32] into %arg1 : tensor<1x1x1x1x8x32xf32> -> tensor<1x1x32x8xf32> return %0 : tensor<1x1x32x8xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @simple_unpack_and_extract_slice(%input: tensor<1x1x8x2xf32>, %output: tensor<5x1xf32>) -> tensor<5x1xf32> { %0 = tensor.unpack %input inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %output : tensor<1x1x8x2xf32> -> tensor<5x1xf32> return %0 : tensor<5x1xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @simple_CNnc_to_NC(%arg0: tensor<1x1x32x8xf32>, %arg1: tensor<32x8xf32>) -> tensor<32x8xf32>{ %0 = tensor.unpack %arg0 outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 8] into %arg1 : tensor<1x1x32x8xf32> -> tensor<32x8xf32> return %0 : tensor<32x8xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @simple_NCHWc_to_NCHW(%arg0: tensor<2x1x16x8x32xf32>, %arg1: tensor<2x32x16x8xf32>) -> tensor<2x32x16x8xf32> { %0 = tensor.unpack %arg0 inner_dims_pos = [1] inner_tiles = [32] into %arg1 : tensor<2x1x16x8x32xf32> -> tensor<2x32x16x8xf32> return %0 : tensor<2x32x16x8xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @simple_NHWC_to_NCHW(%arg0: tensor<1x16x8x32xf32>, %arg1: tensor<1x32x16x8xf32>) -> tensor<1x32x16x8xf32> { %0 = tensor.unpack %arg0 outer_dims_perm = [0, 2, 3, 1] inner_dims_pos = [] inner_tiles = [] into %arg1 : tensor<1x16x8x32xf32> -> tensor<1x32x16x8xf32> return %0 : tensor<1x32x16x8xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @vectorize_matmul(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "#map0 = affine_map<()[s0] -> (-s0 + 12, 7)> #map1 = affine_map<()[s0] -> (-s0 + 7)> func.func @vectorize_keep_pad( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>, %arg3: index, %arg4: index, %arg5: index) -> tensor<24x25xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = affine.min #map0()[%arg5] %1 = tensor.extract_slice %arg0[%arg3, %arg5] [4, %0] [1, 1] : tensor<24x12xf32> to tensor<4x?xf32> %2 = tensor.extract_slice %arg1[%arg5, %arg4] [%0, 5] [1, 1] : tensor<12x25xf32> to tensor %3 = tensor.extract_slice %arg2[%arg3, %arg4] [4, 5] [1, 1] : tensor<24x25xf32> to tensor<4x5xf32> %4 = affine.apply #map1()[%0] %5 = tensor.pad %1 nofold low[%c0, %c0] high[%c0, %4] { ^bb0(%arg6: index, %arg7: index): tensor.yield %cst : f32 } : tensor<4x?xf32> to tensor<4x7xf32> %6 = affine.apply #map1()[%0] %7 = tensor.pad %2 nofold low[%c0, %c0] high[%6, %c0] { ^bb0(%arg6: index, %arg7: index): tensor.yield %cst : f32 } : tensor to tensor<7x5xf32> %8 = linalg.matmul ins(%5, %7 : tensor<4x7xf32>, tensor<7x5xf32>) outs(%3 : tensor<4x5xf32>) -> tensor<4x5xf32> %9 = tensor.insert_slice %8 into %arg2[%arg3, %arg4] [4, 5] [1, 1] : tensor<4x5xf32> into tensor<24x25xf32> return %9 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "#map0 = affine_map<()[s0] -> (-s0 + 12, 7)> #map1 = affine_map<()[s0] -> (-s0 + 7)> func.func @vectorize_pad( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>, %arg3: index, %arg4: index, %arg5: index) -> tensor<24x25xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 %0 = affine.min #map0()[%arg5] %1 = tensor.extract_slice %arg0[%arg3, %arg5] [4, %0] [1, 1] : tensor<24x12xf32> to tensor<4x?xf32> %2 = tensor.extract_slice %arg1[%arg5, %arg4] [%0, 5] [1, 1] : tensor<12x25xf32> to tensor %3 = tensor.extract_slice %arg2[%arg3, %arg4] [4, 5] [1, 1] : tensor<24x25xf32> to tensor<4x5xf32> %4 = affine.apply #map1()[%0] %5 = tensor.pad %1 nofold low[%c0, %c0] high[%c0, %4] { ^bb0(%arg6: index, %arg7: index): tensor.yield %cst : f32 } : tensor<4x?xf32> to tensor<4x7xf32> %6 = affine.apply #map1()[%0] %7 = tensor.pad %2 nofold low[%c0, %c0] high[%6, %c0] { ^bb0(%arg6: index, %arg7: index): tensor.yield %cst : f32 } : tensor to tensor<7x5xf32> %8 = linalg.matmul ins(%5, %7 : tensor<4x7xf32>, tensor<7x5xf32>) outs(%3 : tensor<4x5xf32>) -> tensor<4x5xf32> %9 = tensor.insert_slice %8 into %arg2[%arg3, %arg4] [4, 5] [1, 1] : tensor<4x5xf32> into tensor<24x25xf32> return %9 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 {vectorize_padding} : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @vectorize(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @control_producer_reshape_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.collapse_shape %arg0 [[0, 1], [2]] : tensor into tensor %d0 = tensor.dim %0, %c0 : tensor %d1 = tensor.dim %0, %c1 : tensor %init = tensor.empty(%d0, %d1) : tensor %1 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%0, %arg1 : tensor, tensor) outs(%init : tensor) { ^bb0(%arg2 : f32, %arg3:f32, %arg4 : f32): %2 = arith.addf %arg2, %arg3 : f32 linalg.yield %2 : f32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=control-fusion-by-expansion -split-input-file ,1 "func.func @control_consumer_reshape_fusion(%arg0 : tensor<1x?x?xf32>, %arg1 : tensor<1x?x?xf32>) -> tensor<1x?x?xf32> { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %cst = arith.constant 0.0 : f32 %d0 = tensor.dim %arg0, %c1 : tensor<1x?x?xf32> %d1 = tensor.dim %arg1, %c2 : tensor<1x?x?xf32> %init = tensor.empty(%d0, %d1) : tensor %fill = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} outs(%init : tensor) { ^bb0(%arg2: f32): linalg.yield %cst : f32 } -> tensor %0 = tensor.expand_shape %fill [[0, 1], [2]] : tensor into tensor<1x?x?xf32> %1 = linalg.batch_matmul ins(%arg0, %arg1 : tensor<1x?x?xf32>, tensor<1x?x?xf32>) outs(%0 : tensor<1x?x?xf32>) -> tensor<1x?x?xf32> return %1 : tensor<1x?x?xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=control-fusion-by-expansion -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @dynamic_elem_pack(%arg0: tensor, %dest: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32): %4 = arith.addf %arg3, %arg3 : f32 linalg.yield %4 : f32 } -> tensor %4 = tensor.pack %3 inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %dest : tensor -> tensor return %4 : tensor }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @elem_pack_transpose_inner_dims(%arg0: tensor<128x256xi32>, %dest: tensor<4x16x16x32xi32>) -> tensor<4x16x16x32xi32>{ %init = tensor.empty() : tensor<128x256xi32> %elem = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor<128x256xi32>) outs(%init : tensor<128x256xi32>) { ^bb0(%arg3: i32, %arg4: i32): %4 = arith.addi %arg3, %arg3 : i32 linalg.yield %4 : i32 } -> tensor<128x256xi32> %pack = tensor.pack %elem inner_dims_pos = [1, 0] inner_tiles = [16, 32] into %dest : tensor<128x256xi32> -> tensor<4x16x16x32xi32> return %pack : tensor<4x16x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @elem_pack_transpose_outer_dims(%arg0: tensor<128x256xi32>, %dest: tensor<16x4x32x16xi32>) -> tensor<16x4x32x16xi32>{ %init = tensor.empty() : tensor<128x256xi32> %elem = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor<128x256xi32>) outs(%init : tensor<128x256xi32>) { ^bb0(%arg3: i32, %arg4: i32): %4 = arith.addi %arg3, %arg3 : i32 linalg.yield %4 : i32 } -> tensor<128x256xi32> %pack = tensor.pack %elem outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xi32> -> tensor<16x4x32x16xi32> return %pack : tensor<16x4x32x16xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @elem_pack_transpose_inner_and_outer_dims(%arg0: tensor<128x256xi32>, %dest: tensor<16x4x16x32xi32>) -> tensor<16x4x16x32xi32>{ %init = tensor.empty() : tensor<128x256xi32> %elem = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor<128x256xi32>) outs(%init : tensor<128x256xi32>) { ^bb0(%arg3: i32, %arg4: i32): %4 = arith.addi %arg3, %arg3 : i32 linalg.yield %4 : i32 } -> tensor<128x256xi32> %pack = tensor.pack %elem outer_dims_perm = [1, 0] inner_dims_pos = [1, 0] inner_tiles = [16, 32] into %dest : tensor<128x256xi32> -> tensor<16x4x16x32xi32> return %pack : tensor<16x4x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #map2 = affine_map<(d0, d1) -> (d1)> func.func @dynamic_broadcast_pack(%arg0: tensor, %arg1: tensor, %dest: tensor) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg1, %c0 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = linalg.generic {indexing_maps = [#map1, #map2, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %4 = arith.addf %arg3, %arg4 : f32 linalg.yield %4 : f32 } -> tensor %4 = tensor.pack %3 inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %dest : tensor -> tensor return %4 : tensor }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @elem_pack_transpose_inner_and_outer_dims2(%arg0: tensor<64xf32>, %dest: tensor<1x2x56x57x32xf32>) -> tensor<1x2x56x57x32xf32> { %0 = tensor.empty() : tensor<1x56x57x64xf32> %1 = linalg.generic { indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<64xf32>) outs(%0 : tensor<1x56x57x64xf32>) { ^bb0(%in: f32, %out: f32): linalg.yield %in : f32 } -> tensor<1x56x57x64xf32> %2 = tensor.pack %1 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %dest : tensor<1x56x57x64xf32> -> tensor<1x2x56x57x32xf32> return %2 : tensor<1x2x56x57x32xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @transpose_pack(%arg0: tensor<100x128x200x256xi32>, %arg1: tensor<100xi32>, %arg2: tensor<128xi32>, %dest: tensor<100x200x4x16x16x32xi32>) -> tensor<100x200x4x16x16x32xi32> { %init_transpose = tensor.empty() : tensor<100x200x128x256xi32> %transpose = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0)>, affine_map<(d0, d1, d2, d3) -> (d1)>, affine_map<(d0, d1, d2, d3) -> (d0, d2, d1, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor<100x128x200x256xi32>, tensor<100xi32>, tensor<128xi32>) outs(%init_transpose : tensor<100x200x128x256xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %0 = arith.addi %b0, %b1 : i32 %1 = arith.addi %0, %b2 : i32 linalg.yield %1 : i32 } -> tensor<100x200x128x256xi32> %4 = tensor.pack %transpose inner_dims_pos = [3, 2] inner_tiles = [16, 32] into %dest : tensor<100x200x128x256xi32> -> tensor<100x200x4x16x16x32xi32> return %4 : tensor<100x200x4x16x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @affine_constant_expr_pack(%arg0: tensor<100x128x200x256xi32>, %arg1: tensor<100x1x1x1xi32>, %arg2: tensor<1x128x1x1xi32>, %dest: tensor<100x200x4x16x16x32xi32>) -> tensor<100x200x4x16x16x32xi32> { %init_transpose = tensor.empty() : tensor<100x200x128x256xi32> %transpose = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, 0, 0, 0)>, affine_map<(d0, d1, d2, d3) -> (0, d1, 0, 0)>, affine_map<(d0, d1, d2, d3) -> (d0, d2, d1, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor<100x128x200x256xi32>, tensor<100x1x1x1xi32>, tensor<1x128x1x1xi32>) outs(%init_transpose : tensor<100x200x128x256xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %0 = arith.addi %b0, %b1 : i32 %1 = arith.addi %0, %b2 : i32 linalg.yield %1 : i32 } -> tensor<100x200x128x256xi32> %4 = tensor.pack %transpose inner_dims_pos = [3, 2] inner_tiles = [16, 32] into %dest : tensor<100x200x128x256xi32> -> tensor<100x200x4x16x16x32xi32> return %4 : tensor<100x200x4x16x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @transpose_pack_with_outer_dims(%arg0: tensor<100x128x200x256xi32>, %arg1: tensor<100xi32>, %arg2: tensor<128xi32>, %dest: tensor<200x4x16x100x16x32xi32>) -> tensor<200x4x16x100x16x32xi32> { %init_transpose = tensor.empty() : tensor<100x200x128x256xi32> %transpose = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0)>, affine_map<(d0, d1, d2, d3) -> (d1)>, affine_map<(d0, d1, d2, d3) -> (d0, d2, d1, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor<100x128x200x256xi32>, tensor<100xi32>, tensor<128xi32>) outs(%init_transpose : tensor<100x200x128x256xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %0 = arith.addi %b0, %b1 : i32 %1 = arith.addi %0, %b2 : i32 linalg.yield %1 : i32 } -> tensor<100x200x128x256xi32> %4 = tensor.pack %transpose outer_dims_perm = [1, 2, 3, 0] inner_dims_pos = [3, 2] inner_tiles = [16, 32] into %dest : tensor<100x200x128x256xi32> -> tensor<200x4x16x100x16x32xi32> return %4 : tensor<200x4x16x100x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @elem_pack_transpose_outer_dims(%arg0: tensor<128x256xi32>, %init: tensor<128x256xi32>) -> tensor<16x4x32x16xi32>{ %elem = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor<128x256xi32>) outs(%init : tensor<128x256xi32>) { ^bb0(%arg3: i32, %arg4: i32): %4 = arith.addi %arg3, %arg4 : i32 linalg.yield %4 : i32 } -> tensor<128x256xi32> %empty = tensor.empty() : tensor<16x4x32x16xi32> %pack = tensor.pack %elem outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %empty : tensor<128x256xi32> -> tensor<16x4x32x16xi32> return %pack : tensor<16x4x32x16xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @unpack_on_output(%arg0: tensor<12x2x56x56x32xf32>) -> tensor<12x56x56x64xf32> { %0 = tensor.empty() : tensor<12x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<12x2x56x56x32xf32> -> tensor<12x56x56x64xf32> %2 = linalg.generic {indexing_maps = [#map], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} outs(%1 : tensor<12x56x56x64xf32>) { ^bb0(%out: f32): %3 = arith.addf %out, %out : f32 linalg.yield %3 : f32 } -> tensor<12x56x56x64xf32> return %2 : tensor<12x56x56x64xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @unpack_on_input(%arg0: tensor<12x2x56x56x32xf32>, %init: tensor<12x56x56x64xf32>) -> tensor<12x56x56x64xf32> { %0 = tensor.empty() : tensor<12x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<12x2x56x56x32xf32> -> tensor<12x56x56x64xf32> %2 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%1: tensor<12x56x56x64xf32>) outs(%init : tensor<12x56x56x64xf32>) { ^bb0(%in: f32, %out: f32): %3 = arith.addf %in, %out : f32 linalg.yield %3 : f32 } -> tensor<12x56x56x64xf32> return %2 : tensor<12x56x56x64xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @unpack_element_type_change(%arg0: tensor<12x2x56x56x32xf32>, %init: tensor<12x56x56x64xf16>) -> tensor<12x56x56x64xf16> { %0 = tensor.empty() : tensor<12x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<12x2x56x56x32xf32> -> tensor<12x56x56x64xf32> %2 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%1: tensor<12x56x56x64xf32>) outs(%init : tensor<12x56x56x64xf16>) { ^bb0(%in: f32, %out: f16): %3 = arith.truncf %in : f32 to f16 linalg.yield %3 : f16 } -> tensor<12x56x56x64xf16> return %2 : tensor<12x56x56x64xf16> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @forward_tensor_empty(%arg0: tensor<12x2x56x56x32xf32>) -> tensor<12x56x56x64xf32> { %init = tensor.empty() : tensor<12x56x56x64xf32> %0 = tensor.empty() : tensor<12x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<12x2x56x56x32xf32> -> tensor<12x56x56x64xf32> %2 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%1: tensor<12x56x56x64xf32>) outs(%init : tensor<12x56x56x64xf32>) { ^bb0(%in: f32, %out: f32): %3 = arith.addf %in, %in : f32 linalg.yield %3 : f32 } -> tensor<12x56x56x64xf32> return %2 : tensor<12x56x56x64xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @pad_valid_propagation(%arg0: tensor<1x2x56x56x32xf32>) -> tensor<1x58x58x64xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<1x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<1x2x56x56x32xf32> -> tensor<1x56x56x64xf32> %padded = tensor.pad %1 low[0, 1, 1, 0] high[0, 1, 1, 0] { ^bb0(%arg3: index, %arg4: index, %arg5: index, %arg6: index): tensor.yield %cst : f32 } : tensor<1x56x56x64xf32> to tensor<1x58x58x64xf32> return %padded : tensor<1x58x58x64xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @pad_valid_propagation(%arg0: tensor<1x2x56x56x32xf32>) -> tensor<2x58x58x64xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<1x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<1x2x56x56x32xf32> -> tensor<1x56x56x64xf32> %padded = tensor.pad %1 low[1, 1, 1, 0] high[0, 1, 1, 0] { ^bb0(%arg3: index, %arg4: index, %arg5: index, %arg6: index): tensor.yield %cst : f32 } : tensor<1x56x56x64xf32> to tensor<2x58x58x64xf32> return %padded : tensor<2x58x58x64xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @pad_along_unpacked_dim(%arg0: tensor<1x2x56x56x32xf32>) -> tensor<1x58x58x66xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<1x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %0 : tensor<1x2x56x56x32xf32> -> tensor<1x56x56x64xf32> %padded = tensor.pad %1 low[0, 1, 1, 1] high[0, 1, 1, 1] { ^bb0(%arg3: index, %arg4: index, %arg5: index, %arg6: index): tensor.yield %cst : f32 } : tensor<1x56x56x64xf32> to tensor<1x58x58x66xf32> return %padded : tensor<1x58x58x66xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @would_break_dominance(%arg0: tensor<128x256xi32>) -> tensor<4x16x16x32xi32>{ %init = tensor.empty() : tensor<128x256xi32> %elem = linalg.generic {indexing_maps = [#map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor<128x256xi32>) outs(%init : tensor<128x256xi32>) { ^bb0(%arg3: i32, %arg4: i32): %4 = arith.addi %arg3, %arg3 : i32 linalg.yield %4 : i32 } -> tensor<128x256xi32> %dest = bufferization.alloc_tensor() : tensor<4x16x16x32xi32> %pack = tensor.pack %elem inner_dims_pos = [1, 0] inner_tiles = [16, 32] into %dest : tensor<128x256xi32> -> tensor<4x16x16x32xi32> return %pack : tensor<4x16x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> ()> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @scalar_tensor(%arg0 : tensor) -> tensor<1x32x7x7x32xf32> { %empty_gen = tensor.empty() : tensor<1x7x7x1024xf32> %gen = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%empty_gen : tensor<1x7x7x1024xf32>) { ^bb0(%in: f32, %out: f32): linalg.yield %in : f32 } -> tensor<1x7x7x1024xf32> %empty_pack = tensor.empty() : tensor<1x32x7x7x32xf32> %pack = tensor.pack %gen outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [3] inner_tiles = [32] into %empty_pack : tensor<1x7x7x1024xf32> -> tensor<1x32x7x7x32xf32> return %pack : tensor<1x32x7x7x32xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @unpack_empty_inner_dims(%arg0: tensor<12x64x56x56xf32>) -> tensor<12x56x56x64xf32> { %init = tensor.empty() : tensor<12x56x56x64xf32> %0 = tensor.empty() : tensor<12x56x56x64xf32> %1 = tensor.unpack %arg0 outer_dims_perm = [0, 3, 1, 2] inner_dims_pos = [] inner_tiles = [] into %0 : tensor<12x64x56x56xf32> -> tensor<12x56x56x64xf32> %2 = linalg.generic {indexing_maps = [#map, #map], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%1: tensor<12x56x56x64xf32>) outs(%init : tensor<12x56x56x64xf32>) { ^bb0(%in: f32, %out: f32): %3 = arith.addf %in, %in : f32 linalg.yield %3 : f32 } -> tensor<12x56x56x64xf32> return %2 : tensor<12x56x56x64xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @reduction_pack_transpose_inner_dims(%arg0: tensor<128x256x32xi32>, %arg1: tensor<128x256xi32>) -> tensor<4x16x16x32xi32>{ %elem = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%arg0 : tensor<128x256x32xi32>) outs(%arg1 : tensor<128x256xi32>) { ^bb0(%arg3: i32, %arg4: i32): %4 = arith.addi %arg3, %arg4 : i32 linalg.yield %4 : i32 } -> tensor<128x256xi32> %dest = tensor.empty() : tensor<4x16x16x32xi32> %pack = tensor.pack %elem inner_dims_pos = [1, 0] inner_tiles = [16, 32] into %dest : tensor<128x256xi32> -> tensor<4x16x16x32xi32> return %pack : tensor<4x16x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @reduction_pack_with_outer_dims(%arg0: tensor<100x128x200x256xi32>, %arg1: tensor<100xi32>, %arg2: tensor<128xi32>, %init_reduction: tensor<100x128x256xi32>) -> tensor<4x16x100x16x32xi32> { %reduction = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0)>, affine_map<(d0, d1, d2, d3) -> (d1)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d3)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor<100x128x200x256xi32>, tensor<100xi32>, tensor<128xi32>) outs(%init_reduction : tensor<100x128x256xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %0 = arith.addi %b0, %b1 : i32 %1 = arith.addi %0, %b2 : i32 %2 = arith.addi %1, %b3 : i32 linalg.yield %2 : i32 } -> tensor<100x128x256xi32> %init_pack = tensor.empty() : tensor<4x16x100x16x32xi32> %4 = tensor.pack %reduction outer_dims_perm = [1, 2, 0] inner_dims_pos = [2, 1] inner_tiles = [16, 32] into %init_pack : tensor<100x128x256xi32> -> tensor<4x16x100x16x32xi32> return %4 : tensor<4x16x100x16x32xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5) -> (d0, d1, d2 * 2 + d4, d3 * 2 + d5)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5) -> (d4, d5)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5) -> (d1, d2, d3)> func.func @unpack_different_destination_shape(%arg0: tensor<1x1x1080x1920x16xi32>, %filter: tensor<2x2xi32>) -> tensor<16x540x960xi32>{ %init = tensor.empty() : tensor<16x540x960xi32> %empty = tensor.empty() : tensor<1x16x1080x1920xi32> %unpack = tensor.unpack %arg0 inner_dims_pos = [1] inner_tiles = [16] into %empty : tensor<1x1x1080x1920x16xi32> -> tensor<1x16x1080x1920xi32> %pool = linalg.generic {indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%unpack, %filter : tensor<1x16x1080x1920xi32>, tensor<2x2xi32>) outs(%init : tensor<16x540x960xi32>) { ^bb0(%in: i32, %in_1: i32, %out: i32): %max = arith.maxui %in, %in_1 : i32 linalg.yield %max : i32 } -> tensor<16x540x960xi32> return %pool : tensor<16x540x960xi32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @fill_pack() -> tensor<24x32x16x16xf32> { %dest = tensor.empty() : tensor<384x512xf32> %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<24x32x16x16xf32> %1 = linalg.fill ins(%cst : f32) outs(%dest : tensor<384x512xf32>) -> tensor<384x512xf32> %pack = tensor.pack %1 inner_dims_pos = [0, 1] inner_tiles = [16, 16] into %0 : tensor<384x512xf32> -> tensor<24x32x16x16xf32> return %pack : tensor<24x32x16x16xf32> }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "#map = affine_map<()[s0] -> (s0 ceildiv 16)> func.func @dynamic_fill_pack(%arg0: tensor) -> tensor { %cst = arith.constant 0.000000e+00 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = linalg.fill ins(%cst : f32) outs(%arg0 : tensor) -> tensor %dim = tensor.dim %0, %c0 : tensor %dim_0 = tensor.dim %0, %c1 : tensor %1 = affine.apply #map()[%dim] %2 = affine.apply #map()[%dim_0] %3 = tensor.empty(%1, %2) : tensor %pack = tensor.pack %0 padding_value(%cst : f32) inner_dims_pos = [0, 1] inner_tiles = [16, 16] into %3 : tensor -> tensor return %pack : tensor }", mlir-opt -test-linalg-data-layout-propagation -split-input-file ,1 "func.func @promote_subview_matmul(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %c2000 = arith.constant 2000 : index %c3000 = arith.constant 3000 : index %c4000 = arith.constant 4000 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = memref.dim %arg0, %c0 : memref> %1 = memref.dim %arg0, %c1 : memref> %2 = memref.dim %arg1, %c1 : memref> scf.for %arg3 = %c0 to %0 step %c2000 { scf.for %arg4 = %c0 to %2 step %c3000 { scf.for %arg5 = %c0 to %1 step %c4000 { %3 = memref.subview %arg0[%arg3, %arg5][%c2000, %c4000][%c1, %c1] : memref> to memref> %4 = memref.subview %arg1[%arg5, %arg4][%c4000, %c3000][%c1, %c1] : memref> to memref> %5 = memref.subview %arg2[%arg3, %arg4][%c2000, %c3000][%c1, %c1] : memref> to memref> linalg.matmul ins(%3, %4: memref>, memref>) outs(%5: memref>) } } } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 { operands_to_promote = [0, 1, 2], use_full_tiles_by_default } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @promote_first_subview_matmul(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %c2000 = arith.constant 2000 : index %c3000 = arith.constant 3000 : index %c4000 = arith.constant 4000 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = memref.dim %arg0, %c0 : memref> %1 = memref.dim %arg0, %c1 : memref> %2 = memref.dim %arg1, %c1 : memref> scf.for %arg3 = %c0 to %0 step %c2000 { scf.for %arg4 = %c0 to %2 step %c3000 { scf.for %arg5 = %c0 to %1 step %c4000 { %3 = memref.subview %arg0[%arg3, %arg5][%c2000, %c4000][%c1, %c1] : memref> to memref> %4 = memref.subview %arg1[%arg5, %arg4][%c4000, %c3000][%c1, %c1] : memref> to memref> %5 = memref.subview %arg2[%arg3, %arg4][%c2000, %c3000][%c1, %c1] : memref> to memref> linalg.matmul {__internal_linalg_transform__ = ""_promote_first_view_""} ins(%3, %4: memref>, memref>) outs(%5: memref>) } } } return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 { operands_to_promote = [0], use_full_tiles_by_default } : (!transform.any_op) -> !transform.any_op } }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @aligned_promote_fill(%arg0: memref>) { %c2000 = arith.constant 2000 : index %c4000 = arith.constant 4000 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf = arith.constant 1.0 : f32 %3 = memref.subview %arg0[%c0, %c0][%c2000, %c4000][%c1, %c1] : memref> to memref> linalg.fill ins(%cf : f32) outs(%3 : memref>) return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 { operands_to_promote = [1], use_full_tile_buffers = [false, true], alignment = 32} : (!transform.any_op) -> !transform.any_op } }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @aligned_promote_fill_complex(%arg0: memref, strided<[?, 1], offset: ?>>) { %c2000 = arith.constant 2000 : index %c4000 = arith.constant 4000 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cf = arith.constant 1.0 : f32 %cc = complex.create %cf, %cf : complex %3 = memref.subview %arg0[%c0, %c0][%c2000, %c4000][%c1, %c1] : memref, strided<[?, 1], offset: ?>> to memref, strided<[?, ?], offset: ?>> linalg.fill ins(%cc : complex) outs(%3 : memref, strided<[?, ?], offset: ?>>) return } transform.with_pdl_patterns { ^bb0(%arg0: !transform.any_op): sequence %arg0 : !transform.any_op failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 { operands_to_promote = [1], use_full_tile_buffers = [false, true], alignment = 32} : (!transform.any_op) -> !transform.any_op } }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_identity(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [4] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_1d_broadcast(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0) -> (0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [4] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_2d_transpose(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [4, 8] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_generic_2d_broadcast(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [4, 8] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_reduction(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb(%in: f32, %out: f32) : %0 = arith.addf %in, %out : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [4, 8] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_transpose_reduction(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d2, d1)>], iterator_types = [""reduction"", ""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb(%in: f32, %out: f32) : %0 = arith.addf %in, %out : f32 linalg.yield %0 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [4, 8, 16] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_partial_dynamic_identity(%arg0: tensor<8x?xf32>, %arg1: tensor<8x?xf32>, %arg2: tensor<8x?xf32>) -> tensor<8x?xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor<8x?xf32>, tensor<8x?xf32>) outs(%arg2 : tensor<8x?xf32>) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor<8x?xf32> return %0 : tensor<8x?xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [8, 32] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @do_not_generate_masks(%arg0: tensor<8x32xf32>, %arg1: tensor<8x32xf32>, %arg2: tensor<8x32xf32>) -> tensor<8x32xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor<8x32xf32>, tensor<8x32xf32>) outs(%arg2 : tensor<8x32xf32>) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor<8x32xf32> return %0 : tensor<8x32xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [8, 32] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_static_shape_with_mask(%arg0: tensor<8x30xf32>, %arg1: tensor<8x30xf32>, %arg2: tensor<8x30xf32>) -> tensor<8x30xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0, %arg1 : tensor<8x30xf32>, tensor<8x30xf32>) outs(%arg2 : tensor<8x30xf32>) { ^bb(%in0: f32, %in1: f32, %out: f32) : %0 = arith.addf %in0, %in1 : f32 linalg.yield %0 : f32 } -> tensor<8x30xf32> return %0 : tensor<8x30xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [8, 32] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_fill(%A : tensor, %arg0 : f32) -> tensor { %0 = linalg.fill ins(%arg0 : f32) outs(%A : tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [8, 16] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_masked_vectorize_linalg_copy(%A : memref, %B : memref) { linalg.copy ins(%A : memref) outs(%B : memref) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.copy""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [2, 4] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_masked_vectorize_pad( %0 : tensor, %h0 : index, %h1 : index) -> tensor<2x4xf32> { %cst = arith.constant 42.43 : f32 %c0 = arith.constant 0 : index %1 = tensor.pad %0 low[0, %c0] high[%h0, %h1] { ^bb0(%hh1: index, %hh2: index): tensor.yield %cst : f32 } : tensor to tensor<2x4xf32> return %1: tensor<2x4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [2, 4] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @test_masked_vectorize_dynamic_pad( %0 : tensor, %h0 : index, %h1 : index) -> tensor { %cst = arith.constant 42.43 : f32 %c0 = arith.constant 0 : index %1 = tensor.pad %0 low[0, %c0] high[%h0, %h1] { ^bb0(%hh1: index, %hh2: index): tensor.yield %cst : f32 } : tensor to tensor return %1: tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [2, 4] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @vectorize_dynamic_matmul(%A: memref, %B: memref, %C: memref) { linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.masked_vectorize %0 vector_sizes [8, 16, 4] : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @matmul_split(%A : tensor, %B: tensor<256x32xf32>, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B: tensor, tensor<256x32xf32>) outs(%C: tensor) -> tensor return %0: tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2, use_scaling_algorithm, use_alloc} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter ,1 "#map = affine_map<()[s0] -> (-s0 + 12, 7)> func.func @static_sizes_output_divisible(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>, %iv0 : index, %iv1 : index, %iv2 : index) -> tensor<24x25xf32> { %0 = affine.min #map()[%iv2] %1 = tensor.extract_slice %arg0[%iv0, %iv2] [4, %0] [1, 1] : tensor<24x12xf32> to tensor<4x?xf32> %2 = tensor.extract_slice %arg1[%iv2, %iv1] [%0, 5] [1, 1] : tensor<12x25xf32> to tensor %3 = tensor.extract_slice %arg2[%iv0, %iv1] [4, 5] [1, 1] : tensor<24x25xf32> to tensor<4x5xf32> %4 = linalg.matmul ins(%1, %2 : tensor<4x?xf32>, tensor) outs(%3 : tensor<4x5xf32>) -> tensor<4x5xf32> %5 = tensor.insert_slice %4 into %arg2[%iv0, %iv1] [4, 5] [1, 1] : tensor<4x5xf32> into tensor<24x25xf32> func.return %5 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pad %0 { padding_values=[0.0 : f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 0] } : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "#map = affine_map<()[s0] -> (-s0 + 12, 7)> func.func @static_sizes_output_divisible_on_empty_op(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>, %iv0: index, %iv1: index, %iv2: index) -> tensor<24x25xf32> { %0 = affine.min #map()[%iv2] %1 = tensor.empty(%0) : tensor<4x?xf32> %2 = tensor.empty(%0) : tensor %3 = tensor.empty() : tensor<4x5xf32> %4 = linalg.matmul ins(%1, %2 : tensor<4x?xf32>, tensor) outs(%3 : tensor<4x5xf32>) -> tensor<4x5xf32> %5 = tensor.insert_slice %4 into %arg2[%iv0, %iv1] [4, 5] [1, 1] : tensor<4x5xf32> into tensor<24x25xf32> func.return %5 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pad %0 { padding_values=[0.0 : f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 0] } : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @pad(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pad %0 { padding_values=[0: i32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 0] } : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @pad(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pad %0 { padding_values=[""{foo}"", 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 0] } : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @pad(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(suppress) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pad %0 { padding_values=[0.0 : f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 0] } : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @outs_not_produced_by_empty_or_extract_slice(%a : tensor<128x2044xf32>, %b : tensor<2044x128xf32>) -> tensor<128x128xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<128x128xf32> %9 = linalg.fill ins(%cst : f32) outs(%0 : tensor<128x128xf32>) -> tensor<128x128xf32> %c0 = arith.constant 0 : index %c16 = arith.constant 16 : index %c2044 = arith.constant 2044 : index %10 = scf.for %arg3 = %c0 to %c2044 step %c16 iter_args(%arg4 = %9) -> (tensor<128x128xf32>) { %11 = affine.min affine_map<(d0) -> (-d0 + 2044, 16)>(%arg3) %extracted_slice_2 = tensor.extract_slice %a[0, %arg3] [128, %11] [1, 1] : tensor<128x2044xf32> to tensor<128x?xf32> %extracted_slice_3 = tensor.extract_slice %b[%arg3, 0] [%11, 128] [1, 1] : tensor<2044x128xf32> to tensor %res = linalg.matmul ins(%extracted_slice_2, %extracted_slice_3 : tensor<128x?xf32>, tensor) outs(%arg4 : tensor<128x128xf32>) -> tensor<128x128xf32> scf.yield %res : tensor<128x128xf32> } return %10 : tensor<128x128xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pad %0 { padding_values=[0.0 : f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2], pack_paddings=[1, 1, 1] } : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @generalize_pad_tensor_static_shape(%arg0: tensor<1x28x28x1xf32>) -> tensor<1x32x32x1xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pad %arg0 low[0, 2, 2, 0] high[0, 2, 2, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst : f32 } : tensor<1x28x28x1xf32> to tensor<1x32x32x1xf32> return %0 : tensor<1x32x32x1xf32> } func.func @generalize_pad_tensor_dynamic_shape(%arg0: tensor<4x?x2x?xf32>, %arg1: index) -> tensor<4x?x?x?xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %out = tensor.pad %arg0 low[%c0, %c0, %arg1, %c0] high[%c0, %c0, %c0, %arg1] { ^bb0(%gen_arg1: index, %gen_arg2: index, %gen_arg3: index, %gen_arg4: index): tensor.yield %cst : f32 } : tensor<4x?x2x?xf32> to tensor<4x?x?x?xf32> return %out : tensor<4x?x?x?xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-generalize-pad-tensor"" ",1 "func.func @dot(%arg0: memref>, %arg1: memref>, %arg2: memref) { linalg.dot ins(%arg0, %arg1: memref>, memref>) outs(%arg2: memref) return }", mlir-opt -convert-linalg-to-std --split-input-file -verify-diagnostics ,1 "#matmul_accesses = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (k, n)>, affine_map<(m, n, k) -> (m, n)> ] #matmul_trait = { iterator_types = [""parallel"", ""parallel"", ""reduction""], indexing_maps = #matmul_accesses, library_call = ""external_outerproduct_matmul"" } !vector_type_A = vector<4xf32> !vector_type_B = vector<4xf32> !vector_type_C = vector<4x4xf32> !matrix_type_A = memref !matrix_type_B = memref !matrix_type_C = memref func.func @matmul_vec_impl(%A: !matrix_type_A, %B: !matrix_type_B, %C: !matrix_type_C) { linalg.generic #matmul_trait ins(%A, %B : !matrix_type_A, !matrix_type_B) outs(%C : !matrix_type_C) { ^bb0(%a: !vector_type_A, %b: !vector_type_B, %c: !vector_type_C): %d = vector.outerproduct %a, %b, %c: !vector_type_A, !vector_type_B linalg.yield %d: !vector_type_C } return }", mlir-opt -convert-linalg-to-std --split-input-file -verify-diagnostics ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> func.func @func(%arg0: tensor, %arg1: tensor) { %0 = linalg.generic { indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%in: f32, %out: f32): linalg.yield %in : f32 } -> tensor return }", mlir-opt -convert-linalg-to-std --split-input-file -verify-diagnostics ,1 "func.func @func(%arg0: tensor<4x8xf32>, %arg1: tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.copy ins(%arg0 : tensor<4x8xf32>) outs(%arg1 : tensor<4x8xf32>) -> tensor<4x8xf32> return %0 : tensor<4x8xf32> }", mlir-opt -convert-linalg-to-std --split-input-file -verify-diagnostics ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #binary2Dpointwise = { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""] } #ternary2Dpointwise = { indexing_maps = [#map0, #map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""] } func.func @test_fusion_limit( %arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor, %arg4 : tensor, %arg5 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %init = tensor.empty(%d0, %d1) : tensor %0 = linalg.generic #binary2Dpointwise ins(%arg0, %arg1 : tensor, tensor) outs(%init : tensor) { ^bb0(%arg6 : f32, %arg7 : f32, %arg8 : f32): %1 = arith.mulf %arg6, %arg7 : f32 linalg.yield %1 : f32 } -> tensor %2 = linalg.generic #binary2Dpointwise ins(%arg2, %arg3 : tensor, tensor) outs(%init : tensor) { ^bb0(%arg6 : f32, %arg7 : f32, %arg8 : f32): %3 = arith.mulf %arg6, %arg7 : f32 linalg.yield %3 : f32 } -> tensor %4 = linalg.generic #binary2Dpointwise ins(%arg4, %arg5 : tensor, tensor) outs(%init : tensor) { ^bb0(%arg6 : f32, %arg7 : f32, %arg8 : f32): %5 = arith.mulf %arg6, %arg7 : f32 linalg.yield %5 : f32 } -> tensor %6 = linalg.generic #ternary2Dpointwise ins(%0, %2, %4 : tensor, tensor, tensor) outs(%init : tensor) { ^bb0(%arg6 : f32, %arg7 : f32, %arg8 : f32, %arg9 : f32): %7 = arith.addf %arg6, %arg7 : f32 %8 = arith.addf %7, %arg8 : f32 linalg.yield %8 : f32 } -> tensor return %6 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-generic-ops-control -split-input-file ,1 "func.func @generalize_matmul_tensor_f16f64f32(%A : tensor<16x8xf16>, %B: tensor<8x32xf64>, %C: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.matmul ins(%A, %B: tensor<16x8xf16>, tensor<8x32xf64>) outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_tensor_i16i64i32(%A : tensor<16x8xi16>, %B: tensor<8x32xi64>, %C: tensor<16x32xi32>) -> tensor<16x32xi32> { %0 = linalg.matmul ins(%A, %B: tensor<16x8xi16>, tensor<8x32xi64>) outs(%C: tensor<16x32xi32>) -> tensor<16x32xi32> return %0: tensor<16x32xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_tensor_i16i64i32_unsigned(%A : tensor<16x8xi16>, %B: tensor<8x32xi64>, %C: tensor<16x32xi32>) -> tensor<16x32xi32> { %0 = linalg.matmul {cast = #linalg.type_fn} ins(%A, %B: tensor<16x8xi16>, tensor<8x32xi64>) outs(%C: tensor<16x32xi32>) -> tensor<16x32xi32> return %0: tensor<16x32xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_tensor_i16i64f32(%A : tensor<16x8xi16>, %B: tensor<8x32xi64>, %C: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.matmul ins(%A, %B: tensor<16x8xi16>, tensor<8x32xi64>) outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_tensor_f16f64i32(%A : tensor<16x8xf16>, %B: tensor<8x32xf64>, %C: tensor<16x32xi32>) -> tensor<16x32xi32> { %0 = linalg.matmul ins(%A, %B: tensor<16x8xf16>, tensor<8x32xf64>) outs(%C: tensor<16x32xi32>) -> tensor<16x32xi32> return %0: tensor<16x32xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_unsigned_tensor_i16i64i32(%A : tensor<16x8xi16>, %B: tensor<8x32xi64>, %C: tensor<16x32xi32>) -> tensor<16x32xi32> { %0 = linalg.matmul_unsigned ins(%A, %B: tensor<16x8xi16>, tensor<8x32xi64>) outs(%C: tensor<16x32xi32>) -> tensor<16x32xi32> return %0: tensor<16x32xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_unsigned_tensor_i16i64f32(%A : tensor<16x8xi16>, %B: tensor<8x32xi64>, %C: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.matmul_unsigned ins(%A, %B: tensor<16x8xi16>, tensor<8x32xi64>) outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_unsigned_tensor_f16f64i32(%A : tensor<16x8xf16>, %B: tensor<8x32xf64>, %C: tensor<16x32xi32>) -> tensor<16x32xi32> { %0 = linalg.matmul_unsigned ins(%A, %B: tensor<16x8xf16>, tensor<8x32xf64>) outs(%C: tensor<16x32xi32>) -> tensor<16x32xi32> return %0: tensor<16x32xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_max_f32(%input : tensor<1x4x16x1xf32>, %shape: tensor<2x2xf32>, %output: tensor<1x2x4x1xf32>) -> tensor<1x2x4x1xf32> { %0 = linalg.pooling_nhwc_max {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xf32>, tensor<2x2xf32>) outs(%output : tensor<1x2x4x1xf32>) -> tensor<1x2x4x1xf32> return %0: tensor<1x2x4x1xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_max_f32(%input : tensor<1x16x1xf32>, %shape: tensor<2xf32>, %output: tensor<1x4x1xf32>) -> tensor<1x4x1xf32> { %0 = linalg.pooling_nwc_max {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xf32>, tensor<2xf32>) outs(%output : tensor<1x4x1xf32>) -> tensor<1x4x1xf32> return %0: tensor<1x4x1xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_max_i32(%input : tensor<1x4x16x1xi32>, %shape: tensor<2x2xi32>, %output: tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> { %0 = linalg.pooling_nhwc_max {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xi32>, tensor<2x2xi32>) outs(%output : tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> return %0: tensor<1x2x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_max_i32(%input : tensor<1x16x1xi32>, %shape: tensor<2xi32>, %output: tensor<1x4x1xi32>) -> tensor<1x4x1xi32> { %0 = linalg.pooling_nwc_max {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xi32>, tensor<2xi32>) outs(%output : tensor<1x4x1xi32>) -> tensor<1x4x1xi32> return %0: tensor<1x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_max_unsigned_i32(%input : tensor<1x4x16x1xi32>, %shape: tensor<2x2xi32>, %output: tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> { %0 = linalg.pooling_nhwc_max_unsigned {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xi32>, tensor<2x2xi32>) outs(%output : tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> return %0: tensor<1x2x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_max_unsigned_i32(%input : tensor<1x16x1xi32>, %shape: tensor<2xi32>, %output: tensor<1x4x1xi32>) -> tensor<1x4x1xi32> { %0 = linalg.pooling_nwc_max_unsigned {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xi32>, tensor<2xi32>) outs(%output : tensor<1x4x1xi32>) -> tensor<1x4x1xi32> return %0: tensor<1x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_min_f32(%input : tensor<1x4x16x1xf32>, %shape: tensor<2x2xf32>, %output: tensor<1x2x4x1xf32>) -> tensor<1x2x4x1xf32> { %0 = linalg.pooling_nhwc_min {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xf32>, tensor<2x2xf32>) outs(%output : tensor<1x2x4x1xf32>) -> tensor<1x2x4x1xf32> return %0: tensor<1x2x4x1xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_min_f32(%input : tensor<1x16x1xf32>, %shape: tensor<2xf32>, %output: tensor<1x4x1xf32>) -> tensor<1x4x1xf32> { %0 = linalg.pooling_nwc_min {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xf32>, tensor<2xf32>) outs(%output : tensor<1x4x1xf32>) -> tensor<1x4x1xf32> return %0: tensor<1x4x1xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_min_i32(%input : tensor<1x4x16x1xi32>, %shape: tensor<2x2xi32>, %output: tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> { %0 = linalg.pooling_nhwc_min {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xi32>, tensor<2x2xi32>) outs(%output : tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> return %0: tensor<1x2x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_min_i32(%input : tensor<1x16x1xi32>, %shape: tensor<2xi32>, %output: tensor<1x4x1xi32>) -> tensor<1x4x1xi32> { %0 = linalg.pooling_nwc_min {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xi32>, tensor<2xi32>) outs(%output : tensor<1x4x1xi32>) -> tensor<1x4x1xi32> return %0: tensor<1x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_min_unsigned_i32(%input : tensor<1x4x16x1xi32>, %shape: tensor<2x2xi32>, %output: tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> { %0 = linalg.pooling_nhwc_min_unsigned {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xi32>, tensor<2x2xi32>) outs(%output : tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> return %0: tensor<1x2x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_min_unsigned_i32(%input : tensor<1x16x1xi32>, %shape: tensor<2xi32>, %output: tensor<1x4x1xi32>) -> tensor<1x4x1xi32> { %0 = linalg.pooling_nwc_min_unsigned {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xi32>, tensor<2xi32>) outs(%output : tensor<1x4x1xi32>) -> tensor<1x4x1xi32> return %0: tensor<1x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_sum_f32(%input : tensor<1x4x16x1xf32>, %shape: tensor<2x2xf32>, %output: tensor<1x2x4x1xf32>) -> tensor<1x2x4x1xf32> { %0 = linalg.pooling_nhwc_sum {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xf32>, tensor<2x2xf32>) outs(%output : tensor<1x2x4x1xf32>) -> tensor<1x2x4x1xf32> return %0: tensor<1x2x4x1xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_sum_f32(%input : tensor<1x16x1xf32>, %shape: tensor<2xf32>, %output: tensor<1x4x1xf32>) -> tensor<1x4x1xf32> { %0 = linalg.pooling_nwc_sum {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xf32>, tensor<2xf32>) outs(%output : tensor<1x4x1xf32>) -> tensor<1x4x1xf32> return %0: tensor<1x4x1xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nhwc_sum_i32(%input : tensor<1x4x16x1xi32>, %shape: tensor<2x2xi32>, %output: tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> { %0 = linalg.pooling_nhwc_sum {dilations = dense<[1, 2]> : tensor<2xi64>, strides = dense<[2, 4]> : tensor<2xi64>} ins(%input, %shape : tensor<1x4x16x1xi32>, tensor<2x2xi32>) outs(%output : tensor<1x2x4x1xi32>) -> tensor<1x2x4x1xi32> return %0: tensor<1x2x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_pooling_nwc_sum_i32(%input : tensor<1x16x1xi32>, %shape: tensor<2xi32>, %output: tensor<1x4x1xi32>) -> tensor<1x4x1xi32> { %0 = linalg.pooling_nwc_sum {dilations = dense<[2]> : tensor<1xi64>, strides = dense<[4]> : tensor<1xi64>} ins(%input, %shape : tensor<1x16x1xi32>, tensor<2xi32>) outs(%output : tensor<1x4x1xi32>) -> tensor<1x4x1xi32> return %0: tensor<1x4x1xi32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_fill_0d(%value: f64, %O: tensor) -> tensor { %0 = linalg.fill ins(%value: f64) outs(%O : tensor) -> tensor return %0: tensor }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_fill_2d(%value: f64, %O: memref<16x32xf32>) { linalg.fill ins(%value: f64) outs(%O : memref<16x32xf32>) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_index(%min: f64, %max: f64, %seed: i32, %O: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.fill_rng_2d ins(%min, %max, %seed: f64, f64, i32) outs(%O : tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_const(%min: f64, %max: f64, %seed: i32, %O: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.fill_rng_2d ins(%min, %max, %seed: f64, f64, i32) outs(%O : tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_exp(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_unary ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_log(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_abs(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_ceil(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_floor(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_negf(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_unary {fun = #linalg.unary_fn} ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_add(%lhs : tensor<4x8xf32>, %rhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_binary ins(%lhs, %rhs: tensor<4x8xf32>, tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_mul(%lhs : tensor<4x8xf32>, %rhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%lhs, %rhs: tensor<4x8xf32>, tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_elemwise_rank_zero(%lhs : tensor, %rhs : tensor, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.elemwise_binary {fun = #linalg.binary_fn} ins(%lhs, %rhs: tensor, tensor) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_copy(%lhs : tensor<4x8xf32>, %output : tensor<4x8xf32>) -> tensor<4x8xf32> { %0 = linalg.copy ins(%lhs: tensor<4x8xf32>) outs(%output: tensor<4x8xf32>) -> tensor<4x8xf32> return %0: tensor<4x8xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @fill_inplace( %A : tensor {bufferization.writable = true}) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @fill_inplace( %A : tensor {bufferization.writable = true}) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @not_inplace( %A : tensor {bufferization.writable = false}) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @not_inplace( %A : tensor {bufferization.writable = false}) -> tensor { %f0 = arith.constant 0.0 : f32 %r = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @not_inplace( %A : tensor {bufferization.writable = true}) -> tensor { %f0 = arith.constant 0.0 : f32 %f = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor %r = linalg.matmul ins(%f, %f: tensor, tensor) outs(%A: tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @not_inplace( %A : tensor {bufferization.writable = true}) -> tensor { %f0 = arith.constant 0.0 : f32 %f = linalg.fill ins(%f0 : f32) outs(%A : tensor) -> tensor %r = linalg.matmul ins(%f, %f: tensor, tensor) outs(%A: tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @not_inplace( %A : tensor {bufferization.writable = true}) -> tensor { %r = linalg.matmul ins(%A, %A: tensor, tensor) outs(%A: tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @not_inplace( %A : tensor {bufferization.writable = true}) -> tensor { %r = linalg.matmul ins(%A, %A: tensor, tensor) outs(%A: tensor) -> tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @vec_inplace( %A : tensor {bufferization.writable = true}, %vec : vector<4xf32>) -> tensor { %c0 = arith.constant 0 : index %r = vector.transfer_write %vec, %A[%c0] : vector<4xf32>, tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @vec_inplace( %A : tensor {bufferization.writable = true}, %vec : vector<4xf32>) -> tensor { %c0 = arith.constant 0 : index %r = vector.transfer_write %vec, %A[%c0] : vector<4xf32>, tensor return %r: tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @vec_not_inplace( %A : tensor {bufferization.writable = true}, %vec : vector<4xf32>) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %r0 = vector.transfer_write %vec, %A[%c0] : vector<4xf32>, tensor %r1 = vector.transfer_write %vec, %A[%c1] : vector<4xf32>, tensor return %r0, %r1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @vec_not_inplace( %A : tensor {bufferization.writable = true}, %vec : vector<4xf32>) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %r0 = vector.transfer_write %vec, %A[%c0] : vector<4xf32>, tensor %r1 = vector.transfer_write %vec, %A[%c1] : vector<4xf32>, tensor return %r0, %r1: tensor, tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @matmul( %A: tensor<128x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %B: tensor<256x192xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %C: tensor<128x192xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<128x192xf32> { %c0 = arith.constant 0 : index %c256 = arith.constant 256 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %c128 = arith.constant 128 : index %c192 = arith.constant 192 : index %c8 = arith.constant 8 : index %c16 = arith.constant 16 : index %0 = scf.for %arg3 = %c0 to %c128 step %c8 iter_args(%arg4 = %C) -> (tensor<128x192xf32>) { %1 = tensor.extract_slice %A[%arg3, 0] [8, 256] [1, 1] : tensor<128x256xf32> to tensor<8x256xf32> %2 = scf.for %arg5 = %c0 to %c192 step %c16 iter_args(%arg6 = %arg4) -> (tensor<128x192xf32>) { %3 = tensor.extract_slice %B[0, %arg5] [256, 16] [1, 1] : tensor<256x192xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %C[%arg3, %arg5] [8, 16] [1, 1] : tensor<128x192xf32> to tensor<8x16xf32> %5 = linalg.fill ins(%cst : f32) outs(%4 : tensor<8x16xf32>) -> tensor<8x16xf32> %6 = scf.for %arg7 = %c0 to %c256 step %c32 iter_args(%arg8 = %5) -> (tensor<8x16xf32>) { %8 = tensor.extract_slice %1[0, %arg7] [8, 32] [1, 1] : tensor<8x256xf32> to tensor<8x32xf32> %9 = tensor.extract_slice %3[%arg7, 0] [32, 16] [1, 1] : tensor<256x16xf32> to tensor<32x16xf32> %10 = linalg.matmul ins(%8, %9 : tensor<8x32xf32>, tensor<32x16xf32>) outs(%arg8 : tensor<8x16xf32>) -> tensor<8x16xf32> scf.yield %10 : tensor<8x16xf32> } %7 = tensor.insert_slice %6 into %arg6[%arg3, %arg5] [8, 16] [1, 1] : tensor<8x16xf32> into tensor<128x192xf32> scf.yield %7 : tensor<128x192xf32> } scf.yield %2 : tensor<128x192xf32> } return %0 : tensor<128x192xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @matmul( %A: tensor<128x256xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %B: tensor<256x192xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = false}, %C: tensor<128x192xf32> {bufferization.buffer_layout = affine_map<(d0, d1) -> (d0, d1)>, bufferization.writable = true}) -> tensor<128x192xf32> { %c0 = arith.constant 0 : index %c256 = arith.constant 256 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f32 %c128 = arith.constant 128 : index %c192 = arith.constant 192 : index %c8 = arith.constant 8 : index %c16 = arith.constant 16 : index %0 = scf.for %arg3 = %c0 to %c128 step %c8 iter_args(%arg4 = %C) -> (tensor<128x192xf32>) { %1 = tensor.extract_slice %A[%arg3, 0] [8, 256] [1, 1] : tensor<128x256xf32> to tensor<8x256xf32> %2 = scf.for %arg5 = %c0 to %c192 step %c16 iter_args(%arg6 = %arg4) -> (tensor<128x192xf32>) { %3 = tensor.extract_slice %B[0, %arg5] [256, 16] [1, 1] : tensor<256x192xf32> to tensor<256x16xf32> %4 = tensor.extract_slice %C[%arg3, %arg5] [8, 16] [1, 1] : tensor<128x192xf32> to tensor<8x16xf32> %5 = linalg.fill ins(%cst : f32) outs(%4 : tensor<8x16xf32>) -> tensor<8x16xf32> %6 = scf.for %arg7 = %c0 to %c256 step %c32 iter_args(%arg8 = %5) -> (tensor<8x16xf32>) { %8 = tensor.extract_slice %1[0, %arg7] [8, 32] [1, 1] : tensor<8x256xf32> to tensor<8x32xf32> %9 = tensor.extract_slice %3[%arg7, 0] [32, 16] [1, 1] : tensor<256x16xf32> to tensor<32x16xf32> %10 = linalg.matmul ins(%8, %9 : tensor<8x32xf32>, tensor<32x16xf32>) outs(%arg8 : tensor<8x16xf32>) -> tensor<8x16xf32> scf.yield %10 : tensor<8x16xf32> } %7 = tensor.insert_slice %6 into %arg6[%arg3, %arg5] [8, 16] [1, 1] : tensor<8x16xf32> into tensor<128x192xf32> scf.yield %7 : tensor<128x192xf32> } scf.yield %2 : tensor<128x192xf32> } return %0 : tensor<128x192xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @dominance_violation_bug_1( %A : tensor {bufferization.writable = false}, %idx : index) -> tensor { %f0 = arith.constant 0.0 : f32 %sA = tensor.extract_slice %A[0, 0][%idx, %idx][1, 1] : tensor to tensor %ssA = tensor.extract_slice %sA[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %FA = linalg.fill ins(%f0 : f32) outs(%ssA : tensor<4x4xf32>) -> tensor<4x4xf32> %rsA = tensor.insert_slice %FA into %sA[0, 0][4, 4][1, 1] : tensor<4x4xf32> into tensor %rA = tensor.insert_slice %rsA into %A[0, 0][%idx, %idx][1, 1] : tensor into tensor return %rA : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @dominance_violation_bug_1( %A : tensor {bufferization.writable = false}, %idx : index) -> tensor { %f0 = arith.constant 0.0 : f32 %sA = tensor.extract_slice %A[0, 0][%idx, %idx][1, 1] : tensor to tensor %ssA = tensor.extract_slice %sA[0, 0][4, 4][1, 1] : tensor to tensor<4x4xf32> %FA = linalg.fill ins(%f0 : f32) outs(%ssA : tensor<4x4xf32>) -> tensor<4x4xf32> %rsA = tensor.insert_slice %FA into %sA[0, 0][4, 4][1, 1] : tensor<4x4xf32> into tensor %rA = tensor.insert_slice %rsA into %A[0, 0][%idx, %idx][1, 1] : tensor into tensor return %rA : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @gather_like( %arg0 : tensor {bufferization.writable = false}, %arg1 : tensor {bufferization.writable = false}, %arg2 : tensor {bufferization.writable = true}) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg1 : tensor) outs(%arg2 : tensor) { ^bb0(%arg3: i32, %arg4 : f32): %iv1 = linalg.index 1 : index %1 = arith.index_cast %arg3: i32 to index %2 = tensor.extract %arg0[%1, %iv1] : tensor linalg.yield %2 : f32 } -> tensor return %0 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @gather_like( %arg0 : tensor {bufferization.writable = false}, %arg1 : tensor {bufferization.writable = false}, %arg2 : tensor {bufferization.writable = true}) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg1 : tensor) outs(%arg2 : tensor) { ^bb0(%arg3: i32, %arg4 : f32): %iv1 = linalg.index 1 : index %1 = arith.index_cast %arg3: i32 to index %2 = tensor.extract %arg0[%1, %iv1] : tensor linalg.yield %2 : f32 } -> tensor return %0 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @linalg_op_bufferizes_inplace_with_input( %t1: tensor {bufferization.writable = true}, %t2: tensor {bufferization.writable = true}, %t3: tensor {bufferization.writable = true}, %s1: index, %s2: index, %cst: f32) -> tensor { %r = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1)-> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%t1, %t2 : tensor, tensor) outs(%t3 : tensor) { ^bb0(%arg0 : f32, %arg1 : f32, %arg2 : f32) : %add = arith.addf %arg0, %arg1 : f32 linalg.yield %add : f32 } -> tensor return %r : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @linalg_op_bufferizes_inplace_with_input( %t1: tensor {bufferization.writable = true}, %t2: tensor {bufferization.writable = true}, %t3: tensor {bufferization.writable = true}, %s1: index, %s2: index, %cst: f32) -> tensor { %r = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1)-> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%t1, %t2 : tensor, tensor) outs(%t3 : tensor) { ^bb0(%arg0 : f32, %arg1 : f32, %arg2 : f32) : %add = arith.addf %arg0, %arg1 : f32 linalg.yield %add : f32 } -> tensor return %r : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @op_is_reading_but_following_ops_are_not( %t0 : tensor {bufferization.writable = false}, %cst : f32) -> tensor { %r0 =linalg.generic #trait outs (%t0 : tensor) { ^bb(%0: f32) : %a = arith.addf %cst, %0 : f32 linalg.yield %a : f32 } -> (tensor) %r1 = linalg.generic #trait outs (%r0 : tensor) { ^bb(%0: f32) : linalg.yield %cst : f32 } -> (tensor) return %r1 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "#accesses = [ affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @op_is_reading_but_following_ops_are_not( %t0 : tensor {bufferization.writable = false}, %cst : f32) -> tensor { %r0 =linalg.generic #trait outs (%t0 : tensor) { ^bb(%0: f32) : %a = arith.addf %cst, %0 : f32 linalg.yield %a : f32 } -> (tensor) %r1 = linalg.generic #trait outs (%r0 : tensor) { ^bb(%0: f32) : linalg.yield %cst : f32 } -> (tensor) return %r1 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @map_binary(%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map ins(%lhs, %rhs: tensor<64xf32>, tensor<64xf32>) outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @map_binary(%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map ins(%lhs, %rhs: tensor<64xf32>, tensor<64xf32>) outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @reduce(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @reduce(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @transpose(%input: tensor<16x32x64xf32>, %init: tensor<32x64x16xf32>) -> tensor<32x64x16xf32> { %transpose = linalg.transpose ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<32x64x16xf32>) permutation = [1, 2, 0] func.return %transpose : tensor<32x64x16xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @transpose(%input: tensor<16x32x64xf32>, %init: tensor<32x64x16xf32>) -> tensor<32x64x16xf32> { %transpose = linalg.transpose ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<32x64x16xf32>) permutation = [1, 2, 0] func.return %transpose : tensor<32x64x16xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @broadcast(%input: tensor<8x32xf32>, %init: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> { %bcast = linalg.broadcast ins(%input:tensor<8x32xf32>) outs(%init:tensor<8x16x32xf32>) dimensions = [1] func.return %bcast : tensor<8x16x32xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @broadcast(%input: tensor<8x32xf32>, %init: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> { %bcast = linalg.broadcast ins(%input:tensor<8x32xf32>) outs(%init:tensor<8x16x32xf32>) dimensions = [1] func.return %bcast : tensor<8x16x32xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @depthwise_conv_1d_nwc_wc(%arg0: index, %arg1: index, %arg2: tensor<8x18x32xf32>) -> tensor { %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %c8 = arith.constant 8 : index %0 = bufferization.alloc_tensor() : tensor<4x1x6x8xf32> %1 = tensor.cast %0 : tensor<4x1x6x8xf32> to tensor %2 = bufferization.alloc_tensor() : tensor<1x6x8xf32> %3 = scf.for %arg3 = %c0 to %c32 step %c8 iter_args(%arg4 = %1) -> (tensor) { %4 = affine.apply affine_map<(d0) -> (d0 ceildiv 8)>(%arg3) %5 = tensor.insert_slice %2 into %arg4[%4,0, 0, 0] [1, 1, 6, 8] [1, 1, 1, 1] : tensor<1x6x8xf32> into tensor scf.yield %5 : tensor } return %3 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @depthwise_conv_1d_nwc_wc(%arg0: index, %arg1: index, %arg2: tensor<8x18x32xf32>) -> tensor { %c0 = arith.constant 0 : index %c32 = arith.constant 32 : index %c8 = arith.constant 8 : index %0 = bufferization.alloc_tensor() : tensor<4x1x6x8xf32> %1 = tensor.cast %0 : tensor<4x1x6x8xf32> to tensor %2 = bufferization.alloc_tensor() : tensor<1x6x8xf32> %3 = scf.for %arg3 = %c0 to %c32 step %c8 iter_args(%arg4 = %1) -> (tensor) { %4 = affine.apply affine_map<(d0) -> (d0 ceildiv 8)>(%arg3) %5 = tensor.insert_slice %2 into %arg4[%4,0, 0, 0] [1, 1, 6, 8] [1, 1, 1, 1] : tensor<1x6x8xf32> into tensor scf.yield %5 : tensor } return %3 : tensor }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @do_not_copy_alloc_tensors(%f1: f32, %f2: f32, %idx: index) -> (tensor<5xf32>, tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> %1 = tensor.insert %f1 into %0[%idx] : tensor<5xf32> %2 = tensor.insert %f2 into %0[%idx] : tensor<5xf32> return %1, %2 : tensor<5xf32>, tensor<5xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs bufferize-function-boundaries"" -buffer-loop-hoisting -drop-equivalent-buffer-results -split-input-file ",1 "func.func @do_not_copy_alloc_tensors(%f1: f32, %f2: f32, %idx: index) -> (tensor<5xf32>, tensor<5xf32>) { %0 = bufferization.alloc_tensor() : tensor<5xf32> %1 = tensor.insert %f1 into %0[%idx] : tensor<5xf32> %2 = tensor.insert %f2 into %0[%idx] : tensor<5xf32> return %1, %2 : tensor<5xf32>, tensor<5xf32> }"," mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=23 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=59 bufferize-function-boundaries"" -split-input-file -o /dev/null // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs test-analysis-only analysis-fuzzer-seed=91 bufferize-function-boundaries"" -split-input-file -o /dev/null // Test bufferization using memref types that have no layout map. // RUN: mlir-opt -one-shot-bufferize=""allow-return-allocs unknown-type-conversion=identity-layout-map function-boundary-type-conversion=identity-layout-map bufferize-function-boundaries"" -drop-equivalent-buffer-results -split-input-file ",1 "func.func @pad_tensor_with_memrefs(%arg0: memref<1x28x28x1xf32>) -> memref<2x31x31x3xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = bufferization.to_tensor %arg0 : memref<1x28x28x1xf32> %1 = tensor.pad %0 low[1, 1, 1, 2] high[0, 2, 2, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst : f32 } : tensor<1x28x28x1xf32> to tensor<2x31x31x3xf32> %2 = bufferization.to_memref %1 : memref<2x31x31x3xf32> return %2 : memref<2x31x31x3xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-transform-pad-tensor"" ",1 "func.func @pad_tensor_no_memrefs(%arg0: tensor<1x28x28xf32>) -> tensor<2x32x32xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pad %arg0 low[1, 2, 2] high[0, 2, 2] { ^bb0(%arg1: index, %arg2: index, %arg3: index): tensor.yield %cst : f32 } : tensor<1x28x28xf32> to tensor<2x32x32xf32> return %0 : tensor<2x32x32xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-transform-pad-tensor"" ",1 "func.func @pad_tensor_detailed(%arg0: tensor<1x28x28x1xf32>) -> tensor<1x32x32x1xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pad %arg0 low[0, 2, 2, 0] high[0, 2, 2, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst : f32 } : tensor<1x28x28x1xf32> to tensor<1x32x32x1xf32> return %0 : tensor<1x32x32x1xf32> }"," mlir-opt -split-input-file --test-linalg-transform-patterns=""test-transform-pad-tensor"" ",1 "func.func @depthwise_conv_1d_nwc_wcm(%input: tensor<1x12x8xf32>, %filter: tensor<3x8x8xf32>) -> tensor<1x10x8x8xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<1x10x8x8xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<1x10x8x8xf32>) -> tensor<1x10x8x8xf32> %0 = linalg.depthwise_conv_1d_nwc_wcm {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : tensor<1x12x8xf32>, tensor<3x8x8xf32>) outs(%fill : tensor<1x10x8x8xf32>) -> tensor<1x10x8x8xf32> return %0 : tensor<1x10x8x8xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_1d_nwc_wc(%input: tensor<1x12x8xf32>, %filter: tensor<3x8xf32>) -> tensor<1x10x8xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<1x10x8xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<1x10x8xf32>) -> tensor<1x10x8xf32> %0 = linalg.depthwise_conv_1d_nwc_wc {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : tensor<1x12x8xf32>, tensor<3x8xf32>) outs(%fill : tensor<1x10x8xf32>) -> tensor<1x10x8xf32> return %0 : tensor<1x10x8xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_1d_ncw_cw(%input: tensor<1x8x12xf32>, %filter: tensor<8x3xf32>) -> tensor<1x8x10xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<1x8x10xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<1x8x10xf32>) -> tensor<1x8x10xf32> %0 = linalg.depthwise_conv_1d_ncw_cw {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : tensor<1x8x12xf32>, tensor<8x3xf32>) outs(%fill : tensor<1x8x10xf32>) -> tensor<1x8x10xf32> return %0 : tensor<1x8x10xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_2d_nhwc_hwcm_tensor(%input: tensor<2x4x5x2xf32>, %filter: tensor<2x2x2x3xf32>) -> tensor<2x3x4x2x3xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<2x3x4x2x3xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<2x3x4x2x3xf32>) -> tensor<2x3x4x2x3xf32> %0 = linalg.depthwise_conv_2d_nhwc_hwcm { dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : tensor<2x4x5x2xf32>, tensor<2x2x2x3xf32>) outs(%fill : tensor<2x3x4x2x3xf32>) -> tensor<2x3x4x2x3xf32> return %0 : tensor<2x3x4x2x3xf32> } func.func @depthwise_conv_2d_nhwc_hwcm_memref(%input: memref<2x4x5x2xf32>, %filter: memref<2x2x2x3xf32>, %output: memref<2x3x4x2x3xf32>) { linalg.depthwise_conv_2d_nhwc_hwcm { dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : memref<2x4x5x2xf32>, memref<2x2x2x3xf32>) outs(%output : memref<2x3x4x2x3xf32>) return } func.func @depthwise_conv_1d_nw_tensor(%input: tensor<1x113x96xf32>, %filter: tensor<3x96xf32>) -> tensor<1x56x96xf32> { %init = tensor.empty() : tensor<1x56x96xf32> %0 = linalg.depthwise_conv_1d_nwc_wc {dilations = dense<1> : vector<1xi64>, strides = dense<2> : vector<1xi64>} ins(%input, %filter: tensor<1x113x96xf32>, tensor<3x96xf32>) outs(%init: tensor<1x56x96xf32>) -> tensor<1x56x96xf32> return %0: tensor<1x56x96xf32> } func.func @depthwise_conv_2d_nhwc_hwc_tensor(%input: tensor<1x113x113x96xf32>, %filter: tensor<3x3x96xf32>) -> tensor<1x56x56x96xf32> { %init = tensor.empty() : tensor<1x56x56x96xf32> %0 = linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<2xi64>} ins(%input, %filter: tensor<1x113x113x96xf32>, tensor<3x3x96xf32>) outs(%init: tensor<1x56x56x96xf32>) -> tensor<1x56x56x96xf32> return %0: tensor<1x56x56x96xf32> } func.func @depthwise_conv_2d_nhwc_hwc_memref(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<2xi64>} ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) return } func.func @depthwise_conv_2d_nchw_chw_tensor(%input: tensor<1x96x113x113xf32>, %filter: tensor<96x3x3xf32>) -> tensor<1x96x56x56xf32> { %init = tensor.empty() : tensor<1x96x56x56xf32> %0 = linalg.depthwise_conv_2d_nchw_chw {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<2xi64>} ins(%input, %filter: tensor<1x96x113x113xf32>, tensor<96x3x3xf32>) outs(%init: tensor<1x96x56x56xf32>) -> tensor<1x96x56x56xf32> return %0: tensor<1x96x56x56xf32> } func.func @depthwise_conv_2d_nchw_chw_memref(%input: memref<1x96x113x113xf32>, %filter: memref<96x3x3xf32>, %output: memref<1x96x56x56xf32>) { linalg.depthwise_conv_2d_nchw_chw {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<2xi64>} ins(%input, %filter: memref<1x96x113x113xf32>, memref<96x3x3xf32>) outs(%output: memref<1x96x56x56xf32>) return } func.func @depthwise_conv_2d_nhwc_hwcm_tensor_dilated(%input: tensor<2x8x9x2xf32>, %filter: tensor<2x2x2x3xf32>) -> tensor<2x6x7x2x3xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<2x6x7x2x3xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<2x6x7x2x3xf32>) -> tensor<2x6x7x2x3xf32> %0 = linalg.depthwise_conv_2d_nhwc_hwcm { dilations = dense<2> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : tensor<2x8x9x2xf32>, tensor<2x2x2x3xf32>) outs(%fill : tensor<2x6x7x2x3xf32>) -> tensor<2x6x7x2x3xf32> return %0 : tensor<2x6x7x2x3xf32> } func.func @depthwise_conv_2d_nhwc_hwcm_memref_dilated(%input: memref<2x8x9x2xf32>, %filter: memref<2x2x2x3xf32>, %output: memref<2x6x7x2x3xf32>) { linalg.depthwise_conv_2d_nhwc_hwcm { dilations = dense<2> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : memref<2x8x9x2xf32>, memref<2x2x2x3xf32>) outs(%output : memref<2x6x7x2x3xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_2d_input_nhwc_filter_default_attributes(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { linalg.depthwise_conv_2d_nhwc_hwc ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_2d_input_nhwc_filter_wrong_stride_element_type_properties(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { linalg.depthwise_conv_2d_nhwc_hwc <{dilations = dense<1> : vector<2xi64>, strides = dense<2.0> : vector<2xf32>}> ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_2d_input_nhwc_filter_wrong_stride_element_type(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : vector<2xi64>, strides = dense<2.0> : vector<2xf32>} ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_2d_input_nhwc_filter_wrong_stride_size(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<3xi64> } ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_3d_ndhwc_dhwcm(%input: tensor<2x6x13x12x6xf32>, %filter: tensor<2x1x3x6x6xf32>) -> tensor<2x3x13x4x6x6xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<2x3x13x4x6x6xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<2x3x13x4x6x6xf32>) -> tensor<2x3x13x4x6x6xf32> %0 = linalg.depthwise_conv_3d_ndhwc_dhwcm {dilations = dense<1> : tensor<3xi64>, strides = dense<[2, 1, 3]> : tensor<3xi64>} ins(%input, %filter : tensor<2x6x13x12x6xf32>, tensor<2x1x3x6x6xf32>) outs(%fill : tensor<2x3x13x4x6x6xf32>) -> tensor<2x3x13x4x6x6xf32> return %0 : tensor<2x3x13x4x6x6xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_3d_ndhwc_dhwc(%input: tensor<2x6x13x12x6xf32>, %filter: tensor<2x1x3x6xf32>) -> tensor<2x3x13x4x6xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<2x3x13x4x6xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<2x3x13x4x6xf32>) -> tensor<2x3x13x4x6xf32> %0 = linalg.depthwise_conv_3d_ndhwc_dhwc {dilations = dense<1> : tensor<3xi64>, strides = dense<[2, 1, 3]> : tensor<3xi64>} ins(%input, %filter : tensor<2x6x13x12x6xf32>, tensor<2x1x3x6xf32>) outs(%fill : tensor<2x3x13x4x6xf32>) -> tensor<2x3x13x4x6xf32> return %0 : tensor<2x3x13x4x6xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @depthwise_conv_3d_ncdhw_cdhw(%input: tensor<2x6x6x13x12xf32>, %filter: tensor<6x2x1x3xf32>) -> tensor<2x6x3x13x4xf32> { %zero = arith.constant 0.000000e+00 : f32 %init = tensor.empty() : tensor<2x6x3x13x4xf32> %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<2x6x3x13x4xf32>) -> tensor<2x6x3x13x4xf32> %0 = linalg.depthwise_conv_3d_ncdhw_cdhw {dilations = dense<1> : tensor<3xi64>, strides = dense<[2, 1, 3]> : tensor<3xi64>} ins(%input, %filter : tensor<2x6x6x13x12xf32>, tensor<6x2x1x3xf32>) outs(%fill : tensor<2x6x3x13x4xf32>) -> tensor<2x6x3x13x4xf32> return %0 : tensor<2x6x3x13x4xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_1d_nwc_wcf(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_1d_nwc_wcf(%input: memref, %filter: memref, %output: memref) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_1d_ncw_fcw(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_1d_ncw_fcw {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_1d_ncw_fcw(%input: memref, %filter: memref, %output: memref) { linalg.conv_1d_ncw_fcw {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_2d_nhwc_hwcf(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_2d_ngchw_fgchw(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_2d_ngchw_fgchw {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_2d_nhwc_fhwc(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_2d_nhwc_fhwc {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_2d_nhwc_fhwc_static(%input: tensor, %filter: tensor<64x3x3x32xf32>, %init: tensor) -> tensor { %0 = linalg.conv_2d_nhwc_fhwc {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<64x3x3x32xf32>) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_2d_nhwc_hwcf(%input: memref, %filter: memref, %output: memref) { linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_2d_ngchw_fgchw(%input: memref, %filter: memref, %output: memref) { linalg.conv_2d_ngchw_fgchw {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_3d_ndhwc_dhwcf(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_3d_ndhwc_dhwcf {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_3d_ndhwc_dhwcf(%input: memref, %filter: memref, %output: memref) { linalg.conv_3d_ndhwc_dhwcf {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_3d_ncdhw_fcdhw(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_3d_ncdhw_fcdhw {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @conv_3d_ncdhw_fcdhw(%input: memref, %filter: memref, %output: memref) { linalg.conv_3d_ncdhw_fcdhw {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_sum_tensor(%input: tensor<1x4x4x1xf32>) -> tensor<1x2x2x1xf32> { %fake = tensor.empty() : tensor<3x3xf32> %init = tensor.empty() : tensor<1x2x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x2x1xf32>) -> tensor<1x2x2x1xf32> %res = linalg.pooling_nhwc_sum {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x4x4x1xf32>, tensor<3x3xf32>) outs(%fill: tensor<1x2x2x1xf32>) -> tensor<1x2x2x1xf32> return %res : tensor<1x2x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_sum_tensor(%input: tensor<1x4x1xf32>) -> tensor<1x2x1xf32> { %fake = tensor.empty() : tensor<3xf32> %init = tensor.empty() : tensor<1x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x1xf32>) -> tensor<1x2x1xf32> %res = linalg.pooling_nwc_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x4x1xf32>, tensor<3xf32>) outs(%fill: tensor<1x2x1xf32>) -> tensor<1x2x1xf32> return %res : tensor<1x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_sum(%input: memref<1x4x4x1xf32>, %fake: memref<3x3xf32>, %output: memref<1x2x2x1xf32>) { linalg.pooling_nhwc_sum {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x4x4x1xf32>, memref<3x3xf32>) outs(%output: memref<1x2x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_sum(%input: memref<1x4x1xf32>, %fake: memref<3xf32>, %output: memref<1x2x1xf32>) { linalg.pooling_nwc_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x4x1xf32>, memref<3xf32>) outs(%output: memref<1x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nchw_sum_tensor(%input: tensor<1x1x4x4xf32>) -> tensor<1x1x2x2xf32> { %fake = tensor.empty() : tensor<3x3xf32> %init = tensor.empty() : tensor<1x1x2x2xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x1x2x2xf32>) -> tensor<1x1x2x2xf32> %res = linalg.pooling_nchw_sum {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x1x4x4xf32>, tensor<3x3xf32>) outs(%fill: tensor<1x1x2x2xf32>) -> tensor<1x1x2x2xf32> return %res : tensor<1x1x2x2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ncw_sum_tensor(%input: tensor<1x1x4xf32>) -> tensor<1x1x2xf32> { %fake = tensor.empty() : tensor<3xf32> %init = tensor.empty() : tensor<1x1x2xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x1x2xf32>) -> tensor<1x1x2xf32> %res = linalg.pooling_ncw_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x1x4xf32>, tensor<3xf32>) outs(%fill: tensor<1x1x2xf32>) -> tensor<1x1x2xf32> return %res : tensor<1x1x2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nchw_sum(%input: memref<1x1x4x4xf32>, %fake: memref<3x3xf32>, %output: memref<1x1x2x2xf32>) { linalg.pooling_nchw_sum {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x1x4x4xf32>, memref<3x3xf32>) outs(%output: memref<1x1x2x2xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ncw_sum(%input: memref<1x1x4xf32>, %fake: memref<3xf32>, %output: memref<1x1x2xf32>) { linalg.pooling_ncw_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x1x4xf32>, memref<3xf32>) outs(%output: memref<1x1x2xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_max_tensor(%input: tensor<1x4x4x1xf32>) -> tensor<1x2x2x1xf32> { %fake = tensor.empty() : tensor<3x3xf32> %init = tensor.empty() : tensor<1x2x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x2x1xf32>) -> tensor<1x2x2x1xf32> %res = linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x4x4x1xf32>, tensor<3x3xf32>) outs(%fill: tensor<1x2x2x1xf32>) -> tensor<1x2x2x1xf32> return %res : tensor<1x2x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_max_tensor(%input: tensor<1x4x1xf32>) -> tensor<1x2x1xf32> { %fake = tensor.empty() : tensor<3xf32> %init = tensor.empty() : tensor<1x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x1xf32>) -> tensor<1x2x1xf32> %res = linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x4x1xf32>, tensor<3xf32>) outs(%fill: tensor<1x2x1xf32>) -> tensor<1x2x1xf32> return %res : tensor<1x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nchw_max_tensor(%input: tensor<1x1x4x4xf32>) -> tensor<1x1x2x2xf32> { %fake = tensor.empty() : tensor<3x3xf32> %init = tensor.empty() : tensor<1x1x2x2xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x1x2x2xf32>) -> tensor<1x1x2x2xf32> %res = linalg.pooling_nchw_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x1x4x4xf32>, tensor<3x3xf32>) outs(%fill: tensor<1x1x2x2xf32>) -> tensor<1x1x2x2xf32> return %res : tensor<1x1x2x2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ncw_max_tensor(%input: tensor<1x1x4xf32>) -> tensor<1x1x2xf32> { %fake = tensor.empty() : tensor<3xf32> %init = tensor.empty() : tensor<1x1x2xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x1x2xf32>) -> tensor<1x1x2xf32> %res = linalg.pooling_ncw_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x1x4xf32>, tensor<3xf32>) outs(%fill: tensor<1x1x2xf32>) -> tensor<1x1x2xf32> return %res : tensor<1x1x2xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_max(%input: memref<1x4x4x1xf32>, %fake: memref<3x3xf32>, %output: memref<1x2x2x1xf32>) { linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x4x4x1xf32>, memref<3x3xf32>) outs(%output: memref<1x2x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_max(%input: memref<1x4x1xf32>, %fake: memref<3xf32>, %output: memref<1x2x1xf32>) { linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x4x1xf32>, memref<3xf32>) outs(%output: memref<1x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_i8_max_tensor(%input: tensor<1x4x4x1xi8>) -> tensor<1x2x2x1xi8> { %fake = tensor.empty() : tensor<3x3xi8> %init = tensor.empty() : tensor<1x2x2x1xi8> %cst = arith.constant 0 : i8 %fill = linalg.fill ins(%cst : i8) outs(%init : tensor<1x2x2x1xi8>) -> tensor<1x2x2x1xi8> %res = linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x4x4x1xi8>, tensor<3x3xi8>) outs(%fill: tensor<1x2x2x1xi8>) -> tensor<1x2x2x1xi8> return %res : tensor<1x2x2x1xi8> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_i8_max_tensor(%input: tensor<1x4x1xi8>) -> tensor<1x2x1xi8> { %fake = tensor.empty() : tensor<3xi8> %init = tensor.empty() : tensor<1x2x1xi8> %cst = arith.constant 0 : i8 %fill = linalg.fill ins(%cst : i8) outs(%init : tensor<1x2x1xi8>) -> tensor<1x2x1xi8> %res = linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x4x1xi8>, tensor<3xi8>) outs(%fill: tensor<1x2x1xi8>) -> tensor<1x2x1xi8> return %res : tensor<1x2x1xi8> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_i8_max(%input: memref<1x4x4x1xi8>, %fake: memref<3x3xi8>, %output: memref<1x2x2x1xi8>) { linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x4x4x1xi8>, memref<3x3xi8>) outs(%output: memref<1x2x2x1xi8>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_i8_max(%input: memref<1x4x1xi8>, %fake: memref<3xi8>, %output: memref<1x2x1xi8>) { linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x4x1xi8>, memref<3xi8>) outs(%output: memref<1x2x1xi8>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_i16_max_tensor(%input: tensor<1x4x4x1xi16>) -> tensor<1x2x2x1xi16> { %fake = tensor.empty() : tensor<3x3xi16> %init = tensor.empty() : tensor<1x2x2x1xi16> %cst = arith.constant 0 : i16 %fill = linalg.fill ins(%cst : i16) outs(%init : tensor<1x2x2x1xi16>) -> tensor<1x2x2x1xi16> %res = linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x4x4x1xi16>, tensor<3x3xi16>) outs(%fill: tensor<1x2x2x1xi16>) -> tensor<1x2x2x1xi16> return %res : tensor<1x2x2x1xi16> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_i16_max_tensor(%input: tensor<1x4x1xi16>) -> tensor<1x2x1xi16> { %fake = tensor.empty() : tensor<3xi16> %init = tensor.empty() : tensor<1x2x1xi16> %cst = arith.constant 0 : i16 %fill = linalg.fill ins(%cst : i16) outs(%init : tensor<1x2x1xi16>) -> tensor<1x2x1xi16> %res = linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x4x1xi16>, tensor<3xi16>) outs(%fill: tensor<1x2x1xi16>) -> tensor<1x2x1xi16> return %res : tensor<1x2x1xi16> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_i16_max(%input: memref<1x4x4x1xi16>, %fake: memref<3x3xi16>, %output: memref<1x2x2x1xi16>) { linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x4x4x1xi16>, memref<3x3xi16>) outs(%output: memref<1x2x2x1xi16>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_i16_max(%input: memref<1x4x1xi16>, %fake: memref<3xi16>, %output: memref<1x2x1xi16>) { linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x4x1xi16>, memref<3xi16>) outs(%output: memref<1x2x1xi16>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_i32_max_tensor(%input: tensor<1x4x4x1xi32>) -> tensor<1x2x2x1xi32> { %fake = tensor.empty() : tensor<3x3xi32> %init = tensor.empty() : tensor<1x2x2x1xi32> %cst = arith.constant 0 : i32 %fill = linalg.fill ins(%cst : i32) outs(%init : tensor<1x2x2x1xi32>) -> tensor<1x2x2x1xi32> %res = linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x4x4x1xi32>, tensor<3x3xi32>) outs(%fill: tensor<1x2x2x1xi32>) -> tensor<1x2x2x1xi32> return %res : tensor<1x2x2x1xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_i32_max_tensor(%input: tensor<1x4x1xi32>) -> tensor<1x2x1xi32> { %fake = tensor.empty() : tensor<3xi32> %init = tensor.empty() : tensor<1x2x1xi32> %cst = arith.constant 0 : i32 %fill = linalg.fill ins(%cst : i32) outs(%init : tensor<1x2x1xi32>) -> tensor<1x2x1xi32> %res = linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x4x1xi32>, tensor<3xi32>) outs(%fill: tensor<1x2x1xi32>) -> tensor<1x2x1xi32> return %res : tensor<1x2x1xi32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_i32_max(%input: memref<1x4x4x1xi32>, %fake: memref<3x3xi32>, %output: memref<1x2x2x1xi32>) { linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x4x4x1xi32>, memref<3x3xi32>) outs(%output: memref<1x2x2x1xi32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_i32_max(%input: memref<1x4x1xi32>, %fake: memref<3xi32>, %output: memref<1x2x1xi32>) { linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x4x1xi32>, memref<3xi32>) outs(%output: memref<1x2x1xi32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_min_tensor(%input: tensor<1x4x4x1xf32>) -> tensor<1x2x2x1xf32> { %fake = tensor.empty() : tensor<3x3xf32> %init = tensor.empty() : tensor<1x2x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x2x1xf32>) -> tensor<1x2x2x1xf32> %res = linalg.pooling_nhwc_min {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: tensor<1x4x4x1xf32>, tensor<3x3xf32>) outs(%fill: tensor<1x2x2x1xf32>) -> tensor<1x2x2x1xf32> return %res : tensor<1x2x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_min_tensor(%input: tensor<1x4x1xf32>) -> tensor<1x2x1xf32> { %fake = tensor.empty() : tensor<3xf32> %init = tensor.empty() : tensor<1x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x1xf32>) -> tensor<1x2x1xf32> %res = linalg.pooling_nwc_min {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: tensor<1x4x1xf32>, tensor<3xf32>) outs(%fill: tensor<1x2x1xf32>) -> tensor<1x2x1xf32> return %res : tensor<1x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nhwc_min(%input: memref<1x4x4x1xf32>, %fake: memref<3x3xf32>, %output: memref<1x2x2x1xf32>) { linalg.pooling_nhwc_min {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%input, %fake: memref<1x4x4x1xf32>, memref<3x3xf32>) outs(%output: memref<1x2x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_nwc_min(%input: memref<1x4x1xf32>, %fake: memref<3xf32>, %output: memref<1x2x1xf32>) { linalg.pooling_nwc_min {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %fake: memref<1x4x1xf32>, memref<3xf32>) outs(%output: memref<1x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ndhwc_sum_tensor(%input: tensor<1x4x4x4x1xf32>) -> tensor<1x2x2x2x1xf32> { %fake = tensor.empty() : tensor<3x3x3xf32> %init = tensor.empty() : tensor<1x2x2x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32> %res = linalg.pooling_ndhwc_sum {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins(%input, %fake: tensor<1x4x4x4x1xf32>, tensor<3x3x3xf32>) outs(%fill: tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32> return %res : tensor<1x2x2x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ndhwc_sum(%input: memref<1x4x4x4x1xf32>, %fake: memref<3x3x3xf32>, %output: memref<1x2x2x2x1xf32>) { linalg.pooling_ndhwc_sum {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins(%input, %fake: memref<1x4x4x4x1xf32>, memref<3x3x3xf32>) outs(%output: memref<1x2x2x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ndhwc_max_tensor(%input: tensor<1x4x4x4x1xf32>) -> tensor<1x2x2x2x1xf32> { %fake = tensor.empty() : tensor<3x3x3xf32> %init = tensor.empty() : tensor<1x2x2x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32> %res = linalg.pooling_ndhwc_max {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins(%input, %fake: tensor<1x4x4x4x1xf32>, tensor<3x3x3xf32>) outs(%fill: tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32> return %res : tensor<1x2x2x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ndhwc_max(%input: memref<1x4x4x4x1xf32>, %fake: memref<3x3x3xf32>, %output: memref<1x2x2x2x1xf32>) { linalg.pooling_ndhwc_max {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins(%input, %fake: memref<1x4x4x4x1xf32>, memref<3x3x3xf32>) outs(%output: memref<1x2x2x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ndhwc_min_tensor(%input: tensor<1x4x4x4x1xf32>) -> tensor<1x2x2x2x1xf32> { %fake = tensor.empty() : tensor<3x3x3xf32> %init = tensor.empty() : tensor<1x2x2x2x1xf32> %cst = arith.constant 0.000000e+00 : f32 %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32> %res = linalg.pooling_ndhwc_min {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins(%input, %fake: tensor<1x4x4x4x1xf32>, tensor<3x3x3xf32>) outs(%fill: tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32> return %res : tensor<1x2x2x2x1xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @pooling_ndhwc_min(%input: memref<1x4x4x4x1xf32>, %fake: memref<3x3x3xf32>, %output: memref<1x2x2x2x1xf32>) { linalg.pooling_ndhwc_min {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins(%input, %fake: memref<1x4x4x4x1xf32>, memref<3x3x3xf32>) outs(%output: memref<1x2x2x2x1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1 * 2, d2 * 2 + d5, d6)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d4, d5, d6, d3)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1, d2, d3)> func.func @conv_interface_wrong_input_indexing_map( %arg0 : tensor, %arg2 : tensor, %arg1 : tensor) -> tensor { %0 = ""linalg.conv_2d_nhwc_hwcf""(%arg0, %arg1, %arg2) ({ ^bb0(%arg3: f32, %arg4: f32, %arg5 : f32): %1 = ""arith.mulf""(%arg3, %arg4) : (f32, f32) -> f32 %2 = ""arith.addf""(%arg5, %1) : (f32, f32) -> f32 ""linalg.yield""(%2) : (f32) -> () }) {dilations = dense<1> : tensor<2xi64>, linalg.memoized_indexing_maps = [#map0, #map1, #map2], operand_segment_sizes = array, strides = dense<2> : tensor<2xi64>} : (tensor, tensor, tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1 + d4, d2 + d5, d6)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d4, d5, d6, d3, d5 + 1)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1, d2, d3)> func.func @conv_interface_wrong_num_operands( %arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %0 = ""linalg.conv_2d_nhwc_hwcf""(%arg0, %arg1, %arg2) ({ ^bb0(%arg3: f32, %arg4: f32, %arg5 : f32): %1 = ""arith.mulf""(%arg3, %arg4) : (f32, f32) -> f32 %2 = ""arith.addf""(%arg5, %1) : (f32, f32) -> f32 ""linalg.yield""(%2) : (f32) -> () }) {dilations = dense<1> : tensor<2xi64>, linalg.memoized_indexing_maps = [#map0, #map1, #map2], operand_segment_sizes = array, strides = dense<1> : tensor<2xi64>} : (tensor, tensor, tensor) -> tensor return %0 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @batch_reduce_matmul(%arg0: tensor<8x128x256xf32>, %arg1: tensor<8x256x512xf32>, %arg2: tensor<128x512xf32>) -> tensor<128x512xf32> { %0 = linalg.batch_reduce_matmul ins(%arg0, %arg1 : tensor<8x128x256xf32>, tensor<8x256x512xf32>) outs(%arg2: tensor<128x512xf32>) -> tensor<128x512xf32> return %0: tensor<128x512xf32> }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @batch_reduce_matmul(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.batch_reduce_matmul ins(%arg0, %arg1 : memref, memref) outs(%arg2: memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @matmul_transpose_b(%arg0: memref<3x5xf32>, %arg1: memref<7x5xf32>, %arg2: memref<3x7xf32>) { linalg.matmul_transpose_b ins(%arg0, %arg1 : memref<3x5xf32>, memref<7x5xf32>) outs(%arg2: memref<3x7xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @batchmatmul_transpose_b(%arg0: memref<2x3x5xf32>, %arg1: memref<2x7x5xf32>, %arg2: memref<2x3x7xf32>) { linalg.batch_matmul_transpose_b ins(%arg0, %arg1 : memref<2x3x5xf32>, memref<2x7x5xf32>) outs(%arg2: memref<2x3x7xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0, %1:2 = transform.structured.tile %arg0 [2, 0, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0:2 = transform.structured.split %arg0 after 42 { dimension = 0 } : !transform.any_op transform.structured.split %0#0 after %0#1 { dimension = 1 } : !transform.any_op, !transform.any_op } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0 = transform.structured.pad %arg0 : (!transform.any_op) -> !transform.any_op } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0 = transform.structured.interchange %arg0 : (!transform.any_op) -> !transform.any_op } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %0 = transform.structured.scalarize %arg0 : (!transform.any_op) -> !transform.any_op } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_op): %loop = transform.structured.match ops{[""scf.forall""]} in %arg0 : (!transform.any_op) -> !transform.any_op %0:2 = transform.structured.fuse_into_containing_op %arg1 into %loop : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) %1:2 = transform.structured.fuse_into_containing_op %arg2 into %loop : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt | mlir-opt ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @drop_unused_producer_result(%arg0 : tensor, %arg1 : tensor) -> tensor { %0:2 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0 : tensor, tensor) { ^bb0(%b0: f32, %b1: f32, %b2: f32): %1 = arith.addf %b0, %b0 : f32 %2 = arith.mulf %b0, %b0 : f32 linalg.yield %1, %2 : f32, f32 } -> (tensor, tensor) %3 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%0#0, %arg1 : tensor, tensor) outs(%arg0 : tensor) { ^bb0(%b0: f32, %b1: f32, %b2: f32): %4 = arith.subf %b0, %b1 : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-generic-ops-control -split-input-file ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [4, 4, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @tile_linalg_matmul( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> return %0 : tensor<128x128xf32> }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""func.call""]} in %arg1 : (!transform.any_op) -> !transform.any_op %2, %loops:3 = transform.structured.tile %0 [%1, %1, 4] : (!transform.any_op, !transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func private @get_dynamic_tile_size() -> index func.func @tile_linalg_matmul_dynamic( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %sz = func.call @get_dynamic_tile_size() : () -> index %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> return %0 : tensor<128x128xf32> }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.test_produce_integer_param_with_type i64 : !transform.param transform.structured.tile %0 [%1, %1, %1] : (!transform.any_op, !transform.param, !transform.param, !transform.param) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @tile_linalg_matmul( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> (tensor<128x128xf32>, tensor<128x128xf32>) { %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> %1 = linalg.matmul ins(%0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> return %0, %1 : tensor<128x128xf32>, tensor<128x128xf32> }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""arith.constant""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.tile %0 [%1, %1, 1] : (!transform.any_op, !transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @tile_linalg_matmul( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> (tensor<128x128xf32>, tensor<128x128xf32>) { %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> %1 = linalg.matmul ins(%0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> return %0, %1 : tensor<128x128xf32>, tensor<128x128xf32> }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "func.func @tile_tensor_pad( %arg0 : tensor, %cst : f32, %low: index, %high: index) -> tensor<20x40xf32> { %0 = tensor.pad %arg0 nofold low[%low, %low] high[%high, %high] { ^bb0(%arg9: index, %arg10: index): tensor.yield %cst : f32 } : tensor to tensor<20x40xf32> return %0 : tensor<20x40xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.tile_to_forall_op %0 tile_sizes[1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "#map = affine_map<(d0) -> (d0)> module { func.func @scalable_tile(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: f32) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = [""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) { ^bb0(%in_1: f32, %in_2: f32, %out: f32): %1 = arith.addf %in_1, %in_2 : f32 %2 = arith.mulf %arg3, %1 : f32 linalg.yield %2 : f32 } -> tensor return %0 : tensor } } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile %0 [[4]] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "func.func @scalable_and_fixed_length_tile( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> return %0 : tensor<128x128xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [4, 4, [4]] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "func.func @scalable_and_fixed_length_tile( %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>) -> tensor<128x128xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>) outs(%arg2: tensor<128x128xf32>) -> tensor<128x128xf32> return %0 : tensor<128x128xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [4, [4], [4]] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --mlir-print-local-scope --split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_rhs( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[1] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad.build_packing_loop_nest %pad above %loops_l1 : (!transform.any_op, !transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_init( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[2] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad.build_packing_loop_nest %pad above %loops_l1 : (!transform.any_op, !transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_lhs( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[0] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad.build_packing_loop_nest %pad above %loops_l1 : (!transform.any_op, !transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_lhs_transpose( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[0] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad.build_packing_loop_nest %pad above %loops_l1, transpose by [1, 0] : (!transform.any_op, !transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_init( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1:2 = transform.structured.tile_to_scf_for %matmul [5, 0, 7] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[2] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad.build_packing_loop_nest %pad above %loops_l1#1 : (!transform.any_op, !transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -split-input-file --verify-diagnostics ,1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main() -> (tensor) attributes {} { %c0 = arith.constant 0 : i32 %0 = tensor.from_elements %c0 : tensor %c10 = arith.constant 10 : i32 %1 = tensor.from_elements %c10 : tensor cf.br ^bb1(%0 : tensor) ^bb1(%2: tensor): %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%2, %1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %5 = tensor.extract %4[] : tensor cf.cond_br %5, ^bb2(%2 : tensor), ^bb3(%2 : tensor) ^bb2(%6: tensor): %7 = tensor.empty() : tensor %8 = linalg.generic #attrs ins(%6, %6 : tensor, tensor) outs(%7 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i32): %9 = arith.addi %arg0, %arg1 : i32 linalg.yield %9 : i32 } -> tensor cf.br ^bb3(%8 : tensor) ^bb3(%10: tensor): return %10 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main() -> (tensor) attributes {} { %c0 = arith.constant 0 : i32 %0 = tensor.from_elements %c0 : tensor %c10 = arith.constant 10 : i32 %1 = tensor.from_elements %c10 : tensor cf.br ^bb1(%0 : tensor) ^bb1(%2: tensor): %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%2, %1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %5 = tensor.extract %4[] : tensor cf.cond_br %5, ^bb2(%2 : tensor), ^bb3(%2 : tensor) ^bb2(%6: tensor): %7 = tensor.empty() : tensor %8 = linalg.generic #attrs ins(%6, %6 : tensor, tensor) outs(%7 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i32): %9 = arith.addi %arg0, %arg1 : i32 linalg.yield %9 : i32 } -> tensor cf.br ^bb3(%8 : tensor) ^bb3(%10: tensor): cf.br ^bb4(%10 : tensor) ^bb4(%11: tensor): return %11 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main() -> (tensor) attributes {} { %c0 = arith.constant 0 : i32 %0 = tensor.from_elements %c0 : tensor %c10 = arith.constant 10 : i32 %1 = tensor.from_elements %c10 : tensor cf.br ^bb1(%0 : tensor) ^bb1(%2: tensor): %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%2, %1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %5 = tensor.extract %4[] : tensor cf.cond_br %5, ^bb2(%2 : tensor), ^bb2(%2 : tensor) ^bb2(%6: tensor): %12 = tensor.from_elements %c10 : tensor %7 = tensor.empty() : tensor %8 = linalg.generic #attrs ins(%6, %12 : tensor, tensor) outs(%7 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i32): %9 = arith.addi %arg0, %arg1 : i32 linalg.yield %9 : i32 } -> tensor cf.br ^bb3(%8 : tensor) ^bb3(%10: tensor): return %10 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "#map = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #reduction_2d_trait = { indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""reduction""] } func.func @reduction_2d_static(%t0: tensor<3x7xf16>, %t1: tensor<3xf16>) -> tensor<3xf16> { %2 = linalg.generic #reduction_2d_trait ins(%t0 : tensor<3x7xf16>) outs(%t1 : tensor<3xf16>) { ^bb0(%in: f16, %out: f16): %3 = arith.addf %in, %out : f16 linalg.yield %3 : f16 } -> tensor<3xf16> return %2 : tensor<3xf16> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack %0 packed_sizes = [0, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1)> #col_reduction_2d_trait = { indexing_maps = [#map, #map1], iterator_types = [""reduction"", ""parallel""] } func.func @col_reduction_2d_static(%t0: tensor<7x3xf16>, %t1: tensor<3xf16>) -> tensor<3xf16> { %2 = linalg.generic #col_reduction_2d_trait ins(%t0 : tensor<7x3xf16>) outs(%t1 : tensor<3xf16>) { ^bb0(%in: f16, %out: f16): %3 = arith.addf %in, %out : f16 linalg.yield %3 : f16 } -> tensor<3xf16> return %2 : tensor<3xf16> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [4, 0] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) %pack = transform.get_producer_of_operand %1[0] : (!transform.op<""linalg.generic"">) -> (!transform.op<""tensor.pack"">) %2, %pack_2, %empty_unpack_2 = transform.structured.pack_transpose %pack with_compute_op(%1) outer_perm = [1, 0] : (!transform.op<""tensor.pack"">, !transform.op<""linalg.generic"">) -> (!transform.op<""linalg.generic"">, !transform.op<""tensor.pack"">, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #reduction_2d_trait = { indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""reduction""] } func.func @reduction_2d_dynamic(%t0: tensor, %t1: tensor) -> tensor { %2 = linalg.generic #reduction_2d_trait ins(%t0 : tensor) outs(%t1 : tensor) { ^bb0(%in: f16, %out: f16): %3 = arith.addf %in, %out : f16 linalg.yield %3 : f16 } -> tensor return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack %0 packed_sizes = [0, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #reduction_2d_trait = { indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""reduction""] } func.func @reduction_2d_dynamic(%t0: tensor, %t1: tensor) -> tensor { %2 = linalg.generic #reduction_2d_trait ins(%t0 : tensor) outs(%t1 : tensor) { ^bb0(%in: f16, %out: f16): %3 = arith.addf %in, %out : f16 linalg.yield %3 : f16 } -> tensor return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack %0 packed_sizes = [3, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @matmul(%A: tensor, %B: tensor, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [2, 3, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) %unpack = transform.get_consumers_of_result %1[0] : (!transform.op<""linalg.generic"">) -> (!transform.op<""tensor.unpack"">) %2, %pack_2, %unpack_2 = transform.structured.pack_transpose %unpack with_compute_op(%1) outer_perm = [1, 0] inner_perm = [1, 0] : (!transform.op<""tensor.unpack"">, !transform.op<""linalg.generic"">) -> (!transform.op<""linalg.generic"">, !transform.op<""tensor.pack"">, !transform.op<""tensor.unpack"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @conv_2d_nchw_fchw(%i: tensor<14x512x28x28xf32>, %f: tensor<1024x512x1x1xf32>, %o: tensor<14x1024x28x28xf32>) -> tensor<14x1024x28x28xf32> { %0 = linalg.conv_2d_nchw_fchw ins(%i, %f: tensor<14x512x28x28xf32>, tensor<1024x512x1x1xf32>) outs(%o: tensor<14x1024x28x28xf32>) -> tensor<14x1024x28x28xf32> return %0: tensor<14x1024x28x28xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [0, 4, 0, 0, 8, 0, 0] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @conv_2d_nhwc_hwcf(%input: tensor, %filter: tensor<1x?x?x?xf32>, %init: tensor) -> tensor { %0 = linalg.conv_2d_nhwc_hwcf ins (%input, %filter: tensor, tensor<1x?x?x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [0, 0, 0, 4, 0, 0, 6] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @matmul_dynamic_pack_size(%A: tensor, %B: tensor, %C: tensor) -> tensor { %sz = ""some_tile_size""() : () -> (index) %0 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %sz = transform.structured.match ops{[""some_tile_size""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [0, %sz : !transform.any_op, %sz : !transform.any_op] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @conv_cant_pack(%i: tensor<14x512x28x28xf32>, %f: tensor<1024x512x1x1xf32>, %o: tensor<14x1024x28x28xf32>) -> tensor<14x1024x28x28xf32> { %0 = linalg.conv_2d_nchw_fchw ins(%i, %f: tensor<14x512x28x28xf32>, tensor<1024x512x1x1xf32>) outs(%o: tensor<14x1024x28x28xf32>) -> tensor<14x1024x28x28xf32> return %0: tensor<14x1024x28x28xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [0, 0, 4, 0, 0, 0, 0] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @matmul(%A: tensor, %B: tensor, %C: tensor) -> (tensor, tensor) { %0 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor %1 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor return %0, %1 : tensor, tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [2, 3, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @matmul(%A: tensor, %B: tensor, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [2, 3] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @no_single_packing_op(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) { %0 = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> %1 = tensor.unpack %0 inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %source : tensor<4x16x32x16xf32> -> tensor<128x256xf32> %2 = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack_transpose %0 with_compute_op(%1) inner_perm = [0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @no_single_pack_unpack(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) { %0 = arith.constant 0 : index %1 = tensor.empty() : tensor return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""arith.constant""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""tensor.empty""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack_transpose %0 with_compute_op(%1) inner_perm = [0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @no_linalg_target(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) { %0 = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> %1 = arith.constant 0 : index return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""arith.constant""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack_transpose %0 with_compute_op(%1) inner_perm = [0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @no_single_use_by_linalg(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) { %0 = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> %f0 = arith.constant 0.0 : f32 %1 = tensor.empty() : tensor %2 = linalg.fill ins(%f0: f32) outs(%1 : tensor) -> tensor return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack_transpose %0 with_compute_op(%1) inner_perm = [0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @not_produced_by_linalg(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) { %a = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> %b = tensor.unpack %a inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %source : tensor<4x16x32x16xf32> -> tensor<128x256xf32> %f0 = arith.constant 0.0 : f32 %1 = tensor.empty() : tensor %2 = linalg.fill ins(%f0: f32) outs(%1 : tensor) -> tensor return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack_transpose %0 with_compute_op(%1) inner_perm = [0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @no_matching_pack(%source: tensor<16xf32>) { %f0 = arith.constant 0.0 : f32 %1 = tensor.empty() : tensor<4x4xf32> %2 = linalg.fill ins(%f0: f32) outs(%1 : tensor<4x4xf32>) -> tensor<4x4xf32> %b = tensor.unpack %2 inner_dims_pos = [0] inner_tiles = [4] into %source : tensor<4x4xf32> -> tensor<16xf32> return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.pack_transpose %0 with_compute_op(%1) inner_perm = [0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @invalid_outer_perm(%A: tensor, %B: tensor, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [2, 3, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) %unpack = transform.get_consumers_of_result %1[0] : (!transform.op<""linalg.generic"">) -> (!transform.op<""tensor.unpack"">) %2, %pack_2, %unpack_2 = transform.structured.pack_transpose %unpack with_compute_op(%1) outer_perm = [1] : (!transform.op<""tensor.unpack"">, !transform.op<""linalg.generic"">) -> (!transform.op<""linalg.generic"">, !transform.op<""tensor.pack"">, !transform.op<""tensor.unpack"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @invalid_inner_perm(%A: tensor, %B: tensor, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B: tensor, tensor) outs(%C: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.pack %0 packed_sizes = [2, 3, 4] : (!transform.any_op) -> (!transform.op<""linalg.generic"">) %unpack = transform.get_consumers_of_result %1[0] : (!transform.op<""linalg.generic"">) -> (!transform.op<""tensor.unpack"">) %2, %pack_2, %unpack_2 = transform.structured.pack_transpose %unpack with_compute_op(%1) inner_perm = [1] : (!transform.op<""tensor.unpack"">, !transform.op<""linalg.generic"">) -> (!transform.op<""linalg.generic"">, !transform.op<""tensor.pack"">, !transform.op<""tensor.unpack"">) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics -allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs( %memref0: memref, %memref1: memref, %memref2: memref, %memref3: memref, %memref4: memref, %memref5: memref, %val: index, %lb : index, %ub : index, %step: index, %cmp: i1) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 scf.for %i = %lb to %ub step %step { scf.for %j = %lb to %ub step %step { %r0 = vector.transfer_read %memref1[%c0, %c0], %cst: memref, vector<1xf32> %r1 = vector.transfer_read %memref0[%i, %i], %cst: memref, vector<2xf32> %r2 = vector.transfer_read %memref2[%c0, %c0], %cst: memref, vector<3xf32> %r3 = vector.transfer_read %memref3[%c0, %c0], %cst: memref, vector<4xf32> ""some_crippling_use""(%memref4) : (memref) -> () %r4 = vector.transfer_read %memref4[%c0, %c0], %cst: memref, vector<5xf32> %r5 = vector.transfer_read %memref5[%c0, %c0], %cst: memref, vector<6xf32> ""some_crippling_use""(%memref5) : (memref) -> () %u0 = ""some_use""(%r0) : (vector<1xf32>) -> vector<1xf32> %u1 = ""some_use""(%r1) : (vector<2xf32>) -> vector<2xf32> %u2 = ""some_use""(%memref2, %r2) : (memref, vector<3xf32>) -> vector<3xf32> %u3 = ""some_use""(%r3) : (vector<4xf32>) -> vector<4xf32> %u4 = ""some_use""(%r4) : (vector<5xf32>) -> vector<5xf32> %u5 = ""some_use""(%r5) : (vector<6xf32>) -> vector<6xf32> vector.transfer_write %u0, %memref1[%c0, %c0] : vector<1xf32>, memref vector.transfer_write %u1, %memref0[%i, %i] : vector<2xf32>, memref vector.transfer_write %u2, %memref2[%c0, %c0] : vector<3xf32>, memref vector.transfer_write %u3, %memref3[%c0, %c0] : vector<4xf32>, memref vector.transfer_write %u4, %memref4[%c0, %c0] : vector<5xf32>, memref vector.transfer_write %u5, %memref5[%c0, %c0] : vector<6xf32>, memref ""some_crippling_use""(%memref3) : (memref) -> () } ""unrelated_use""(%memref0) : (memref) -> () } ""unrelated_use""(%memref1) : (memref) -> () return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs_disjoint( %memref0: memref, %memref1: memref, %memref2: memref, %memref3: memref, %val: index, %lb : index, %ub : index, %step: index, %random_index : index, %cmp: i1) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %cst = arith.constant 0.0 : f32 scf.for %i = %lb to %ub step %step { scf.for %j = %lb to %ub step %step { %r00 = vector.transfer_read %memref1[%c0, %c0], %cst: memref, vector<2xf32> %r01 = vector.transfer_read %memref1[%c0, %c1], %cst: memref, vector<2xf32> %r20 = vector.transfer_read %memref2[%c0, %c0], %cst: memref, vector<3xf32> %r21 = vector.transfer_read %memref2[%c0, %c3], %cst: memref, vector<3xf32> %r30 = vector.transfer_read %memref3[%c0, %random_index], %cst: memref, vector<4xf32> %r31 = vector.transfer_read %memref3[%c1, %random_index], %cst: memref, vector<4xf32> %r10 = vector.transfer_read %memref0[%i, %i], %cst: memref, vector<2xf32> %r11 = vector.transfer_read %memref0[%random_index, %random_index], %cst: memref, vector<2xf32> %u00 = ""some_use""(%r00) : (vector<2xf32>) -> vector<2xf32> %u01 = ""some_use""(%r01) : (vector<2xf32>) -> vector<2xf32> %u20 = ""some_use""(%r20) : (vector<3xf32>) -> vector<3xf32> %u21 = ""some_use""(%r21) : (vector<3xf32>) -> vector<3xf32> %u30 = ""some_use""(%r30) : (vector<4xf32>) -> vector<4xf32> %u31 = ""some_use""(%r31) : (vector<4xf32>) -> vector<4xf32> %u10 = ""some_use""(%r10) : (vector<2xf32>) -> vector<2xf32> %u11 = ""some_use""(%r11) : (vector<2xf32>) -> vector<2xf32> vector.transfer_write %u00, %memref1[%c0, %c0] : vector<2xf32>, memref vector.transfer_write %u01, %memref1[%c0, %c1] : vector<2xf32>, memref vector.transfer_write %u20, %memref2[%c0, %c0] : vector<3xf32>, memref vector.transfer_write %u21, %memref2[%c0, %c3] : vector<3xf32>, memref vector.transfer_write %u30, %memref3[%c0, %random_index] : vector<4xf32>, memref vector.transfer_write %u31, %memref3[%c1, %random_index] : vector<4xf32>, memref vector.transfer_write %u10, %memref0[%i, %i] : vector<2xf32>, memref vector.transfer_write %u11, %memref0[%random_index, %random_index] : vector<2xf32>, memref } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs_in_affine_loops(%memref0: memref<64x64xi32>, %memref1: memref<64x64xi32>, %memref2: memref<64x64xi32>) { %c0_i32 = arith.constant 0 : i32 affine.for %arg3 = 0 to 64 { affine.for %arg4 = 0 to 64 step 16 { affine.for %arg5 = 0 to 64 { %0 = vector.transfer_read %memref0[%arg3, %arg5], %c0_i32 {permutation_map = affine_map<(d0, d1) -> (0)>} : memref<64x64xi32>, vector<16xi32> %1 = vector.transfer_read %memref1[%arg5, %arg4], %c0_i32 : memref<64x64xi32>, vector<16xi32> %2 = vector.transfer_read %memref2[%arg3, %arg4], %c0_i32 : memref<64x64xi32>, vector<16xi32> %3 = arith.muli %0, %1 : vector<16xi32> %4 = arith.addi %2, %3 : vector<16xi32> vector.transfer_write %4, %memref2[%arg3, %arg4] : vector<16xi32>, memref<64x64xi32> } } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs_tensor( %tensor0: tensor, %tensor1: tensor, %tensor2: tensor, %tensor3: tensor, %tensor4: tensor, %tensor5: tensor, %val: index, %lb : index, %ub : index, %step: index) -> (tensor, tensor, tensor, tensor, tensor, tensor) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0:6 = scf.for %i = %lb to %ub step %step iter_args(%arg0 = %tensor0, %arg1 = %tensor1, %arg2 = %tensor2, %arg3 = %tensor3, %arg4 = %tensor4, %arg5 = %tensor5) -> (tensor, tensor, tensor, tensor, tensor, tensor) { %1:6 = scf.for %j = %lb to %ub step %step iter_args(%arg6 = %arg0, %arg7 = %arg1, %arg8 = %arg2, %arg9 = %arg3, %arg10 = %arg4, %arg11 = %arg5) -> (tensor, tensor, tensor, tensor, tensor, tensor) { %r0 = vector.transfer_read %arg7[%c0, %c0], %cst: tensor, vector<1xf32> %r1 = vector.transfer_read %arg6[%i, %i], %cst: tensor, vector<2xf32> %r3 = vector.transfer_read %arg9[%c0, %c0], %cst: tensor, vector<4xf32> ""some_crippling_use""(%arg10) : (tensor) -> () %r4 = vector.transfer_read %arg10[%c0, %c0], %cst: tensor, vector<5xf32> %r5 = vector.transfer_read %arg11[%c0, %c0], %cst: tensor, vector<6xf32> ""some_crippling_use""(%arg11) : (tensor) -> () %u0 = ""some_use""(%r0) : (vector<1xf32>) -> vector<1xf32> %u1 = ""some_use""(%r1) : (vector<2xf32>) -> vector<2xf32> %u2 = ""some_use""(%arg8) : (tensor) -> vector<3xf32> %u3 = ""some_use""(%r3) : (vector<4xf32>) -> vector<4xf32> %u4 = ""some_use""(%r4) : (vector<5xf32>) -> vector<5xf32> %u5 = ""some_use""(%r5) : (vector<6xf32>) -> vector<6xf32> %w1 = vector.transfer_write %u0, %arg7[%c0, %c0] : vector<1xf32>, tensor %w0 = vector.transfer_write %u1, %arg6[%i, %i] : vector<2xf32>, tensor %w2 = vector.transfer_write %u2, %arg8[%c0, %c0] : vector<3xf32>, tensor %w3 = vector.transfer_write %u3, %arg9[%c0, %c0] : vector<4xf32>, tensor %w4 = vector.transfer_write %u4, %arg10[%c0, %c0] : vector<5xf32>, tensor %w5 = vector.transfer_write %u5, %arg11[%c0, %c0] : vector<6xf32>, tensor ""some_crippling_use""(%w3) : (tensor) -> () scf.yield %w0, %w1, %w2, %w3, %w4, %w5 : tensor, tensor, tensor, tensor, tensor, tensor } scf.yield %1#0, %1#1, %1#2, %1#3, %1#4, %1#5 : tensor, tensor, tensor, tensor, tensor, tensor } return %0#0, %0#1, %0#2, %0#3, %0#4, %0#5 : tensor, tensor, tensor, tensor, tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs_disjoint_tensor( %tensor0: tensor, %tensor1: tensor, %tensor2: tensor, %tensor3: tensor, %val: index, %lb : index, %ub : index, %step: index, %random_index : index) -> (tensor, tensor, tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %cst = arith.constant 0.0 : f32 %0:4 = scf.for %i = %lb to %ub step %step iter_args(%arg0 = %tensor0, %arg1 = %tensor1, %arg2 = %tensor2, %arg3 = %tensor3) -> (tensor, tensor, tensor, tensor) { %1:4 = scf.for %j = %lb to %ub step %step iter_args(%arg4 = %arg0, %arg5 = %arg1, %arg6 = %arg2, %arg7 = %arg3) -> (tensor, tensor, tensor, tensor) { %r00 = vector.transfer_read %arg5[%c0, %c0], %cst: tensor, vector<2xf32> %r01 = vector.transfer_read %arg5[%c0, %c1], %cst: tensor, vector<2xf32> %r20 = vector.transfer_read %arg6[%c0, %c0], %cst: tensor, vector<3xf32> %r21 = vector.transfer_read %arg6[%c0, %c3], %cst: tensor, vector<3xf32> %r30 = vector.transfer_read %arg7[%c0, %random_index], %cst: tensor, vector<4xf32> %r31 = vector.transfer_read %arg7[%c1, %random_index], %cst: tensor, vector<4xf32> %r10 = vector.transfer_read %arg4[%i, %i], %cst: tensor, vector<2xf32> %r11 = vector.transfer_read %arg4[%random_index, %random_index], %cst: tensor, vector<2xf32> %u00 = ""some_use""(%r00) : (vector<2xf32>) -> vector<2xf32> %u01 = ""some_use""(%r01) : (vector<2xf32>) -> vector<2xf32> %u20 = ""some_use""(%r20) : (vector<3xf32>) -> vector<3xf32> %u21 = ""some_use""(%r21) : (vector<3xf32>) -> vector<3xf32> %u30 = ""some_use""(%r30) : (vector<4xf32>) -> vector<4xf32> %u31 = ""some_use""(%r31) : (vector<4xf32>) -> vector<4xf32> %u10 = ""some_use""(%r10) : (vector<2xf32>) -> vector<2xf32> %u11 = ""some_use""(%r11) : (vector<2xf32>) -> vector<2xf32> %w10 = vector.transfer_write %u00, %arg5[%c0, %c0] : vector<2xf32>, tensor %w11 = vector.transfer_write %u01, %w10[%c0, %c1] : vector<2xf32>, tensor %w20 = vector.transfer_write %u20, %arg6[%c0, %c0] : vector<3xf32>, tensor %w21 = vector.transfer_write %u21, %w20[%c0, %c3] : vector<3xf32>, tensor %w30 = vector.transfer_write %u30, %arg7[%c0, %random_index] : vector<4xf32>, tensor %w31 = vector.transfer_write %u31, %w30[%c1, %random_index] : vector<4xf32>, tensor %w00 = vector.transfer_write %u10, %arg4[%i, %i] : vector<2xf32>, tensor %w01 = vector.transfer_write %u11, %w00[%random_index, %random_index] : vector<2xf32>, tensor scf.yield %w01, %w11, %w21, %w31 : tensor, tensor, tensor, tensor } scf.yield %1#0, %1#1, %1#2, %1#3 : tensor, tensor, tensor, tensor } return %0#0, %0#1, %0#2, %0#3 : tensor, tensor, tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs_tensor_and_slices( %tensor0: tensor, %tensor1: tensor, %tensor2: tensor, %tensor3: tensor, %tensor4: tensor, %tensor5: tensor, %val: index, %lb : index, %ub : index, %step: index) -> ( tensor, tensor, tensor ) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0:3 = scf.for %i = %lb to %ub step %step iter_args(%arg0 = %tensor0, %arg1 = %tensor1, %arg2 = %tensor2) -> (tensor, tensor, tensor) { %1:3 = scf.for %j = %lb to %ub step %step iter_args(%arg6 = %arg0, %arg7 = %arg1, %arg8 = %arg2) -> (tensor, tensor, tensor) { %st0 = tensor.extract_slice %arg6[%i, %i][%step, %step][1, 1] : tensor to tensor %r0 = vector.transfer_read %st0[%c0, %c0], %cst: tensor, vector<1xf32> %st1 = tensor.extract_slice %arg7[%j, %c0][%step, %step][1, 1] : tensor to tensor %r1 = vector.transfer_read %st1[%c0, %c0], %cst: tensor, vector<2xf32> %st2 = tensor.extract_slice %arg8[%i, %c0][%step, %step][1, 1] : tensor to tensor %r2 = vector.transfer_read %st2[%c0, %c0], %cst: tensor, vector<3xf32> %u0 = ""some_use""(%r0) : (vector<1xf32>) -> vector<1xf32> %u1 = ""some_use""(%r1) : (vector<2xf32>) -> vector<2xf32> %u2 = ""some_use""(%r2) : (vector<3xf32>) -> vector<3xf32> %w0 = vector.transfer_write %u0, %st0[%c0, %c0] : vector<1xf32>, tensor %w1 = vector.transfer_write %u1, %st1[%i, %i] : vector<2xf32>, tensor %w2 = vector.transfer_write %u2, %st2[%c0, %c0] : vector<3xf32>, tensor %sti0 = tensor.insert_slice %w0 into %arg6[%i, %i][%step, %step][1, 1] : tensor into tensor %sti1 = tensor.insert_slice %w1 into %arg7[%j, %c0][%step, %step][1, 1] : tensor into tensor %sti2 = tensor.insert_slice %w2 into %arg8[%i, %c0][%step, %step][1, 1] : tensor into tensor %st22 = tensor.extract_slice %sti2[%i, %c0][%step, %step][2, 1] : tensor to tensor %sti22 = tensor.insert_slice %st22 into %arg8[%i, %c0][%step, %step][1, 1] : tensor into tensor scf.yield %sti0, %sti1, %sti22: tensor, tensor, tensor } scf.yield %1#0, %1#1, %1#2 : tensor, tensor, tensor } return %0#0, %0#1, %0#2 : tensor, tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_write_pairs_disjoint_tensor( %tensor: tensor, %val: index, %lb : index, %ub : index, %step: index) -> (tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %cst = arith.constant 0.0 : f32 %1 = scf.for %j = %lb to %ub step %step iter_args(%arg5 = %tensor) -> (tensor) { %r00 = vector.transfer_read %arg5[%c0, %c0], %cst: tensor, vector<2xf32> %u00 = ""some_use""(%r00) : (vector<2xf32>) -> vector<2xf32> %w10 = vector.transfer_write %u00, %arg5[%c0, %c0] : vector<2xf32>, tensor %r01 = vector.transfer_read %w10[%c0, %c3], %cst: tensor, vector<2xf32> %u01 = ""some_use""(%r01) : (vector<2xf32>) -> vector<2xf32> %w11 = vector.transfer_write %u01, %w10[%c0, %c3] : vector<2xf32>, tensor scf.yield %w11 : tensor } return %1 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_pairs_tensor_and_slices_static_large_tensor( %tensor0: tensor<100x100xf32>, %tensor1: tensor<200x200xf32>, %tensor2: tensor<300x300xf32>, %val: index, %lb : index, %ub : index, %step: index) -> ( tensor<100x100xf32>, tensor<200x200xf32>, tensor<300x300xf32> ) { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %0:3 = scf.for %i = %lb to %ub step %step iter_args(%arg0 = %tensor0, %arg1 = %tensor1, %arg2 = %tensor2) -> (tensor<100x100xf32>, tensor<200x200xf32>, tensor<300x300xf32>) { %1:3 = scf.for %j = %lb to %ub step %step iter_args(%arg6 = %arg0, %arg7 = %arg1, %arg8 = %arg2) -> (tensor<100x100xf32>, tensor<200x200xf32>, tensor<300x300xf32>) { %st0 = tensor.extract_slice %arg6[%i, %i][%step, %step][1, 1] : tensor<100x100xf32> to tensor %r0 = vector.transfer_read %st0[%c0, %c0], %cst: tensor, vector<1xf32> %st1 = tensor.extract_slice %arg7[%j, %c0][%step, %step][1, 1] : tensor<200x200xf32> to tensor %r1 = vector.transfer_read %st1[%c0, %c0], %cst: tensor, vector<2xf32> %st2 = tensor.extract_slice %arg8[%i, %c0][%step, %step][1, 1] : tensor<300x300xf32> to tensor %r2 = vector.transfer_read %st2[%c0, %c0], %cst: tensor, vector<3xf32> %u0 = ""some_use""(%r0) : (vector<1xf32>) -> vector<1xf32> %u1 = ""some_use""(%r1) : (vector<2xf32>) -> vector<2xf32> %u2 = ""some_use""(%r2) : (vector<3xf32>) -> vector<3xf32> %w0 = vector.transfer_write %u0, %st0[%c0, %c0] : vector<1xf32>, tensor %w1 = vector.transfer_write %u1, %st1[%i, %i] : vector<2xf32>, tensor %w2 = vector.transfer_write %u2, %st2[%c0, %c0] : vector<3xf32>, tensor %sti0 = tensor.insert_slice %w0 into %arg6[%i, %i][%step, %step][1, 1] : tensor into tensor<100x100xf32> %sti1 = tensor.insert_slice %w1 into %arg7[%j, %c0][%step, %step][1, 1] : tensor into tensor<200x200xf32> %sti2 = tensor.insert_slice %w2 into %arg8[%i, %c0][%step, %step][1, 1] : tensor into tensor<300x300xf32> %st22 = tensor.extract_slice %sti2[%i, %c0][%step, %step][2, 1] : tensor<300x300xf32> to tensor %sti22 = tensor.insert_slice %st22 into %arg8[%i, %c0][%step, %step][1, 1] : tensor into tensor<300x300xf32> scf.yield %sti0, %sti1, %sti22: tensor<100x100xf32>, tensor<200x200xf32>, tensor<300x300xf32> } scf.yield %1#0, %1#1, %1#2 : tensor<100x100xf32>, tensor<200x200xf32>, tensor<300x300xf32> } return %0#0, %0#1, %0#2 : tensor<100x100xf32>, tensor<200x200xf32>, tensor<300x300xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 : (!transform.any_op) -> () }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @hoist_vector_transfer_read() { %c0 = arith.constant 0 : index %c128 = arith.constant 128 : index %c1024 = arith.constant 1024 : index %cst_2 = arith.constant 0.000000e+00 : f32 %memref0 = memref.alloc() : memref<32x64xf32> %memref2 = memref.alloc() : memref<32x128xf32> %subview2 = memref.subview %memref2[%c0, %c0] [32, 128] [1, 1]: memref<32x128xf32> to memref<32x128xf32, strided<[128, 1], offset: ?>> scf.for %arg0 = %c0 to %c1024 step %c128 { %2 = vector.transfer_read %memref2[%c0, %c0], %cst_2 {in_bounds = [true, true]} : memref<32x128xf32>, vector<32x128xf32> %3 = vector.transfer_read %memref0[%c0, %c0], %cst_2 {in_bounds = [true, true]} : memref<32x64xf32>, vector<32x64xf32> ""some_use""(%3, %2, %subview2) : (vector<32x64xf32>, vector<32x128xf32>, memref<32x128xf32, strided<[128, 1], offset: ?>>) -> () } memref.dealloc %memref0 : memref<32x64xf32> return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -canonicalize --split-input-file --allow-unregistered-dialect ,1 "func.func @conv1d_nwc_4x2x8_memref(%input: memref<4x6x3xf32>, %filter: memref<1x3x8xf32>, %output: memref<4x2x8xf32>) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x6x3xf32>, memref<1x3x8xf32>) outs(%output : memref<4x2x8xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_nwc_4x2x8_i8i8i32_memref(%input: memref<4x6x3xi8>, %filter: memref<1x3x8xi8>, %output: memref<4x2x8xi32>) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x6x3xi8>, memref<1x3x8xi8>) outs(%output : memref<4x2x8xi32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_nwc_4x2x8_memref(%input: memref<4x6x3xf32>, %filter: memref<2x3x8xf32>, %output: memref<4x2x8xf32>) { linalg.conv_1d_nwc_wcf {dilations = dense<2> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x6x3xf32>, memref<2x3x8xf32>) outs(%output : memref<4x2x8xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_nwc_4x2x8_memref(%input: memref<4x6x3xf32>, %filter: memref<2x3x8xf32>, %output: memref<4x2x8xf32>) { linalg.conv_1d_nwc_wcf {dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : memref<4x6x3xf32>, memref<2x3x8xf32>) outs(%output : memref<4x2x8xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_ncw_4x8x2_memref(%input: memref<4x3x6xf32>, %filter: memref<8x3x1xf32>, %output: memref<4x8x2xf32>) { linalg.conv_1d_ncw_fcw {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x3x6xf32>, memref<8x3x1xf32>) outs(%output : memref<4x8x2xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_ncw_4x8x2_memref(%input: memref<4x3x6xf32>, %filter: memref<8x3x2xf32>, %output: memref<4x8x2xf32>) { linalg.conv_1d_ncw_fcw {dilations = dense<2> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x3x6xf32>, memref<8x3x2xf32>) outs(%output : memref<4x8x2xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_ncw_4x8x2_memref(%input: memref<4x3x6xf32>, %filter: memref<8x3x2xf32>, %output: memref<4x8x2xf32>) { linalg.conv_1d_ncw_fcw {dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : memref<4x3x6xf32>, memref<8x3x2xf32>) outs(%output : memref<4x8x2xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv1d_8_tensor(%input: tensor<11xf32>, %filter: tensor<4xf32>, %output: tensor<8xf32>) -> tensor<8xf32> { %0 = linalg.conv_1d ins(%input, %filter : tensor<11xf32>, tensor<4xf32>) outs(%output : tensor<8xf32>) -> tensor<8xf32> return %0 : tensor<8xf32> }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @depthwise_conv1d_nwc_wc_3x5x4xf32_memref(%input: memref<3x5x4xf32>, %filter: memref<2x4xf32>, %output: memref<3x2x4xf32>) { linalg.depthwise_conv_1d_nwc_wc {dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : memref<3x5x4xf32>, memref<2x4xf32>) outs(%output : memref<3x2x4xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @depthwise_conv1d_nwc_wc_3x5x4xi8_memref(%input: memref<3x5x4xi8>, %filter: memref<2x4xi8>, %output: memref<3x2x4xi32>) { linalg.depthwise_conv_1d_nwc_wc {dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : memref<3x5x4xi8>, memref<2x4xi8>) outs(%output : memref<3x2x4xi32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @conv_1d_nwc_wcf_mixed_type_memref(%input: memref<1x2x3xf16>, %filter: memref<1x3x2xf16>, %output: memref<1x2x2xf32>) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : vector<1xi64>, strides = dense<1> : vector<1xi64>} ins(%input, %filter : memref<1x2x3xf16>, memref<1x3x2xf16>) outs(%output : memref<1x2x2xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_sum_memref_1_2_1_3(%input: memref<4x4x3xf32>, %filter: memref<1xf32>, %output: memref<4x2x3xf32>) { linalg.pooling_nwc_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x4x3xf32>, memref<1xf32>) outs(%output : memref<4x2x3xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_max_memref_1_2_1_3(%input: memref<4x4x3xf32>, %filter: memref<1xf32>, %output: memref<4x2x3xf32>) { linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x4x3xf32>, memref<1xf32>) outs(%output : memref<4x2x3xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_sum_i8i8i32_memref_1_2_1_3(%input: memref<4x4x3xi8>, %filter: memref<1xi8>, %output: memref<4x2x3xi32>) { linalg.pooling_nwc_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x4x3xi8>, memref<1xi8>) outs(%output : memref<4x2x3xi32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_max_i8i8i32_memref_1_2_1_3(%input: memref<4x4x3xi8>, %filter: memref<1xi8>, %output: memref<4x2x3xi32>) { linalg.pooling_nwc_max {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x4x3xi8>, memref<1xi8>) outs(%output : memref<4x2x3xi32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_sum_memref_2_2_2_3(%input: memref<4x6x3xf32>, %filter: memref<2xf32>, %output: memref<4x2x3xf32>) { linalg.pooling_nwc_sum {dilations = dense<2> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x6x3xf32>, memref<2xf32>) outs(%output : memref<4x2x3xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_ncw_sum_memref_1_2_1_3(%input: memref<4x3x4xf32>, %filter: memref<1xf32>, %output: memref<4x3x2xf32>) { linalg.pooling_ncw_sum {dilations = dense<1> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x3x4xf32>, memref<1xf32>) outs(%output : memref<4x3x2xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_sum_mixed_type_memref_1_2_1_1(%input: memref<1x2x3xf16>, %filter: memref<1xf16>, %output: memref<1x2x3xf32>) { linalg.pooling_nwc_sum {dilations = dense<1> : vector<1xi64>, strides = dense<1> : vector<1xi64>} ins(%input, %filter : memref<1x2x3xf16>, memref<1xf16>) outs(%output : memref<1x2x3xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_nwc_sum_memref_2_2_2_1(%input: memref<4x4x3xf32>, %filter: memref<2xf32>, %output: memref<4x2x3xf32>) { linalg.pooling_nwc_sum {dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : memref<4x4x3xf32>, memref<2xf32>) outs(%output : memref<4x2x3xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_ncw_sum_memref_2_2_2_3(%input: memref<4x3x6xf32>, %filter: memref<2xf32>, %output: memref<4x3x2xf32>) { linalg.pooling_ncw_sum {dilations = dense<2> : tensor<1xi64>, strides = dense<3> : tensor<1xi64>} ins(%input, %filter : memref<4x3x6xf32>, memref<2xf32>) outs(%output : memref<4x3x2xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @pooling_ncw_sum_memref_2_3_2_1(%input: memref<4x2x5xf32>, %filter: memref<2xf32>, %output: memref<4x2x3xf32>) { linalg.pooling_ncw_sum {dilations = dense<2> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins(%input, %filter : memref<4x2x5xf32>, memref<2xf32>) outs(%output : memref<4x2x3xf32>) return }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-linalg-to-vector-patterns ,1 "func.func @if_true_test(%arg0: i1, %arg1: i32) -> tensor attributes {} { %arg0_t = tensor.from_elements %arg0 : tensor %arg1_t = tensor.from_elements %arg1 : tensor %cst = arith.constant dense<10> : tensor %2 = tensor.empty() : tensor %3 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%arg0_t : tensor) outs(%2 : tensor) { ^bb0(%arg2: i1, %arg3: i8): %10 = arith.extui %arg2 : i1 to i8 linalg.yield %10 : i8 } -> tensor %4 = tensor.extract %3[] : tensor %5 = arith.trunci %4 : i8 to i1 cf.cond_br %5, ^bb1, ^bb2(%arg1_t : tensor) ^bb1: %6 = tensor.empty() : tensor %7 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%arg1_t, %cst : tensor, tensor) outs(%6 : tensor) { ^bb0(%arg2: i32, %arg3: i32, %arg4: i32): %10 = arith.addi %arg2, %arg3 : i32 linalg.yield %10 : i32 } -> tensor cf.br ^bb2(%7 : tensor) ^bb2(%8: tensor): return %8 : tensor }"," mlir-opt -split-input-file -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "func.func @KCRSsr_to_KCRS(%arg0: tensor<1x1x4x8x8x32xf32>, %arg1: tensor<1x1x128x64xf32>) -> tensor<1x1x128x64xf32> { %0 = tensor.unpack %arg0 inner_dims_pos = [3, 2] inner_tiles = [8, 32] into %arg1 : tensor<1x1x4x8x8x32xf32> -> tensor<1x1x128x64xf32> return %0 : tensor<1x1x128x64xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:4 = transform.structured.tile_to_scf_for %0 [1, 1, 32, 8] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }"," mlir-opt -split-input-file --test-transform-dialect-interpreter --canonicalize --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @unpack_and_extract_slice(%arg0: tensor<2x8x8x2xf32>, %arg1: tensor<13x15xf32>) -> tensor<13x15xf32> { %0 = tensor.unpack %arg0 inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %arg1 : tensor<2x8x8x2xf32> -> tensor<13x15xf32> return %0 : tensor<13x15xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [8, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }"," mlir-opt -split-input-file --test-transform-dialect-interpreter --canonicalize --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @CKkc_to_KC(%arg0: tensor<32x4x32x8xf32>, %arg1: tensor<128x256xf32>) -> tensor<128x256xf32> { %0 = tensor.unpack %arg0 outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 8] into %arg1 : tensor<32x4x32x8xf32> -> tensor<128x256xf32> return %0 : tensor<128x256xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.unpack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [32, 8] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }"," mlir-opt -split-input-file --test-transform-dialect-interpreter --canonicalize --test-linalg-transform-patterns=""test-generalize-tensor-unpack"" ",1 "func.func @reduction_tile(%arg0: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg9: f32): %1 = arith.mulf %arg7, %arg7 : f32 %2 = arith.addf %1, %arg9 : f32 linalg.yield %2 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_scf %0 by tile_sizes = [0, 5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @reduction_tile_transpose(%arg0: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>], iterator_types = [""reduction"", ""parallel""]} ins(%arg0 : tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg9: f32): %42 = arith.addf %arg7, %arg9 : f32 linalg.yield %42 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_scf %0 by tile_sizes = [5, 0] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @reduction_tile_parallel( %arg0: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg9: f32): %1 = arith.mulf %arg7, %arg7 : f32 %2 = arith.addf %1, %arg9 : f32 linalg.yield %2 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_forall %0 by num_threads = [0, 5], tile_sizes = [] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @matmul_tile_parallel( %A: tensor, %B: tensor, %out: tensor) -> tensor { %matmul = linalg.matmul ins(%A, %B: tensor, tensor) outs(%out: tensor) -> tensor return %matmul : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_forall %0 by num_threads = [0, 0, 5], tile_sizes = [] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @reduction_tile_parallel_cyclic_dist( %arg0: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg9: f32): %1 = arith.mulf %arg7, %arg7 : f32 %2 = arith.addf %1, %arg9 : f32 linalg.yield %2 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_forall %0 by num_threads = [0, 5], tile_sizes = [0, 3], mapping = [#gpu.thread] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @reduction_tile_parallel_cyclic_dist( %arg0: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg9: f32): %1 = arith.mulf %arg7, %arg7 : f32 %2 = arith.addf %1, %arg9 : f32 linalg.yield %2 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_forall %0 by num_threads = [0, 5], tile_sizes = [0, 3], mapping = [#gpu.thread] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) transform.print %1 {name = ""expecting fill""} : !transform.any_op transform.print %2 {name = ""expecting parallel reduction""} : !transform.any_op transform.print %3 {name = ""expecting parallel reduction""} : !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @reduction_untiled_forall( %arg0: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg9: f32): %1 = arith.mulf %arg7, %arg7 : f32 %2 = arith.addf %1, %arg9 : f32 linalg.yield %2 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %loop, %1, %2, %3 = transform.structured.tile_reduction_using_forall %0 by num_threads = [5], tile_sizes = [3], mapping = [#gpu.thread] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> module { func.func @fail_for_float_neutral(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%in: f32, %out: f32): %1 = llvm.fmul %in, %in : f32 %2 = llvm.fadd %1, %out : f32 linalg.yield %2 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg0 : (!transform.any_op) -> !transform.any_op %for_op, %fill_op, %split_linalg_op, %combining_linalg_op = transform.structured.tile_reduction_using_scf %0 by tile_sizes = [0, 5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } }", mlir-opt -test-transform-dialect-interpreter -split-input-file -canonicalize -cse -verify-diagnostics ,1 "func.func @scalarize(%arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops = transform.structured.tile %0 [10, 0, 0] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %2 = transform.structured.scalarize %1 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @multi_use_producer(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor, %arg4 : tensor) -> (tensor, tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg1, %arg2 : tensor, tensor) { ^bb0(%b0: f32, %b1 : f32, %b2 : f32): %1 = arith.addf %b0, %b1 : f32 linalg.yield %1, %1 : f32, f32 } -> (tensor, tensor) %2 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%0#1, %arg3 : tensor, tensor) outs(%arg4 : tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %3 = arith.mulf %b0, %b1 : f32 linalg.yield %3 : f32 } -> tensor return %0#0, %0#1, %2 : tensor, tensor, tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-multiuse-producer -split-input-file ,1 "#accesses = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""] } func.func @inline_into(%arg0: memref) { call @inlined_fn(%arg0) : (memref) -> () return } func.func @inlined_fn(%arg0: memref) { linalg.generic #trait ins(%arg0 : memref) outs(%arg0 : memref) { ^bb(%0 : f32, %1 : f32) : %2 = arith.addf %0, %0: f32 linalg.yield %2 : f32 } return }", mlir-opt -inline ,1 "func.func @matmul_tensors(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %t0 = linalg.matmul ins(%arg0, %arg1: tensor, tensor) outs(%arg2: tensor) -> tensor %c4 = arith.constant 4 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c1 = arith.constant 1 : index %0 = tensor.dim %t0, %c0 : tensor %1 = tensor.dim %t0, %c1 : tensor %2 = tensor.dim %arg1, %c1 : tensor %3 = scf.for %arg3 = %c0 to %0 step %c2 iter_args(%arg4 = %arg2) -> (tensor) { %4 = scf.for %arg5 = %c0 to %2 step %c3 iter_args(%arg6 = %arg4) -> (tensor) { %5 = scf.for %arg7 = %c0 to %1 step %c4 iter_args(%arg8 = %arg6) -> (tensor) { %6 = tensor.extract_slice %t0[%arg3, %arg7][%c2, 4][1, 1] : tensor to tensor %7 = tensor.extract_slice %arg1[%arg7, %arg5][4, %c3][1, 1] : tensor to tensor<4x?xf32> %8 = tensor.extract_slice %arg8[%arg3, %arg5][%c2, %c3][1, 1] : tensor to tensor %9 = linalg.matmul ins(%6, %7 : tensor, tensor<4x?xf32>) outs(%8 : tensor) -> tensor %10 = tensor.insert_slice %9 into %arg8[%arg3, %arg5] [%c2, %c3] [1, 1] : tensor into tensor scf.yield %10 : tensor } scf.yield %5 : tensor } scf.yield %4 : tensor } return %3 : tensor }", mlir-opt -test-linalg-greedy-fusion -split-input-file ,1 "func.func @conv_tensors_static(%input: tensor<1x225x225x3xf32>, %filter: tensor<3x3x3x32xf32>, %elementwise: tensor<1x112x112x32xf32>) -> tensor<1x112x112x32xf32> { %c112 = arith.constant 112 : index %c32 = arith.constant 32 : index %c16 = arith.constant 16 : index %c8 = arith.constant 8 : index %c4 = arith.constant 4 : index %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %init = tensor.empty() : tensor<1x112x112x32xf32> %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1x112x112x32xf32>) -> tensor<1x112x112x32xf32> %conv = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<2> : tensor<2xi64>} ins(%input, %filter : tensor<1x225x225x3xf32>, tensor<3x3x3x32xf32>) outs(%fill : tensor<1x112x112x32xf32>) -> tensor<1x112x112x32xf32> %for0 = scf.for %iv0 = %c0 to %c112 step %c8 iter_args(%arg0 = %fill) -> tensor<1x112x112x32xf32> { %for1 = scf.for %iv1 = %c0 to %c112 step %c16 iter_args(%arg1 = %arg0) -> tensor<1x112x112x32xf32> { %for2 = scf.for %iv2 = %c0 to %c32 step %c4 iter_args(%arg2 = %arg1) -> tensor<1x112x112x32xf32> { %0 = tensor.extract_slice %conv[0, %iv0, %iv1, %iv2][1, 8, 16, 4][1, 1, 1, 1] : tensor<1x112x112x32xf32> to tensor<1x8x16x4xf32> %1 = tensor.extract_slice %elementwise[0, %iv0, %iv1, %iv2][1, 8, 16, 4][1, 1, 1, 1] : tensor<1x112x112x32xf32> to tensor<1x8x16x4xf32> %2 = tensor.extract_slice %arg2[0, %iv0, %iv1, %iv2][1, 8, 16, 4][1, 1, 1, 1] : tensor<1x112x112x32xf32> to tensor<1x8x16x4xf32> %add = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } ins(%0, %1 : tensor<1x8x16x4xf32>, tensor<1x8x16x4xf32>) outs(%2 : tensor<1x8x16x4xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %result = arith.addf %arg3, %arg4 : f32 linalg.yield %result : f32 } -> tensor<1x8x16x4xf32> %insert = tensor.insert_slice %add into %arg2[0, %iv0, %iv1, %iv2] [1, 8, 16, 4] [1, 1, 1, 1] : tensor<1x8x16x4xf32> into tensor<1x112x112x32xf32> scf.yield %insert : tensor<1x112x112x32xf32> } scf.yield %for2 : tensor<1x112x112x32xf32> } scf.yield %for1 : tensor<1x112x112x32xf32> } return %for0 : tensor<1x112x112x32xf32> }", mlir-opt -test-linalg-greedy-fusion -split-input-file ,1 "func.func @conv_tensors_dynamic(%input: tensor, %filter: tensor, %elementwise: tensor) -> tensor { %cst = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c8 = arith.constant 8 : index %c16 = arith.constant 16 : index %n = tensor.dim %elementwise, %c0 : tensor %oh = tensor.dim %elementwise, %c1 : tensor %ow = tensor.dim %elementwise, %c2 : tensor %oc = tensor.dim %elementwise, %c3 : tensor %init = tensor.empty(%n, %oh, %ow, %oc) : tensor %fill = linalg.fill ins(%cst : f32) outs(%init : tensor) -> tensor %conv = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<2> : tensor<2xi64>} ins(%input, %filter : tensor, tensor) outs(%fill : tensor) -> tensor %for0 = scf.for %iv0 = %c0 to %n step %c8 iter_args(%arg0 = %fill) -> tensor { %for1 = scf.for %iv1 = %c0 to %oh step %c16 iter_args(%arg1 = %arg0) -> tensor { %for2 = scf.for %iv2 = %c0 to %ow step %c4 iter_args(%arg2 = %arg1) -> tensor { %for3 = scf.for %iv3 = %c0 to %oc step %c2 iter_args(%arg3 = %arg2) -> tensor { %n_size = affine.min affine_map<(d0)[s0] -> (8, -d0 + s0)>(%iv0)[%n] %oh_size = affine.min affine_map<(d0)[s0] -> (16, -d0 + s0)>(%iv1)[%oh] %ow_size = affine.min affine_map<(d0)[s0] -> (4, -d0 + s0)>(%iv2)[%ow] %oc_size = affine.min affine_map<(d0)[s0] -> (2, -d0 + s0)>(%iv2)[%oc] %0 = tensor.extract_slice %conv[%iv0, %iv1, %iv2, %iv3][%n_size, %oh_size, %ow_size, %oc_size][1, 1, 1, 1] : tensor to tensor %1 = tensor.extract_slice %elementwise[%iv0, %iv1, %iv2, %iv3][%n_size, %oh_size, %ow_size, %oc_size][1, 1, 1, 1] : tensor to tensor %2 = tensor.extract_slice %arg3[%iv0, %iv1, %iv2, %iv3][%n_size, %oh_size, %ow_size, %oc_size][1, 1, 1, 1] : tensor to tensor %add = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""] } ins(%0, %1 : tensor, tensor) outs(%2 : tensor) { ^bb0(%arg4: f32, %arg5: f32, %arg6: f32): %result = arith.addf %arg4, %arg5 : f32 linalg.yield %result : f32 } -> tensor %insert = tensor.insert_slice %add into %arg3[%iv0, %iv1, %iv2, %iv3] [%n_size, %oh_size, %ow_size, %oc_size] [1, 1, 1, 1] : tensor into tensor scf.yield %insert : tensor } scf.yield %for3 : tensor } scf.yield %for2 : tensor } scf.yield %for1 : tensor } return %for0 : tensor }", mlir-opt -test-linalg-greedy-fusion -split-input-file ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @pad_generic_static(%small_input: tensor<58x1xf32>, %large_input: tensor<64x128xf32>) -> tensor<64x128xf32> { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c16 = arith.constant 16 : index %c32 = arith.constant 32 : index %zero = arith.constant 0.0 : f32 %d0 = tensor.dim %large_input, %c0 : tensor<64x128xf32> %d1 = tensor.dim %large_input, %c1 : tensor<64x128xf32> %pad = tensor.pad %small_input low[4, 60] high[2, 67] { ^bb0(%arg0: index, %arg1: index): tensor.yield %zero : f32 } : tensor<58x1xf32> to tensor<64x128xf32> %fill = linalg.fill ins(%zero : f32) outs(%large_input : tensor<64x128xf32>) -> tensor<64x128xf32> %for0 = scf.for %iv0 = %c0 to %d0 step %c16 iter_args(%arg0 = %fill) -> tensor<64x128xf32> { %for1 = scf.for %iv1 = %c0 to %d1 step %c32 iter_args(%arg1 = %arg0) -> tensor<64x128xf32> { %0 = tensor.extract_slice %pad[%iv0, %iv1][16, 32][1, 1] : tensor<64x128xf32> to tensor<16x32xf32> %1 = tensor.extract_slice %large_input[%iv0, %iv1][16, 32][1, 1] : tensor<64x128xf32> to tensor<16x32xf32> %2 = tensor.extract_slice %arg1[%iv0, %iv1][16, 32][1, 1] : tensor<64x128xf32> to tensor<16x32xf32> %add = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%0, %1 : tensor<16x32xf32>, tensor<16x32xf32>) outs(%2 : tensor<16x32xf32>) { ^bb0(%arg4: f32, %arg5: f32, %arg6: f32): %result = arith.addf %arg4, %arg5 : f32 linalg.yield %result : f32 } -> tensor<16x32xf32> %insert = tensor.insert_slice %add into %arg1[%iv0, %iv1] [16, 32] [1, 1] : tensor<16x32xf32> into tensor<64x128xf32> scf.yield %insert : tensor<64x128xf32> } scf.yield %for1 : tensor<64x128xf32> } return %for0 : tensor<64x128xf32> }", mlir-opt -test-linalg-greedy-fusion -split-input-file ,1 "func.func @outerproduct_matmul(%A: memref<3x3xf32>, %B: memref<3x3xf32>, %C: memref<3x3xf32>) { linalg.matmul ins(%A, %B: memref<3x3xf32>, memref<3x3xf32>) outs(%C: memref<3x3xf32>) return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = get_closest_isolated_parent %0 : (!transform.any_op) -> !transform.any_op %2 = transform.structured.vectorize %1 : (!transform.any_op) -> !transform.any_op transform.vector.lower_contraction %2 lowering_strategy = ""outerproduct"" : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter ,1 "func.func @matmul_tensors( %arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.matmul ins(%arg0, %arg1: tensor, tensor) outs(%arg2: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @generic_op_tensors( %arg0 : tensor, %arg1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.dim %arg0, %c2 : tensor %3 = tensor.empty(%0, %1, %2) : tensor %4 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d2, d1)>, affine_map<(d0, d1, d2) -> (d2, d1, d0)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg2 : f32, %arg3: f32, %arg4: f32): %5 = arith.addf %arg2, %arg3 : f32 linalg.yield %5 : f32 } -> tensor return %4 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @fold_extract_slice( %arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.dim %arg1, %c0 : tensor %1 = tensor.extract_slice %arg0[3, 4] [%0, 42] [1, 1] : tensor to tensor %2 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%1, %arg2 : tensor, tensor) outs(%arg1 : tensor) { ^bb0(%arg3 : f32, %arg4: f32, %arg5: f32): %5 = arith.addf %arg3, %arg5 : f32 linalg.yield %5 : f32 } -> tensor return %2 : tensor } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @simple_op(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %init1 = tensor.empty(%d1, %d0) : tensor %init2 = tensor.empty(%d0, %d1) : tensor %result:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor, tensor, tensor) outs(%init1, %init2 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : %0 = arith.addf %b0, %b1 : f32 %1 = arith.mulf %0, %b2 : f32 linalg.yield %0, %1 : f32, f32 } -> (tensor, tensor) return %result#0, %result#1 : tensor, tensor }", mlir-opt -test-linalg-decompose-ops -cse -split-input-file ,1 "func.func @simple_op(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %init1 = tensor.empty(%d1, %d0) : tensor %init2 = tensor.empty(%d0, %d1) : tensor %result:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor, tensor, tensor) outs(%init1, %init2 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : %0 = arith.addf %b0, %b1 : f32 %1 = arith.mulf %0, %b2 : f32 linalg.yield %0, %1 : f32, f32 } -> (tensor, tensor) return %result#0, %result#1 : tensor, tensor }", mlir-opt -test-linalg-decompose-ops=remove-dead-args-and-results -cse -split-input-file ,1 "func.func @simple_op_permuted_outputs(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor, tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %init1 = tensor.empty(%d1, %d0) : tensor %init2 = tensor.empty(%d0, %d1) : tensor %result:3 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor, tensor, tensor) outs(%init1, %init2, %init2 : tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32, %b5 : f32) : %0 = arith.addf %b0, %b1 : f32 %1 = arith.mulf %0, %b2 : f32 linalg.yield %0, %1, %0 : f32, f32, f32 } -> (tensor, tensor, tensor) return %result#0, %result#1, %result#2 : tensor, tensor, tensor }", mlir-opt -test-linalg-decompose-ops -cse -split-input-file ,1 "func.func @simple_op_permuted_outputs(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor, tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg0, %c1 : tensor %init1 = tensor.empty(%d1, %d0) : tensor %init2 = tensor.empty(%d0, %d1) : tensor %result:3 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : tensor, tensor, tensor) outs(%init1, %init2, %init2 : tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32, %b5 : f32) : %0 = arith.addf %b0, %b1 : f32 %1 = arith.mulf %0, %b2 : f32 linalg.yield %0, %1, %0 : f32, f32, f32 } -> (tensor, tensor, tensor) return %result#0, %result#1, %result#2 : tensor, tensor, tensor }", mlir-opt -test-linalg-decompose-ops=remove-dead-args-and-results -cse -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #map2 = affine_map<(d0, d1) -> (d1, d0)> func.func @multi_statement(%arg0 : tensor<10x20xf32>, %arg1 : tensor<10xi32>) -> tensor<20x10xf64> { %init = tensor.empty() : tensor<20x10xf64> %0 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor<10x20xf32>, tensor<10xi32>) outs(%init : tensor<20x10xf64>) { ^bb0(%b0 : f32, %b1 : i32, %b2 : f64): %1 = arith.sitofp %b1 : i32 to f64 %2 = arith.extf %b0 : f32 to f64 %3 = arith.addf %1, %2 : f64 linalg.yield %3 : f64 } -> tensor<20x10xf64> return %0 : tensor<20x10xf64> }", mlir-opt -test-linalg-decompose-ops -cse -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d0)> #map2 = affine_map<(d0, d1) -> (d1, d0)> func.func @multi_statement(%arg0 : tensor<10x20xf32>, %arg1 : tensor<10xi32>) -> tensor<20x10xf64> { %init = tensor.empty() : tensor<20x10xf64> %0 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor<10x20xf32>, tensor<10xi32>) outs(%init : tensor<20x10xf64>) { ^bb0(%b0 : f32, %b1 : i32, %b2 : f64): %1 = arith.sitofp %b1 : i32 to f64 %2 = arith.extf %b0 : f32 to f64 %3 = arith.addf %1, %2 : f64 linalg.yield %3 : f64 } -> tensor<20x10xf64> return %0 : tensor<20x10xf64> }", mlir-opt -test-linalg-decompose-ops=remove-dead-args-and-results -cse -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0)> #map1 = affine_map<(d0, d1) -> (d1)> #map2 = affine_map<(d0, d1) -> (d0, d1)> #map3 = affine_map<(d0, d1) -> (d1, d0)> func.func @destination_passing_style( %arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor) -> (tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2, %arg3 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32) : %1 = arith.addf %b0, %b2 : f32 %2 = arith.mulf %b1, %b3 : f32 linalg.yield %1, %2 : f32, f32 } -> (tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -test-linalg-decompose-ops -cse -split-input-file ,1 "#map0 = affine_map<(d0, d1) -> (d0)> #map1 = affine_map<(d0, d1) -> (d1)> #map2 = affine_map<(d0, d1) -> (d0, d1)> #map3 = affine_map<(d0, d1) -> (d1, d0)> func.func @destination_passing_style( %arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor) -> (tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2, %arg3 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32) : %1 = arith.addf %b0, %b2 : f32 %2 = arith.mulf %b1, %b3 : f32 linalg.yield %1, %2 : f32, f32 } -> (tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -test-linalg-decompose-ops=remove-dead-args-and-results -cse -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d3, d4, d5, d6)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing(%arg0 : tensor<2x12x5x336x9xi32>, %arg1 : tensor<2x3x4xi32>, %arg2 : tensor<5x6x7x8xi32>) -> tensor<2x3x4x5x6x7x8x9xi32> { %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor<2x12x5x336x9xi32> into tensor<2x3x4x5x6x7x8x9xi32> %init = tensor.empty() : tensor<2x3x4x5x6x7x8x9xi32> %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor<2x3x4x5x6x7x8x9xi32>, tensor<2x3x4xi32>, tensor<5x6x7x8xi32>) outs(%init : tensor<2x3x4x5x6x7x8x9xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %t0 = arith.addi %b0, %b1 : i32 %t1 = arith.addi %t0, %b2 : i32 linalg.yield %t1 : i32 } -> tensor<2x3x4x5x6x7x8x9xi32> return %generic : tensor<2x3x4x5x6x7x8x9xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d3, d4, d5, d6)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing(%arg0 : tensor<2x12x5x336x9xi32>, %arg1 : tensor<2x3x4xi32>, %arg2 : tensor<5x6x7x8xi32>) -> tensor<2x3x4x5x6x7x8x9xi32> { %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor<2x12x5x336x9xi32> into tensor<2x3x4x5x6x7x8x9xi32> %init = tensor.empty() : tensor<2x3x4x5x6x7x8x9xi32> %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor<2x3x4x5x6x7x8x9xi32>, tensor<2x3x4xi32>, tensor<5x6x7x8xi32>) outs(%init : tensor<2x3x4x5x6x7x8x9xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %t0 = arith.addi %b0, %b1 : i32 %t1 = arith.addi %t0, %b2 : i32 linalg.yield %t1 : i32 } -> tensor<2x3x4x5x6x7x8x9xi32> return %generic : tensor<2x3x4x5x6x7x8x9xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d3, d4, d5, d6)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing_indexing_op(%arg0 : tensor<2x12x5x336x9xi32>, %arg1 : tensor<2x3x4xi32>, %arg2 : tensor<5x6x7x8xi32>) -> tensor<2x3x4x5x6x7x8x9xi32> { %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor<2x12x5x336x9xi32> into tensor<2x3x4x5x6x7x8x9xi32> %init = tensor.empty() : tensor<2x3x4x5x6x7x8x9xi32> %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor<2x3x4x5x6x7x8x9xi32>, tensor<2x3x4xi32>, tensor<5x6x7x8xi32>) outs(%init : tensor<2x3x4x5x6x7x8x9xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %iv0 = linalg.index 0: index %iv1 = linalg.index 1: index %t0 = arith.addi %iv0, %iv1 : index %iv2 = linalg.index 2 : index %t1 = arith.addi %t0, %iv2 : index %iv3 = linalg.index 3 : index %t2 = arith.addi %t1, %iv3 : index %iv4 = linalg.index 4 : index %t3 = arith.addi %t2, %iv4 : index %iv5 = linalg.index 5 : index %t4 = arith.addi %t3, %iv5 : index %iv6 = linalg.index 6 : index %t5 = arith.addi %t4, %iv6 : index %iv7 = linalg.index 7 : index %t6 = arith.addi %t5, %iv7 : index %yield = arith.index_cast %t6 : index to i32 linalg.yield %yield : i32 } -> tensor<2x3x4x5x6x7x8x9xi32> return %generic : tensor<2x3x4x5x6x7x8x9xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d3, d4, d5, d6)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing_indexing_op(%arg0 : tensor<2x12x5x336x9xi32>, %arg1 : tensor<2x3x4xi32>, %arg2 : tensor<5x6x7x8xi32>) -> tensor<2x3x4x5x6x7x8x9xi32> { %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor<2x12x5x336x9xi32> into tensor<2x3x4x5x6x7x8x9xi32> %init = tensor.empty() : tensor<2x3x4x5x6x7x8x9xi32> %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor<2x3x4x5x6x7x8x9xi32>, tensor<2x3x4xi32>, tensor<5x6x7x8xi32>) outs(%init : tensor<2x3x4x5x6x7x8x9xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %iv0 = linalg.index 0: index %iv1 = linalg.index 1: index %t0 = arith.addi %iv0, %iv1 : index %iv2 = linalg.index 2 : index %t1 = arith.addi %t0, %iv2 : index %iv3 = linalg.index 3 : index %t2 = arith.addi %t1, %iv3 : index %iv4 = linalg.index 4 : index %t3 = arith.addi %t2, %iv4 : index %iv5 = linalg.index 5 : index %t4 = arith.addi %t3, %iv5 : index %iv6 = linalg.index 6 : index %t5 = arith.addi %t4, %iv6 : index %iv7 = linalg.index 7 : index %t6 = arith.addi %t5, %iv7 : index %yield = arith.index_cast %t6 : index to i32 linalg.yield %yield : i32 } -> tensor<2x3x4x5x6x7x8x9xi32> return %generic : tensor<2x3x4x5x6x7x8x9xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d7, d5, d6, d0, d1, d2, d3, d4)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d5, d6, d0)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d4, d1, d2, d3)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing_change_reshape_order(%arg0 : tensor<9x56x2x60x6xi32>, %arg1 : tensor<7x8x2xi32>, %arg2 : tensor<6x3x4x5xi32>) -> tensor<2x3x4x5x6x7x8x9xi32> { %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor<9x56x2x60x6xi32> into tensor<9x7x8x2x3x4x5x6xi32> %init = tensor.empty() : tensor<2x3x4x5x6x7x8x9xi32> %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor<9x7x8x2x3x4x5x6xi32>, tensor<7x8x2xi32>, tensor<6x3x4x5xi32>) outs(%init : tensor<2x3x4x5x6x7x8x9xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %t0 = arith.addi %b0, %b1 : i32 %t1 = arith.addi %t0, %b2 : i32 linalg.yield %t1 : i32 } -> tensor<2x3x4x5x6x7x8x9xi32> return %generic : tensor<2x3x4x5x6x7x8x9xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d7, d5, d6, d0, d1, d2, d3, d4)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d5, d6, d0)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d4, d1, d2, d3)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing_change_reshape_order(%arg0 : tensor<9x56x2x60x6xi32>, %arg1 : tensor<7x8x2xi32>, %arg2 : tensor<6x3x4x5xi32>) -> tensor<2x3x4x5x6x7x8x9xi32> { %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor<9x56x2x60x6xi32> into tensor<9x7x8x2x3x4x5x6xi32> %init = tensor.empty() : tensor<2x3x4x5x6x7x8x9xi32> %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor<9x7x8x2x3x4x5x6xi32>, tensor<7x8x2xi32>, tensor<6x3x4x5xi32>) outs(%init : tensor<2x3x4x5x6x7x8x9xi32>) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %t0 = arith.addi %b0, %b1 : i32 %t1 = arith.addi %t0, %b2 : i32 linalg.yield %t1 : i32 } -> tensor<2x3x4x5x6x7x8x9xi32> return %generic : tensor<2x3x4x5x6x7x8x9xi32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d7, d5, d6, d0, d1, d2, d3, d4)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d5, d6, d0)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d4, d1, d2, d3)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing_dynamic(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor into tensor %d0 = tensor.dim %arg1, %c2 : tensor %d2 = tensor.dim %arg2, %c2 : tensor %d4 = tensor.dim %arg2, %c0 : tensor %d6 = tensor.dim %arg1, %c1 : tensor %d7 = tensor.dim %arg0, %c0 : tensor %init = tensor.empty(%d0, %d2, %d4, %d6, %d7) : tensor %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor, tensor, tensor) outs(%init : tensor) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %iv0 = linalg.index 0: index %iv1 = linalg.index 1: index %t0 = arith.addi %iv0, %iv1 : index %iv2 = linalg.index 2 : index %t1 = arith.addi %t0, %iv2 : index %iv3 = linalg.index 3 : index %t2 = arith.addi %t1, %iv3 : index %iv4 = linalg.index 4 : index %t3 = arith.addi %t2, %iv4 : index %iv5 = linalg.index 5 : index %t4 = arith.addi %t3, %iv5 : index %iv6 = linalg.index 6 : index %t5 = arith.addi %t4, %iv6 : index %iv7 = linalg.index 7 : index %t6 = arith.addi %t5, %iv7 : index %yield = arith.index_cast %t6 : index to i32 linalg.yield %yield : i32 } -> tensor return %generic : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d7, d5, d6, d0, d1, d2, d3, d4)> #map1 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d5, d6, d0)> #map2 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d4, d1, d2, d3)> #map3 = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7) -> (d0, d1, d2, d3, d4, d5, d6, d7)> func.func @fuse_by_collapsing_dynamic(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %expand = tensor.expand_shape %arg0 [[0], [1, 2], [3], [4, 5, 6], [7]] : tensor into tensor %d0 = tensor.dim %arg1, %c2 : tensor %d2 = tensor.dim %arg2, %c2 : tensor %d4 = tensor.dim %arg2, %c0 : tensor %d6 = tensor.dim %arg1, %c1 : tensor %d7 = tensor.dim %arg0, %c0 : tensor %init = tensor.empty(%d0, %d2, %d4, %d6, %d7) : tensor %generic = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%expand, %arg1, %arg2 : tensor, tensor, tensor) outs(%init : tensor) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32): %iv0 = linalg.index 0: index %iv1 = linalg.index 1: index %t0 = arith.addi %iv0, %iv1 : index %iv2 = linalg.index 2 : index %t1 = arith.addi %t0, %iv2 : index %iv3 = linalg.index 3 : index %t2 = arith.addi %t1, %iv3 : index %iv4 = linalg.index 4 : index %t3 = arith.addi %t2, %iv4 : index %iv5 = linalg.index 5 : index %t4 = arith.addi %t3, %iv5 : index %iv6 = linalg.index 6 : index %t5 = arith.addi %t4, %iv6 : index %iv7 = linalg.index 7 : index %t6 = arith.addi %t5, %iv7 : index %yield = arith.index_cast %t6 : index to i32 linalg.yield %yield : i32 } -> tensor return %generic : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d3)> func.func @fuse_reductions(%arg0 : tensor<2x?x5xf32>, %arg1 : tensor<2x5xf32>) -> tensor<2x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x?x5xf32> into tensor<2x6x?x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""reduction"", ""reduction"", ""parallel""]} ins(%0 : tensor<2x6x?x5xf32>) outs(%arg1 : tensor<2x5xf32>) { ^bb0(%b0 : f32, %b1 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x5xf32> return %1 : tensor<2x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d3)> func.func @fuse_reductions(%arg0 : tensor<2x?x5xf32>, %arg1 : tensor<2x5xf32>) -> tensor<2x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x?x5xf32> into tensor<2x6x?x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""reduction"", ""reduction"", ""parallel""]} ins(%0 : tensor<2x6x?x5xf32>) outs(%arg1 : tensor<2x5xf32>) { ^bb0(%b0 : f32, %b1 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x5xf32> return %1 : tensor<2x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> func.func @no_fuse_unpreserved_folding(%arg0 : tensor<2x12x5xf32>, %arg1 : tensor<2x3xf32>) -> tensor<2x3x4x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x12x5xf32> into tensor<2x3x4x5xf32> %init = tensor.empty(): tensor<2x3x4x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor<2x3x4x5xf32>, tensor<2x3xf32>) outs(%init : tensor<2x3x4x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x3x4x5xf32> return %1 : tensor<2x3x4x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> func.func @no_fuse_unpreserved_folding(%arg0 : tensor<2x12x5xf32>, %arg1 : tensor<2x3xf32>) -> tensor<2x3x4x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x12x5xf32> into tensor<2x3x4x5xf32> %init = tensor.empty(): tensor<2x3x4x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor<2x3x4x5xf32>, tensor<2x3xf32>) outs(%init : tensor<2x3x4x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x3x4x5xf32> return %1 : tensor<2x3x4x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d1, d3)> func.func @no_fuse_unpreserved_folding_transpose(%arg0 : tensor<2x12x5xf32>, %arg1 : tensor<2xf32>) -> tensor<2x4x3x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x12x5xf32> into tensor<2x3x4x5xf32> %init = tensor.empty() : tensor<2x4x3x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor<2x3x4x5xf32>, tensor<2xf32>) outs(%init : tensor<2x4x3x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x4x3x5xf32> return %1 : tensor<2x4x3x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d1, d3)> func.func @no_fuse_unpreserved_folding_transpose(%arg0 : tensor<2x12x5xf32>, %arg1 : tensor<2xf32>) -> tensor<2x4x3x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x12x5xf32> into tensor<2x3x4x5xf32> %init = tensor.empty() : tensor<2x4x3x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor<2x3x4x5xf32>, tensor<2xf32>) outs(%init : tensor<2x4x3x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x4x3x5xf32> return %1 : tensor<2x4x3x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d3)> func.func @no_fuse_mismatched_iterator_types(%arg0 : tensor<2x12x5xf32>, %arg1 : tensor<2x3xf32>) -> tensor<2x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x12x5xf32> into tensor<2x3x4x5xf32> %init = tensor.empty() : tensor<2x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""reduction"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor<2x3x4x5xf32>, tensor<2x3xf32>) outs(%init : tensor<2x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x5xf32> return %1 : tensor<2x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d3)> func.func @no_fuse_mismatched_iterator_types(%arg0 : tensor<2x12x5xf32>, %arg1 : tensor<2x3xf32>) -> tensor<2x5xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2], [3]] : tensor<2x12x5xf32> into tensor<2x3x4x5xf32> %init = tensor.empty() : tensor<2x5xf32> %1 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""reduction"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor<2x3x4x5xf32>, tensor<2x3xf32>) outs(%init : tensor<2x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<2x5xf32> return %1 : tensor<2x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> #map1 = affine_map<(d0, d1, d2, d3) -> (d2, d3)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @control_fusion(%arg0 : tensor<6xf32>, %arg1 : tensor<20xf32>) -> tensor<2x3x4x5xf32> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<6xf32> into tensor<2x3xf32> %1 = tensor.expand_shape %arg1 [[0, 1]] : tensor<20xf32> into tensor<4x5xf32> %init = tensor.empty() : tensor<2x3x4x5xf32> %2 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %1 : tensor<2x3xf32>, tensor<4x5xf32>) outs(%init : tensor<2x3x4x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %3 = arith.addf %b0, %b1 : f32 linalg.yield %3 : f32 } -> tensor<2x3x4x5xf32> return %2 : tensor<2x3x4x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> #map1 = affine_map<(d0, d1, d2, d3) -> (d2, d3)> #map2 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @control_fusion(%arg0 : tensor<6xf32>, %arg1 : tensor<20xf32>) -> tensor<2x3x4x5xf32> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<6xf32> into tensor<2x3xf32> %1 = tensor.expand_shape %arg1 [[0, 1]] : tensor<20xf32> into tensor<4x5xf32> %init = tensor.empty() : tensor<2x3x4x5xf32> %2 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %1 : tensor<2x3xf32>, tensor<4x5xf32>) outs(%init : tensor<2x3x4x5xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %3 = arith.addf %b0, %b1 : f32 linalg.yield %3 : f32 } -> tensor<2x3x4x5xf32> return %2 : tensor<2x3x4x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map = affine_map<(d0) -> (d0)> func.func @zero_D_test(%arg0: tensor) -> tensor<1xf32> { %0 = tensor.expand_shape %arg0 [] : tensor into tensor<1xf32> %init = tensor.empty() : tensor<1xf32> %1 = linalg.generic { indexing_maps = [#map, #map], iterator_types = [""parallel""]} ins(%0: tensor<1xf32>) outs(%init : tensor<1xf32>) { ^bb0(%b0 : f32, %b1 : f32): linalg.yield %b0: f32 } -> tensor<1xf32> return %1 : tensor<1xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map = affine_map<(d0) -> (d0)> func.func @zero_D_test(%arg0: tensor) -> tensor<1xf32> { %0 = tensor.expand_shape %arg0 [] : tensor into tensor<1xf32> %init = tensor.empty() : tensor<1xf32> %1 = linalg.generic { indexing_maps = [#map, #map], iterator_types = [""parallel""]} ins(%0: tensor<1xf32>) outs(%init : tensor<1xf32>) { ^bb0(%b0 : f32, %b1 : f32): linalg.yield %b0: f32 } -> tensor<1xf32> return %1 : tensor<1xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d1, d0, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @fuse_only_one_reassociation(%arg0 : tensor, %arg1 : tensor<4x?x?x8xf32>) -> tensor<4x?x?x8xf32> { %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3]] : tensor into tensor %1 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor, tensor<4x?x?x8xf32>) outs(%arg1 : tensor<4x?x?x8xf32>) { ^bb0(%b0: f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<4x?x?x8xf32> return %1 : tensor<4x?x?x8xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d1, d0, d2, d3)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @fuse_only_one_reassociation(%arg0 : tensor, %arg1 : tensor<4x?x?x8xf32>) -> tensor<4x?x?x8xf32> { %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3]] : tensor into tensor %1 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0, %arg1 : tensor, tensor<4x?x?x8xf32>) outs(%arg1 : tensor<4x?x?x8xf32>) { ^bb0(%b0: f32, %b1 : f32, %b2 : f32): %2 = arith.addf %b0, %b1 : f32 linalg.yield %2 : f32 } -> tensor<4x?x?x8xf32> return %1 : tensor<4x?x?x8xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d3, d1)> #map1 = affine_map<(d0, d1, d2, d3) -> (d3, d1, d0, d2)> func.func @fold_non_consecutive_dims(%arg0 : tensor) -> tensor { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3]] : tensor into tensor %d0 = tensor.dim %0, %c0 : tensor %d1 = tensor.dim %0, %c2 : tensor %init = tensor.empty(%d1, %d0) : tensor %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0 : tensor) outs(%init : tensor) { ^bb0(%b0 : i32, %b1 : i32): %2 = linalg.index 0 : index %3 = linalg.index 1 : index %4 = linalg.index 2 : index %5 = linalg.index 3 : index %6 = arith.addi %2, %3 : index %7 = arith.addi %6, %4 : index %8 = arith.addi %7, %5 : index %9 = arith.index_cast %8 : index to i32 linalg.yield %9: i32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d3, d1)> #map1 = affine_map<(d0, d1, d2, d3) -> (d3, d1, d0, d2)> func.func @fold_non_consecutive_dims(%arg0 : tensor) -> tensor { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3]] : tensor into tensor %d0 = tensor.dim %0, %c0 : tensor %d1 = tensor.dim %0, %c2 : tensor %init = tensor.empty(%d1, %d0) : tensor %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%0 : tensor) outs(%init : tensor) { ^bb0(%b0 : i32, %b1 : i32): %2 = linalg.index 0 : index %3 = linalg.index 1 : index %4 = linalg.index 2 : index %5 = linalg.index 3 : index %6 = arith.addi %2, %3 : index %7 = arith.addi %6, %4 : index %8 = arith.addi %7, %5 : index %9 = arith.index_cast %8 : index to i32 linalg.yield %9: i32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d3, d1)> #map1 = affine_map<(d0, d1, d2, d3) -> ()> func.func @no_fold_non_consecutive_reduction_dims(%arg0 : tensor) -> tensor { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3]] : tensor into tensor %init = tensor.empty() : tensor %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""reduction"", ""reduction"", ""reduction"", ""reduction""]} ins(%0 : tensor) outs(%init : tensor) { ^bb0(%b0 : i32, %b1 : i32): %2 = linalg.index 0 : index %3 = linalg.index 1 : index %4 = linalg.index 2 : index %5 = linalg.index 3 : index %6 = arith.addi %2, %3 : index %7 = arith.addi %6, %4 : index %8 = arith.addi %7, %5 : index %9 = arith.index_cast %8 : index to i32 linalg.yield %9: i32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d2, d3, d1)> #map1 = affine_map<(d0, d1, d2, d3) -> ()> func.func @no_fold_non_consecutive_reduction_dims(%arg0 : tensor) -> tensor { %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %0 = tensor.expand_shape %arg0 [[0, 1], [2, 3]] : tensor into tensor %init = tensor.empty() : tensor %1 = linalg.generic { indexing_maps = [#map0, #map1], iterator_types = [""reduction"", ""reduction"", ""reduction"", ""reduction""]} ins(%0 : tensor) outs(%init : tensor) { ^bb0(%b0 : i32, %b1 : i32): %2 = linalg.index 0 : index %3 = linalg.index 1 : index %4 = linalg.index 2 : index %5 = linalg.index 3 : index %6 = arith.addi %2, %3 : index %7 = arith.addi %6, %4 : index %8 = arith.addi %7, %5 : index %9 = arith.index_cast %8 : index to i32 linalg.yield %9: i32 } -> tensor return %1 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing-control -split-input-file ,1 "module { func.func @foo(%A: tensor, %B: tensor, %C: tensor, %D: tensor, %sz0: index, %sz1: index) -> tensor { %cst = arith.constant 0.000000e+00 : f32 %5 = linalg.fill {__producer__} ins(%cst : f32) outs(%D : tensor) -> tensor %6 = linalg.matmul {__producer__} ins(%A, %B : tensor, tensor) outs(%5 : tensor) -> tensor %7 = linalg.generic {__root__, indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%C, %6 : tensor, tensor) outs(%D : tensor) { ^bb0(%arg2: f32, %arg3: f32, %arg4: f32): %16 = arith.maxf %arg3, %cst : f32 %17 = arith.cmpf ogt, %arg2, %cst : f32 %18 = arith.select %17, %cst, %16 : f32 linalg.yield %18 : f32 } -> tensor return %7 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %root = transform.structured.match attributes{""__root__""} in %arg1 : (!transform.any_op) -> !transform.any_op %producers = transform.structured.match attributes{""__producer__""} in %arg1 : (!transform.any_op) -> !transform.any_op %forall_op, %tiled_op = transform.structured.tile_to_forall_op %root num_threads [10, 20] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.structured.fuse_into_containing_op %producers into %forall_op : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "module { func.func @foo(%A: tensor, %B: tensor, %C: tensor, %D: tensor, %sz0: index, %sz1: index) -> tensor { %cst = arith.constant 0.000000e+00 : f32 %5 = linalg.fill {__producer__} ins(%cst : f32) outs(%D : tensor) -> tensor %6 = linalg.matmul {__producer__} ins(%A, %B : tensor, tensor) outs(%5 : tensor) -> tensor %7 = linalg.generic {__root__, indexing_maps = [affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%C, %6 : tensor, tensor) outs(%D : tensor) { ^bb0(%arg2: f32, %arg3: f32, %arg4: f32): %16 = arith.maxf %arg3, %cst : f32 %17 = arith.cmpf ogt, %arg2, %cst : f32 %18 = arith.select %17, %cst, %16 : f32 linalg.yield %18 : f32 } -> tensor return %7 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %root = transform.structured.match attributes{""__root__""} in %arg1 : (!transform.any_op) -> !transform.any_op %producers = transform.structured.match attributes{""__producer__""} in %arg1 : (!transform.any_op) -> !transform.any_op %reversed_producers = transform.test_reverse_payload_ops %producers : (!transform.any_op) -> !transform.any_op %forall_op, %tiled_op = transform.structured.tile_to_forall_op %root num_threads [10, 20] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) transform.structured.fuse_into_containing_op %reversed_producers into %forall_op : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @conv_2d_nhwc_hwcf(%input: tensor, %filter: tensor<1x?x?x?xf32>, %init: tensor) -> tensor { %0 = linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?x?x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @conv_2d_nchw_fchw(%input: tensor, %filter: tensor, %init: tensor) -> tensor { %0 = linalg.conv_2d_nchw_fchw {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor) outs (%init: tensor) -> tensor return %0 : tensor } func.func @depthwise_conv_2d_nhwc_hwc(%input: tensor<1x1x113x96xf32>, %filter: tensor<1x3x96xf32>) -> tensor<1x1x56x96xf32> { %init = tensor.empty() : tensor<1x1x56x96xf32> %0 = linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<2xi64>} ins(%input, %filter: tensor<1x1x113x96xf32>, tensor<1x3x96xf32>) outs(%init: tensor<1x1x56x96xf32>) -> tensor<1x1x56x96xf32> return %0: tensor<1x1x56x96xf32> } func.func @conv_2d(%input: tensor<1x?xf32>, %filter: tensor<1x?xf32>, %init: tensor<1x?xf32>) -> tensor<1x?xf32> { %0 = linalg.conv_2d ins (%input, %filter: tensor<1x?xf32>, tensor<1x?xf32>) outs (%init: tensor<1x?xf32>) -> tensor<1x?xf32> return %0 : tensor<1x?xf32> } func.func @pooling_nhwc_sum(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nhwc_sum {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @pooling_nchw_sum(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nchw_sum {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @pooling_nhwc_max(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nhwc_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @pooling_nhwc_max_unsigned(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nhwc_max_unsigned {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @pooling_nhwc_min(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nhwc_min {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @pooling_nhwc_min_unsigned(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nhwc_min_unsigned {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } func.func @pooling_nchw_max(%input: tensor, %filter: tensor<1x?xf32>, %init: tensor) -> tensor { %0 = linalg.pooling_nchw_max {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%input, %filter: tensor, tensor<1x?xf32>) outs (%init: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.decompose %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @testAllocRead(%in: memref) -> vector<32 x f32> { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<32 x f32> %subview = memref.subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32> memref.copy %in, %subview : memref to memref<16 x f32> %0 = vector.transfer_read %alloc[%c0], %f0 {in_bounds = [true]} : memref<32 x f32>, vector<32 x f32> memref.dealloc %alloc : memref<32 x f32> return %0: vector<32 x f32> } func.func @testAllocFillRead(%in: memref) -> vector<32 x f32> { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<32 x f32> linalg.fill ins(%f0 : f32) outs(%alloc : memref<32 x f32>) %subview = memref.subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32> memref.copy %in, %subview : memref to memref<16 x f32> %0 = vector.transfer_read %alloc[%c0], %f0 {in_bounds = [true]} : memref<32 x f32>, vector<32 x f32> memref.dealloc %alloc : memref<32 x f32> return %0: vector<32 x f32> } func.func @testViewRead(%in: memref) -> vector<32 x f32> { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<128 x i8> %view = memref.view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32> %subview = memref.subview %view[0][16][1] : memref<32 x f32> to memref<16 x f32> memref.copy %in, %subview : memref to memref<16 x f32> %0 = vector.transfer_read %view[%c0], %f0 {in_bounds = [true]} : memref<32 x f32>, vector<32 x f32> memref.dealloc %alloc : memref<128 x i8> return %0: vector<32 x f32> } func.func @testViewFillRead(%in: memref) -> vector<32 x f32> { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<128 x i8> %view = memref.view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32> %subview = memref.subview %view[0][16][1] : memref<32 x f32> to memref<16 x f32> linalg.fill ins(%f0 : f32) outs(%view : memref<32 x f32>) memref.copy %in, %subview : memref to memref<16 x f32> %0 = vector.transfer_read %view[%c0], %f0 {in_bounds = [true]} : memref<32 x f32>, vector<32 x f32> memref.dealloc %alloc : memref<128 x i8> return %0: vector<32 x f32> } func.func @testAllocWrite(%vec: vector<32 x f32>, %out: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<32 x f32> %subview = memref.subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32> vector.transfer_write %vec, %alloc[%c0] {in_bounds = [true]} : vector<32 x f32>, memref<32 x f32> memref.copy %subview, %out : memref<16 x f32> to memref memref.dealloc %alloc : memref<32 x f32> return } func.func @testViewWrite(%vec: vector<32 x f32>, %out: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<128 x i8> %view = memref.view %alloc[%c0][] : memref<128 x i8> to memref<32 x f32> %subview = memref.subview %view[0][16][1] : memref<32 x f32> to memref<16 x f32> vector.transfer_write %vec, %view[%c0] {in_bounds = [true]} : vector<32 x f32>, memref<32 x f32> memref.copy %subview, %out : memref<16 x f32> to memref memref.dealloc %alloc : memref<128 x i8> return } func.func @failAllocFillRead(%in: memref) -> vector<32 x f32> { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %f1 = arith.constant 1.0: f32 %alloc = memref.alloc() : memref<32 x f32> linalg.fill ins(%f0 : f32) outs(%alloc : memref<32 x f32>) %subview = memref.subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32> memref.copy %in, %subview : memref to memref<16 x f32> ""some_interleaved_use""(%subview) : (memref<16 x f32>) -> () %0 = vector.transfer_read %alloc[%c0], %f1: memref<32 x f32>, vector<32 x f32> memref.dealloc %alloc : memref<32 x f32> return %0: vector<32 x f32> } func.func @failAllocWrite(%vec: vector<32 x f32>, %out: memref) { %c0 = arith.constant 0: index %f0 = arith.constant 0.0: f32 %alloc = memref.alloc() : memref<32 x f32> %subview = memref.subview %alloc[0][16][1] : memref<32 x f32> to memref<16 x f32> vector.transfer_write %vec, %alloc[%c0] : vector<32 x f32>, memref<32 x f32> ""some_interleaved_use""(%subview) : (memref<16 x f32>) -> () memref.copy %subview, %out : memref<16 x f32> to memref memref.dealloc %alloc : memref<32 x f32> return }", mlir-opt -allow-unregistered-dialect -test-linalg-transform-patterns=test-vector-transfer-forwarding-patterns ,1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main() -> () attributes {} { %c0 = arith.constant 0 : i32 %0 = tensor.from_elements %c0 : tensor<1xi32> %reshaped0 = tensor.collapse_shape %0 [] : tensor<1xi32> into tensor %c10 = arith.constant 10 : i32 %1 = tensor.from_elements %c10 : tensor<1xi32> %reshaped1 = tensor.collapse_shape %1 [] : tensor<1xi32> into tensor cf.br ^bb1(%reshaped0 : tensor) ^bb1(%2: tensor): %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%2, %reshaped1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %5 = tensor.extract %4[] : tensor cf.cond_br %5, ^bb2(%2 : tensor), ^bb3 ^bb2(%6: tensor): %7 = tensor.empty() : tensor %8 = linalg.generic #attrs ins(%6, %6 : tensor, tensor) outs(%7 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i32): %9 = arith.addi %arg0, %arg1 : i32 linalg.yield %9 : i32 } -> tensor cf.br ^bb1(%8 : tensor) ^bb3: return }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!transform.any_op) -> !transform.any_op %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!transform.any_op) -> !transform.any_op %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !transform.any_op, !transform.any_op %3:2 = transform.structured.tile %2#0 [%1#0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) %4:2 = transform.structured.tile %2#1 [%1#1] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) %5 = merge_handles %3#0, %4#0 : !transform.any_op %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !transform.any_op, !transform.any_op transform.structured.tile %6#0 [0, %tt#0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) transform.structured.tile %6#1 [0, %tt#1] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @two_d(%arg0: tensor<10x34xf32>, %arg1: tensor<10x34xf32>) -> tensor<10x34xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0: tensor<10x34xf32>) outs(%arg1: tensor<10x34xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %call_res = func.call @elem(%0, %i, %j) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<10x34xf32> return %0 : tensor<10x34xf32> }", mlir-opt --test-transform-dialect-interpreter --scf-for-loop-canonicalization --canonicalize --split-input-file ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!transform.any_op) -> !transform.any_op %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!transform.any_op) -> !transform.any_op %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !transform.any_op, !transform.any_op %3:2 = transform.structured.tile %2#0 [%1#0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) %4:2 = transform.structured.tile %2#1 [%1#1] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) %5 = merge_handles %3#0, %4#0 : !transform.any_op %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !transform.any_op, !transform.any_op transform.structured.tile %6#0 [0, %tt#0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) transform.structured.tile %6#1 [0, %tt#1] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @two_d(%arg0: tensor<10x34xf32>, %arg1: tensor<10x34xf32>) -> tensor<10x34xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0: tensor<10x34xf32>) outs(%arg1: tensor<10x34xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %call_res = func.call @elem(%0, %i, %j) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<10x34xf32> return %0 : tensor<10x34xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!transform.any_op) -> !transform.param %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!transform.any_op) -> !transform.param %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !transform.any_op, !transform.param %3:2 = transform.structured.tile %2#0 [%1#0] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) %4:2 = transform.structured.tile %2#1 [%1#1] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) %5 = merge_handles %3#0, %4#0 : !transform.any_op %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !transform.any_op, !transform.param, !transform.param, !transform.param %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !transform.any_op, !transform.param transform.structured.tile %6#0 [0, %tt#0] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) transform.structured.tile %6#1 [0, %tt#1] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @two_d_param(%arg0: tensor<10x34xf32>, %arg1: tensor<10x34xf32>) -> tensor<10x34xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0: tensor<10x34xf32>) outs(%arg1: tensor<10x34xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %call_res = func.call @elem(%0, %i, %j) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<10x34xf32> return %0 : tensor<10x34xf32> }", mlir-opt --test-transform-dialect-interpreter --scf-for-loop-canonicalization --canonicalize --split-input-file ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!transform.any_op) -> !transform.param %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!transform.any_op) -> !transform.param %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !transform.any_op, !transform.param %3:2 = transform.structured.tile %2#0 [%1#0] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) %4:2 = transform.structured.tile %2#1 [%1#1] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) %5 = merge_handles %3#0, %4#0 : !transform.any_op %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !transform.any_op, !transform.param, !transform.param, !transform.param %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !transform.any_op, !transform.param transform.structured.tile %6#0 [0, %tt#0] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) transform.structured.tile %6#1 [0, %tt#1] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @two_d_param(%arg0: tensor<10x34xf32>, %arg1: tensor<10x34xf32>) -> tensor<10x34xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0: tensor<10x34xf32>) outs(%arg1: tensor<10x34xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %call_res = func.call @elem(%0, %i, %j) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<10x34xf32> return %0 : tensor<10x34xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @indexed_vector(%arg0: memref<50xindex>) { linalg.generic {indexing_maps = [affine_map<(i) -> (i)>], iterator_types = [""parallel""]} outs(%arg0 : memref<50xindex>) { ^bb0(%a: index): %i = linalg.index 0 : index linalg.yield %i : index } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile %0 [10] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -split-input-file ,1 "func.func @indexed_matrix(%arg0: memref<50x50xindex>) { linalg.generic {indexing_maps = [affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""]} outs(%arg0 : memref<50x50xindex>) { ^bb0(%a: index): %i = linalg.index 0 : index %j = linalg.index 1 : index %sum = arith.addi %i, %j : index linalg.yield %sum : index } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop:2 = transform.structured.tile %0 [10, 25] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt -test-transform-dialect-interpreter -canonicalize -split-input-file ,1 "func.func @views(%arg0: index) { %c0 = arith.constant 0 : index %0 = arith.muli %arg0, %arg0 : index %1 = memref.alloc (%0) : memref %3 = memref.view %1[%c0][%arg0, %arg0] : memref to memref %4 = memref.view %1[%c0][%arg0, %arg0] : memref to memref> memref.dealloc %1 : memref return }", mlir-opt | mlir-opt ,1 "func.func @views(%arg0: index) { %c0 = arith.constant 0 : index %0 = arith.muli %arg0, %arg0 : index %1 = memref.alloc (%0) : memref %3 = memref.view %1[%c0][%arg0, %arg0] : memref to memref %4 = memref.view %1[%c0][%arg0, %arg0] : memref to memref> memref.dealloc %1 : memref return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @ops(%arg0: memref>, %arg1: memref>, %arg2: memref>, %arg3: memref) { linalg.matmul ins(%arg0, %arg0 : memref>, memref>) outs(%arg0 : memref>) linalg.matvec ins(%arg0, %arg1: memref>, memref>) outs(%arg2: memref>) linalg.dot ins(%arg1, %arg2: memref>, memref>) outs(%arg3: memref) return }", mlir-opt | mlir-opt ,1 "func.func @ops(%arg0: memref>, %arg1: memref>, %arg2: memref>, %arg3: memref) { linalg.matmul ins(%arg0, %arg0 : memref>, memref>) outs(%arg0 : memref>) linalg.matvec ins(%arg0, %arg1: memref>, memref>) outs(%arg2: memref>) linalg.dot ins(%arg1, %arg2: memref>, memref>) outs(%arg3: memref) return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @fill_view(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return }", mlir-opt | mlir-opt ,1 "func.func @fill_view(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @memref_transpose(%arg0: memref>) { %0 = memref.transpose %arg0 (i, j, k) -> (k, j, i) : memref> to memref> return }", mlir-opt | mlir-opt ,1 "func.func @memref_transpose(%arg0: memref>) { %0 = memref.transpose %arg0 (i, j, k) -> (k, j, i) : memref> to memref> return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @fill_view3(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return }", mlir-opt | mlir-opt ,1 "func.func @fill_view3(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "#accesses_0 = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> ()>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait_0 = { indexing_maps = #accesses_0, iterator_types = [""parallel"", ""parallel"", ""parallel""], library_call = ""some_external_function_name_1"" } func.func @generic(%arg0: memref, strided<[?, 1], offset: ?>>, %arg1: memref>) { %cst = arith.constant 0.0 : f32 linalg.generic #trait_0 ins(%arg0, %cst : memref, strided<[?, 1], offset: ?>>, f32) outs(%arg1 : memref>) attrs = {foo = 1} { ^bb(%0: vector<3x4xi4>, %1: f32, %2: f32) : linalg.yield %1 : f32 } return }", mlir-opt | mlir-opt ,1 "#accesses_0 = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> ()>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait_0 = { indexing_maps = #accesses_0, iterator_types = [""parallel"", ""parallel"", ""parallel""], library_call = ""some_external_function_name_1"" } func.func @generic(%arg0: memref, strided<[?, 1], offset: ?>>, %arg1: memref>) { %cst = arith.constant 0.0 : f32 linalg.generic #trait_0 ins(%arg0, %cst : memref, strided<[?, 1], offset: ?>>, f32) outs(%arg1 : memref>) attrs = {foo = 1} { ^bb(%0: vector<3x4xi4>, %1: f32, %2: f32) : linalg.yield %1 : f32 } return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @generic_without_inputs(%arg0 : memref) { linalg.generic {indexing_maps = [#map0], iterator_types = [""parallel"", ""parallel"", ""parallel""]} outs(%arg0 : memref) { ^bb0(%arg3: f32): %cst = arith.constant 0.000000e+00 : f32 linalg.yield %cst : f32 } return }", mlir-opt | mlir-opt ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> func.func @generic_without_inputs(%arg0 : memref) { linalg.generic {indexing_maps = [#map0], iterator_types = [""parallel"", ""parallel"", ""parallel""]} outs(%arg0 : memref) { ^bb0(%arg3: f32): %cst = arith.constant 0.000000e+00 : f32 linalg.yield %cst : f32 } return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "#accesses_1 = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> (i, k, i + j)>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait_1 = { indexing_maps = #accesses_1, iterator_types = [""parallel"", ""parallel"", ""parallel""], library_call = ""some_external_function_name_1"" } func.func @generic_with_tensor_input_and_output( %arg0: tensor>, %arg1: tensor) -> (tensor) { %0 = linalg.generic #trait_1 ins(%arg0, %arg1 : tensor>, tensor) outs(%arg1 : tensor) attrs = {foo = 1} { ^bb(%0: vector<3x4xi4>, %1: f32, %2: f32) : %f0 = arith.constant 0.0 : f32 linalg.yield %f0 : f32 } -> tensor return %0 : tensor }", mlir-opt | mlir-opt ,1 "#accesses_1 = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> (i, k, i + j)>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait_1 = { indexing_maps = #accesses_1, iterator_types = [""parallel"", ""parallel"", ""parallel""], library_call = ""some_external_function_name_1"" } func.func @generic_with_tensor_input_and_output( %arg0: tensor>, %arg1: tensor) -> (tensor) { %0 = linalg.generic #trait_1 ins(%arg0, %arg1 : tensor>, tensor) outs(%arg1 : tensor) attrs = {foo = 1} { ^bb(%0: vector<3x4xi4>, %1: f32, %2: f32) : %f0 = arith.constant 0.0 : f32 linalg.yield %f0 : f32 } -> tensor return %0 : tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @generic_with_multiple_tensor_outputs( %arg0: tensor, %arg1: tensor, %arg2: i32) -> (tensor, tensor) { %c0 = arith.constant 0 : index %0 = tensor.empty() : tensor %1 = linalg.fill ins(%arg2 : i32) outs(%0 : tensor) -> tensor %2 = tensor.empty() : tensor %3 = linalg.fill ins(%arg2 : i32) outs(%2 : tensor) -> tensor %4:2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0, %arg1 : tensor, tensor) outs(%1, %3 : tensor, tensor) { ^bb0(%arg3: i32, %arg4: i32, %arg5: i32, %arg6: i32): %5 = arith.cmpi sge, %arg3, %arg5 : i32 %6 = arith.select %5, %arg3, %arg5 : i32 %7 = arith.cmpi eq, %arg3, %arg5 : i32 %8 = arith.cmpi slt, %arg4, %arg6 : i32 %9 = arith.select %8, %arg4, %arg6 : i32 %10 = arith.select %5, %arg4, %arg6 : i32 %11 = arith.select %7, %9, %10 : i32 linalg.yield %6, %11 : i32, i32 } -> (tensor, tensor) return %4#0, %4#1 : tensor, tensor }", mlir-opt | mlir-opt ,1 "func.func @generic_with_multiple_tensor_outputs( %arg0: tensor, %arg1: tensor, %arg2: i32) -> (tensor, tensor) { %c0 = arith.constant 0 : index %0 = tensor.empty() : tensor %1 = linalg.fill ins(%arg2 : i32) outs(%0 : tensor) -> tensor %2 = tensor.empty() : tensor %3 = linalg.fill ins(%arg2 : i32) outs(%2 : tensor) -> tensor %4:2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0, %arg1 : tensor, tensor) outs(%1, %3 : tensor, tensor) { ^bb0(%arg3: i32, %arg4: i32, %arg5: i32, %arg6: i32): %5 = arith.cmpi sge, %arg3, %arg5 : i32 %6 = arith.select %5, %arg3, %arg5 : i32 %7 = arith.cmpi eq, %arg3, %arg5 : i32 %8 = arith.cmpi slt, %arg4, %arg6 : i32 %9 = arith.select %8, %arg4, %arg6 : i32 %10 = arith.select %5, %arg4, %arg6 : i32 %11 = arith.select %7, %9, %10 : i32 linalg.yield %6, %11 : i32, i32 } -> (tensor, tensor) return %4#0, %4#1 : tensor, tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "#broadcast_access = [ affine_map<(i, j) -> ()>, affine_map<(i, j) -> (i, j)> ] #trait_broadcast = { indexing_maps = #broadcast_access, iterator_types = [""parallel"", ""parallel""], library_call = ""some_broadcast_external_fn"" } func.func @generic_op_zero_rank(%arg0: tensor, %arg1 : tensor<3x4xf32>) -> (tensor<3x4xf32>) { %0 = linalg.generic #trait_broadcast ins(%arg0 : tensor) outs(%arg1 : tensor<3x4xf32>) { ^bb(%a: f32, %b: f32) : linalg.yield %a : f32 } -> tensor<3x4xf32> return %0 : tensor<3x4xf32> }", mlir-opt | mlir-opt ,1 "#broadcast_access = [ affine_map<(i, j) -> ()>, affine_map<(i, j) -> (i, j)> ] #trait_broadcast = { indexing_maps = #broadcast_access, iterator_types = [""parallel"", ""parallel""], library_call = ""some_broadcast_external_fn"" } func.func @generic_op_zero_rank(%arg0: tensor, %arg1 : tensor<3x4xf32>) -> (tensor<3x4xf32>) { %0 = linalg.generic #trait_broadcast ins(%arg0 : tensor) outs(%arg1 : tensor<3x4xf32>) { ^bb(%a: f32, %b: f32) : linalg.yield %a : f32 } -> tensor<3x4xf32> return %0 : tensor<3x4xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "#accesses_3 = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait_3 = { indexing_maps = #accesses_3, iterator_types = [""parallel"", ""parallel"", ""parallel""], library_call = ""some_external_function_name_2"" } func.func @generic_region(%arg0: memref, strided<[?, 1], offset: ?>>, %arg1: memref>) { linalg.generic #trait_3 ins(%arg0 : memref, strided<[?, 1], offset: ?>>) outs(%arg1 : memref>) attrs = {foo = 1} { ^bb(%a: vector<3x4xi4>, %b: f32) : %0 = linalg.index 0 : index %1 = linalg.index 1 : index %2 = linalg.index 2 : index linalg.yield %b : f32 } return }", mlir-opt | mlir-opt ,1 "#accesses_3 = [ affine_map<(i, j, k) -> (j, i)>, affine_map<(i, j, k) -> (i, k, i + j)> ] #trait_3 = { indexing_maps = #accesses_3, iterator_types = [""parallel"", ""parallel"", ""parallel""], library_call = ""some_external_function_name_2"" } func.func @generic_region(%arg0: memref, strided<[?, 1], offset: ?>>, %arg1: memref>) { linalg.generic #trait_3 ins(%arg0 : memref, strided<[?, 1], offset: ?>>) outs(%arg1 : memref>) attrs = {foo = 1} { ^bb(%a: vector<3x4xi4>, %b: f32) : %0 = linalg.index 0 : index %1 = linalg.index 1 : index %2 = linalg.index 2 : index linalg.yield %b : f32 } return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @named_ops(%a3: memref, %b3: memref, %c3: memref, %ta3: tensor, %tb3: tensor, %tc3: tensor) -> (tensor) { linalg.batch_matmul ins(%a3, %b3: memref, memref) outs(%c3: memref) %res1 = linalg.batch_matmul ins(%ta3, %tb3: tensor, tensor) outs(%tc3: tensor) -> tensor return %res1 : tensor }", mlir-opt | mlir-opt ,1 "func.func @named_ops(%a3: memref, %b3: memref, %c3: memref, %ta3: tensor, %tb3: tensor, %tc3: tensor) -> (tensor) { linalg.batch_matmul ins(%a3, %b3: memref, memref) outs(%c3: memref) %res1 = linalg.batch_matmul ins(%ta3, %tb3: tensor, tensor) outs(%tc3: tensor) -> tensor return %res1 : tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @fill_tensor(%arg0 : index, %arg1 : index, %arg2 : f32) -> tensor { %0 = tensor.empty(%arg0, %arg1) : tensor %1 = linalg.fill ins(%arg2 : f32) outs(%0 : tensor) -> tensor return %1 : tensor }", mlir-opt | mlir-opt ,1 "func.func @fill_tensor(%arg0 : index, %arg1 : index, %arg2 : f32) -> tensor { %0 = tensor.empty(%arg0, %arg1) : tensor %1 = linalg.fill ins(%arg2 : f32) outs(%0 : tensor) -> tensor return %1 : tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @mixed_parallel_reduced_results(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor) -> (tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2, %arg3 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32): %1 = arith.mulf %b0, %b1 : f32 %2 = arith.addf %1, %b3 : f32 linalg.yield %1, %2 : f32, f32 } -> (tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt | mlir-opt ,1 "func.func @mixed_parallel_reduced_results(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor) -> (tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2, %arg3 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32): %1 = arith.mulf %b0, %b1 : f32 %2 = arith.addf %1, %b3 : f32 linalg.yield %1, %2 : f32, f32 } -> (tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @map_no_inputs(%init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map outs(%init:tensor<64xf32>) () { %0 = arith.constant 0.0: f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }", mlir-opt | mlir-opt ,1 "func.func @map_no_inputs(%init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map outs(%init:tensor<64xf32>) () { %0 = arith.constant 0.0: f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @map_binary(%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map ins(%lhs, %rhs: tensor<64xf32>, tensor<64xf32>) outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }", mlir-opt | mlir-opt ,1 "func.func @map_binary(%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map ins(%lhs, %rhs: tensor<64xf32>, tensor<64xf32>) outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @map_binary_memref(%lhs: memref<64xf32>, %rhs: memref<64xf32>, %init: memref<64xf32>) { linalg.map ins(%lhs, %rhs: memref<64xf32>, memref<64xf32>) outs(%init:memref<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 linalg.yield %0: f32 } func.return }", mlir-opt | mlir-opt ,1 "func.func @map_binary_memref(%lhs: memref<64xf32>, %rhs: memref<64xf32>, %init: memref<64xf32>) { linalg.map ins(%lhs, %rhs: memref<64xf32>, memref<64xf32>) outs(%init:memref<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem: f32 linalg.yield %0: f32 } func.return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @map_unary(%input: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %abs = linalg.map ins(%input:tensor<64xf32>) outs(%init:tensor<64xf32>) (%input_elem: f32) { %0 = math.absf %input_elem: f32 linalg.yield %0: f32 } func.return %abs : tensor<64xf32> }", mlir-opt | mlir-opt ,1 "func.func @map_unary(%input: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %abs = linalg.map ins(%input:tensor<64xf32>) outs(%init:tensor<64xf32>) (%input_elem: f32) { %0 = math.absf %input_elem: f32 linalg.yield %0: f32 } func.return %abs : tensor<64xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @map_unary_memref(%input: memref<64xf32>, %init: memref<64xf32>) { linalg.map ins(%input:memref<64xf32>) outs(%init:memref<64xf32>) (%input_elem: f32) { %0 = math.absf %input_elem: f32 linalg.yield %0: f32 } func.return }", mlir-opt | mlir-opt ,1 "func.func @map_unary_memref(%input: memref<64xf32>, %init: memref<64xf32>) { linalg.map ins(%input:memref<64xf32>) outs(%init:memref<64xf32>) (%input_elem: f32) { %0 = math.absf %input_elem: f32 linalg.yield %0: f32 } func.return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @reduce(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> }", mlir-opt | mlir-opt ,1 "func.func @reduce(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @reduce_memref(%input: memref<16x32x64xf32>, %init: memref<16x64xf32>) { linalg.reduce ins(%input:memref<16x32x64xf32>) outs(%init:memref<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return }", mlir-opt | mlir-opt ,1 "func.func @reduce_memref(%input: memref<16x32x64xf32>, %init: memref<16x64xf32>) { linalg.reduce ins(%input:memref<16x32x64xf32>) outs(%init:memref<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in: f32 linalg.yield %0: f32 } func.return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @variadic_reduce(%input1: tensor<16x32x64xf32>, %init1: tensor<16x64xf32>, %input2: tensor<16x32x64xi64>, %init2: tensor<16x64xi64>) -> (tensor<16x64xf32>, tensor<16x64xi64>) { %reduce, %reduce2 = linalg.reduce ins(%input1, %input2 : tensor<16x32x64xf32>, tensor<16x32x64xi64>) outs(%init1, %init2 : tensor<16x64xf32>, tensor<16x64xi64>) dimensions = [1] (%in1: f32, %in2: i64, %out1: f32, %out2: i64) { %0 = arith.addf %in1, %out1: f32 %1 = arith.addi %in2, %out2: i64 linalg.yield %0, %1: f32, i64 } func.return %reduce, %reduce2 : tensor<16x64xf32>, tensor<16x64xi64> }", mlir-opt | mlir-opt ,1 "func.func @variadic_reduce(%input1: tensor<16x32x64xf32>, %init1: tensor<16x64xf32>, %input2: tensor<16x32x64xi64>, %init2: tensor<16x64xi64>) -> (tensor<16x64xf32>, tensor<16x64xi64>) { %reduce, %reduce2 = linalg.reduce ins(%input1, %input2 : tensor<16x32x64xf32>, tensor<16x32x64xi64>) outs(%init1, %init2 : tensor<16x64xf32>, tensor<16x64xi64>) dimensions = [1] (%in1: f32, %in2: i64, %out1: f32, %out2: i64) { %0 = arith.addf %in1, %out1: f32 %1 = arith.addi %in2, %out2: i64 linalg.yield %0, %1: f32, i64 } func.return %reduce, %reduce2 : tensor<16x64xf32>, tensor<16x64xi64> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @variadic_reduce_memref(%input1: memref<16x32x64xf32>, %init1: memref<16x64xf32>, %input2: memref<16x32x64xi64>, %init2: memref<16x64xi64>) { linalg.reduce ins(%input1, %input2 : memref<16x32x64xf32>, memref<16x32x64xi64>) outs(%init1, %init2 : memref<16x64xf32>, memref<16x64xi64>) dimensions = [1] (%in1: f32, %in2: i64, %out1: f32, %out2: i64) { %0 = arith.addf %in1, %out1: f32 %1 = arith.addi %in2, %out2: i64 linalg.yield %0, %1: f32, i64 } func.return }", mlir-opt | mlir-opt ,1 "func.func @variadic_reduce_memref(%input1: memref<16x32x64xf32>, %init1: memref<16x64xf32>, %input2: memref<16x32x64xi64>, %init2: memref<16x64xi64>) { linalg.reduce ins(%input1, %input2 : memref<16x32x64xf32>, memref<16x32x64xi64>) outs(%init1, %init2 : memref<16x64xf32>, memref<16x64xi64>) dimensions = [1] (%in1: f32, %in2: i64, %out1: f32, %out2: i64) { %0 = arith.addf %in1, %out1: f32 %1 = arith.addi %in2, %out2: i64 linalg.yield %0, %1: f32, i64 } func.return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @transpose(%input: tensor<16x32x64xf32>, %init: tensor<32x64x16xf32>) -> tensor<32x64x16xf32> { %transpose = linalg.transpose ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<32x64x16xf32>) permutation = [1, 2, 0] func.return %transpose : tensor<32x64x16xf32> }", mlir-opt | mlir-opt ,1 "func.func @transpose(%input: tensor<16x32x64xf32>, %init: tensor<32x64x16xf32>) -> tensor<32x64x16xf32> { %transpose = linalg.transpose ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<32x64x16xf32>) permutation = [1, 2, 0] func.return %transpose : tensor<32x64x16xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @transpose_memref(%input: memref<16x32x64xf32>, %init: memref<32x64x16xf32>) { linalg.transpose ins(%input:memref<16x32x64xf32>) outs(%init:memref<32x64x16xf32>) permutation = [1, 2, 0] func.return }", mlir-opt | mlir-opt ,1 "func.func @transpose_memref(%input: memref<16x32x64xf32>, %init: memref<32x64x16xf32>) { linalg.transpose ins(%input:memref<16x32x64xf32>) outs(%init:memref<32x64x16xf32>) permutation = [1, 2, 0] func.return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @broadcast_static_sizes(%input: tensor<8x32xf32>, %init: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> { %bcast = linalg.broadcast ins(%input:tensor<8x32xf32>) outs(%init:tensor<8x16x32xf32>) dimensions = [1] func.return %bcast : tensor<8x16x32xf32> }", mlir-opt | mlir-opt ,1 "func.func @broadcast_static_sizes(%input: tensor<8x32xf32>, %init: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> { %bcast = linalg.broadcast ins(%input:tensor<8x32xf32>) outs(%init:tensor<8x16x32xf32>) dimensions = [1] func.return %bcast : tensor<8x16x32xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @broadcast_with_dynamic_sizes( %input: tensor<8x?xf32>, %init: tensor<8x16x?xf32>) -> tensor<8x16x?xf32> { %bcast = linalg.broadcast ins(%input:tensor<8x?xf32>) outs(%init:tensor<8x16x?xf32>) dimensions = [1] func.return %bcast : tensor<8x16x?xf32> }", mlir-opt | mlir-opt ,1 "func.func @broadcast_with_dynamic_sizes( %input: tensor<8x?xf32>, %init: tensor<8x16x?xf32>) -> tensor<8x16x?xf32> { %bcast = linalg.broadcast ins(%input:tensor<8x?xf32>) outs(%init:tensor<8x16x?xf32>) dimensions = [1] func.return %bcast : tensor<8x16x?xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @broadcast_memref(%input: memref<8x32xf32>, %init: memref<8x16x32xf32>) { linalg.broadcast ins(%input:memref<8x32xf32>) outs(%init:memref<8x16x32xf32>) dimensions = [1] func.return }", mlir-opt | mlir-opt ,1 "func.func @broadcast_memref(%input: memref<8x32xf32>, %init: memref<8x16x32xf32>) { linalg.broadcast ins(%input:memref<8x32xf32>) outs(%init:memref<8x16x32xf32>) dimensions = [1] func.return }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @map_arith_with_attr(%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map ins(%lhs, %rhs: tensor<64xf32>, tensor<64xf32>) outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem fastmath : f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }", mlir-opt | mlir-opt ,1 "func.func @map_arith_with_attr(%lhs: tensor<64xf32>, %rhs: tensor<64xf32>, %init: tensor<64xf32>) -> tensor<64xf32> { %add = linalg.map ins(%lhs, %rhs: tensor<64xf32>, tensor<64xf32>) outs(%init:tensor<64xf32>) (%lhs_elem: f32, %rhs_elem: f32) { %0 = arith.addf %lhs_elem, %rhs_elem fastmath : f32 linalg.yield %0: f32 } func.return %add : tensor<64xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @reduce_arith_with_attr(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in fastmath : f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> }", mlir-opt | mlir-opt ,1 "func.func @reduce_arith_with_attr(%input: tensor<16x32x64xf32>, %init: tensor<16x64xf32>) -> tensor<16x64xf32> { %reduce = linalg.reduce ins(%input:tensor<16x32x64xf32>) outs(%init:tensor<16x64xf32>) dimensions = [1] (%in: f32, %out: f32) { %0 = arith.addf %out, %in fastmath : f32 linalg.yield %0: f32 } func.return %reduce : tensor<16x64xf32> }", mlir-opt --mlir-print-op-generic | mlir-opt ,1 "func.func @bar() { ""another_op""() : () -> () } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.func""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.replace %0 { func.func @foo() { ""dummy_op""() : () -> () } } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -allow-unregistered-dialect -verify-diagnostics --split-input-file ,1 "func.func @bar(%arg0: i1) { ""another_op""(%arg0) : (i1) -> () } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""another_op""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.replace %0 { ""dummy_op""() : () -> () } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -allow-unregistered-dialect -verify-diagnostics --split-input-file ,1 "func.func @bar() { ""another_op""() : () -> () } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""another_op""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.replace %0 { ^bb0(%a: i1): ""dummy_op""(%a) : (i1) -> () } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -allow-unregistered-dialect -verify-diagnostics --split-input-file ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @remove_deadargs_generic_basic(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %cst = arith.constant 7.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.empty(%0) : tensor %2 = tensor.empty(%0) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types=[""parallel""]} ins(%arg0, %1 : tensor, tensor) outs (%2:tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %4 = arith.addf %arg1, %cst : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0) -> (d0)> func.func @remove_deadargs_generic_basic(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %cst = arith.constant 7.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.empty(%0) : tensor %2 = tensor.empty(%0) : tensor %3 = linalg.generic {indexing_maps = [#map0, #map0, #map0], iterator_types=[""parallel""]} ins(%arg0, %1 : tensor, tensor) outs (%2:tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %4 = arith.addf %arg1, %cst : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @remove_deadargs_generic_mixedaccess(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 0 : index %cst1 = arith.constant 7.0 : f32 %cst2 = arith.constant 6.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = tensor.empty(%1, %0) : tensor %4 = tensor.empty(%0, %1) : tensor %5 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types=[""parallel"",""parallel""]} ins(%2, %3 : tensor, tensor) outs (%4:tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %6 = arith.divf %cst1, %cst2 : f32 linalg.yield %6 : f32 } -> tensor return %5 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @remove_deadargs_generic_mixedaccess(%arg0: tensor) -> (tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 0 : index %cst1 = arith.constant 7.0 : f32 %cst2 = arith.constant 6.0 : f32 %0 = tensor.dim %arg0, %c0 : tensor %1 = tensor.dim %arg0, %c1 : tensor %2 = tensor.empty(%0, %1) : tensor %3 = tensor.empty(%1, %0) : tensor %4 = tensor.empty(%0, %1) : tensor %5 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types=[""parallel"",""parallel""]} ins(%2, %3 : tensor, tensor) outs (%4:tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %6 = arith.divf %cst1, %cst2 : f32 linalg.yield %6 : f32 } -> tensor return %5 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map = affine_map<(d0) -> (d0)> func.func @basic(%arg0: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = [""parallel""]} ins(%arg0, %arg0 : tensor, tensor) outs(%arg0 : tensor) attrs = {someattr} { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %1 = arith.addf %arg1, %arg2 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map = affine_map<(d0) -> (d0)> func.func @basic(%arg0: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = [""parallel""]} ins(%arg0, %arg0 : tensor, tensor) outs(%arg0 : tensor) attrs = {someattr} { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %1 = arith.addf %arg1, %arg2 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @distinct_affine_maps(%arg0: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg0 : tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %1 = arith.addf %arg1, %arg2 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @distinct_affine_maps(%arg0: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg0 : tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %1 = arith.addf %arg1, %arg2 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @mixed_redundant_non_redundant(%arg0: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map0, #map1, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg0, %arg0 : tensor, tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32, %arg4: f32): %1 = ""test.elementwise_mappable""(%arg1, %arg2, %arg3) : (f32, f32, f32) -> f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> func.func @mixed_redundant_non_redundant(%arg0: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map0, #map1, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg0, %arg0 : tensor, tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32, %arg4: f32): %1 = ""test.elementwise_mappable""(%arg1, %arg2, %arg3) : (f32, f32, f32) -> f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map = affine_map<(d0) -> (d0)> func.func @multiple_different_redundant_args(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map, #map, #map], iterator_types = [""parallel""]} ins(%arg0, %arg1, %arg0, %arg1 : tensor, tensor, tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg2: f32, %arg3: f32, %arg4: f32, %arg5: f32, %arg6: f32): %1 = ""test.elementwise_mappable""(%arg2, %arg3, %arg4, %arg5) : (f32, f32, f32, f32) -> f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map = affine_map<(d0) -> (d0)> func.func @multiple_different_redundant_args(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map, #map, #map], iterator_types = [""parallel""]} ins(%arg0, %arg1, %arg0, %arg1 : tensor, tensor, tensor, tensor) outs(%arg0 : tensor) { ^bb0(%arg2: f32, %arg3: f32, %arg4: f32, %arg5: f32, %arg6: f32): %1 = ""test.elementwise_mappable""(%arg2, %arg3, %arg4, %arg5) : (f32, f32, f32, f32) -> f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #map4 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @drop_dead_results(%arg0 : tensor) -> (tensor, tensor) { %0:4 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3, #map4], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0, %arg0, %arg0 : tensor, tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : %1 = arith.addf %b0, %b0: f32 linalg.yield %1, %1, %1, %1 : f32, f32, f32, f32 } -> (tensor, tensor, tensor, tensor) return %0#0, %0#2 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #map4 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @drop_dead_results(%arg0 : tensor) -> (tensor, tensor) { %0:4 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3, #map4], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0, %arg0, %arg0 : tensor, tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : %1 = arith.addf %b0, %b0: f32 linalg.yield %1, %1, %1, %1 : f32, f32, f32, f32 } -> (tensor, tensor, tensor, tensor) return %0#0, %0#2 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0) -> (d0)> #map1 = affine_map<(d0) -> ()> func.func @argmax_lowering(%arg0 : tensor) -> tensor { %init0 = tensor.empty() : tensor %init1 = tensor.empty() : tensor %0:2 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""reduction""]} ins(%arg0 : tensor) outs(%init0, %init1 : tensor, tensor) { ^bb0(%b0: f32, %b1: f32, %b2: i32): %8 = linalg.index 0 : index %9 = arith.index_cast %8 : index to i32 %10 = arith.cmpf oge, %b0, %b1 : f32 %11 = arith.select %10, %b0, %b1 : f32 %12 = arith.cmpf oeq, %b0, %b1 : f32 %13 = arith.minsi %9, %b2 : i32 %14 = arith.select %10, %9, %b2 : i32 %15 = arith.select %12, %13, %14 : i32 linalg.yield %11, %15 : f32, i32 } -> (tensor, tensor) return %0#1 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0) -> (d0)> #map1 = affine_map<(d0) -> ()> func.func @argmax_lowering(%arg0 : tensor) -> tensor { %init0 = tensor.empty() : tensor %init1 = tensor.empty() : tensor %0:2 = linalg.generic { indexing_maps = [#map0, #map1, #map1], iterator_types = [""reduction""]} ins(%arg0 : tensor) outs(%init0, %init1 : tensor, tensor) { ^bb0(%b0: f32, %b1: f32, %b2: i32): %8 = linalg.index 0 : index %9 = arith.index_cast %8 : index to i32 %10 = arith.cmpf oge, %b0, %b1 : f32 %11 = arith.select %10, %b0, %b1 : f32 %12 = arith.cmpf oeq, %b0, %b1 : f32 %13 = arith.minsi %9, %b2 : i32 %14 = arith.select %10, %9, %b2 : i32 %15 = arith.select %12, %13, %14 : i32 linalg.yield %11, %15 : f32, i32 } -> (tensor, tensor) return %0#1 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "func.func @loop_dim_operand(%arg0 : tensor) -> tensor { %cst = arith.constant 0 : i32 %init = tensor.empty() : tensor %fill = linalg.fill ins(%cst : i32) outs(%init : tensor) -> tensor %0 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0 : tensor) outs(%fill : tensor) { ^bb0(%b0: f32, %b1: i32): %1 = linalg.index 0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %b1, %2 : i32 linalg.yield %3 : i32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "func.func @loop_dim_operand(%arg0 : tensor) -> tensor { %cst = arith.constant 0 : i32 %init = tensor.empty() : tensor %fill = linalg.fill ins(%cst : i32) outs(%init : tensor) -> tensor %0 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0 : tensor) outs(%fill : tensor) { ^bb0(%b0: f32, %b1: i32): %1 = linalg.index 0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %b1, %2 : i32 linalg.yield %3 : i32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "func.func @loop_dim_outs_operand(%arg0 : index) -> tensor { %cst = arith.constant 0 : i32 %init1 = tensor.empty(%arg0) : tensor %init = tensor.empty() : tensor %fill = linalg.fill ins(%cst : i32) outs(%init : tensor) -> tensor %0:2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""parallel""]} outs(%init1, %fill : tensor, tensor) { ^bb0(%b0: i32, %b1: i32): %1 = linalg.index 0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %b1, %2 : i32 linalg.yield %2, %3 : i32, i32 } -> (tensor, tensor) return %0#1 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "func.func @loop_dim_outs_operand(%arg0 : index) -> tensor { %cst = arith.constant 0 : i32 %init1 = tensor.empty(%arg0) : tensor %init = tensor.empty() : tensor %fill = linalg.fill ins(%cst : i32) outs(%init : tensor) -> tensor %0:2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>], iterator_types = [""parallel""]} outs(%init1, %fill : tensor, tensor) { ^bb0(%b0: i32, %b1: i32): %1 = linalg.index 0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %b1, %2 : i32 linalg.yield %2, %3 : i32, i32 } -> (tensor, tensor) return %0#1 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> #map2 = affine_map<(d0, d1) -> (d0)> #map3 = affine_map<(d0, d1) -> (d1)> func.func @multiple_redundant_args(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor, %arg4 : tensor) -> tensor { %0 = linalg.generic { indexing_maps = [#map3, #map0, #map0, #map2, #map1, #map1, #map2], iterator_types = [""parallel"", ""reduction""]} ins(%arg4, %arg0, %arg0, %arg1, %arg3, %arg3 : tensor, tensor, tensor, tensor, tensor, tensor) outs(%arg2 : tensor) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32, %b4 : i32, %b5 : i32, %b6 : i32): %1 = arith.addi %b0, %b1 : i32 %2 = arith.addi %1, %b2 : i32 %3 = arith.addi %2, %b3 : i32 %4 = arith.addi %3, %b4 : i32 %5 = arith.addi %4, %b5 : i32 %6 = arith.addi %5, %b6 : i32 linalg.yield %6 : i32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> #map1 = affine_map<(d0, d1) -> (d1, d0)> #map2 = affine_map<(d0, d1) -> (d0)> #map3 = affine_map<(d0, d1) -> (d1)> func.func @multiple_redundant_args(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor, %arg3 : tensor, %arg4 : tensor) -> tensor { %0 = linalg.generic { indexing_maps = [#map3, #map0, #map0, #map2, #map1, #map1, #map2], iterator_types = [""parallel"", ""reduction""]} ins(%arg4, %arg0, %arg0, %arg1, %arg3, %arg3 : tensor, tensor, tensor, tensor, tensor, tensor) outs(%arg2 : tensor) { ^bb0(%b0 : i32, %b1 : i32, %b2 : i32, %b3 : i32, %b4 : i32, %b5 : i32, %b6 : i32): %1 = arith.addi %b0, %b1 : i32 %2 = arith.addi %1, %b2 : i32 %3 = arith.addi %2, %b3 : i32 %4 = arith.addi %3, %b4 : i32 %5 = arith.addi %4, %b5 : i32 %6 = arith.addi %5, %b6 : i32 linalg.yield %6 : i32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @drop_redundant_results( %arg0 : tensor) -> (tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %1 = arith.addf %b0, %b0 : f32 linalg.yield %1, %1 : f32, f32 } -> (tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map = affine_map<(d0, d1) -> (d0, d1)> func.func @drop_redundant_results( %arg0 : tensor) -> (tensor, tensor) { %0:2 = linalg.generic { indexing_maps = [#map, #map, #map], iterator_types = [""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0 : tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %1 = arith.addf %b0, %b0 : f32 linalg.yield %1, %1 : f32, f32 } -> (tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #map4 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @drop_dead_results_with_different_tensors(%arg0 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:4 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3, #map4], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0, %init0, %init0 : tensor, tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : linalg.yield %b0, %b0, %b3, %b4 : f32, f32, f32, f32 } -> (tensor, tensor, tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #map4 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @drop_dead_results_with_different_tensors(%arg0 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:4 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3, #map4], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0, %init0, %init0 : tensor, tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : linalg.yield %b0, %b0, %b3, %b4 : f32, f32, f32, f32 } -> (tensor, tensor, tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #map4 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @drop_dead_results_with_unused_cycles(%arg0 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:4 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3, #map4], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0, %init0, %init0 : tensor, tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : %1 = arith.addf %b0, %b0: f32 %2 = arith.addf %b0, %b3: f32 %3 = arith.addf %b0, %b4: f32 linalg.yield %1, %1, %2, %3 : f32, f32, f32, f32 } -> (tensor, tensor, tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #map4 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @drop_dead_results_with_unused_cycles(%arg0 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:4 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3, #map4], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %arg0, %init0, %init0 : tensor, tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32, %b4 : f32) : %1 = arith.addf %b0, %b0: f32 %2 = arith.addf %b0, %b3: f32 %3 = arith.addf %b0, %b4: f32 linalg.yield %1, %1, %2, %3 : f32, f32, f32, f32 } -> (tensor, tensor, tensor, tensor) return %0#0, %0#1 : tensor, tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> func.func @drop_only_the_results_not_used_by_others(%arg0 : tensor) -> (tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:3 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %init0, %init0 : tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32) : linalg.yield %b2, %b1, %b3 : f32, f32, f32 } -> (tensor, tensor, tensor) return %0#0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> func.func @drop_only_the_results_not_used_by_others(%arg0 : tensor) -> (tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:3 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %init0, %init0 : tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32) : linalg.yield %b2, %b1, %b3 : f32, f32, f32 } -> (tensor, tensor, tensor) return %0#0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> func.func @drop_only_the_cycles_not_used_by_others(%arg0 : tensor) -> (tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:3 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %init0, %init0 : tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32) : %1 = arith.addf %b1, %b2: f32 %2 = arith.addf %b1, %b3 : f32 linalg.yield %1, %b1, %2 : f32, f32, f32 } -> (tensor, tensor, tensor) return %0#0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2, d0)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> func.func @drop_only_the_cycles_not_used_by_others(%arg0 : tensor) -> (tensor) { %c0 = arith.constant 0 : index %d0 = tensor.dim %arg0, %c0 : tensor %c1 = arith.constant 1 : index %d1 = tensor.dim %arg0, %c1 : tensor %c2 = arith.constant 2 : index %d2 = tensor.dim %arg0, %c2 : tensor %init0 = tensor.empty(%d0, %d1, %d2) : tensor %0:3 = linalg.generic { indexing_maps = [#map0, #map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor) outs(%arg0, %init0, %init0 : tensor, tensor, tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32, %b3 : f32) : %1 = arith.addf %b1, %b2: f32 %2 = arith.addf %b1, %b3 : f32 linalg.yield %1, %b1, %2 : f32, f32, f32 } -> (tensor, tensor, tensor) return %0#0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "#map = affine_map<(d0) -> (d0)> func.func @remove_unnecessary_input(%a: tensor, %b: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = [""parallel""]} ins(%a, %b : tensor, tensor) outs(%b : tensor) { ^bb0(%in: f32, %in_2: f32, %out: f32): %16 = arith.addf %in, %in_2 : f32 linalg.yield %16 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unused-operands-and-results ,1 "#map = affine_map<(d0) -> (d0)> func.func @remove_unnecessary_input(%a: tensor, %b: tensor) -> tensor { %0 = linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = [""parallel""]} ins(%a, %b : tensor, tensor) outs(%b : tensor) { ^bb0(%in: f32, %in_2: f32, %out: f32): %16 = arith.addf %in, %in_2 : f32 linalg.yield %16 : f32 } -> tensor return %0 : tensor }", mlir-opt -split-input-file -test-linalg-transform-patterns=test-erase-unnecessary-inputs ,1 "func.func @addf_rank0(%arg0: tensor, %arg1: tensor) -> tensor { %0 = arith.addf %arg0, %arg1 : tensor return %0 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-elementwise-to-linalg))"" -split-input-file ",1 "func.func @addf_rank1(%arg0: tensor, %arg1: tensor) -> tensor { %0 = arith.addf %arg0, %arg1 : tensor return %0 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-elementwise-to-linalg))"" -split-input-file ",1 "func.func @exp(%arg0: tensor) -> tensor { %0 = math.exp %arg0 : tensor return %0 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-elementwise-to-linalg))"" -split-input-file ",1 "func.func @select(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = arith.select %arg0, %arg1, %arg2 : tensor, tensor return %0 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-elementwise-to-linalg))"" -split-input-file ",1 "func.func @cmpf(%arg0: tensor, %arg1: tensor) -> tensor { %0 = arith.cmpf olt, %arg0, %arg1 : tensor return %0 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-elementwise-to-linalg))"" -split-input-file ",1 "func.func @cmpf(%arg0: tensor<4x?x?x8x2x?xf32>, %arg1: tensor<4x?x?x8x2x?xf32>) -> tensor<4x?x?x8x2x?xi1> { %0 = arith.cmpf olt, %arg0, %arg1 : tensor<4x?x?x8x2x?xf32> return %0 : tensor<4x?x?x8x2x?xi1> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-elementwise-to-linalg))"" -split-input-file ",1 "func.func @matmul(%arg0: memref, %M: index, %N: index, %K: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %A = memref.view %arg0[%c0][%M, %K] : memref to memref %B = memref.view %arg0[%c0][%K, %N] : memref to memref %C = memref.view %arg0[%c0][%M, %N] : memref to memref linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) return } func.func @named_batch_matmul(%A: memref, %B: memref, %C: memref) { linalg.batch_matmul ins(%A, %B: memref, memref) outs(%C : memref) return }", mlir-opt -convert-linalg-to-affine-loops ,1 "func.func @matmul(%arg0: memref, %M: index, %N: index, %K: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %A = memref.view %arg0[%c0][%M, %K] : memref to memref %B = memref.view %arg0[%c0][%K, %N] : memref to memref %C = memref.view %arg0[%c0][%M, %N] : memref to memref linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) return } func.func @matvec(%arg0: memref, %M: index, %N: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = memref.view %arg0[%c0][%M, %N] : memref to memref %3 = memref.view %arg0[%c0][%M] : memref to memref %4 = memref.view %arg0[%c0][%N] : memref to memref linalg.matvec ins(%2, %3: memref, memref) outs(%4 : memref) return } func.func @dot(%arg0: memref, %M: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %1 = memref.view %arg0[%c0][%M] : memref to memref %2 = memref.view %arg0[%c0][%M] : memref to memref %3 = memref.view %arg0[%c0][] : memref to memref linalg.dot ins(%1, %2 : memref, memref) outs(%3 : memref) return } func.func @dot_int(%arg0: memref, %arg1: memref, %arg3: memref) { linalg.dot ins(%arg0, %arg1 : memref, memref) outs(%arg3 : memref) return } func.func @dot_bool(%arg0: memref, %arg1: memref, %arg3: memref) { linalg.dot ins(%arg0, %arg1 : memref, memref) outs(%arg3 : memref) return } func.func @dot_view(%arg0: memref>, %arg1: memref>, %arg2: memref) { linalg.dot ins(%arg0, %arg1 : memref>, memref>) outs(%arg2: memref) return } func.func @fill_view(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return } func.func @fill_view0(%arg0: memref, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref) return } func.func @fill_view3(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return } func.func @copy_view(%arg0: memref>, %arg1: memref>) { linalg.generic { iterator_types = [""parallel""], indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>] } ins(%arg0: memref>) outs(%arg1: memref>) { ^bb0(%a: f32, %b: f32): linalg.yield %a : f32 } return } #accesses = [ affine_map<(i, j, k) -> (i, j)>, affine_map<(i, j, k) -> (i, j, k)>, affine_map<(i, j, k) -> (i, k, j)> ] #trait2 = { args_in = 1, args_out = 2, iterator_types = [""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_function_name_2"", doc = ""B(i,j,k), C(i,k,j) = foo(A(i, j), B(i,j,k), C(i,k,j))"" } func.func @generic_region(%arg0: memref>, %arg1: memref>, %arg2: memref>) { linalg.generic #trait2 ins(%arg0: memref>) outs(%arg1, %arg2 : memref>, memref>) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %d, %e : f32, f32 } return } #trait4 = { args_in = 1, args_out = 2, iterator_types = [""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_function_name_2"", doc = ""B(i,j,k), C(i,k,j) = foo(A(i, j) * B(i,j,k), i * j * k + C(i,k,j))"" } func.func @generic_index_region( %arg0: memref>, %arg1: memref>, %arg2: memref>) { linalg.generic #trait4 ins(%arg0 : memref>) outs(%arg1, %arg2 : memref>, memref>) { ^bb0(%a: f32, %b: f32, %c: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %k = linalg.index 2 : index %result_1 = arith.mulf %a, %b : f32 %ij = arith.addi %i, %j : index %ijk = arith.addi %ij, %k : index %ijk_int = arith.index_cast %ijk : index to i32 %ijk_float = arith.sitofp %ijk_int : i32 to f32 %result_2 = arith.addf %c, %ijk_float : f32 linalg.yield %result_1, %result_2 : f32, f32 } return }", mlir-opt -convert-linalg-to-loops ,1 "func.func @matmul(%arg0: memref, %M: index, %N: index, %K: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %A = memref.view %arg0[%c0][%M, %K] : memref to memref %B = memref.view %arg0[%c0][%K, %N] : memref to memref %C = memref.view %arg0[%c0][%M, %N] : memref to memref linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) return } func.func @matvec(%arg0: memref, %M: index, %N: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %2 = memref.view %arg0[%c0][%M, %N] : memref to memref %3 = memref.view %arg0[%c0][%M] : memref to memref %4 = memref.view %arg0[%c0][%N] : memref to memref linalg.matvec ins(%2, %3: memref, memref) outs(%4 : memref) return } func.func @dot(%arg0: memref, %M: index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %1 = memref.view %arg0[%c0][%M] : memref to memref %2 = memref.view %arg0[%c0][%M] : memref to memref %3 = memref.view %arg0[%c0][] : memref to memref linalg.dot ins(%1, %2 : memref, memref) outs(%3 : memref) return } func.func @dot_int(%arg0: memref, %arg1: memref, %arg3: memref) { linalg.dot ins(%arg0, %arg1 : memref, memref) outs(%arg3 : memref) return } func.func @dot_bool(%arg0: memref, %arg1: memref, %arg3: memref) { linalg.dot ins(%arg0, %arg1 : memref, memref) outs(%arg3 : memref) return } func.func @dot_view(%arg0: memref>, %arg1: memref>, %arg2: memref) { linalg.dot ins(%arg0, %arg1 : memref>, memref>) outs(%arg2: memref) return } func.func @fill_view(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return } func.func @fill_view0(%arg0: memref, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref) return } func.func @fill_view3(%arg0: memref>, %arg1: f32) { linalg.fill ins(%arg1 : f32) outs(%arg0 : memref>) return } func.func @copy_view(%arg0: memref>, %arg1: memref>) { linalg.generic { iterator_types = [""parallel""], indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>] } ins(%arg0: memref>) outs(%arg1: memref>) { ^bb0(%a: f32, %b: f32): linalg.yield %a : f32 } return } #accesses = [ affine_map<(i, j, k) -> (i, j)>, affine_map<(i, j, k) -> (i, j, k)>, affine_map<(i, j, k) -> (i, k, j)> ] #trait2 = { args_in = 1, args_out = 2, iterator_types = [""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_function_name_2"", doc = ""B(i,j,k), C(i,k,j) = foo(A(i, j), B(i,j,k), C(i,k,j))"" } func.func @generic_region(%arg0: memref>, %arg1: memref>, %arg2: memref>) { linalg.generic #trait2 ins(%arg0: memref>) outs(%arg1, %arg2 : memref>, memref>) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %d, %e : f32, f32 } return } #trait4 = { args_in = 1, args_out = 2, iterator_types = [""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_function_name_2"", doc = ""B(i,j,k), C(i,k,j) = foo(A(i, j) * B(i,j,k), i * j * k + C(i,k,j))"" } func.func @generic_index_region( %arg0: memref>, %arg1: memref>, %arg2: memref>) { linalg.generic #trait4 ins(%arg0 : memref>) outs(%arg1, %arg2 : memref>, memref>) { ^bb0(%a: f32, %b: f32, %c: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %k = linalg.index 2 : index %result_1 = arith.mulf %a, %b : f32 %ij = arith.addi %i, %j : index %ijk = arith.addi %ij, %k : index %ijk_int = arith.index_cast %ijk : index to i32 %ijk_float = arith.sitofp %ijk_int : i32 to f32 %result_2 = arith.addf %c, %ijk_float : f32 linalg.yield %result_1, %result_2 : f32, f32 } return }", mlir-opt -convert-linalg-to-parallel-loops ,1 "#broadcast_access = [ affine_map<(i, j) -> ()>, affine_map<(i, j) -> (i, j)> ] #trait_broadcast = { args_in = 1, args_out = 1, indexing_maps = #broadcast_access, iterator_types = [""parallel"", ""parallel""], library_call = ""some_broadcast_external_fn"" } func.func @generic_op_zero_rank(%arg0: memref, %arg1: memref<3x4xf32>) { linalg.generic #trait_broadcast ins(%arg0 : memref) outs(%arg1 : memref<3x4xf32>) { ^bb(%a: f32, %b: f32) : linalg.yield %a : f32 } return } func.func @generic_op_scalar(%arg0: f32, %arg1: memref<3x4xf32>) { linalg.generic #trait_broadcast ins(%arg0 : f32) outs(%arg1 : memref<3x4xf32>) { ^bb(%a: f32, %b: f32) : linalg.yield %a : f32 } return } func.func @generic_index_op_zero_rank(%arg0: memref, %arg1: memref<3x4xi32>) { linalg.generic #trait_broadcast ins(%arg0 : memref) outs(%arg1 : memref<3x4xi32>) { ^bb(%a: i32, %b: i32) : %i = linalg.index 0 : index %j = linalg.index 1 : index %ij = arith.addi %i, %j : index %ij_int = arith.index_cast %ij : index to i32 %result = arith.addi %a, %ij_int : i32 linalg.yield %result : i32 } return } #reduce_1D_access = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()> ] #trait_reduce_1D = { args_in = 1, args_out = 1, indexing_maps = #reduce_1D_access, iterator_types = [""reduction""], library_call = ""some_reduce_external_fn"" } func.func @generic_op_1D_reduce(%arg0: memref, %arg1: memref) { linalg.generic #trait_reduce_1D ins(%arg0 : memref) outs(%arg1 : memref) { ^bb(%a: f32, %b: f32) : %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } return } #reduce_init_1D_access = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()>, affine_map<(i) -> ()> ] #trait_reduce_init_1D = { args_in = 2, args_out = 1, indexing_maps = #reduce_init_1D_access, iterator_types = [""reduction""], library_call = ""some_reduce_external_fn"" } func.func @generic_index_op_1D_reduce(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.generic #trait_reduce_init_1D ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) { ^bb(%a: f32, %b: f32, %c: f32) : %i = linalg.index 0 : index %0 = arith.constant 0 : index %1 = arith.cmpi eq, %0, %i : index %2 = arith.select %1, %b, %c : f32 %3 = arith.addf %a, %2 : f32 linalg.yield %3 : f32 } return } #trait_const_fill = { args_in = 0, args_out = 1, indexing_maps = [affine_map<(i) -> (i)>], iterator_types = [""parallel""], library_call = ""some_external_fn"" } func.func @generic_const_init(%arg0: memref) { %cst = arith.constant 1.0 : f32 linalg.generic #trait_const_fill outs(%arg0 : memref) { ^bb0(%arg1: f32): linalg.yield %cst : f32 } return } #scalar_access = [ affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()> ] #scalar_trait = { args_in = 2, args_out = 1, iterator_types = [], indexing_maps = #scalar_access, library_call = ""some_external_fn"" } func.func @scalar_code(%arg0: memref, %arg1 : memref, %arg2 : memref, %arg3 : i1) { linalg.generic #scalar_trait ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) { ^bb(%a : f32, %b : f32, %c : f32) : %result = scf.if %arg3 -> (f32) { scf.yield %a : f32 } else { scf.yield %b : f32 } linalg.yield %result : f32 } return } func.func @named_batch_matmul(%A: memref, %B: memref, %C: memref) { linalg.batch_matmul ins(%A, %B : memref, memref) outs(%C : memref) return } func.func @conv1d_no_symbols(%in : memref, %filter : memref, %out : memref) -> () { linalg.conv_1d ins(%in, %filter : memref, memref) outs(%out : memref) return } func.func @conv2d_no_symbols(%in : memref, %filter : memref, %out : memref) -> () { linalg.conv_2d ins(%in, %filter : memref, memref) outs(%out: memref) return } func.func @conv3d_no_symbols(%in : memref, %filter : memref, %out : memref) -> () { linalg.conv_3d ins(%in, %filter : memref, memref) outs(%out : memref) return }", mlir-opt -convert-linalg-to-loops ,1 "#broadcast_access = [ affine_map<(i, j) -> ()>, affine_map<(i, j) -> (i, j)> ] #trait_broadcast = { args_in = 1, args_out = 1, indexing_maps = #broadcast_access, iterator_types = [""parallel"", ""parallel""], library_call = ""some_broadcast_external_fn"" } func.func @generic_op_zero_rank(%arg0: memref, %arg1: memref<3x4xf32>) { linalg.generic #trait_broadcast ins(%arg0 : memref) outs(%arg1 : memref<3x4xf32>) { ^bb(%a: f32, %b: f32) : linalg.yield %a : f32 } return } func.func @generic_op_scalar(%arg0: f32, %arg1: memref<3x4xf32>) { linalg.generic #trait_broadcast ins(%arg0 : f32) outs(%arg1 : memref<3x4xf32>) { ^bb(%a: f32, %b: f32) : linalg.yield %a : f32 } return } func.func @generic_index_op_zero_rank(%arg0: memref, %arg1: memref<3x4xi32>) { linalg.generic #trait_broadcast ins(%arg0 : memref) outs(%arg1 : memref<3x4xi32>) { ^bb(%a: i32, %b: i32) : %i = linalg.index 0 : index %j = linalg.index 1 : index %ij = arith.addi %i, %j : index %ij_int = arith.index_cast %ij : index to i32 %result = arith.addi %a, %ij_int : i32 linalg.yield %result : i32 } return } #reduce_1D_access = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()> ] #trait_reduce_1D = { args_in = 1, args_out = 1, indexing_maps = #reduce_1D_access, iterator_types = [""reduction""], library_call = ""some_reduce_external_fn"" } func.func @generic_op_1D_reduce(%arg0: memref, %arg1: memref) { linalg.generic #trait_reduce_1D ins(%arg0 : memref) outs(%arg1 : memref) { ^bb(%a: f32, %b: f32) : %0 = arith.addf %a, %b : f32 linalg.yield %0 : f32 } return } #reduce_init_1D_access = [ affine_map<(i) -> (i)>, affine_map<(i) -> ()>, affine_map<(i) -> ()> ] #trait_reduce_init_1D = { args_in = 2, args_out = 1, indexing_maps = #reduce_init_1D_access, iterator_types = [""reduction""], library_call = ""some_reduce_external_fn"" } func.func @generic_index_op_1D_reduce(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.generic #trait_reduce_init_1D ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) { ^bb(%a: f32, %b: f32, %c: f32) : %i = linalg.index 0 : index %0 = arith.constant 0 : index %1 = arith.cmpi eq, %0, %i : index %2 = arith.select %1, %b, %c : f32 %3 = arith.addf %a, %2 : f32 linalg.yield %3 : f32 } return } #trait_const_fill = { args_in = 0, args_out = 1, indexing_maps = [affine_map<(i) -> (i)>], iterator_types = [""parallel""], library_call = ""some_external_fn"" } func.func @generic_const_init(%arg0: memref) { %cst = arith.constant 1.0 : f32 linalg.generic #trait_const_fill outs(%arg0 : memref) { ^bb0(%arg1: f32): linalg.yield %cst : f32 } return } #scalar_access = [ affine_map<() -> ()>, affine_map<() -> ()>, affine_map<() -> ()> ] #scalar_trait = { args_in = 2, args_out = 1, iterator_types = [], indexing_maps = #scalar_access, library_call = ""some_external_fn"" } func.func @scalar_code(%arg0: memref, %arg1 : memref, %arg2 : memref, %arg3 : i1) { linalg.generic #scalar_trait ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) { ^bb(%a : f32, %b : f32, %c : f32) : %result = scf.if %arg3 -> (f32) { scf.yield %a : f32 } else { scf.yield %b : f32 } linalg.yield %result : f32 } return } func.func @named_batch_matmul(%A: memref, %B: memref, %C: memref) { linalg.batch_matmul ins(%A, %B : memref, memref) outs(%C : memref) return } func.func @conv1d_no_symbols(%in : memref, %filter : memref, %out : memref) -> () { linalg.conv_1d ins(%in, %filter : memref, memref) outs(%out : memref) return } func.func @conv2d_no_symbols(%in : memref, %filter : memref, %out : memref) -> () { linalg.conv_2d ins(%in, %filter : memref, memref) outs(%out: memref) return } func.func @conv3d_no_symbols(%in : memref, %filter : memref, %out : memref) -> () { linalg.conv_3d ins(%in, %filter : memref, memref) outs(%out : memref) return }", mlir-opt -convert-linalg-to-parallel-loops ,1 "func.func @lower_to_loops_with_rank_reducing_subviews( %arg0 : memref, %arg1 : memref, %arg2 : index, %arg3 : index, %arg4 : index) { %0 = memref.subview %arg0[%arg2] [%arg3] [1] : memref to memref> %1 = memref.subview %arg1[0, %arg4] [1, %arg3] [1, 1] : memref to memref> linalg.generic { iterator_types = [""parallel""], indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>]} ins(%0: memref>) outs(%1: memref>) { ^bb0(%a: i32, %b: i32): linalg.yield %a : i32 } return }", mlir-opt -convert-linalg-to-loops ,1 "func.func @lower_to_loops_with_rank_reducing_subviews( %arg0 : memref, %arg1 : memref, %arg2 : index, %arg3 : index, %arg4 : index) { %0 = memref.subview %arg0[%arg2] [%arg3] [1] : memref to memref> %1 = memref.subview %arg1[0, %arg4] [1, %arg3] [1, 1] : memref to memref> linalg.generic { iterator_types = [""parallel""], indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>]} ins(%0: memref>) outs(%1: memref>) { ^bb0(%a: i32, %b: i32): linalg.yield %a : i32 } return }", mlir-opt -convert-linalg-to-parallel-loops ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.multitile_sizes %0 { target_size = 3, dimension = 0 } : (!transform.any_op) -> !transform.any_op } func.func @multitile_sizes_static( %arg0: tensor<13x34xf32>, %arg1: tensor<34x42xf32>, %arg2: tensor<13x42xf32>) -> tensor<13x42xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<13x34xf32>, tensor<34x42xf32>) outs(%arg2: tensor<13x42xf32>) -> tensor<13x42xf32> return %0 : tensor<13x42xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %low_tile, %high_tile, %split_point = transform.structured.multitile_sizes %0 { target_size = 3, dimension = 0 } : (!transform.any_op) -> !transform.param transform.test_print_param %low_tile : !transform.param transform.test_print_param %high_tile : !transform.param transform.test_print_param %split_point : !transform.param } func.func @multitile_sizes_static_gen( %arg0: tensor<13x34xf32>, %arg1: tensor<34x42xf32>, %arg2: tensor<13x42xf32>) -> tensor<13x42xf32> { %0 = linalg.matmul ins(%arg0, %arg1: tensor<13x34xf32>, tensor<34x42xf32>) outs(%arg2: tensor<13x42xf32>) -> tensor<13x42xf32> return %0 : tensor<13x42xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.multitile_sizes %0 { target_size = 3, divisor = 2, dimension = 0 } : (!transform.any_op) -> !transform.any_op } func.func @multitile_sizes_dynamic( %arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.matmul ins(%arg0, %arg1: tensor, tensor) outs(%arg2: tensor) -> tensor return %0 : tensor }", mlir-opt --test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.multitile_sizes %0 { target_size = 3, divisor = 2, dimension = 0 } : (!transform.any_op) -> !transform.param } func.func @multitile_sizes_dynamic_gen( %arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.matmul ins(%arg0, %arg1: tensor, tensor) outs(%arg2: tensor) -> tensor return %0 : tensor }", mlir-opt --test-transform-dialect-interpreter --split-input-file --verify-diagnostics ,1 "func.func @KCRS_to_KCRSsr(%arg0: tensor<1x1x128x64xf32>, %arg1: tensor<1x1x4x8x8x32xf32>) -> tensor<1x1x4x8x8x32xf32> { %0 = tensor.pack %arg0 inner_dims_pos = [3, 2] inner_tiles = [8, 32] into %arg1 : tensor<1x1x128x64xf32> -> tensor<1x1x4x8x8x32xf32> return %0 : tensor<1x1x4x8x8x32xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:4 = transform.structured.tile_to_scf_for %0 [1, 1, 1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }"," mlir-opt -split-input-file --test-transform-dialect-interpreter --canonicalize --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @pad_and_pack(%arg0: tensor<13x15xf32>, %arg1: tensor<2x8x8x2xf32>, %arg2: f32) -> tensor<2x8x8x2xf32> { %0 = tensor.pack %arg0 padding_value(%arg2 : f32) inner_dims_pos = [0, 1] inner_tiles = [8, 2] into %arg1 : tensor<13x15xf32> -> tensor<2x8x8x2xf32> return %0 : tensor<2x8x8x2xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }"," mlir-opt -split-input-file --test-transform-dialect-interpreter --canonicalize --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "func.func @KC_to_CKkc(%arg0: tensor<128x256xf32>, %arg1: tensor<32x4x32x8xf32>) -> tensor<32x4x32x8xf32> { %0 = tensor.pack %arg0 outer_dims_perm = [1, 0] inner_dims_pos = [0, 1] inner_tiles = [32, 8] into %arg1 : tensor<128x256xf32> -> tensor<32x4x32x8xf32> return %0 : tensor<32x4x32x8xf32> } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pack""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile_to_scf_for %0 [1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) }"," mlir-opt -split-input-file --test-transform-dialect-interpreter --canonicalize --test-linalg-transform-patterns=""test-generalize-tensor-pack"" ",1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> module { func.func @fuse_tileable_op(%arg0: index, %arg1: tensor, %arg2: tensor) -> tensor { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0 = linalg.fill ins(%cst : f32) outs(%arg1 : tensor) -> tensor %d0 = tensor.dim %arg1, %c0 : tensor %1 = affine.apply #map0()[%d0, %arg0] %2 = scf.forall (%arg3) in (%1) shared_outs(%o = %arg2) -> (tensor) { %3 = affine.apply #map1(%arg3)[%arg0] %4 = affine.min #map2(%arg3)[%d0, %arg0] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor to tensor %6 = tensor.extract_slice %0[%3] [%4] [1] : tensor to tensor %7 = linalg.elemwise_unary ins(%6 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor } } func.return %2 : tensor } func.func @dummy1() { return } func.func @dummy2() { return } func.func @dummy3() { return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.fill""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.fill"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0] -> (64 ceildiv s0)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0] -> (-(d0 * s0) + 64, s0)> module { func.func @fuse_untileable_op(%arg0: index, %arg1: tensor<64xf32>, %arg2: tensor<64xf32>) -> tensor<64xf32> { %0 = tensor.empty(%arg0) : tensor %1 = affine.apply #map0()[%arg0] %2 = scf.forall (%arg3) in (%1) shared_outs(%o = %arg2) -> (tensor<64xf32>) { %3 = affine.apply #map1(%arg3)[%arg0] %4 = affine.min #map2(%arg3)[%arg0] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor<64xf32> to tensor %7 = linalg.elemwise_unary ins(%0 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor<64xf32> } } func.return %2 : tensor<64xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.empty""]} in %arg1 : (!transform.any_op) -> !transform.op<""tensor.empty""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""tensor.empty"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "module { func.func @foo(%0: tensor) -> tensor { return %0: tensor } func.func @fuse_tileable_op_rank_reducing(%arg0: index, %arg1: tensor, %arg2: tensor) -> tensor { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0 = linalg.fill ins(%cst : f32) outs(%arg2 : tensor) -> tensor %d0 = tensor.dim %arg1, %c0 : tensor %2 = scf.forall (%arg3) in (%d0) shared_outs(%o = %0) -> (tensor) { %5 = tensor.extract_slice %o[%arg3] [1] [1] : tensor to tensor %7 = func.call @foo(%5) : (tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%arg3] [1] [1] : tensor into tensor } } func.return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.fill""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.fill"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> module { func.func @fuse_tileable_op_through_bbarg(%arg0: index, %arg1: tensor, %arg2: tensor) -> tensor { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0 = linalg.fill ins(%cst : f32) outs(%arg2 : tensor) -> tensor %d0 = tensor.dim %arg1, %c0 : tensor %1 = affine.apply #map0()[%d0, %arg0] %2 = scf.forall (%arg3) in (%1) shared_outs(%o = %0) -> (tensor) { %3 = affine.apply #map1(%arg3)[%arg0] %4 = affine.min #map2(%arg3)[%d0, %arg0] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor to tensor %6 = tensor.extract_slice %arg1[%3] [%4] [1] : tensor to tensor %7 = linalg.elemwise_unary ins(%6 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor } } func.return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.fuse_into_containing_op %0 into %1 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> module { func.func @fuse_tileable_multi_output_op(%idx: index, %in: tensor, %out_1: tensor, %out_2: tensor, %out_3: tensor) -> tensor { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0:2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%in : tensor) outs(%out_1, %out_3 : tensor, tensor) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.addf %a, %b : f32 %e = arith.addf %d, %c : f32 linalg.yield %d, %e : f32, f32 } -> (tensor, tensor) %d0 = tensor.dim %out_1, %c0 : tensor %1 = affine.apply #map0()[%d0, %idx] %2 = scf.forall (%i) in (%1) shared_outs(%o = %out_2) -> (tensor) { %3 = affine.apply #map1(%i)[%idx] %4 = affine.min #map2(%i)[%d0, %idx] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor to tensor %6 = tensor.extract_slice %0#0[%3] [%4] [1] : tensor to tensor %7 = linalg.elemwise_unary ins(%6 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor } } func.return %2 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.generic""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "module { func.func @fuse_repeated(%fill: tensor<2xf32>, %output: tensor<2xf32>) -> tensor<2xf32> { %c0 = arith.constant 0.0 : f32 %0 = linalg.fill ins(%c0 : f32) outs(%fill : tensor<2xf32>) -> tensor<2xf32> %1 = scf.forall (%i) in (2) shared_outs(%arg1 = %output) -> (tensor<2xf32>) { %2 = tensor.extract_slice %0[%i][1][1] : tensor<2xf32> to tensor<1xf32> %3 = tensor.extract_slice %arg1[%i][1][1] : tensor<2xf32> to tensor<1xf32> %4 = linalg.elemwise_unary ins(%2 : tensor<1xf32>) outs(%3 : tensor<1xf32>) -> tensor<1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %4 into %arg1[%i][1][1] : tensor<1xf32> into tensor<2xf32> } } return %1 : tensor<2xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.fill""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.any_op %2 = transform.merge_handles %0, %0 : !transform.any_op transform.structured.fuse_into_containing_op %2 into %1 : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> module { func.func @fuse_tileable_multi_output_op_multi_use(%idx: index, %in: tensor, %out_1: tensor, %out_2: tensor, %out_3: tensor) -> (tensor, tensor, tensor) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0:2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%in : tensor) outs(%out_1, %out_3 : tensor, tensor) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.addf %a, %b : f32 %e = arith.addf %d, %c : f32 linalg.yield %d, %e : f32, f32 } -> (tensor, tensor) %d0 = tensor.dim %out_1, %c0 : tensor %1 = affine.apply #map0()[%d0, %idx] %2 = scf.forall (%i) in (%1) shared_outs(%o = %out_2) -> (tensor) { %3 = affine.apply #map1(%i)[%idx] %4 = affine.min #map2(%i)[%d0, %idx] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor to tensor %6 = tensor.extract_slice %0#0[%3] [%4] [1] : tensor to tensor %7 = linalg.elemwise_unary ins(%6 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor } } func.return %2, %0#0, %0#1 : tensor, tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.generic""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> module { func.func @fuse_tileable_mixed_dominating_uses(%idx: index, %in: tensor, %out_1: tensor, %out_2: tensor, %out_3: tensor) -> (tensor, tensor) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%in : tensor) outs(%out_1 : tensor) { ^bb0(%a: f32, %b: f32): %d = arith.addf %a, %b : f32 linalg.yield %d : f32 } -> tensor %d0 = tensor.dim %0, %c0 : tensor %1 = affine.apply #map0()[%d0, %idx] %2 = scf.forall (%i) in (%1) shared_outs(%o = %out_2) -> (tensor) { %3 = affine.apply #map1(%i)[%idx] %4 = affine.min #map2(%i)[%d0, %idx] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor to tensor %6 = tensor.extract_slice %0[%3] [%4] [1] : tensor to tensor %7 = linalg.elemwise_unary ins(%6 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor } } func.return %2, %0 : tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.generic""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> #map3 = affine_map<(d0, d1) -> (d0, d1)> #map4 = affine_map<(d0, d1) -> (d0)> module { func.func @fuse_tileable_reductions(%idx: index, %in: tensor, %out_1: tensor, %out_2: tensor, %out_3: tensor) -> (tensor, tensor) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0 = linalg.generic { indexing_maps = [#map3, #map4], iterator_types = [""parallel"", ""reduction""] } ins(%in : tensor) outs(%out_1 : tensor) { ^bb0(%a: f32, %b: f32): %d = arith.maxf %a, %b : f32 linalg.yield %d : f32 } -> tensor %d0 = tensor.dim %out_1, %c0 : tensor %1 = affine.apply #map0()[%d0, %idx] %2 = scf.forall (%i) in (%1) shared_outs(%o = %out_2) -> (tensor) { %3 = affine.apply #map1(%i)[%idx] %4 = affine.min #map2(%i)[%d0, %idx] %5 = tensor.extract_slice %o[%3] [%4] [1] : tensor to tensor %6 = tensor.extract_slice %0[%3] [%4] [1] : tensor to tensor %7 = linalg.elemwise_unary ins(%6 : tensor) outs(%5 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %7 into %o[%3] [%4] [1] : tensor into tensor } } func.return %2, %0 : tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.generic""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "#map0 = affine_map<()[s0, s1] -> (s0 ceildiv s1)> #map1 = affine_map<(d0)[s0] -> (d0 * s0)> #map2 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)> #map3 = affine_map<(d0) -> (d0)> module { func.func @fuse_tileable_using_new_handle(%idx: index, %in: tensor, %out_1: tensor, %out_2: tensor, %out_3: tensor) -> (tensor, tensor) { %cst = arith.constant 4.200000e+01 : f32 %c0 = arith.constant 0 : index %0 = linalg.generic { indexing_maps = [#map3, #map3], iterator_types = [""parallel""] } ins(%in : tensor) outs(%out_1 : tensor) { ^bb0(%a: f32, %b: f32): %d = arith.addf %a, %b : f32 linalg.yield %d : f32 } -> tensor %1 = linalg.generic { indexing_maps = [#map3, #map3], iterator_types = [""parallel""] } ins(%0 : tensor) outs(%out_1 : tensor) { ^bb0(%a: f32, %b: f32): %d = arith.mulf %a, %b : f32 linalg.yield %d : f32 } -> tensor %d0 = tensor.dim %out_1, %c0 : tensor %2 = affine.apply #map0()[%d0, %idx] %3 = scf.forall (%i) in (%2) shared_outs(%o = %out_2) -> (tensor) { %4 = affine.apply #map1(%i)[%idx] %5 = affine.min #map2(%i)[%d0, %idx] %6 = tensor.extract_slice %o[%4] [%5] [1] : tensor to tensor %7 = tensor.extract_slice %1[%4] [%5] [1] : tensor to tensor %8 = linalg.elemwise_unary ins(%7 : tensor) outs(%6 : tensor) -> tensor scf.forall.in_parallel { tensor.parallel_insert_slice %8 into %o[%2] [%5] [1] : tensor into tensor } } func.return %3, %1 : tensor, tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.generic""> %add, %reduce = transform.split_handle %0 : (!transform.op<""linalg.generic"">) -> (!transform.op<""linalg.generic"">, !transform.op<""linalg.generic"">) %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> %fused_ops, %new_forall = transform.structured.fuse_into_containing_op %reduce into %1 : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.op<""scf.forall"">) %fused_ops_2, %new_forall_2 = transform.structured.fuse_into_containing_op %add into %new_forall : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.op<""scf.forall"">) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "module { func.func @softmax_dispatch_0_generic_16x128x128_f32() -> tensor<16x128x128xf32> { %c0 = arith.constant 0 : index %cst = arith.constant dense<5.000000e+00> : tensor<16x128x128xf32> %cst_1 = arith.constant 5.000000e+00 : f32 %1 = tensor.empty() : tensor<16x128xf32> %2 = tensor.empty() : tensor<16x128x128xf32> %3 = linalg.fill ins(%cst_1 : f32) outs(%1 : tensor<16x128xf32>) -> tensor<16x128xf32> %4 = linalg.fill ins(%cst_1 : f32) outs(%1 : tensor<16x128xf32>) -> tensor<16x128xf32> %5 = linalg.generic {producer, indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%cst : tensor<16x128x128xf32>) outs(%4 : tensor<16x128xf32>) { ^bb0(%in: f32, %out: f32): %8 = arith.maxf %in, %out : f32 linalg.yield %8 : f32 } -> tensor<16x128xf32> %c16 = arith.constant 16 : index %c32 = arith.constant 32 : index %7 = scf.forall (%arg0, %arg1) in (16, 32) shared_outs(%arg2 = %2) -> (tensor<16x128x128xf32>) { %11 = affine.apply affine_map<(d0) -> (d0 * 4)>(%arg1) %extracted_slice = tensor.extract_slice %5[%arg0, %11] [1, 4] [1, 1] : tensor<16x128xf32> to tensor<1x4xf32> %extracted_slice_3 = tensor.extract_slice %2[%arg0, %11, 0] [1, 4, 128] [1, 1, 1] : tensor<16x128x128xf32> to tensor<1x4x128xf32> %extracted_slice_4 = tensor.extract_slice %3[%arg0, %11] [1, 4] [1, 1] : tensor<16x128xf32> to tensor<1x4xf32> %15:2 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%extracted_slice : tensor<1x4xf32>) outs(%extracted_slice_3, %extracted_slice_4 : tensor<1x4x128xf32>, tensor<1x4xf32>) { ^bb0(%in: f32, %out: f32, %out_9: f32): %22 = arith.subf %cst_1, %in : f32 %23 = math.exp %22 : f32 %24 = arith.addf %23, %out_9 : f32 linalg.yield %23, %24 : f32, f32 } -> (tensor<1x4x128xf32>, tensor<1x4xf32>) %extracted_slice_5 = tensor.extract_slice %5[%arg0, %11] [1, 4] [1, 1] : tensor<16x128xf32> to tensor<1x4xf32> %extracted_slice_6 = tensor.extract_slice %2[%arg0, %11, 0] [1, 4, 128] [1, 1, 1] : tensor<16x128x128xf32> to tensor<1x4x128xf32> %extracted_slice_7 = tensor.extract_slice %3[%arg0, %11] [1, 4] [1, 1] : tensor<16x128xf32> to tensor<1x4xf32> %19:2 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%extracted_slice_5 : tensor<1x4xf32>) outs(%extracted_slice_6, %extracted_slice_7 : tensor<1x4x128xf32>, tensor<1x4xf32>) { ^bb0(%in: f32, %out: f32, %out_9: f32): %22 = arith.subf %cst_1, %in : f32 %23 = math.exp %22 : f32 %24 = arith.addf %23, %out_9 : f32 linalg.yield %23, %24 : f32, f32 } -> (tensor<1x4x128xf32>, tensor<1x4xf32>) %extracted_slice_8 = tensor.extract_slice %arg2[%arg0, %11, 0] [1, 4, 128] [1, 1, 1] : tensor<16x128x128xf32> to tensor<1x4x128xf32> %20 = linalg.generic {indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%15#0, %19#1 : tensor<1x4x128xf32>, tensor<1x4xf32>) outs(%extracted_slice_8 : tensor<1x4x128xf32>) { ^bb0(%in: f32, %in_9: f32, %out: f32): %22 = arith.divf %in, %in_9 : f32 linalg.yield %22 : f32 } -> tensor<1x4x128xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %20 into %arg2[%arg0, %11, 0] [1, 4, 128] [1, 1, 1] : tensor<1x4x128xf32> into tensor<16x128x128xf32> } } return %7 : tensor<16x128x128xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match attributes{producer} in %arg1 : (!transform.any_op) -> !transform.op<""linalg.generic""> %1 = transform.structured.match ops{[""scf.forall""]} in %arg1 : (!transform.any_op) -> !transform.op<""scf.forall""> transform.structured.fuse_into_containing_op %0 into %1 : (!transform.op<""linalg.generic"">, !transform.op<""scf.forall"">) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter --split-input-file ,1 "func.func @matmul_split(%A : tensor<16x256xf32>, %B: tensor<256x32xf32>, %C: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.matmul ins(%A, %B: tensor<16x256xf32>, tensor<256x32xf32>) outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --split-input-file --test-transform-dialect-interpreter ,1 "func.func @generic_split_1d(%arg0: tensor<32xf32>, %arg1: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0, %arg1 : tensor<32xf32>, tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg8: f32, %arg9: f32): %40 = arith.subf %arg7, %arg8 : f32 %41 = math.exp %40 : f32 %42 = arith.mulf %41, %arg9 : f32 linalg.yield %42 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 0} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --split-input-file --test-transform-dialect-interpreter ,1 "func.func @generic_split_3d(%input: tensor<32x2xf32>, %input_2: tensor<5x32xf32>, %output: tensor<5x2xf32>) -> tensor<5x2xf32> { %0 = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2) -> (d1, d0)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d2, d0)> ], iterator_types = [""parallel"", ""reduction"", ""parallel""] } ins(%input, %input_2 : tensor<32x2xf32>, tensor<5x32xf32>) outs(%output : tensor<5x2xf32>) { ^bb0(%arg0: f32, %arg1: f32, %arg2: f32): %3 = arith.addf %arg0, %arg1 : f32 %4 = arith.maxf %3, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<5x2xf32> return %0 : tensor<5x2xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --split-input-file --test-transform-dialect-interpreter ,1 "func.func @matmul_split(%A : tensor<16x256xf32>, %B: tensor<256x32xf32>, %C: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.matmul ins(%A, %B: tensor<16x256xf32>, tensor<256x32xf32>) outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2, inner_parallel} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --split-input-file --test-transform-dialect-interpreter ,1 "func.func @generic_split_1d(%arg0: tensor<32xf32>, %arg1: tensor, %out: tensor) -> tensor { %red = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> ()>, affine_map<(d0) -> ()>], iterator_types = [""reduction""]} ins(%arg0, %arg1 : tensor<32xf32>, tensor) outs(%out : tensor) { ^bb0(%arg7: f32, %arg8: f32, %arg9: f32): %40 = arith.subf %arg7, %arg8 : f32 %41 = math.exp %40 : f32 %42 = arith.mulf %41, %arg9 : f32 linalg.yield %42 : f32 } -> tensor return %red : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 0, inner_parallel} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --split-input-file --test-transform-dialect-interpreter ,1 "func.func @generic_split_3d(%input: tensor<32x2xf32>, %input_2: tensor<5x32xf32>, %output: tensor<5x2xf32>) -> tensor<5x2xf32> { %0 = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2) -> (d1, d0)>, affine_map<(d0, d1, d2) -> (d2, d1)>, affine_map<(d0, d1, d2) -> (d2, d0)> ], iterator_types = [""parallel"", ""reduction"", ""parallel""] } ins(%input, %input_2 : tensor<32x2xf32>, tensor<5x32xf32>) outs(%output : tensor<5x2xf32>) { ^bb0(%arg0: f32, %arg1: f32, %arg2: f32): %3 = arith.addf %arg0, %arg1 : f32 %4 = arith.minf %3, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<5x2xf32> return %0 : tensor<5x2xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:4 = transform.structured.split_reduction %0 { split_factor = 4, insert_split_dimension = 2, inner_parallel} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) }", mlir-opt --split-input-file --test-transform-dialect-interpreter ,1 "#map0 = affine_map<() -> ()> #map1 = affine_map<(i) -> ()> #map2 = affine_map<(i) -> (i)> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } #sum_reduction_attrs = { indexing_maps = [#map2, #map1], iterator_types = [""reduction""] } #broadcast_attrs = { indexing_maps = [#map1, #map2], iterator_types = [""parallel""] } func.func @main(%farg0: tensor<10xi32>, %farg1: tensor) -> tensor attributes {} { cf.br ^bb1(%farg0 : tensor<10xi32>) ^bb1(%0: tensor<10xi32>): %1 = tensor.empty() : tensor %2 = linalg.generic #sum_reduction_attrs ins(%0: tensor<10xi32>) outs(%1: tensor) { ^bb(%a: i32, %x: i32): %b = arith.addi %x, %a : i32 linalg.yield %b : i32 } -> tensor %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%2, %farg1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %5 = tensor.extract %4[] : tensor cf.cond_br %5, ^bb2(%2 : tensor), ^bb3(%2 : tensor) ^bb2(%6: tensor): %7 = tensor.empty() : tensor<10xi32> %9 = linalg.generic #broadcast_attrs ins(%6: tensor) outs(%7: tensor<10xi32>) { ^bb(%a: i32, %b: i32) : linalg.yield %a : i32 } -> tensor<10xi32> cf.br ^bb1(%9 : tensor<10xi32>) ^bb3(%10: tensor): return %10 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(linalg-detensorize{aggressive-mode}))"" ",1 "#map0 = affine_map<() -> ()> #map1 = affine_map<(i) -> ()> #map2 = affine_map<(i) -> (i)> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } #sum_reduction_attrs = { indexing_maps = [#map2, #map1], iterator_types = [""reduction""] } #broadcast_attrs = { indexing_maps = [#map1, #map2], iterator_types = [""parallel""] } func.func @main(%farg0: tensor<10xi32>, %farg1: tensor) -> tensor attributes {} { cf.br ^bb1(%farg0 : tensor<10xi32>) ^bb1(%0: tensor<10xi32>): %1 = tensor.empty() : tensor %2 = linalg.generic #sum_reduction_attrs ins(%0: tensor<10xi32>) outs(%1: tensor) { ^bb(%a: i32, %x: i32): %b = arith.addi %x, %a : i32 linalg.yield %b : i32 } -> tensor %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%2, %farg1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor %5 = tensor.extract %4[] : tensor cf.cond_br %5, ^bb2(%2 : tensor), ^bb3(%2 : tensor) ^bb2(%6: tensor): %7 = tensor.empty() : tensor<10xi32> %9 = linalg.generic #broadcast_attrs ins(%6: tensor) outs(%7: tensor<10xi32>) { ^bb(%a: i32, %b: i32) : linalg.yield %a : i32 } -> tensor<10xi32> cf.br ^bb1(%9 : tensor<10xi32>) ^bb3(%10: tensor): return %10 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "func.func @pad_and_hoist_rhs( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[1] : (!transform.any_op) -> !transform.op<""tensor.pad""> transform.structured.hoist_pad %pad by 1 loops : (!transform.op<""tensor.pad"">) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_init( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[2] : (!transform.any_op) -> !transform.op<""tensor.pad""> transform.structured.hoist_pad %pad by 1 loops : (!transform.op<""tensor.pad"">) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_lhs( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[0] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad %pad by 1 loops : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_lhs_transpose( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1 = transform.structured.tile_to_scf_for %matmul [5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[0] : (!transform.any_op) -> !transform.any_op transform.structured.hoist_pad %pad by 1 loops, transpose by [1, 0] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize -split-input-file --verify-diagnostics ,1 "func.func @pad_and_hoist_init( %arg0: tensor<24x12xf32>, %arg1: tensor<12x25xf32>, %arg2: tensor<24x25xf32>) -> tensor<24x25xf32> { %0 = linalg.matmul ins(%arg0, %arg1 : tensor<24x12xf32>, tensor<12x25xf32>) outs(%arg2 : tensor<24x25xf32>) -> tensor<24x25xf32> func.return %0 : tensor<24x25xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %matmul_l1, %loops_l1:2 = transform.structured.tile_to_scf_for %matmul [5, 0, 7] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) %matmul_padded = transform.structured.pad %matmul_l1 { padding_values=[0.0: f32, 0.0 : f32, 0.0 : f32], padding_dimensions=[0, 1, 2] } : (!transform.any_op) -> !transform.any_op %pad = transform.get_producer_of_operand %matmul_padded[2] : (!transform.any_op) -> !transform.op<""tensor.pad""> transform.structured.hoist_pad %pad by 1 loops : (!transform.op<""tensor.pad"">) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter -canonicalize -split-input-file --verify-diagnostics ,1 "!A_mk = tensor<1023x255xf32> !B_kn = tensor<255x127xf32> !C_mn = tensor<1023x127xf32> func.func @matmul_mk_kn_mn(%A : !A_mk, %B : !B_kn, %C : !C_mn) -> !C_mn { %0 = linalg.matmul ins(%A, %B : !A_mk, !B_kn) outs(%C : !C_mn) -> !C_mn return %0 : !C_mn } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %matmul = transform.structured.match ops{[""linalg.matmul""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.matmul""> transform.structured.pack_greedily %matmul matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.matmul"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "!A_mk = tensor<1023x255xf32> !B_nk = tensor<127x255xf32> !C_nm = tensor<127x1023xf32> #mkn_accesses = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (n, k)>, affine_map<(m, n, k) -> (n, m)> ] #mkn_trait = { indexing_maps = #mkn_accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_mk_nk_nm(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { %0 = linalg.generic #mkn_trait ins(%A, %B : !A_mk, !B_nk) outs(%C : !C_nm) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %e : f32 } -> !C_nm return %0 : !C_nm } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %generic = transform.structured.match ops{[""linalg.generic""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.generic""> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.generic"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "!A_mk = tensor<1023x255xf32> !B_nk = tensor<127x255xf32> !C_nm = tensor<127x1023xf32> #mkn_accesses = [ affine_map<(k, m, n) -> (m, k)>, affine_map<(k, m, n) -> (n, k)>, affine_map<(k, m, n) -> (n, m)> ] #mkn_trait = { indexing_maps = #mkn_accesses, iterator_types = [""reduction"", ""parallel"", ""parallel""] } func.func @matmul_mk_nk_nm_transposed(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { %0 = linalg.generic #mkn_trait ins(%A, %B : !A_mk, !B_nk) outs(%C : !C_nm) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %e : f32 } -> !C_nm return %0 : !C_nm } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %generic = transform.structured.match ops{[""linalg.generic""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.generic""> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.generic"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "!A_bmkm2 = tensor<42x1023x255x33xf32> !B_nkb = tensor<127x255x42xf32> !C_nbm = tensor<127x42x1023xf32> #mkn_accesses = [ affine_map<(k, m, n, b, m2) -> (b, m, k, m2)>, affine_map<(k, m, n, b, m2) -> (n, k, b)>, affine_map<(k, m, n, b, m2) -> (n, b, m)> ] #mkn_trait = { indexing_maps = #mkn_accesses, iterator_types = [""reduction"", ""parallel"", ""parallel"", ""parallel"", ""parallel""] } func.func @contraction_bmkm2_nkb_nbm(%A : !A_bmkm2, %B : !B_nkb, %C : !C_nbm) -> !C_nbm { %0 = linalg.generic #mkn_trait ins(%A, %B : !A_bmkm2, !B_nkb) outs(%C : !C_nbm) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %e : f32 } -> !C_nbm return %0 : !C_nbm } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %generic = transform.structured.match ops{[""linalg.generic""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.generic""> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.generic"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "func.func @conv_2d_nchw_fchw(%arg0: tensor, %arg2: tensor) -> tensor { %c0 = arith.constant dense<0.1> : tensor<16x47x3x3xf32> %0 = linalg.conv_2d_nchw_fchw {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%arg0, %c0: tensor, tensor<16x47x3x3xf32>) outs(%arg2: tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %conv = transform.structured.match ops{[""linalg.conv_2d_nchw_fchw""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.conv_2d_nchw_fchw""> transform.structured.pack_greedily %conv matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.conv_2d_nchw_fchw"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "func.func @reduce_and_map(%arg0: tensor<10x100xf32>, %arg1: tensor<10x100xf32>, %output: tensor<10xf32>) -> tensor<10xf32> { %map_init = tensor.empty() : tensor<10x100xf32> %mapped = linalg.map { arith.addf } ins(%arg0, %arg1 : tensor<10x100xf32>, tensor<10x100xf32>) outs(%map_init : tensor<10x100xf32>) %res = linalg.reduce { arith.addf } ins(%mapped: tensor<10x100xf32>) outs(%output: tensor<10xf32>) dimensions = [1] return %res : tensor<10xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %generic = transform.structured.match ops{[""linalg.generic""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.generic""> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.generic"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "!A_mk = tensor<1023x255xf32> !B_nk = tensor<127x255xf32> !C_nm = tensor<127x1023xf32> #mkn_accesses = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (n, k)>, affine_map<(m, n, k) -> (n, m)> ] #mkn_trait = { indexing_maps = #mkn_accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_mk_nk_nm(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { %0 = linalg.generic #mkn_trait ins(%A, %B : !A_mk, !B_nk) outs(%C : !C_nm) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %e : f32 } -> !C_nm return %0 : !C_nm } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %generic = transform.structured.match ops{[""linalg.generic""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.generic""> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 0, 32] matmul_padded_sizes_next_multiple_of = [0, 10, 0] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.generic"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "!A_mk = tensor<1023x255xf32> !B_nk = tensor<127x255xf32> !C_nm = tensor<127x1023xf32> #mkn_accesses = [ affine_map<(m, n, k) -> (m, k)>, affine_map<(m, n, k) -> (n, k)>, affine_map<(m, n, k) -> (n, m)> ] #mkn_trait = { indexing_maps = #mkn_accesses, iterator_types = [""parallel"", ""parallel"", ""reduction""] } func.func @matmul_mk_nk_nm(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { %0 = linalg.generic #mkn_trait ins(%A, %B : !A_mk, !B_nk) outs(%C : !C_nm) { ^bb0(%a: f32, %b: f32, %c: f32): %d = arith.mulf %a, %b : f32 %e = arith.addf %c, %d : f32 linalg.yield %e : f32 } -> !C_nm return %0 : !C_nm } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %generic = transform.structured.match ops{[""linalg.generic""]} in %module_op : (!transform.any_op) -> !transform.op<""linalg.generic""> transform.structured.pack_greedily %generic matmul_packed_sizes = [0, 0, 32] matmul_padded_sizes_next_multiple_of = [0, 10, 0] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<""linalg.generic"">) -> !transform.op<""linalg.generic""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file ,1 "func.func @insert_slice_to_copy( %I : tensor<2x3xf32>, %O : tensor, %off0 : index, %off1 : index, %sz0 : index, %sz1 : index, %st0 : index, %st1 : index) -> tensor { %0 = tensor.insert_slice %I into %O[%off0, %off1] [2, 3] [%st0, %st1] : tensor<2x3xf32> into tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.insert_slice""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.insert_slice_to_copy %0 : (!transform.any_op) -> !transform.any_op transform.cast %1 : !transform.any_op to !transform.op<""linalg.copy""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_to_copy( %I : tensor, %O : tensor, %off0 : index, %off1 : index, %sz0 : index, %sz1 : index, %st0 : index, %st1 : index) -> tensor { %0 = tensor.insert_slice %I into %O[%off0, %off1] [%sz0, %sz1] [1, 1] : tensor into tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.insert_slice""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.insert_slice_to_copy %0 : (!transform.any_op) -> !transform.any_op transform.cast %1 : !transform.any_op to !transform.op<""linalg.copy""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file --allow-unregistered-dialect ,1 "func.func @insert_slice_to_copy( %I : tensor<2x3xf32>, %O : tensor, %off0 : index, %off1 : index, %sz0 : index, %sz1 : index, %st0 : index, %st1 : index) -> tensor { %extracted_slice = tensor.extract_slice %O[%off0, %off1] [2, 3] [%st0, %st1] : tensor to tensor<2x3xf32> %0 = linalg.copy ins(%I : tensor<2x3xf32>) outs(%extracted_slice : tensor<2x3xf32>) -> tensor<2x3xf32> %inserted_slice = tensor.insert_slice %0 into %O[%off0, %off1] [2, 3] [%st0, %st1] : tensor<2x3xf32> into tensor return %inserted_slice : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.insert_slice""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.insert_slice_to_copy %0 : (!transform.any_op) -> !transform.any_op transform.cast %1 : !transform.any_op to !transform.op<""linalg.copy""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file --allow-unregistered-dialect ,1 "func.func @parallel_insert_slice_to_copy(%out : tensor, %sz0: index, %sz1: index) { %0 = scf.forall (%arg0, %arg1) in (27, 8) shared_outs(%arg2 = %out) -> (tensor) { %t = ""make_me_a_tensor""() : () -> (tensor ) scf.forall.in_parallel { tensor.parallel_insert_slice %t into %arg2[0, 0] [%sz0, %sz1] [1, 1] : tensor into tensor } } return } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.parallel_insert_slice""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.insert_slice_to_copy %0 : (!transform.any_op) -> !transform.any_op transform.cast %1 : !transform.any_op to !transform.op<""linalg.copy""> }", mlir-opt -test-transform-dialect-interpreter --split-input-file --allow-unregistered-dialect ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops(%arg0 : tensor, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0 : tensor) outs(%shape : tensor) { ^bb0(%arg1 : f32, %arg2 : f32) : linalg.yield %arg1 : f32 } -> tensor return %0 : tensor }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(linalg-fold-unit-extent-dims{fold-one-trip-loops-only}))"" ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : tensor<1x1xf32>) -> tensor<1x1xf32> { %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xf32>) outs(%arg0 : tensor<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } -> tensor<1x1xf32> return %0 : tensor<1x1xf32> }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(linalg-fold-unit-extent-dims{fold-one-trip-loops-only}))"" ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : memref<1x1xf32>, %arg1 : memref<1x1xf32>) { linalg.generic #trait ins(%arg0 : memref<1x1xf32>) outs(%arg1 : memref<1x1xf32>) { ^bb0(%arg2: f32, %arg3 : f32) : linalg.yield %arg2 : f32 } return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(linalg-fold-unit-extent-dims{fold-one-trip-loops-only}))"" ",1 "#accesses = [ affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @leading_dim_1_canonicalization(%arg0: tensor<1x5xf32>, %shape: tensor<5xf32>) -> tensor<5xf32> { %0 = linalg.generic #trait ins(%arg0 : tensor<1x5xf32>) outs(%shape : tensor<5xf32>) { ^bb0(%arg2: f32, %arg3: f32): linalg.yield %arg2 : f32 } -> tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(linalg-fold-unit-extent-dims{fold-one-trip-loops-only}))"" ",1 "module { func.func @matmul(%A: tensor, %B: tensor, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B : tensor, tensor) outs(%C : tensor) -> (tensor) return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 num_threads [10, 20] (mapping = [ #gpu.thread, #gpu.thread ] ) : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @matmul_tile_size_dynamic_dynamic(%A: tensor, %B: tensor, %C: tensor) -> tensor { %tile_size_1 = ""test.dummy""() : () -> (index) %tile_size_2 = ""test.dummy""() : () -> (index) %0 = linalg.matmul ins(%A, %B : tensor, tensor) outs(%C : tensor) -> (tensor) return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %sz = transform.structured.match ops{[""test.dummy""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 tile_sizes *(%sz : !transform.any_op) : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @matmul_static(%A: tensor<100x200xf32>, %B: tensor<200x300xf32>, %C: tensor<100x300xf32>) -> tensor<100x300xf32> { %0 = linalg.matmul ins(%A, %B : tensor<100x200xf32>, tensor<200x300xf32>) outs(%C : tensor<100x300xf32>) -> (tensor<100x300xf32>) return %0 : tensor<100x300xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 num_threads [10, 21] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @matmul_tile_size_dynamic(%A: tensor, %B: tensor, %C: tensor) -> tensor { %0 = linalg.matmul ins(%A, %B : tensor, tensor) outs(%C : tensor) -> (tensor) return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 tile_sizes [10, 20] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @matmul_tile_size_static(%A: tensor<100x200xf32>, %B: tensor<200x300xf32>, %C: tensor<100x300xf32>) -> tensor<100x300xf32> { %0 = linalg.matmul ins(%A, %B : tensor<100x200xf32>, tensor<200x300xf32>) outs(%C : tensor<100x300xf32>) -> (tensor<100x300xf32>) return %0 : tensor<100x300xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 tile_sizes [10, 21] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "module { func.func @extract_source(%A: tensor<4xf32>, %B: tensor<16xf32>) -> tensor<4xf32> { %B1 = tensor.extract_slice %B[10] [4] [1] : tensor<16xf32> to tensor<4xf32> %result = linalg.generic {indexing_maps = [ affine_map<(d0) -> (d0)>,affine_map<(d0) -> (d0)>], iterator_types = [""parallel""]} ins(%A : tensor<4xf32>) outs(%B1 : tensor<4xf32>) { ^bb0(%arg3: f32, %arg4: f32): %2 = arith.addf %arg3, %arg3 : f32 linalg.yield %2 : f32 } -> tensor<4xf32> return %result : tensor<4xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 num_threads [2] ( mapping = [#gpu.thread]) : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @matmul_tile_size_dynamic_dynamic(%A: tensor, %B: tensor, %C: tensor) -> tensor { %tile_size = ""test.dummy""() : () -> (index) %0 = linalg.matmul ins(%A, %B : tensor, tensor) outs(%C : tensor) -> (tensor) return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %sz = transform.structured.match ops{[""test.dummy""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.tile_to_forall_op %0 tile_sizes [%sz : !transform.any_op, 20] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 " func.func @tile_output_multi_1d_static(%IN1: tensor<100xf32>, %IN2: tensor<100xf32>, %OUT1: tensor<100xf32>, %OUT2: tensor<100xf32>) -> (tensor<100xf32>, tensor<100xf32>) { %res1, %res2 = linalg.generic { indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = [""parallel""] } ins(%IN1, %IN2 : tensor<100xf32>, tensor<100xf32>) outs(%OUT1, %OUT2 : tensor<100xf32>, tensor<100xf32>) { ^bb0(%a1: f32, %a2: f32, %a3: f32, %a4: f32): %1 = arith.addf %a1, %a3 : f32 %2 = arith.addf %a2, %a4 : f32 linalg.yield %1, %2 : f32,f32 } -> (tensor<100xf32>, tensor<100xf32>) return %res1, %res2 : tensor<100xf32>, tensor<100xf32> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %forall, %tiled_generic = transform.structured.tile_to_forall_op %0 num_threads [7] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 " func.func @tile_output_multi_1d2d_static(%IN1: tensor<100xf32>, %IN2: tensor<100x300xf32>, %IN3: tensor<300xf32>, %OUT1: tensor<300x100xf32>, %OUT2: tensor<300xf32>) -> (tensor<300x100xf32>, tensor<300xf32>) { %res2, %res3 = linalg.generic { indexing_maps = [affine_map<(d0,d1) -> (d1)>, affine_map<(d0,d1) -> (d1,d0)>, affine_map<(d0,d1) -> (d0)>, affine_map<(d0,d1) -> (d0,d1)>, affine_map<(d0,d1) -> (d0)> ], iterator_types = [""parallel"", ""parallel""] } ins(%IN1, %IN2, %IN3 : tensor<100xf32>, tensor<100x300xf32>, tensor<300xf32>) outs(%OUT1, %OUT2: tensor<300x100xf32>, tensor<300xf32>) { ^bb0(%i1: f32, %i2: f32, %i3: f32, %o1: f32, %o2: f32): %1 = arith.addf %i1, %o1 : f32 %2 = arith.addf %i2, %1 : f32 %3 = arith.addf %i3, %2 : f32 linalg.yield %3, %i3 : f32, f32 } -> (tensor<300x100xf32>, tensor<300xf32>) return %res2, %res3 : tensor<300x100xf32>, tensor<300xf32> } transform.sequence failures(propagate) { ^bb1(%IN_MAT2: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %IN_MAT2 : (!transform.any_op) -> !transform.any_op %forall, %tiled_generic = transform.structured.tile_to_forall_op %0 num_threads [4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter -canonicalize -cse -split-input-file ,1 "func.func @reshape(%A: tensor, %B: tensor<16xf32>, %init: tensor) -> tensor { %0 = tensor.expand_shape %A [[0, 1], [2]] : tensor into tensor %2 = linalg.generic {indexing_maps = [ affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%0, %B : tensor, tensor<16xf32>) outs(%init : tensor) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %s = arith.subf %arg1, %arg2 : f32 linalg.yield %s : f32 } -> tensor return %2 : tensor }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "func.func @reshape_multiple(%A: tensor<12544x16xf32>, %B: tensor<12544x16xf32>, %C: tensor<16xf32>) -> tensor<112x112x16xf32> { %0 = tensor.expand_shape %A [[0, 1], [2]] : tensor<12544x16xf32> into tensor<112x112x16xf32> %1 = tensor.expand_shape %B [[0, 1], [2]] : tensor<12544x16xf32> into tensor<112x112x16xf32> %2 = tensor.empty() : tensor<112x112x16xf32> %3 = linalg.generic {indexing_maps = [ affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%0, %1, %C : tensor<112x112x16xf32>, tensor<112x112x16xf32>, tensor<16xf32>) outs(%2 : tensor<112x112x16xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32, %arg4: f32): %s = arith.subf %arg1, %arg2 : f32 %m = arith.mulf %s, %arg3 : f32 linalg.yield %m : f32 } -> tensor<112x112x16xf32> return %3 : tensor<112x112x16xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "func.func @reshape_negative(%A: tensor<12544x16xf32>, %B: tensor<112xf32>) -> tensor<112x112x16xf32> { %20 = tensor.expand_shape %A [[0, 1], [2]] : tensor<12544x16xf32> into tensor<112x112x16xf32> %21 = tensor.empty() : tensor<112x112x16xf32> %22 = linalg.generic {indexing_maps = [ affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d1)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%20, %B : tensor<112x112x16xf32>, tensor<112xf32>) outs(%21 : tensor<112x112x16xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %s = arith.subf %arg1, %arg2 : f32 linalg.yield %s : f32 } -> tensor<112x112x16xf32> return %22 : tensor<112x112x16xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "func.func @type_correctness(%arg0 : tensor<6x5xi32>, %arg1 : tensor<5xf32>, %arg2 : tensor<5xf32>) -> tensor<2x3x5xf32> { %cst_6 = arith.constant 1.000000e+00 : f32 %cst_7 = arith.constant 7.000000e+00 : f32 %cst_8 = arith.constant 1.1920929E-7 : f32 %25 = tensor.expand_shape %arg0 [[0, 1], [2]] : tensor<6x5xi32> into tensor<2x3x5xi32> %26 = tensor.empty() : tensor<2x3x5xf32> %28 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2) -> (d0, d1, d2)>, affine_map<(d0, d1, d2) -> (d2)>, affine_map<(d0, d1, d2) -> (d2)>, affine_map<(d0, d1, d2) -> (d0, d1, d2)>], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%25, %arg1, %arg2 : tensor<2x3x5xi32>, tensor<5xf32>, tensor<5xf32>) outs(%26 : tensor<2x3x5xf32>) { ^bb0(%arg6: i32, %arg7: f32, %arg8: f32, %arg9: f32): %29 = arith.sitofp %arg6 : i32 to f32 %30 = arith.addf %arg7, %cst_8 : f32 %31 = arith.divf %cst_7, %30 : f32 %32 = arith.divf %cst_6, %31 : f32 %33 = arith.mulf %29, %32 : f32 %34 = arith.addf %33, %arg8 : f32 linalg.yield %34 : f32 } -> tensor<2x3x5xf32> return %28 : tensor<2x3x5xf32> }", mlir-opt -test-linalg-elementwise-fusion-patterns=fuse-with-reshape-by-collapsing -split-input-file ,1 "func.func @collapse_reduction( %arg0: tensor<2x32x10x4096xf32>, %arg1: tensor<2x32xf32>) -> tensor<2x32xf32> { %0 = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor<2x32x10x4096xf32>) outs(%arg1 : tensor<2x32xf32>) { ^bb0(%arg3: f32, %arg4: f32): %1 = arith.addf %arg3, %arg4 : f32 linalg.yield %1 : f32 } -> tensor<2x32xf32> return %0 : tensor<2x32xf32> }"," mlir-opt -test-linalg-elementwise-fusion-patterns=collapse-dimensions-control=2,3 -split-input-file ",1 "func.func @collapse_parallel( %arg0: tensor<32x2x10x4096xf32>, %arg1: tensor<2x32x10x4096xf32>) -> tensor<2x32x10x4096xf32> { %0 = linalg.generic { indexing_maps = [ affine_map<(d0, d1, d2, d3) -> (d1, d0, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<32x2x10x4096xf32>) outs(%arg1 : tensor<2x32x10x4096xf32>) { ^bb0(%arg3: f32, %arg4: f32): %1 = arith.addf %arg3, %arg4 : f32 linalg.yield %1 : f32 } -> tensor<2x32x10x4096xf32> return %0 : tensor<2x32x10x4096xf32> }"," mlir-opt -test-linalg-elementwise-fusion-patterns=collapse-dimensions-control=2,3 -split-input-file ",1 "#map = affine_map<(d0, d1, d2, d3) -> (d3, d0, d1, d2)> #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)> func.func @uncollapsable(%arg0 : tensor<41x3x1x57xf32>, %arg1 : tensor<3x1x57x41xf32>) -> tensor<3x1x57x41xf32> { %0 = linalg.generic { indexing_maps = [#map, #map1], iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<41x3x1x57xf32>) outs(%arg1 : tensor<3x1x57x41xf32>) { ^bb0(%in: f32, %out: f32): linalg.yield %in : f32 } -> tensor<3x1x57x41xf32> return %0 : tensor<3x1x57x41xf32> }"," mlir-opt -test-linalg-elementwise-fusion-patterns=collapse-dimensions-control=2,3 -split-input-file ",1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.split %0 after 42 { dimension = 0 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @one_d_static(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<100xf32>) outs(%arg1: tensor<100xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %call_res = func.call @elem(%0, %i, %i) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<100xf32> return %0 : tensor<100xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.split %0 after 42 { dimension = 0 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @one_d_static_overflow(%arg0: tensor<10xf32>, %arg1: tensor<10xf32>) -> tensor<10xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<10xf32>) outs(%arg1: tensor<10xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %call_res = func.call @elem(%0, %i, %i) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<10xf32> return %0 : tensor<10xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""func.call""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.split %0 after %1 { dimension = 0 } : !transform.any_op, !transform.any_op } func.func private @get_size() -> index func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { %0 = func.call @get_size() : () -> index %1 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<100xf32>) outs(%arg1: tensor<100xf32>) { ^bb0(%3: f32, %4: f32): %5 = arith.addf %3, %4 : f32 linalg.yield %5 : f32 } -> tensor<100xf32> return %1 : tensor<100xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.split %0 after 4 { dimension = 0 } : !transform.any_op %2:2 = transform.structured.split %1#1 after 16 { dimension = 1 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @two_d(%arg0: tensor<10x34xf32>, %arg1: tensor<10x34xf32>) -> tensor<10x34xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0: tensor<10x34xf32>) outs(%arg1: tensor<10x34xf32>) { ^bb0(%0: f32, %1: f32): %i = linalg.index 0 : index %j = linalg.index 1 : index %call_res = func.call @elem(%0, %i, %j) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<10x34xf32> return %0 : tensor<10x34xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0:2 = ""transform.structured.split""(%arg1) { dimension = 1, static_split_point = -9223372036854775808 } : (!transform.any_op) -> (!transform.any_op, !transform.any_op) }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""func.call""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.split %0 after %1 { dimension = 0 } : !transform.any_op, !transform.any_op } func.func private @get_size() -> i64 func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { %0 = func.call @get_size() : () -> i64 %1 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<100xf32>) outs(%arg1: tensor<100xf32>) { ^bb0(%3: f32, %4: f32): linalg.yield %3 : f32 } -> tensor<100xf32> return %1 : tensor<100xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.match ops{[""func.call""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.split %0 after %1 { dimension = 0 } : !transform.any_op, !transform.any_op } func.func private @get_size() -> i64 func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { %1 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<100xf32>) outs(%arg1: tensor<100xf32>) { ^bb0(%3: f32, %4: f32): linalg.yield %3 : f32 } -> tensor<100xf32> return %1 : tensor<100xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""func.return""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.split %0 after 16 { dimension = 1 } : !transform.any_op } func.func @noop(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { return %arg0 : tensor<100xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.split %0 after 16 { dimension = 1 } : !transform.any_op } func.func @one_d_static(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { %0 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<100xf32>) outs(%arg1: tensor<100xf32>) { ^bb0(%0: f32, %1: f32): linalg.yield %0 : f32 } -> tensor<100xf32> return %0 : tensor<100xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1:2 = transform.structured.split %0 after 142 { dimension = 0 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 func.func @split_one_but_not_other( %arg0: tensor<100xf32>, %arg1: tensor<100xf32>, %arg2: tensor<200xf32>, %arg3: tensor<200xf32>) -> (tensor<100xf32>, tensor<200xf32>) { %0 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg0: tensor<100xf32>) outs(%arg1: tensor<100xf32>) { ^bb0(%arg4: f32, %arg5: f32): %i = linalg.index 0 : index %call_res = func.call @elem(%arg4, %i, %i) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<100xf32> %1 = linalg.generic { indexing_maps = [affine_map<(i) -> (i)>, affine_map<(i) -> (i)>], iterator_types = [""parallel""] } ins(%arg2: tensor<200xf32>) outs(%arg3: tensor<200xf32>) { ^bb0(%arg4: f32, %arg5: f32): %i = linalg.index 0 : index %call_res = func.call @elem(%arg4, %i, %i) : (f32, index, index) -> f32 linalg.yield %call_res : f32 } -> tensor<200xf32> return %0, %1 : tensor<100xf32>, tensor<200xf32> }", mlir-opt --test-transform-dialect-interpreter --split-input-file -verify-diagnostics ,1 "#map1 = affine_map<(d0) -> (d0 + 2)> #map2 = affine_map<(d0) -> (d0 + 4)> #map3 = affine_map<(d0) -> (d0 + 3)> func.func @matmul_f32(%A: memref, %M: index, %N: index, %K: index) { %c4 = arith.constant 4 : index %c3 = arith.constant 3 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %3 = memref.view %A[%c0][%M, %K] : memref to memref %4 = memref.view %A[%c0][%K, %N] : memref to memref %5 = memref.view %A[%c0][%M, %N] : memref to memref %6 = memref.dim %3, %c0 : memref %7 = memref.dim %3, %c1 : memref %8 = memref.dim %4, %c1 : memref scf.for %arg4 = %c0 to %6 step %c2 { scf.for %arg5 = %c0 to %8 step %c3 { scf.for %arg6 = %c0 to %7 step %c4 { %11 = memref.subview %3[%arg4, %arg6][%c2, %c4][1, 1] : memref to memref> %14 = memref.subview %4[%arg6, %arg5][%c4, %c3][1, 1] : memref to memref> %17 = memref.subview %5[%arg4, %arg5][%c2, %c3][1, 1] : memref to memref> linalg.matmul ins(%11, %14: memref>, memref>) outs(%17: memref>) } } } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 { use_alloca } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @matmul_f64(%A: memref, %M: index, %N: index, %K: index) { %c4 = arith.constant 4 : index %c3 = arith.constant 3 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %3 = memref.view %A[%c0][%M, %K] : memref to memref %4 = memref.view %A[%c0][%K, %N] : memref to memref %5 = memref.view %A[%c0][%M, %N] : memref to memref %6 = memref.dim %3, %c0 : memref %7 = memref.dim %3, %c1 : memref %8 = memref.dim %4, %c1 : memref scf.for %arg4 = %c0 to %6 step %c2 { scf.for %arg5 = %c0 to %8 step %c3 { scf.for %arg6 = %c0 to %7 step %c4 { %11 = memref.subview %3[%arg4, %arg6][%c2, %c4][1, 1] : memref to memref> %14 = memref.subview %4[%arg6, %arg5][%c4, %c3][1, 1] : memref to memref> %17 = memref.subview %5[%arg4, %arg5][%c2, %c3][1, 1] : memref to memref> linalg.matmul ins(%11, %14: memref>, memref>) outs(%17: memref>) } } } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @gemm_shared(%a : memref, %b : memref, %c : memref) { linalg.matmul ins(%a, %b: memref, memref) outs(%c: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [16, 16, 16] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2 = transform.structured.promote %1 { operands_to_promote = [0, 1], mapping = [#gpu.memory_space] } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "func.func @gemm_private(%a : memref, %b : memref, %c : memref) { linalg.matmul ins(%a, %b: memref, memref) outs(%c: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [16, 16, 16] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) %2 = transform.structured.promote %1 { operands_to_promote = [0, 1], mapping = [#gpu.memory_space] } : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#map6 = affine_map<(d0, d1, d2) -> (d0, d2)> #map7 = affine_map<(d0, d1, d2) -> (d1, d2)> #map8 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @promote_rank_reducing_subviews(%arg0: memref>, %arg1: memref<128x3x3x64xf32, strided<[?, ?, ?, ?], offset: ?>>, %arg2: memref, %arg3: index, %arg4: index, %arg5: index, %arg6: index, %arg7: index, %arg8: index, %ub1: index, %ub2: index) { %13 = memref.subview %arg0[%arg3, 0, %arg4, %arg8] [1, 1, %ub1, 32] [1, 1, 1, 1] : memref> to memref> %14 = memref.subview %arg1[0, %arg6, %arg7, %arg8] [128, 1, 1, 32] [1, 1, 1, 1] : memref<128x3x3x64xf32, strided<[?, ?, ?, ?], offset: ?>> to memref<128x32xf32, strided<[?, ?], offset: ?>> %9 = memref.subview %arg2[%arg3, %arg4, %arg5, 0] [1, 1, %ub2, 128] [1, 1, 1, 1] : memref to memref> linalg.generic {indexing_maps = [#map6, #map7, #map8], iterator_types = [""parallel"", ""parallel"", ""reduction""]} ins(%13, %14 : memref>, memref<128x32xf32, strided<[?, ?], offset: ?>>) outs(%9 : memref>) { ^bb0(%arg9: f32, %arg10: f32, %arg11: f32): %15 = arith.mulf %arg9, %arg10 : f32 %16 = arith.addf %arg11, %15 : f32 linalg.yield %16 : f32 } return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match interface{LinalgOp} in %arg1 : (!transform.any_op) -> !transform.any_op %1 = transform.structured.promote %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops(%arg0 : tensor, %arg1 : f32, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0, %arg1 : tensor, f32) outs(%shape : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } -> tensor return %0 : tensor }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops(%arg0 : tensor, %arg1 : f32, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0, %arg1 : tensor, f32) outs(%shape : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } -> tensor return %0 : tensor }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops_all_ones(%arg0 : tensor<1x1x1xf32>, %arg1 : f32, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0, %arg1 : tensor<1x1x1xf32>, f32) outs(%shape : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } -> tensor return %0 : tensor }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops_all_ones(%arg0 : tensor<1x1x1xf32>, %arg1 : f32, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0, %arg1 : tensor<1x1x1xf32>, f32) outs(%shape : tensor) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } -> tensor return %0 : tensor }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops_indexed (%arg0 : tensor, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0 : tensor) outs(%shape: tensor) { ^bb0(%arg6 : i32, %arg7 : i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %idx3 = linalg.index 3 : index %idx4 = linalg.index 4 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.subi %1, %idx2 : index %3 = arith.subi %2, %idx3 : index %4 = arith.addi %3, %idx4 : index %5 = arith.index_cast %4 : index to i32 %6 = arith.addi %5, %arg6 : i32 linalg.yield %6 : i32 } -> tensor return %0 : tensor }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops_indexed (%arg0 : tensor, %shape: tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0 : tensor) outs(%shape: tensor) { ^bb0(%arg6 : i32, %arg7 : i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %idx3 = linalg.index 3 : index %idx4 = linalg.index 4 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.subi %1, %idx2 : index %3 = arith.subi %2, %idx3 : index %4 = arith.addi %3, %idx4 : index %5 = arith.index_cast %4 : index to i32 %6 = arith.addi %5, %arg6 : i32 linalg.yield %6 : i32 } -> tensor return %0 : tensor }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : tensor<1x1xf32>) -> tensor<1x1xf32> { %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xf32>) outs(%arg0 : tensor<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } -> tensor<1x1xf32> return %0 : tensor<1x1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : tensor<1x1xf32>) -> tensor<1x1xf32> { %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xf32>) outs(%arg0 : tensor<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } -> tensor<1x1xf32> return %0 : tensor<1x1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops_indexed (%arg0 : tensor<1x1xi32>) -> tensor<1x1xi32>{ %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xi32>) outs(%arg0 : tensor<1x1xi32>) { ^bb0(%arg3: i32, %arg4: i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %2, %arg3 : i32 linalg.yield %3 : i32 } -> tensor<1x1xi32> return %0 : tensor<1x1xi32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops_indexed (%arg0 : tensor<1x1xi32>) -> tensor<1x1xi32>{ %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xi32>) outs(%arg0 : tensor<1x1xi32>) { ^bb0(%arg3: i32, %arg4: i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %2, %arg3 : i32 linalg.yield %3 : i32 } -> tensor<1x1xi32> return %0 : tensor<1x1xi32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(d0) -> (0, d0)>, affine_map<(d0) -> (d0)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""], library_call = ""some_external_fn"" } func.func @leading_dim_1_canonicalization(%arg0: tensor<1x5xf32>, %shape: tensor<5xf32>) -> tensor<5xf32> { %0 = linalg.generic #trait ins(%arg0 : tensor<1x5xf32>) outs(%shape : tensor<5xf32>) { ^bb0(%arg2: f32, %arg3: f32): linalg.yield %arg2 : f32 } -> tensor<5xf32> return %0 : tensor<5xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(d0) -> (0, d0)>, affine_map<(d0) -> (d0)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""], library_call = ""some_external_fn"" } func.func @leading_dim_1_canonicalization(%arg0: tensor<1x5xf32>, %shape: tensor<5xf32>) -> tensor<5xf32> { %0 = linalg.generic #trait ins(%arg0 : tensor<1x5xf32>) outs(%shape : tensor<5xf32>) { ^bb0(%arg2: f32, %arg3: f32): linalg.yield %arg2 : f32 } -> tensor<5xf32> return %0 : tensor<5xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(d0, d1) -> (0, d1)>, affine_map<(d0, d1) -> (d0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_test(%arg0 : tensor<5xf32>, %arg1 : tensor<5xf32>, %shape : tensor<5x5xf32>) -> tensor<5x5xf32> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<5xf32> into tensor<1x5xf32> %1 = tensor.expand_shape %arg1 [[0, 1]] : tensor<5xf32> into tensor<5x1xf32> %2 = linalg.generic #trait ins(%0, %1 : tensor<1x5xf32>, tensor<5x1xf32>) outs(%shape : tensor<5x5xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %3 = arith.addf %arg3, %arg4 : f32 linalg.yield %3 : f32 } -> tensor<5x5xf32> return %2 : tensor<5x5xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(d0, d1) -> (0, d1)>, affine_map<(d0, d1) -> (d0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_test(%arg0 : tensor<5xf32>, %arg1 : tensor<5xf32>, %shape : tensor<5x5xf32>) -> tensor<5x5xf32> { %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<5xf32> into tensor<1x5xf32> %1 = tensor.expand_shape %arg1 [[0, 1]] : tensor<5xf32> into tensor<5x1xf32> %2 = linalg.generic #trait ins(%0, %1 : tensor<1x5xf32>, tensor<5x1xf32>) outs(%shape : tensor<5x5xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %3 = arith.addf %arg3, %arg4 : f32 linalg.yield %3 : f32 } -> tensor<5x5xf32> return %2 : tensor<5x5xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(d0, d1) -> (0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_scalar(%arg0 : tensor<1x1xf32>, %shape : tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xf32>) outs(%shape : tensor) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } -> tensor return %0 : tensor }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(d0, d1) -> (0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_scalar(%arg0 : tensor<1x1xf32>, %shape : tensor) -> tensor { %0 = linalg.generic #trait ins(%arg0 : tensor<1x1xf32>) outs(%shape : tensor) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } -> tensor return %0 : tensor }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d2)> func.func @fold_unit_dim_tensor_reshape_op(%arg0 : tensor<5xf32>) -> tensor<2x5xf32> { %1 = tensor.empty() : tensor<1x2x5xf32> %2 = linalg.generic {i64, indexing_maps = [#map1, #map0], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<5xf32>) outs(%1 : tensor<1x2x5xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } -> tensor<1x2x5xf32> %3 = tensor.collapse_shape %2 [[0, 1], [2]] : tensor<1x2x5xf32> into tensor<2x5xf32> return %3 : tensor<2x5xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d2)> func.func @fold_unit_dim_tensor_reshape_op(%arg0 : tensor<5xf32>) -> tensor<2x5xf32> { %1 = tensor.empty() : tensor<1x2x5xf32> %2 = linalg.generic {i64, indexing_maps = [#map1, #map0], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : tensor<5xf32>) outs(%1 : tensor<1x2x5xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } -> tensor<1x2x5xf32> %3 = tensor.collapse_shape %2 [[0, 1], [2]] : tensor<1x2x5xf32> into tensor<2x5xf32> return %3 : tensor<2x5xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @fold_unit_dim_for_empty_tensor(%input: tensor<1x1000xf32>) -> tensor<1xf32> { %cst = arith.constant 0.0 : f32 %init = tensor.empty() : tensor<1xf32> %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1xf32>) -> tensor<1xf32> %add = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%input : tensor<1x1000xf32>)outs(%fill : tensor<1xf32>) { ^bb0(%arg1: f32, %arg2: f32): %1823 = arith.addf %arg1, %arg2 : f32 linalg.yield %1823 : f32 } -> tensor<1xf32> return %add : tensor<1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @fold_unit_dim_for_empty_tensor(%input: tensor<1x1000xf32>) -> tensor<1xf32> { %cst = arith.constant 0.0 : f32 %init = tensor.empty() : tensor<1xf32> %fill = linalg.fill ins(%cst : f32) outs(%init : tensor<1xf32>) -> tensor<1xf32> %add = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%input : tensor<1x1000xf32>)outs(%fill : tensor<1xf32>) { ^bb0(%arg1: f32, %arg2: f32): %1823 = arith.addf %arg1, %arg2 : f32 linalg.yield %1823 : f32 } -> tensor<1xf32> return %add : tensor<1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @fold_slice( %arg0 : tensor<1x?x?x1x?x1x1xf32>, %arg1 : tensor<1x?x?x?x?x1x1xf32>, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index, %arg7 : index) -> (tensor<1x?x?x1x?x1x1xf32>, tensor<1x?x?x1x?x1x1xf32>) { %0 = tensor.extract_slice %arg0[0, %arg2, %arg3, 0, %arg4, 0, 0] [1, %arg5, %arg6, 1, %arg7, 1, 1] [1, 1, 1, 1, 1, 1, 1] : tensor<1x?x?x1x?x1x1xf32> to tensor<1x?x?x1x?x1x1xf32> %1 = tensor.extract_slice %arg1[%arg2, 0, %arg3, 0, 0, %arg4, 0] [1, %arg5, %arg6, 1, %arg7, 1, 1] [1, 1, 1, 1, 1, 1, 1] : tensor<1x?x?x?x?x1x1xf32> to tensor<1x?x?x1x?x1x1xf32> return %0, %1 : tensor<1x?x?x1x?x1x1xf32>, tensor<1x?x?x1x?x1x1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @fold_slice( %arg0 : tensor<1x?x?x1x?x1x1xf32>, %arg1 : tensor<1x?x?x?x?x1x1xf32>, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : index, %arg6 : index, %arg7 : index) -> (tensor<1x?x?x1x?x1x1xf32>, tensor<1x?x?x1x?x1x1xf32>) { %0 = tensor.extract_slice %arg0[0, %arg2, %arg3, 0, %arg4, 0, 0] [1, %arg5, %arg6, 1, %arg7, 1, 1] [1, 1, 1, 1, 1, 1, 1] : tensor<1x?x?x1x?x1x1xf32> to tensor<1x?x?x1x?x1x1xf32> %1 = tensor.extract_slice %arg1[%arg2, 0, %arg3, 0, 0, %arg4, 0] [1, %arg5, %arg6, 1, %arg7, 1, 1] [1, 1, 1, 1, 1, 1, 1] : tensor<1x?x?x?x?x1x1xf32> to tensor<1x?x?x1x?x1x1xf32> return %0, %1 : tensor<1x?x?x1x?x1x1xf32>, tensor<1x?x?x1x?x1x1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @unit_dim_for_reduction(%arg0: tensor<1x?x1x?xf32>) -> tensor<1x?xf32> { %cst = arith.constant 1.000000e+00 : f32 %c3 = arith.constant 3 : index %0 = tensor.dim %arg0, %c3 : tensor<1x?x1x?xf32> %1 = tensor.empty(%0) : tensor<1x?xf32> %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor<1x?xf32>) -> tensor<1x?xf32> %3 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor<1x?x1x?xf32>) outs(%2 : tensor<1x?xf32>) { ^bb0(%arg1: f32, %arg2: f32): %4 = arith.addf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<1x?xf32> return %3 : tensor<1x?xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @unit_dim_for_reduction(%arg0: tensor<1x?x1x?xf32>) -> tensor<1x?xf32> { %cst = arith.constant 1.000000e+00 : f32 %c3 = arith.constant 3 : index %0 = tensor.dim %arg0, %c3 : tensor<1x?x1x?xf32> %1 = tensor.empty(%0) : tensor<1x?xf32> %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor<1x?xf32>) -> tensor<1x?xf32> %3 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor<1x?x1x?xf32>) outs(%2 : tensor<1x?xf32>) { ^bb0(%arg1: f32, %arg2: f32): %4 = arith.addf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<1x?xf32> return %3 : tensor<1x?xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @unit_dim_for_both_reduction(%arg0: tensor<1x?x1x1xf32>) -> tensor<1x1xf32> { %cst = arith.constant 1.000000e+00 : f32 %c3 = arith.constant 3 : index %1 = tensor.empty() : tensor<1x1xf32> %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor<1x1xf32>) -> tensor<1x1xf32> %3 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor<1x?x1x1xf32>) outs(%2 : tensor<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32): %4 = arith.addf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<1x1xf32> return %3 : tensor<1x1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @unit_dim_for_both_reduction(%arg0: tensor<1x?x1x1xf32>) -> tensor<1x1xf32> { %cst = arith.constant 1.000000e+00 : f32 %c3 = arith.constant 3 : index %1 = tensor.empty() : tensor<1x1xf32> %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor<1x1xf32>) -> tensor<1x1xf32> %3 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor<1x?x1x1xf32>) outs(%2 : tensor<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32): %4 = arith.addf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor<1x1xf32> return %3 : tensor<1x1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @unit_dim_for_reduction_inner(%arg0: tensor) -> tensor { %cst = arith.constant 1.000000e+00 : f32 %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c2 : tensor %1 = tensor.empty(%0) : tensor %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor) -> tensor %3 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor) outs(%2 : tensor) { ^bb0(%arg1: f32, %arg2: f32): %4 = arith.addf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @unit_dim_for_reduction_inner(%arg0: tensor) -> tensor { %cst = arith.constant 1.000000e+00 : f32 %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c2 : tensor %1 = tensor.empty(%0) : tensor %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor) -> tensor %3 = linalg.generic { indexing_maps = [affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel"", ""reduction"", ""reduction""]} ins(%arg0 : tensor) outs(%2 : tensor) { ^bb0(%arg1: f32, %arg2: f32): %4 = arith.addf %arg1, %arg2 : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @slice_unit_dims(%arg0: tensor<1x3xf32>) -> tensor<1x1xf32> { %0 = tensor.extract_slice %arg0[0, 2] [1, 1] [1, 1] : tensor<1x3xf32> to tensor<1x1xf32> return %0 : tensor<1x1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @slice_unit_dims(%arg0: tensor<1x3xf32>) -> tensor<1x1xf32> { %0 = tensor.extract_slice %arg0[0, 2] [1, 1] [1, 1] : tensor<1x3xf32> to tensor<1x1xf32> return %0 : tensor<1x1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @insert_slice_unit_dims(%arg0: tensor<1x3xf32>, %arg1: tensor<1x1xf32>) -> tensor<1x3xf32> { %0 = tensor.insert_slice %arg1 into %arg0[0, 2] [1, 1] [1, 1] : tensor<1x1xf32> into tensor<1x3xf32> return %0 : tensor<1x3xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @insert_slice_unit_dims(%arg0: tensor<1x3xf32>, %arg1: tensor<1x1xf32>) -> tensor<1x3xf32> { %0 = tensor.insert_slice %arg1 into %arg0[0, 2] [1, 1] [1, 1] : tensor<1x1xf32> into tensor<1x3xf32> return %0 : tensor<1x3xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops(%arg0 : memref, %arg1 : f32, %shape: memref) -> memref { linalg.generic #trait ins(%arg0, %arg1 : memref, f32) outs(%shape : memref) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } return %shape : memref }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops(%arg0 : memref, %arg1 : f32, %shape: memref) -> memref { linalg.generic #trait ins(%arg0, %arg1 : memref, f32) outs(%shape : memref) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } return %shape : memref }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops_indexed (%arg0 : memref, %shape: memref) -> memref { linalg.generic #trait ins(%arg0 : memref) outs(%shape: memref) { ^bb0(%arg6 : i32, %arg7 : i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %idx3 = linalg.index 3 : index %idx4 = linalg.index 4 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.subi %1, %idx2 : index %3 = arith.subi %2, %idx3 : index %4 = arith.addi %3, %idx4 : index %5 = arith.index_cast %4 : index to i32 %6 = arith.addi %5, %arg6 : i32 linalg.yield %6 : i32 } return %shape : memref }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @drop_one_trip_loops_indexed (%arg0 : memref, %shape: memref) -> memref { linalg.generic #trait ins(%arg0 : memref) outs(%shape: memref) { ^bb0(%arg6 : i32, %arg7 : i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %idx2 = linalg.index 2 : index %idx3 = linalg.index 3 : index %idx4 = linalg.index 4 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.subi %1, %idx2 : index %3 = arith.subi %2, %idx3 : index %4 = arith.addi %3, %idx4 : index %5 = arith.index_cast %4 : index to i32 %6 = arith.addi %5, %arg6 : i32 linalg.yield %6 : i32 } return %shape : memref }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : memref<1x1xf32>) -> memref<1x1xf32> { linalg.generic #trait ins(%arg0 : memref<1x1xf32>) outs(%arg0 : memref<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } return %arg0 : memref<1x1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : memref<1x1xf32>) -> memref<1x1xf32> { linalg.generic #trait ins(%arg0 : memref<1x1xf32>) outs(%arg0 : memref<1x1xf32>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } return %arg0 : memref<1x1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops_indexed (%arg0 : memref<1x1xi32>) -> memref<1x1xi32>{ linalg.generic #trait ins(%arg0 : memref<1x1xi32>) outs(%arg0 : memref<1x1xi32>) { ^bb0(%arg3: i32, %arg4: i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %2, %arg3 : i32 linalg.yield %3 : i32 } return %arg0 : memref<1x1xi32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops_indexed (%arg0 : memref<1x1xi32>) -> memref<1x1xi32>{ linalg.generic #trait ins(%arg0 : memref<1x1xi32>) outs(%arg0 : memref<1x1xi32>) { ^bb0(%arg3: i32, %arg4: i32) : %idx0 = linalg.index 0 : index %idx1 = linalg.index 1 : index %1 = arith.addi %idx0, %idx1 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.addi %2, %arg3 : i32 linalg.yield %3 : i32 } return %arg0 : memref<1x1xi32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(d0) -> (0, d0)>, affine_map<(d0) -> (d0)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""], library_call = ""some_external_fn"" } func.func @leading_dim_1_canonicalization(%arg0: memref<1x5xf32>, %shape: memref<5xf32>) -> memref<5xf32> { linalg.generic #trait ins(%arg0 : memref<1x5xf32>) outs(%shape : memref<5xf32>) { ^bb0(%arg2: f32, %arg3: f32): linalg.yield %arg2 : f32 } return %shape : memref<5xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(d0) -> (0, d0)>, affine_map<(d0) -> (d0)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel""], library_call = ""some_external_fn"" } func.func @leading_dim_1_canonicalization(%arg0: memref<1x5xf32>, %shape: memref<5xf32>) -> memref<5xf32> { linalg.generic #trait ins(%arg0 : memref<1x5xf32>) outs(%shape : memref<5xf32>) { ^bb0(%arg2: f32, %arg3: f32): linalg.yield %arg2 : f32 } return %shape : memref<5xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(d0, d1) -> (0, d1)>, affine_map<(d0, d1) -> (d0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_test(%arg0 : memref<5xf32>, %arg1 : memref<5xf32>, %shape : memref<5x5xf32>) -> memref<5x5xf32> { %0 = memref.expand_shape %arg0 [[0, 1]] : memref<5xf32> into memref<1x5xf32> %1 = memref.expand_shape %arg1 [[0, 1]] : memref<5xf32> into memref<5x1xf32> linalg.generic #trait ins(%0, %1 : memref<1x5xf32>, memref<5x1xf32>) outs(%shape : memref<5x5xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %3 = arith.addf %arg3, %arg4 : f32 linalg.yield %3 : f32 } return %shape : memref<5x5xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(d0, d1) -> (0, d1)>, affine_map<(d0, d1) -> (d0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_test(%arg0 : memref<5xf32>, %arg1 : memref<5xf32>, %shape : memref<5x5xf32>) -> memref<5x5xf32> { %0 = memref.expand_shape %arg0 [[0, 1]] : memref<5xf32> into memref<1x5xf32> %1 = memref.expand_shape %arg1 [[0, 1]] : memref<5xf32> into memref<5x1xf32> linalg.generic #trait ins(%0, %1 : memref<1x5xf32>, memref<5x1xf32>) outs(%shape : memref<5x5xf32>) { ^bb0(%arg3: f32, %arg4: f32, %arg5: f32): %3 = arith.addf %arg3, %arg4 : f32 linalg.yield %3 : f32 } return %shape : memref<5x5xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(d0, d1) -> (0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_scalar(%arg0 : memref<1x1xf32>, %shape : memref) -> memref { linalg.generic #trait ins(%arg0 : memref<1x1xf32>) outs(%shape : memref) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } return %shape : memref }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(d0, d1) -> (0, 0)>, affine_map<(d0, d1) -> (d0, d1)> ] #trait = { indexing_maps = #accesses, iterator_types = [""parallel"", ""parallel""], library_call = ""some_external_fn"" } func.func @broadcast_scalar(%arg0 : memref<1x1xf32>, %shape : memref) -> memref { linalg.generic #trait ins(%arg0 : memref<1x1xf32>) outs(%shape : memref) { ^bb0(%arg2 : f32, %arg3 : f32): linalg.yield %arg2 : f32 } return %shape : memref }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d2)> func.func @fold_unit_dim_memref_reshape_op(%arg0 : memref<5xf32>) -> memref<2x5xf32> { %1 = memref.alloc() : memref<1x2x5xf32> linalg.generic {i64, indexing_maps = [#map1, #map0], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : memref<5xf32>) outs(%1 : memref<1x2x5xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } %3 = memref.collapse_shape %1 [[0, 1], [2]] : memref<1x2x5xf32> into memref<2x5xf32> return %3 : memref<2x5xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d2)> func.func @fold_unit_dim_memref_reshape_op(%arg0 : memref<5xf32>) -> memref<2x5xf32> { %1 = memref.alloc() : memref<1x2x5xf32> linalg.generic {i64, indexing_maps = [#map1, #map0], iterator_types = [""parallel"", ""parallel"", ""parallel""]} ins(%arg0 : memref<5xf32>) outs(%1 : memref<1x2x5xf32>) { ^bb0(%arg1: f32, %arg2: f32): linalg.yield %arg1 : f32 } %3 = memref.collapse_shape %1 [[0, 1], [2]] : memref<1x2x5xf32> into memref<2x5xf32> return %3 : memref<2x5xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @fold_unit_dim_for_init_memref(%input: memref<1x1000xf32>) -> memref<1xf32> { %cst = arith.constant 0.0 : f32 %init = memref.alloc() : memref<1xf32> linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%input : memref<1x1000xf32>)outs(%init : memref<1xf32>) { ^bb0(%arg1: f32, %arg2: f32): %1823 = arith.addf %arg1, %arg2 : f32 linalg.yield %1823 : f32 } return %init : memref<1xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @fold_unit_dim_for_init_memref(%input: memref<1x1000xf32>) -> memref<1xf32> { %cst = arith.constant 0.0 : f32 %init = memref.alloc() : memref<1xf32> linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%input : memref<1x1000xf32>)outs(%init : memref<1xf32>) { ^bb0(%arg1: f32, %arg2: f32): %1823 = arith.addf %arg1, %arg2 : f32 linalg.yield %1823 : f32 } return %init : memref<1xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @input_stays_same(%arg0 : memref>, %arg1 : f32, %shape: memref) -> memref { linalg.generic #trait ins(%arg0, %arg1 : memref>, f32) outs(%shape : memref) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } return %shape : memref }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#accesses = [ affine_map<(i, j, k, l, m) -> (i, k, m)>, affine_map<(i, j, k, l, m) -> ()>, affine_map<(i, j, k, l, m) -> (i, k, j, l, m)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""parallel"", ""parallel"", ""parallel""], indexing_maps = #accesses, library_call = ""some_external_func"" } func.func @input_stays_same(%arg0 : memref>, %arg1 : f32, %shape: memref) -> memref { linalg.generic #trait ins(%arg0, %arg1 : memref>, f32) outs(%shape : memref) { ^bb0(%arg2 : f32, %arg3 : f32, %arg4 : f32) : linalg.yield %arg3 : f32 } return %shape : memref }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"", ""reduction""] } #CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> func.func @sparse_case(%arg0: tensor<8x8xf32, #CSR>, %arg1: tensor<8xf32>) -> tensor<8xf32> { %0 = tensor.empty() : tensor<8xf32> %1 = linalg.generic #matvec ins(%arg0, %arg1: tensor<8x8xf32, #CSR>, tensor<8xf32>) outs(%0: tensor<8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %m = arith.mulf %a, %b : f32 %add = arith.addf %x, %m : f32 linalg.yield %add : f32 } -> tensor<8xf32> return %1: tensor<8xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#matvec = { indexing_maps = [ affine_map<(i,j) -> (i,j)>, affine_map<(i,j) -> (j)>, affine_map<(i,j) -> (i)> ], iterator_types = [""parallel"", ""reduction""] } #CSR = #sparse_tensor.encoding<{ lvlTypes = [""dense"", ""compressed""] }> func.func @sparse_case(%arg0: tensor<8x8xf32, #CSR>, %arg1: tensor<8xf32>) -> tensor<8xf32> { %0 = tensor.empty() : tensor<8xf32> %1 = linalg.generic #matvec ins(%arg0, %arg1: tensor<8x8xf32, #CSR>, tensor<8xf32>) outs(%0: tensor<8xf32>) { ^bb(%a: f32, %b: f32, %x: f32): %m = arith.mulf %a, %b : f32 %add = arith.addf %x, %m : f32 linalg.yield %add : f32 } -> tensor<8xf32> return %1: tensor<8xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "func.func @reduce_dispatch_0() -> tensor<4x2xf32> { %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<4x2xf32> %res = scf.forall (%arg0, %arg1) in (%c4, %c2) shared_outs(%o = %0) -> (tensor<4x2xf32>) { %1 = tensor.empty() : tensor<1x1xf32> %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor<1x1xf32>) -> tensor<1x1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %2 into %o[%arg0, %arg1] [1, 1] [1, 1] : tensor<1x1xf32> into tensor<4x2xf32> } } return %res: tensor<4x2xf32> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "func.func @reduce_dispatch_0() -> tensor<4x2xf32> { %c2 = arith.constant 2 : index %c4 = arith.constant 4 : index %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.empty() : tensor<4x2xf32> %res = scf.forall (%arg0, %arg1) in (%c4, %c2) shared_outs(%o = %0) -> (tensor<4x2xf32>) { %1 = tensor.empty() : tensor<1x1xf32> %2 = linalg.fill ins(%cst : f32) outs(%1 : tensor<1x1xf32>) -> tensor<1x1xf32> scf.forall.in_parallel { tensor.parallel_insert_slice %2 into %o[%arg0, %arg1] [1, 1] [1, 1] : tensor<1x1xf32> into tensor<4x2xf32> } } return %res: tensor<4x2xf32> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : memref<1x1xf32, 3>) -> memref<1x1xf32, 3> { linalg.generic #trait ins(%arg0 : memref<1x1xf32, 3>) outs(%arg0 : memref<1x1xf32, 3>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } return %arg0 : memref<1x1xf32, 3> }", mlir-opt -linalg-fold-unit-extent-dims -split-input-file ,1 "#map0 = affine_map<(i, j) -> (i, j)> #access = [#map0, #map0] #trait = { iterator_types = [""parallel"", ""parallel""], indexing_maps = #access, library_call = ""some_external_func"" } func.func @drop_all_loops(%arg0 : memref<1x1xf32, 3>) -> memref<1x1xf32, 3> { linalg.generic #trait ins(%arg0 : memref<1x1xf32, 3>) outs(%arg0 : memref<1x1xf32, 3>) { ^bb0(%arg1: f32, %arg2: f32) : linalg.yield %arg1 : f32 } return %arg0 : memref<1x1xf32, 3> }"," mlir-opt -linalg-fold-unit-extent-dims=""use-rank-reducing-slices"" -cse -split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @linalg_generic_sum(%lhs: memref<2x2xf32>, %rhs: memref<2x2xf32>, %sum: memref<2x2xf32>) { linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""]} ins(%lhs, %rhs : memref<2x2xf32>, memref<2x2xf32>) outs(%sum : memref<2x2xf32>) { ^bb0(%lhs_in: f32, %rhs_in: f32, %sum_out: f32): %0 = arith.addf %lhs_in, %rhs_in : f32 linalg.yield %0 : f32 } return }", mlir-opt -convert-linalg-to-parallel-loops -split-input-file ,1 "#accesses = [ affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>, affine_map<(d0, d1, d2, d3) -> (d0, d1, d3)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""reduction"", ""parallel""], indexing_maps = #accesses } func.func @lower_outer_parallel(%A: memref, %B: memref) { linalg.generic #trait ins(%A : memref) outs(%B : memref) { ^bb0(%a: f32, %b: f32): linalg.yield %a: f32 } return }", mlir-opt -convert-linalg-to-parallel-loops -split-input-file ,1 "#accesses = [ affine_map<(d0, d1, d2, d3, d4, d5) -> (d0, d1, d2, d3, d4, d5)>, affine_map<(d0, d1, d2, d3, d4, d5) -> (d0, d1, d4, d3)> ] #trait = { iterator_types = [""parallel"", ""parallel"", ""reduction"", ""parallel"", ""parallel"", ""reduction""], indexing_maps = #accesses } func.func @lower_mixed_parallel(%A: memref, %B: memref) { linalg.generic #trait ins(%A : memref) outs(%B : memref) { ^bb0(%a: f32, %b: f32): linalg.yield %a: f32 } return }", mlir-opt -convert-linalg-to-parallel-loops -split-input-file ,1 "func.func @tensor_from_elements_0d(%arg0: index) -> tensor { %0 = tensor.from_elements %arg0 : tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.from_elements""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_from_elements_1d(%arg0: index, %arg1: index) -> tensor<2xindex> { %0 = tensor.from_elements %arg0, %arg1 : tensor<2xindex> return %0 : tensor<2xindex> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.from_elements""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_from_elements_2d(%arg0: index, %arg1: index) -> tensor<3x2xindex> { %0 = tensor.from_elements %arg0, %arg1, %arg0, %arg1, %arg0, %arg1 : tensor<3x2xindex> return %0 : tensor<3x2xindex> } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.from_elements""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_generate(%s1: index, %s2: index) -> tensor { %0 = tensor.generate %s1, %s2 { ^bb0(%arg0: index, %arg1: index): %1 = arith.addi %arg0, %arg1 : index tensor.yield %1 : index } : tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.generate""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_pad(%t1: tensor, %l2: index, %h1: index, %h2: index) -> tensor { %0 = tensor.pad %t1 low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): %m = arith.muli %arg0, %arg1 : index tensor.yield %m : index } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_pad_constant(%t1: tensor, %l2: index, %h1: index, %h2: index) -> tensor { %0 = tensor.pad %t1 low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): %c = arith.constant 50 : index tensor.yield %c : index } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_pad_invariant(%t1: tensor, %l2: index, %h1: index, %h2: index, %padding: index) -> tensor { %0 = tensor.pad %t1 low[5, %l2] high[%h1, %h2] { ^bb0(%arg0: index, %arg1: index): tensor.yield %padding : index } : tensor to tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @tensor_pad_nofold(%t1: tensor, %padding: index) -> tensor { %c0 = arith.constant 0 : index %0 = tensor.pad %t1 nofold low[0, %c0] high[%c0, 0] { ^bb0(%arg0: index, %arg1: index): tensor.yield %padding : index } : tensor to tensor return %0: tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""tensor.pad""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter --split-input-file -canonicalize ,1 "func.func @interchange_generic(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""] } ins(%arg0 : tensor) outs(%arg1 : tensor) { ^bb0(%arg2: f32, %arg3: f32): %1 = math.exp %arg2 : f32 linalg.yield %1 : f32 } -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.generic""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.interchange %0 iterator_interchange = [1, 0] : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "func.func @interchange_matmul(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor { %0 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor return %0 : tensor } transform.sequence failures(propagate) { ^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op transform.structured.interchange %0 iterator_interchange = [1, 0] : (!transform.any_op) -> !transform.any_op }", mlir-opt -test-transform-dialect-interpreter -split-input-file -verify-diagnostics ,1 "#map2 = affine_map<(d0) -> (d0)> #map3 = affine_map<(d0) -> ()> func.func @inline_zerod(%arg0: tensor<4xf32>, %scalar: tensor) -> tensor<4xf32> { %0 = tensor.empty() : tensor<4xf32> %1 = linalg.generic {indexing_maps = [#map2, #map3, #map2], iterator_types = [""parallel""]} ins(%arg0, %scalar : tensor<4xf32>, tensor) outs(%0 : tensor<4xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %2 = arith.divf %arg1, %arg2 : f32 linalg.yield %2 : f32 } -> tensor<4xf32> return %1 : tensor<4xf32> }", mlir-opt -linalg-inline-scalar-operands -split-input-file ,1 "#map2 = affine_map<(d0) -> (d0)> #map3 = affine_map<(d0) -> (0)> func.func @inline_oned(%arg0: tensor<4xf32>, %scalar: tensor<1xf32>) -> tensor<4xf32> { %0 = tensor.empty() : tensor<4xf32> %1 = linalg.generic {indexing_maps = [#map2, #map3, #map2], iterator_types = [""parallel""]} ins(%arg0, %scalar : tensor<4xf32>, tensor<1xf32>) outs(%0 : tensor<4xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %2 = arith.divf %arg1, %arg2 : f32 linalg.yield %2 : f32 } -> tensor<4xf32> return %1 : tensor<4xf32> }", mlir-opt -linalg-inline-scalar-operands -split-input-file ,1 "func.func @pack(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<17x2x16x16x32x8xf32>) -> tensor<17x2x16x16x32x8xf32> { %cst_0 = arith.constant 0.0 : f32 %pack = tensor.pack %arg0 padding_value(%cst_0 : f32) inner_dims_pos = [1, 0] inner_tiles = [32, 8] into %arg1 : tensor<129x47x16x16xf32> -> tensor<17x2x16x16x32x8xf32> return %pack : tensor<17x2x16x16x32x8xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack(%arg0: tensor<128x8xf32>, %arg1: tensor<8x8x16x1xf32>) -> tensor<8x8x16x1xf32> { %pack = tensor.pack %arg0 inner_dims_pos = [0, 1] inner_tiles = [16, 1] into %arg1 : tensor<128x8xf32> -> tensor<8x8x16x1xf32> return %pack : tensor<8x8x16x1xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack_as_pad(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<1x1x1x1x136x64x16x16xf32>) -> tensor<1x1x1x1x136x64x16x16xf32> { %cst_0 = arith.constant 0.0 : f32 %pack = tensor.pack %arg0 padding_value(%cst_0 : f32) inner_dims_pos = [0, 1, 2, 3] inner_tiles = [136, 64, 16, 16] into %arg1 : tensor<129x47x16x16xf32> -> tensor<1x1x1x1x136x64x16x16xf32> return %pack : tensor<1x1x1x1x136x64x16x16xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack_not_a_pad(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<1x1x16x16x136x64xf32>) -> tensor<1x1x16x16x136x64xf32> { %cst_0 = arith.constant 0.0 : f32 %pack = tensor.pack %arg0 padding_value(%cst_0 : f32) inner_dims_pos = [0, 1] inner_tiles = [136, 64] into %arg1 : tensor<129x47x16x16xf32> -> tensor<1x1x16x16x136x64xf32> return %pack : tensor<1x1x16x16x136x64xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @unpack(%arg0: tensor<17x2x16x16x32x8xf32>, %arg1: tensor<129x47x16x16xf32>) -> tensor<129x47x16x16xf32> { %cst_0 = arith.constant 0.0 : f32 %pack = tensor.unpack %arg0 inner_dims_pos = [1, 0] inner_tiles = [32, 8] into %arg1 : tensor<17x2x16x16x32x8xf32> -> tensor<129x47x16x16xf32> return %pack : tensor<129x47x16x16xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %unpack = transform.structured.match ops{[""tensor.unpack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.unpack""> transform.structured.lower_unpack %unpack : (!transform.op<""tensor.unpack"">) -> (!transform.op<""tensor.empty"">, !transform.op<""linalg.transpose"">, !transform.op<""tensor.collapse_shape"">, !transform.op<""tensor.extract_slice"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @unpack_as_pad(%arg0: tensor<1x1x1x1x136x64x16x16xf32>, %arg1: tensor<129x47x16x16xf32>) -> tensor<129x47x16x16xf32> { %cst_0 = arith.constant 0.0 : f32 %pack = tensor.unpack %arg0 inner_dims_pos = [0, 1, 2, 3] inner_tiles = [136, 64, 16, 16] into %arg1 : tensor<1x1x1x1x136x64x16x16xf32> -> tensor<129x47x16x16xf32> return %pack : tensor<129x47x16x16xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %unpack = transform.structured.match ops{[""tensor.unpack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.unpack""> transform.structured.lower_unpack %unpack : (!transform.op<""tensor.unpack"">) -> (!transform.op<""tensor.empty"">, !transform.op<""linalg.transpose"">, !transform.op<""tensor.collapse_shape"">, !transform.op<""tensor.extract_slice"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack_with_outer_dims_perm(%src: tensor<100x200x128x256xi32>, %dest: tensor<200x4x16x100x16x32xi32>) -> tensor<200x4x16x100x16x32xi32> { %0 = tensor.pack %src outer_dims_perm = [1, 2, 3, 0] inner_dims_pos = [3, 2] inner_tiles = [16, 32] into %dest : tensor<100x200x128x256xi32> -> tensor<200x4x16x100x16x32xi32> return %0 : tensor<200x4x16x100x16x32xi32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack_with_pad(%src: tensor<4225x12xf32>, %dest: tensor<265x16x16x1xf32>) -> tensor<265x16x16x1xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pack %src padding_value(%cst : f32) inner_dims_pos = [0, 1] inner_tiles = [16, 1] into %dest : tensor<4225x12xf32> -> tensor<265x16x16x1xf32> return %0 : tensor<265x16x16x1xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack_with_pad_and_outer_dims_perm(%src: tensor<100x200x127x255xi32>, %dest: tensor<200x4x16x100x16x32xi32>) -> tensor<200x4x16x100x16x32xi32> { %cst_0 = arith.constant 0 : i32 %0 = tensor.pack %src padding_value(%cst_0 : i32) outer_dims_perm = [1, 2, 3, 0] inner_dims_pos = [3, 2] inner_tiles = [16, 32] into %dest : tensor<100x200x127x255xi32> -> tensor<200x4x16x100x16x32xi32> return %0 : tensor<200x4x16x100x16x32xi32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @dynamic_pack_pad_transpose_inner_and_outer_dims(%source: tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %source, %c0 : tensor %d1 = tensor.dim %source, %c1 : tensor %padding_value = arith.constant 0.0 : f32 %c16 = arith.constant 16 : index %c32 = arith.constant 32 : index %tiled_d0 = arith.ceildivui %d0, %c32 : index %tiled_d1 = arith.ceildivui %d1, %c16 : index %init_pack = tensor.empty(%tiled_d1, %tiled_d0) : tensor %pack = tensor.pack %source padding_value(%padding_value : f32) outer_dims_perm = [1, 0] inner_dims_pos = [1, 0] inner_tiles = [16, 32] into %init_pack : tensor -> tensor return %pack : tensor } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "func.func @pack_as_pad_with_outer_dims_perm(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<1x1x1x1x136x64x16x16xf32>) -> tensor<1x1x1x1x136x64x16x16xf32> { %cst_0 = arith.constant 0.0 : f32 %pack = tensor.pack %arg0 padding_value(%cst_0 : f32) outer_dims_perm = [1, 2, 3, 0] inner_dims_pos = [0, 1, 2, 3] inner_tiles = [136, 64, 16, 16] into %arg1 : tensor<129x47x16x16xf32> -> tensor<1x1x1x1x136x64x16x16xf32> return %pack : tensor<1x1x1x1x136x64x16x16xf32> } transform.sequence failures(propagate) { ^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{[""tensor.pack""]} in %module_op : (!transform.any_op) -> !transform.op<""tensor.pack""> transform.structured.lower_pack %pack : (!transform.op<""tensor.pack"">) -> (!transform.op<""tensor.pad"">, !transform.op<""tensor.expand_shape"">, !transform.op<""linalg.transpose"">) }", mlir-opt -test-transform-dialect-interpreter -cse --split-input-file ,1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main(%farg0 : tensor) -> (tensor) attributes {} { %c10 = arith.constant 10 : i32 %1 = tensor.from_elements %c10 : tensor %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%farg0, %1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor return %4 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(linalg-detensorize{aggressive-mode}))"" ",1 "#map0 = affine_map<() -> ()> #attrs = { indexing_maps = [#map0, #map0, #map0], iterator_types = [] } func.func @main(%farg0 : tensor) -> (tensor) attributes {} { %c10 = arith.constant 10 : i32 %1 = tensor.from_elements %c10 : tensor %3 = tensor.empty() : tensor %4 = linalg.generic #attrs ins(%farg0, %1 : tensor, tensor) outs(%3 : tensor) { ^bb0(%arg0: i32, %arg1: i32, %arg2: i1): %8 = arith.cmpi slt, %arg0, %arg1 : i32 linalg.yield %8 : i1 } -> tensor return %4 : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(linalg-detensorize))"" ",1 "func.func @generalize_matmul_buffer(%A : memref<16x8xf32>, %B: memref<8x32xf32>, %C: memref<16x32xf32>) { linalg.matmul ins(%A, %B: memref<16x8xf32>, memref<8x32xf32>) outs(%C: memref<16x32xf32>) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_tensor(%A : tensor<16x8xf32>, %B: tensor<8x32xf32>, %C: tensor<16x32xf32>) -> tensor<16x32xf32> { %0 = linalg.matmul ins(%A, %B: tensor<16x8xf32>, tensor<8x32xf32>) outs(%C: tensor<16x32xf32>) -> tensor<16x32xf32> return %0: tensor<16x32xf32> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_matmul_tensor_complex(%A : tensor<16x8xcomplex>, %B: tensor<8x32xcomplex>, %C: tensor<16x32xcomplex>) -> tensor<16x32xcomplex> { %0 = linalg.matmul ins(%A, %B: tensor<16x8xcomplex>, tensor<8x32xcomplex>) outs(%C: tensor<16x32xcomplex>) -> tensor<16x32xcomplex> return %0: tensor<16x32xcomplex> }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @depthwise_conv_2d_nhwc_hwcm(%input: memref<2x4x5x2xf32>, %filter: memref<2x2x2x3xf32>, %output: memref<2x3x4x2x3xf32>) { linalg.depthwise_conv_2d_nhwc_hwcm { dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : memref<2x4x5x2xf32>, memref<2x2x2x3xf32>) outs(%output : memref<2x3x4x2x3xf32>) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @depthwise_conv_2d_nhwc_hwcm(%input: memref<2x4x5x2xf32>, %filter: memref<2x2x2x3xf32>, %output: memref<2x2x3x2x3xf32>) { linalg.depthwise_conv_2d_nhwc_hwcm { dilations = dense<2> : tensor<2xi64>, strides = dense<1> : tensor<2xi64> } ins(%input, %filter : memref<2x4x5x2xf32>, memref<2x2x2x3xf32>) outs(%output : memref<2x2x3x2x3xf32>) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @depthwise_conv_2d_nhwc_hwc(%input: memref<1x113x113x96xf32>, %filter: memref<3x3x96xf32>, %output: memref<1x56x56x96xf32>) { linalg.depthwise_conv_2d_nhwc_hwc {dilations = dense<1> : vector<2xi64>, strides = dense<2> : vector<2xi64>} ins(%input, %filter: memref<1x113x113x96xf32>, memref<3x3x96xf32>) outs(%output: memref<1x56x56x96xf32>) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @conv_1d_nwc_wcf(%input: memref, %filter: memref, %output: memref) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @conv_1d_ncw_fcw(%input: memref, %filter: memref, %output: memref) { linalg.conv_1d_ncw_fcw {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%input, %filter: memref, memref) outs (%output: memref) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_fill(%output: memref, %value : f32) { linalg.fill ins(%value : f32) outs(%output : memref) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @generalize_batch_matm_vec(%lhs : memref, %rhs: memref, %out: memref) { linalg.batch_matvec ins(%lhs, %rhs: memref, memref) outs(%out: memref) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @batch_reduce_gemm(%lhs: memref<7x8x9xf32>, %rhs: memref<7x9x8xf32>, %out: memref<8x8xf32>) { linalg.batch_reduce_matmul ins(%lhs, %rhs: memref<7x8x9xf32>, memref<7x9x8xf32>) outs(%out: memref<8x8xf32>) return }", mlir-opt -split-input-file -linalg-generalize-named-ops ,1 "func.func @arm_sve_sdot(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.sdot %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_smmla(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.smmla %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_udot(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.udot %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_ummla(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.ummla %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_arithi_masked(%a: vector<[4]xi32>, %b: vector<[4]xi32>, %c: vector<[4]xi32>, %d: vector<[4]xi32>, %e: vector<[4]xi32>, %mask: vector<[4]xi1> ) -> vector<[4]xi32> { %0 = arm_sve.masked.addi %mask, %a, %b : vector<[4]xi1>, vector<[4]xi32> %1 = arm_sve.masked.subi %mask, %0, %c : vector<[4]xi1>, vector<[4]xi32> %2 = arm_sve.masked.muli %mask, %1, %d : vector<[4]xi1>, vector<[4]xi32> %3 = arm_sve.masked.divi_signed %mask, %2, %e : vector<[4]xi1>, vector<[4]xi32> %4 = arm_sve.masked.divi_unsigned %mask, %3, %e : vector<[4]xi1>, vector<[4]xi32> return %4 : vector<[4]xi32> } func.func @arm_sve_arithf_masked(%a: vector<[4]xf32>, %b: vector<[4]xf32>, %c: vector<[4]xf32>, %d: vector<[4]xf32>, %e: vector<[4]xf32>, %mask: vector<[4]xi1> ) -> vector<[4]xf32> { %0 = arm_sve.masked.addf %mask, %a, %b : vector<[4]xi1>, vector<[4]xf32> %1 = arm_sve.masked.subf %mask, %0, %c : vector<[4]xi1>, vector<[4]xf32> %2 = arm_sve.masked.mulf %mask, %1, %d : vector<[4]xi1>, vector<[4]xf32> %3 = arm_sve.masked.divf %mask, %2, %e : vector<[4]xi1>, vector<[4]xf32> return %3 : vector<[4]xf32> } func.func @arm_sve_abs_diff(%a: vector<[4]xi32>, %b: vector<[4]xi32>) -> vector<[4]xi32> { %z = arith.subi %a, %a : vector<[4]xi32> %agb = arith.cmpi sge, %a, %b : vector<[4]xi32> %bga = arith.cmpi slt, %a, %b : vector<[4]xi32> %0 = arm_sve.masked.subi %agb, %a, %b : vector<[4]xi1>, vector<[4]xi32> %1 = arm_sve.masked.subi %bga, %b, %a : vector<[4]xi1>, vector<[4]xi32> %2 = arm_sve.masked.addi %agb, %z, %0 : vector<[4]xi1>, vector<[4]xi32> %3 = arm_sve.masked.addi %bga, %2, %1 : vector<[4]xi1>, vector<[4]xi32> return %3 : vector<[4]xi32> } func.func @get_vector_scale() -> index { %0 = vector.vscale return %0 : index }"," mlir-opt -convert-vector-to-llvm=""enable-arm-sve"" -convert-func-to-llvm -reconcile-unrealized-casts | mlir-opt ",1 "func.func @arm_sve_sdot(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.sdot %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_smmla(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.smmla %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_udot(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.udot %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_ummla(%a: vector<[16]xi8>, %b: vector<[16]xi8>, %c: vector<[4]xi32>) -> vector<[4]xi32> { %0 = arm_sve.ummla %c, %a, %b : vector<[16]xi8> to vector<[4]xi32> return %0 : vector<[4]xi32> } func.func @arm_sve_masked_arithi(%a: vector<[4]xi32>, %b: vector<[4]xi32>, %c: vector<[4]xi32>, %d: vector<[4]xi32>, %e: vector<[4]xi32>, %mask: vector<[4]xi1>) -> vector<[4]xi32> { %0 = arm_sve.masked.muli %mask, %a, %b : vector<[4]xi1>, vector<[4]xi32> %1 = arm_sve.masked.addi %mask, %0, %c : vector<[4]xi1>, vector<[4]xi32> %2 = arm_sve.masked.subi %mask, %1, %d : vector<[4]xi1>, vector<[4]xi32> %3 = arm_sve.masked.divi_signed %mask, %2, %e : vector<[4]xi1>, vector<[4]xi32> %4 = arm_sve.masked.divi_unsigned %mask, %3, %e : vector<[4]xi1>, vector<[4]xi32> return %2 : vector<[4]xi32> } func.func @arm_sve_masked_arithf(%a: vector<[4]xf32>, %b: vector<[4]xf32>, %c: vector<[4]xf32>, %d: vector<[4]xf32>, %e: vector<[4]xf32>, %mask: vector<[4]xi1>) -> vector<[4]xf32> { %0 = arm_sve.masked.mulf %mask, %a, %b : vector<[4]xi1>, vector<[4]xf32> %1 = arm_sve.masked.addf %mask, %0, %c : vector<[4]xi1>, vector<[4]xf32> %2 = arm_sve.masked.subf %mask, %1, %d : vector<[4]xi1>, vector<[4]xf32> %3 = arm_sve.masked.divf %mask, %2, %e : vector<[4]xi1>, vector<[4]xf32> return %3 : vector<[4]xf32> }", mlir-opt -verify-diagnostics | mlir-opt ,1 "!type = memref<2 x 32 x f32> !type1d = memref<32 x f32> func.func @saxpy2dblock(%x: !type, %y: !type, %t: !type1d, %alpha : f32, %stream : !gpu.async.token) -> !type { %c9 = arith.constant 9 : index %c7 = arith.constant 7 : index %one = arith.constant 1 : index %name = gpu.launch async[%stream] blocks(%arg3, %arg4, %arg5) in (%arg9 = %one, %arg10 = %one, %arg11 = %one) threads(%arg6, %arg7, %arg8) in (%arg12 = %one, %arg13 = %one, %arg14 = %one) { scf.forall (%i, %j) in (%c7, %c9) { %4 = memref.load %x[%i, %j] : !type %5 = memref.load %y[%i, %j] : !type %6 = math.fma %alpha, %4, %5 : f32 memref.store %6, %y[%i, %j] : !type } { mapping = [#gpu.block, #gpu.block]} gpu.terminator } return %y : !type } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""gpu.launch""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.gpu.map_forall_to_blocks %funcop grid_dims = [12, 9, 1] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "!type = memref<2 x 32 x f32> !type1d = memref<32 x f32> func.func @saxpy2d(%x: !type, %y: !type, %t: !type1d, %alpha : f32, %stream : !gpu.async.token) -> !type { %one = arith.constant 1 : index %c12 = arith.constant 12 : index %c9 = arith.constant 9 : index %c7 = arith.constant 7 : index %name = gpu.launch async[%stream] blocks(%arg3, %arg4, %arg5) in (%arg9 = %one, %arg10 = %one, %arg11 = %one) threads(%arg6, %arg7, %arg8) in (%arg12 = %one, %arg13 = %one, %arg14 = %one) { scf.forall (%i, %j) in (%c7, %c9) { %4 = memref.load %x[%i, %j] : !type %5 = memref.load %y[%i, %j] : !type %6 = math.fma %alpha, %4, %5 : f32 memref.store %6, %y[%i, %j] : !type } { mapping = [#gpu.thread, #gpu.thread]} scf.forall (%i) in (%c12) { %7 = memref.load %t[%i] : !type1d %8 = arith.addf %alpha, %7 : f32 memref.store %8, %t[%i] : !type1d } {mapping = [#gpu.thread] } gpu.terminator } return %y : !type } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""gpu.launch""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.gpu.map_nested_forall_to_threads %funcop block_dims = [12, 9, 1] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "!type4d = memref<32x64x4x32xf32> func.func @saxpy4d(%x: !type4d, %y: !type4d, %alpha : f32) -> !type4d { %c32 = arith.constant 32 : index %c64 = arith.constant 64 : index %c4 = arith.constant 4 : index scf.forall (%i, %j) in (%c32, %c64) { scf.forall (%k, %l) in (%c4, %c32) { %4 = memref.load %x[%i, %j, %k, %l] : !type4d %5 = memref.load %y[%i, %j, %k, %l] : !type4d %6 = math.fma %alpha, %4, %5 : f32 memref.store %6, %y[%i, %j, %k, %l] : !type4d } { mapping = [#gpu.thread, #gpu.thread] } } { mapping = [#gpu.block, #gpu.block] } return %y : !type4d } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""func.func""]} in %arg0 : (!transform.any_op) -> !transform.any_op %gpuLaunch = transform.gpu.map_forall_to_blocks %funcop { generate_gpu_launch } : (!transform.any_op) -> !transform.any_op transform.gpu.map_nested_forall_to_threads %gpuLaunch block_dims = [32, 4, 1] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "!type = memref<2 x 32 x f32> !type1d = memref<32 x f32> func.func @saxpy2d_no_barrier(%x: !type, %y: !type, %t: !type1d, %alpha : f32, %stream : !gpu.async.token) -> !type { %one = arith.constant 1 : index %c12 = arith.constant 12 : index %c9 = arith.constant 9 : index %c7 = arith.constant 7 : index %name = gpu.launch async[%stream] blocks(%arg3, %arg4, %arg5) in (%arg9 = %one, %arg10 = %one, %arg11 = %one) threads(%arg6, %arg7, %arg8) in (%arg12 = %one, %arg13 = %one, %arg14 = %one) { scf.forall (%i, %j) in (%c7, %c9) { %4 = memref.load %x[%i, %j] : !type %5 = memref.load %y[%i, %j] : !type %6 = math.fma %alpha, %4, %5 : f32 memref.store %6, %y[%i, %j] : !type } { mapping = [#gpu.thread, #gpu.thread] } gpu.terminator } return %y : !type } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""gpu.launch""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.gpu.map_nested_forall_to_threads %funcop block_dims = [12, 9, 1] sync_after_distribute = false : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "!type = memref<32x32xf32> func.func @saxpy2d_singleloop(%x: !type, %y: !type, %stream : !gpu.async.token) -> !type { %c32 = arith.constant 32 : index %one = arith.constant 1 : index %name = gpu.launch async[%stream] blocks(%arg3, %arg4, %arg5) in (%arg9 = %one, %arg10 = %one, %arg11 = %one) threads(%arg6, %arg7, %arg8) in (%arg12 = %one, %arg13 = %one, %arg14 = %one) { scf.forall (%i) in (%c32) { %4 = memref.load %x[%i, %i] : !type %5 = memref.load %y[%i, %i] : !type %6 = arith.mulf %4, %5 : f32 memref.store %6, %y[%i, %i] : !type } { mapping = [#gpu.thread] } gpu.terminator } return %y : !type } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""gpu.launch""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.gpu.map_nested_forall_to_threads %funcop block_dims = [32, 1, 1] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "!type = memref<3 x 2 x 32 x f32> !type1d = memref<32 x f32> func.func @saxpy3d_fold_id_z(%x: !type, %y: !type, %t: !type1d, %alpha : f32, %stream : !gpu.async.token) -> !type { %one = arith.constant 1 : index %c12 = arith.constant 12 : index %c9 = arith.constant 9 : index %c7 = arith.constant 7 : index %name = gpu.launch async[%stream] blocks(%arg3, %arg4, %arg5) in (%arg9 = %one, %arg10 = %one, %arg11 = %one) threads(%arg6, %arg7, %arg8) in (%arg12 = %one, %arg13 = %one, %arg14 = %one) { scf.forall (%i, %j, %k) in (%one, %c7, %c9) { %4 = memref.load %x[%i, %j, %k] : !type %5 = memref.load %y[%i, %j, %k] : !type %6 = math.fma %alpha, %4, %5 : f32 memref.store %6, %y[%i, %j, %k] : !type } { mapping = [#gpu.thread, #gpu.thread, #gpu.thread] } gpu.terminator } return %y : !type } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""gpu.launch""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.gpu.map_nested_forall_to_threads %funcop block_dims = [12, 9, 1] sync_after_distribute = false : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "!type = memref<2 x 32 x f32> !type1d = memref<32 x f32> func.func @map_multi_level(%x: !type, %y: !type, %t: !type1d, %alpha : f32, %stream : !gpu.async.token) -> !type { %one = arith.constant 1 : index %c10 = arith.constant 10 : index %c9 = arith.constant 9 : index %c7 = arith.constant 7 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %name = gpu.launch async[%stream] blocks(%arg3, %arg4, %arg5) in (%arg9 = %one, %arg10 = %one, %arg11 = %one) threads(%arg6, %arg7, %arg8) in (%arg12 = %one, %arg13 = %one, %arg14 = %one) { scf.forall (%i, %j) in (%c7, %c9) { %4 = memref.load %x[%i, %j] : !type %5 = memref.load %y[%i, %j] : !type %6 = math.fma %alpha, %4, %5 : f32 memref.store %6, %y[%i, %j] : !type } { mapping = [#gpu.thread, #gpu.thread]} scf.forall (%i) in (%c1) { %7 = memref.load %t[%i] : !type1d %8 = arith.addf %alpha, %7 : f32 memref.store %8, %t[%i] : !type1d } {mapping = [#gpu.warp] } scf.forall (%i, %j) in (%c10, %c2) { %7 = memref.load %t[%i] : !type1d %8 = arith.addf %alpha, %7 : f32 memref.store %8, %t[%j] : !type1d } {mapping = [#gpu.linear, #gpu.linear] } gpu.terminator } return %y : !type } transform.sequence failures(propagate) { ^bb1(%arg0: !transform.any_op): %funcop = transform.structured.match ops{[""gpu.launch""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.gpu.map_nested_forall_to_threads %funcop block_dims = [12, 11, 1] warp_dims = [3, 2, 1] : (!transform.any_op) -> !transform.any_op }", mlir-opt --test-transform-dialect-interpreter --split-input-file -canonicalize -cse ,1 "module attributes {gpu.container_module} { func.func @matvec(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_coo async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnvec, %token5 = gpu.create_dn_vec async [%token4] %mem2, %arg0 : memref %bufferSz, %token6 = gpu.spmv_buffer_size async [%token5] %env, %spmat, %dnvec, %dnvec into f64 %token7 = gpu.spmv async [%token6] %env, %spmat, %dnvec, %dnvec, %mem2 : memref into f64 %token8 = gpu.destroy_sp_mat async [%token7] %spmat %token9 = gpu.destroy_dn_vec async [%token8] %dnvec %token10 = gpu.destroy_sparse_env async [%token9] %env gpu.wait [%token10] return } func.func @matmul(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_csr async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnmat, %token5 = gpu.create_dn_mat async [%token4] %arg0, %arg0, %mem2 : memref %bufferSz, %token6 = gpu.spmm_buffer_size async [%token5] %env, %spmat, %dnmat, %dnmat into f64 %token7 = gpu.spmm async [%token6] %env, %spmat, %dnmat, %dnmat, %mem2 : memref into f64 %token8 = gpu.destroy_sp_mat async [%token7] %spmat %token9 = gpu.destroy_dn_mat async [%token8] %dnmat %token10 = gpu.destroy_sparse_env async [%token9] %env gpu.wait [%token10] return } func.func @sddmm(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_csr async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnmat, %token5 = gpu.create_dn_mat async [%token4] %arg0, %arg0, %mem2 : memref %bufferSz, %token6 = gpu.sddmm_buffer_size async [%token5] %env, %dnmat, %dnmat, %spmat into f64 %token7 = gpu.sddmm async [%token6] %env, %dnmat, %dnmat, %spmat, %mem2 : memref into f64 %token8 = gpu.destroy_sp_mat async [%token7] %spmat %token9 = gpu.destroy_dn_mat async [%token8] %dnmat %token10 = gpu.destroy_sparse_env async [%token9] %env gpu.wait [%token10] return } }", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "module { func.func @globalId(%sz : index, %mem: memref) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %sz, %grid_y = %sz, %grid_z = %sz) threads(%tx, %ty, %tz) in (%block_x = %sz, %block_y = %sz, %block_z = %sz) { %idx = gpu.global_id x memref.store %idx, %mem[] : memref %idy = gpu.global_id y memref.store %idy, %mem[] : memref %idz = gpu.global_id z memref.store %idz, %mem[] : memref gpu.terminator } return } }", mlir-opt --test-gpu-rewrite -split-input-file ,1 "gpu.module @kernels { gpu.func @kernel(%arg0 : f32) kernel { %sum = gpu.all_reduce add %arg0 uniform {} : (f32) -> (f32) gpu.return } }", mlir-opt -test-gpu-rewrite ,1 "func.func @fold_wait_op_test1() { %1 = gpu.wait async gpu.wait [] %3 = gpu.wait async gpu.wait [%3] return } func.func @fold_wait_op_test2(%arg0: i1) -> (memref<5xf16>, memref<5xf16>) { %0 = gpu.wait async %memref, %asyncToken = gpu.alloc async [%0] () : memref<5xf16> gpu.wait [%0] %1 = gpu.wait async [%0] %memref_0, %asyncToken_0 = gpu.alloc async [%1] () : memref<5xf16> gpu.wait [%1] return %memref, %memref_0 : memref<5xf16>, memref<5xf16> } func.func @fold_memcpy_op(%arg0: i1) { %cst = arith.constant 0.000000e+00 : f16 %1 = memref.alloc() : memref<2xf16> %2 = gpu.wait async %memref, %asyncToken = gpu.alloc async [%2] () : memref<2xf16> gpu.wait [%2] affine.store %cst, %memref[0] : memref<2xf16> %3 = gpu.wait async %4 = gpu.memcpy async [%3] %1, %memref : memref<2xf16>, memref<2xf16> gpu.wait [%3] %5 = scf.if %arg0 -> (i1) { memref.dealloc %1 : memref<2xf16> scf.yield %arg0 : i1 } else { memref.dealloc %1 : memref<2xf16> scf.yield %arg0 : i1 } return } func.func @do_not_fold_memcpy_op1(%arg0: i1, %arg1: memref<2xf16>) { %cst = arith.constant 0.000000e+00 : f16 %2 = gpu.wait async %memref, %asyncToken = gpu.alloc async [%2] () : memref<2xf16> gpu.wait [%2] affine.store %cst, %memref[0] : memref<2xf16> %3 = gpu.wait async %4 = gpu.memcpy async [%3] %arg1, %memref : memref<2xf16>, memref<2xf16> gpu.wait [%3] return } func.func @do_not_fold_memcpy_op2(%arg0: i1, %arg1: index) -> f16 { %cst = arith.constant 0.000000e+00 : f16 %1 = memref.alloc() : memref<2xf16> %2 = gpu.wait async %memref, %asyncToken = gpu.alloc async [%2] () : memref<2xf16> gpu.wait [%2] affine.store %cst, %memref[0] : memref<2xf16> %3 = gpu.wait async %4 = gpu.memcpy async [%3] %1, %memref : memref<2xf16>, memref<2xf16> gpu.wait [%3] %5 = memref.load %1[%arg1] : memref<2xf16> return %5 : f16 } func.func @do_not_fold_memcpy_op3(%arg0: memref<1xi8>, %arg1: memref) { %0 = arith.constant 0 : index %1 = memref.view %arg0[%0][] : memref<1xi8> to memref gpu.memcpy %1, %arg1 : memref, memref func.return } func.func @memcpy_after_cast(%arg0: memref<10xf32>, %arg1: memref<10xf32>) { %0 = memref.cast %arg0 : memref<10xf32> to memref %1 = memref.cast %arg1 : memref<10xf32> to memref gpu.memcpy %0, %1 : memref, memref return } func.func @memset_after_cast(%arg0: memref<10xf32>, %arg1: f32) { %0 = memref.cast %arg0 : memref<10xf32> to memref gpu.memset %0, %arg1 : memref, f32 return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @gpu_dim_of_alloc(%size: index) -> index { %0 = gpu.alloc(%size) : memref %c0 = arith.constant 0 : index %1 = memref.dim %0, %c0 : memref return %1 : index }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @simplify_gpu_launch() attributes {llvm.emit_c_interface} { %cst = arith.constant 0.000000e+00 : f32 %c1 = arith.constant 1 : index %c32 = arith.constant 32 : index %c16 = arith.constant 16 : index %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<2x16x16xf32> scf.for %arg0 = %c0 to %c2 step %c1 { scf.for %arg1 = %c0 to %c16 step %c1 { scf.for %arg2 = %c0 to %c16 step %c1 { memref.store %cst, %0[%arg0, %arg1, %arg2] : memref<2x16x16xf32> } } } %1 = gpu.wait async %memref, %asyncToken = gpu.alloc async [%1] () : memref<2x16x16xf32> %2 = gpu.memcpy async [%1] %memref, %0 : memref<2x16x16xf32>, memref<2x16x16xf32> gpu.wait [%1] gpu.launch blocks(%arg0, %arg1, %arg2) in (%arg6 = %c1, %arg7 = %c1, %arg8 = %c1) threads(%arg3, %arg4, %arg5) in (%arg9 = %c32, %arg10 = %c1, %arg11 = %c1) { %3 = arith.muli %arg5, %c32 : index %4 = arith.muli %arg4, %c32 : index %5 = arith.addi %3, %4 : index %6 = arith.addi %5, %arg3 : index %7 = arith.divui %6, %c32 : index %8 = arith.muli %arg0, %c16 : index %9 = arith.muli %arg1, %c2 : index %10 = arith.muli %7, %c2 : index %11 = arith.addi %9, %10 : index %12 = memref.load %memref[%11, %c0, %8] : memref<2x16x16xf32> %13 = arith.addi %11, %c1 : index %14 = memref.load %memref[%13, %c0, %8] : memref<2x16x16xf32> memref.store %12, %memref[%11, %c0, %8] : memref<2x16x16xf32> memref.store %14, %memref[%13, %c0, %8] : memref<2x16x16xf32> gpu.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @make_reduce_uniform() { %0:6 = ""test.test1""() : () -> (index, index, index, index, index, index) gpu.launch blocks(%arg0, %arg1, %arg2) in (%arg6 = %0#0, %arg7 = %0#1, %arg8 = %0#2) threads(%arg3, %arg4, %arg5) in (%arg9 = %0#3, %arg10 = %0#4, %arg11 = %0#5) { %1 = ""test.test2""() : () -> i32 %2 = gpu.all_reduce add %1 {} : (i32) -> (i32) ""test.test3""(%2) : (i32) -> () gpu.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @make_subgroup_reduce_uniform() { %0:6 = ""test.test1""() : () -> (index, index, index, index, index, index) gpu.launch blocks(%arg0, %arg1, %arg2) in (%arg6 = %0#0, %arg7 = %0#1, %arg8 = %0#2) threads(%arg3, %arg4, %arg5) in (%arg9 = %0#3, %arg10 = %0#4, %arg11 = %0#5) { %1 = ""test.test2""() : () -> i32 %2 = gpu.subgroup_reduce add %1 : (i32) -> (i32) ""test.test3""(%2) : (i32) -> () gpu.terminator } return }"," mlir-opt -canonicalize=""test-convergence"" --split-input-file -allow-unregistered-dialect ",1 "func.func @launch() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref) %gDimX = arith.constant 8 : index %gDimY = arith.constant 12 : index %gDimZ = arith.constant 16 : index %bDimX = arith.constant 20 : index %bDimY = arith.constant 24 : index %bDimZ = arith.constant 28 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %gDimX, %grid_y = %gDimY, %grid_z = %gDimZ) threads(%tx, %ty, %tz) in (%block_x = %bDimX, %block_y = %bDimY, %block_z = %bDimZ) { ""use""(%0): (f32) -> () ""some_op""(%bx, %block_x) : (index, index) -> () %42 = memref.load %1[%tx] : memref gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @launch() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref) %gDimX = arith.constant 8 : index %gDimY = arith.constant 12 : index %gDimZ = arith.constant 16 : index %bDimX = arith.constant 20 : index %bDimY = arith.constant 24 : index %bDimZ = arith.constant 28 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %gDimX, %grid_y = %gDimY, %grid_z = %gDimZ) threads(%tx, %ty, %tz) in (%block_x = %bDimX, %block_y = %bDimY, %block_z = %bDimZ) { ""use""(%0): (f32) -> () ""some_op""(%bx, %block_x) : (index, index) -> () %42 = memref.load %1[%tx] : memref gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @multiple_launches() { %cst = arith.constant 8 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { gpu.terminator } gpu.launch blocks(%bx2, %by2, %bz2) in (%grid_x2 = %cst, %grid_y2 = %cst, %grid_z2 = %cst) threads(%tx2, %ty2, %tz2) in (%block_x2 = %cst, %block_y2 = %cst, %block_z2 = %cst) { gpu.terminator } %t = gpu.wait async %u = gpu.launch async [%t] blocks(%bx2, %by2, %bz2) in (%grid_x2 = %cst, %grid_y2 = %cst, %grid_z2 = %cst) threads(%tx2, %ty2, %tz2) in (%block_x2 = %cst, %block_y2 = %cst, %block_z2 = %cst) { gpu.terminator } %v = gpu.launch async blocks(%bx2, %by2, %bz2) in (%grid_x2 = %cst, %grid_y2 = %cst, %grid_z2 = %cst) threads(%tx2, %ty2, %tz2) in (%block_x2 = %cst, %block_y2 = %cst, %block_z2 = %cst) { gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @multiple_launches() { %cst = arith.constant 8 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { gpu.terminator } gpu.launch blocks(%bx2, %by2, %bz2) in (%grid_x2 = %cst, %grid_y2 = %cst, %grid_z2 = %cst) threads(%tx2, %ty2, %tz2) in (%block_x2 = %cst, %block_y2 = %cst, %block_z2 = %cst) { gpu.terminator } %t = gpu.wait async %u = gpu.launch async [%t] blocks(%bx2, %by2, %bz2) in (%grid_x2 = %cst, %grid_y2 = %cst, %grid_z2 = %cst) threads(%tx2, %ty2, %tz2) in (%block_x2 = %cst, %block_y2 = %cst, %block_z2 = %cst) { gpu.terminator } %v = gpu.launch async blocks(%bx2, %by2, %bz2) in (%grid_x2 = %cst, %grid_y2 = %cst, %grid_z2 = %cst) threads(%tx2, %ty2, %tz2) in (%block_x2 = %cst, %block_y2 = %cst, %block_z2 = %cst) { gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @extra_constants_not_inlined(%arg0: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = ""secret_constant""() : () -> index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @extra_constants_not_inlined(%arg0: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = ""secret_constant""() : () -> index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @extra_constants(%arg0: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = memref.dim %arg0, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @extra_constants(%arg0: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = memref.dim %arg0, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @extra_constants_noarg(%arg0: memref, %arg1: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = memref.dim %arg1, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @extra_constants_noarg(%arg0: memref, %arg1: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = memref.dim %arg1, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @multiple_uses(%arg0 : memref) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { ""use1""(%c2, %c2) : (index, index) -> () ""use2""(%c2) : (index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @multiple_uses(%arg0 : memref) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { ""use1""(%c2, %c2) : (index, index) -> () ""use2""(%c2) : (index) -> () gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @multiple_uses2(%arg0 : memref<*xf32>) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d = memref.dim %arg0, %c2 : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { ""use1""(%d) : (index) -> () ""use2""(%c2, %c2) : (index, index) -> () ""use3""(%arg0) : (memref<*xf32>) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @multiple_uses2(%arg0 : memref<*xf32>) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d = memref.dim %arg0, %c2 : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { ""use1""(%d) : (index) -> () ""use2""(%c2, %c2) : (index, index) -> () ""use3""(%arg0) : (memref<*xf32>) -> () gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "llvm.mlir.global internal @global(42 : i64) : i64 func.func @function_call(%arg0 : memref) { %cst = arith.constant 8 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { func.call @device_function() : () -> () func.call @device_function() : () -> () %0 = llvm.mlir.addressof @global : !llvm.ptr gpu.terminator } return } func.func @device_function() { call @recursive_device_function() : () -> () return } func.func @recursive_device_function() { call @recursive_device_function() : () -> () return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "llvm.mlir.global internal @global(42 : i64) : i64 func.func @function_call(%arg0 : memref) { %cst = arith.constant 8 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { func.call @device_function() : () -> () func.call @device_function() : () -> () %0 = llvm.mlir.addressof @global : !llvm.ptr gpu.terminator } return } func.func @device_function() { call @recursive_device_function() : () -> () return } func.func @recursive_device_function() { call @recursive_device_function() : () -> () return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @non_constant_launches(%arg0 : index) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %arg0, %grid_y = %arg0, %grid_z = %arg0) threads(%tx, %ty, %tz) in (%block_x = %arg0, %block_y = %arg0, %block_z = %arg0) { gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @non_constant_launches(%arg0 : index) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %arg0, %grid_y = %arg0, %grid_z = %arg0) threads(%tx, %ty, %tz) in (%block_x = %arg0, %block_y = %arg0, %block_z = %arg0) { gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @launch_memory_attributions_0() { %1 = ""op""() : () -> (memref) %128 = arith.constant 128 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %128, %grid_y = %128, %grid_z = %128) threads(%tx, %ty, %tz) in (%block_x = %128, %block_y = %128, %block_z = %128) workgroup(%shared: memref<42xf32, 3>) private(%priv0: memref<2xf32, 5>, %priv1: memref<1xf32, 5>) { ""some_op""(%bx, %block_x) : (index, index) -> () %42 = memref.load %1[%tx] : memref %43 = memref.load %shared[%tx] : memref<42xf32, 3> %44 = memref.load %priv1[%tx] : memref<1xf32, 5> gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @launch_memory_attributions_0() { %1 = ""op""() : () -> (memref) %128 = arith.constant 128 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %128, %grid_y = %128, %grid_z = %128) threads(%tx, %ty, %tz) in (%block_x = %128, %block_y = %128, %block_z = %128) workgroup(%shared: memref<42xf32, 3>) private(%priv0: memref<2xf32, 5>, %priv1: memref<1xf32, 5>) { ""some_op""(%bx, %block_x) : (index, index) -> () %42 = memref.load %1[%tx] : memref %43 = memref.load %shared[%tx] : memref<42xf32, 3> %44 = memref.load %priv1[%tx] : memref<1xf32, 5> gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "func.func @launch_memory_attributions_1(%arg0 : memref<*xf32>) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d = memref.dim %arg0, %c2 : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) private(%priv0: memref<3xf32, 5>) { %42 = memref.load %priv0[%c2] : memref<3xf32, 5> gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining -split-input-file -verify-diagnostics ,1 "func.func @launch_memory_attributions_1(%arg0 : memref<*xf32>) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d = memref.dim %arg0, %c2 : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) private(%priv0: memref<3xf32, 5>) { %42 = memref.load %priv0[%c2] : memref<3xf32, 5> gpu.terminator } return }"," mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -gpu-kernel-outlining=data-layout-str='#dlti.dl_spec<#dlti.dl_entry>' -split-input-file ",1 "module { func.func @shuffleF64(%sz : index, %value: f64, %offset: i32, %width: i32, %mem: memref) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %sz, %grid_y = %sz, %grid_z = %sz) threads(%tx, %ty, %tz) in (%block_x = %sz, %block_y = %sz, %block_z = %sz) { %shfl, %pred = gpu.shuffle xor %value, %offset, %width : f64 memref.store %shfl, %mem[] : memref gpu.terminator } return } }", mlir-opt --test-gpu-rewrite -split-input-file ,1 "module { func.func @shuffleI64(%sz : index, %value: i64, %offset: i32, %width: i32, %mem: memref) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %sz, %grid_y = %sz, %grid_z = %sz) threads(%tx, %ty, %tz) in (%block_x = %sz, %block_y = %sz, %block_z = %sz) { %shfl, %pred = gpu.shuffle xor %value, %offset, %width : i64 memref.store %shfl, %mem[] : memref gpu.terminator } return } }", mlir-opt --test-gpu-rewrite -split-input-file ,1 "func.func @main() { %data = memref.alloc() : memref<2x6xf32> %sum = memref.alloc() : memref<2xf32> %mul = memref.alloc() : memref<2xf32> %c1 = arith.constant 1 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xf32> %reduced0 = gpu.all_reduce add %val uniform {} : (f32) -> (f32) memref.store %reduced0, %sum[%bx] : memref<2xf32> %reduced1 = gpu.all_reduce mul %val uniform {} : (f32) -> (f32) memref.store %reduced1, %mul[%bx] : memref<2xf32> gpu.terminator } return }", mlir-opt --gpu-kernel-outlining --convert-gpu-to-nvvm ,1 "gpu.module @foo { gpu.func @memref3d(%arg0: memref<5x4xf32> {gpu.test_promote_workgroup}) kernel { ""use""(%arg0) : (memref<5x4xf32>) -> () gpu.return } }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(gpu.module(gpu.func(test-gpu-memory-promotion)))' -split-input-file ,1 "gpu.module @foo { gpu.func @memref5d(%arg0: memref<8x7x6x5x4xf32> {gpu.test_promote_workgroup}) kernel { ""use""(%arg0) : (memref<8x7x6x5x4xf32>) -> () gpu.return } }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(gpu.module(gpu.func(test-gpu-memory-promotion)))' -split-input-file ,1 "gpu.module @foo { gpu.func @insert(%arg0: memref<4xf32> {gpu.test_promote_workgroup}) workgroup(%arg1: memref<1x1xf64, #gpu.address_space>) private(%arg2: memref<1x1xi64, 5>) kernel { ""use""(%arg0) : (memref<4xf32>) -> () gpu.return } }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(gpu.module(gpu.func(test-gpu-memory-promotion)))' -split-input-file ,1 "module attributes {gpu.container_module} { func.func @no_args(%sz : index) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %sz, %grid_y = %sz, %grid_z = %sz) threads(%tx, %ty, %tz) in (%block_x = %sz, %block_y = %sz, %block_z = %sz) { gpu.terminator } return } func.func @args(%blk : index, %thrd : index, %float : f32, %data : memref) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%tx, %ty, %tz) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { ""use""(%float) : (f32) -> () ""use""(%data) : (memref) -> () gpu.terminator } return } func.func @launch_async(%blk : index, %thrd : index) { %t = gpu.wait async %name = gpu.launch async [%t] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } return } func.func @launch_async_no_deps(%blk : index, %thrd : index) { %t0 = gpu.launch async blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } %t1 = gpu.launch async [] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } return } gpu.module @kernels { gpu.func @kernel_1(%arg0 : f32, %arg1 : memref) kernel { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z %gIdX = gpu.global_id x %gIdY = gpu.global_id y %gIdZ = gpu.global_id z %sgId = gpu.subgroup_id : index %numSg = gpu.num_subgroups : index %SgSi = gpu.subgroup_size : index %one = arith.constant 1.0 : f32 %sum = gpu.all_reduce add %one {} : (f32) -> (f32) %sum1 = gpu.all_reduce add %one uniform {} : (f32) -> f32 %sum_subgroup = gpu.subgroup_reduce add %one : (f32) -> f32 %sum_subgroup1 = gpu.subgroup_reduce add %one uniform : (f32) -> f32 %width = arith.constant 7 : i32 %offset = arith.constant 3 : i32 %shfl, %pred = gpu.shuffle xor %arg0, %offset, %width : f32 %shfl1, %pred1 = gpu.shuffle up %arg0, %offset, %width : f32 %shfl2, %pred2 = gpu.shuffle down %arg0, %offset, %width : f32 %shfl3, %pred3 = gpu.shuffle idx %arg0, %offset, %width : f32 ""gpu.barrier""() : () -> () ""some_op""(%bIdX, %tIdX) : (index, index) -> () %42 = memref.load %arg1[%bIdX] : memref gpu.return } gpu.func @kernel_2() kernel { gpu.return } } func.func private @two_value_generator() -> (f32, memref) func.func @foo() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref) %cst = arith.constant 8 : index %c0 = arith.constant 0 : i32 %t0 = gpu.wait async gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref) gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) dynamic_shared_memory_size %c0 args(%0 : f32, %1 : memref) gpu.launch_func @kernels::@kernel_2 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) %t1 = gpu.launch_func async [%t0] @kernels::@kernel_2 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) %values:2 = func.call @two_value_generator() : () -> (f32, memref) gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%values#0 : f32, %values#1 : memref) return } gpu.module @gpu_funcs { gpu.func @kernel_1(%arg0: f32) workgroup(%arg1: memref<42xf32, 3>) private(%arg2: memref<2xf32, 5>, %arg3: memref<1xf32, 5>) kernel attributes {foo=""bar""} { ""use""(%arg1) : (memref<42xf32, 3>) -> () ""use""(%arg2) : (memref<2xf32, 5>) -> () ""use""(%arg3) : (memref<1xf32, 5>) -> () gpu.return } gpu.func @printf_test(%arg0 : i32) { gpu.printf ""Value: %d"" %arg0 : i32 gpu.return } gpu.func @no_attribution(%arg0: f32) { gpu.return } gpu.func @no_attribution_attrs(%arg0: f32) attributes {foo=""bar""} { gpu.return } gpu.func @workgroup_only() workgroup(%arg0: memref<42xf32, 3>) { gpu.return } gpu.func @private_only() private(%arg0: memref<2xf32, 5>) { gpu.return } gpu.func @empty_attribution(%arg0: f32) workgroup() private() { gpu.return } } gpu.module @explicit_attributions { ""gpu.func""() ({ ^bb0(%arg0: f32, %arg1: memref, %arg2: memref<5xf32, 3>, %arg3: memref<5xf32, 5>): ""gpu.return""() : () -> () } ) {function_type = (f32, memref) -> (), gpu.kernel, sym_name = ""kernel_1"", workgroup_attributions = 1: i64} : () -> () } func.func @alloc() { %m0 = gpu.alloc () : memref<13xf32, 1> gpu.dealloc %m0 : memref<13xf32, 1> %t0 = gpu.wait async %m1, %t1 = gpu.alloc async [%t0] () : memref<13xf32, 1> %t2 = gpu.dealloc async [%t1] %m1 : memref<13xf32, 1> %m2 = gpu.alloc host_shared () : memref<13xf32, 1> gpu.dealloc %m2 : memref<13xf32, 1> return } func.func @async_token(%arg0 : !gpu.async.token) -> !gpu.async.token { return %arg0 : !gpu.async.token } func.func @async_wait() { %0 = gpu.wait async %1 = gpu.wait async [%0] %2 = gpu.wait async [%0, %1] gpu.wait [%0, %1] gpu.wait return } func.func @memcpy(%dst : memref<3x7xf32>, %src : memref<3x7xf32, 1>) { gpu.memcpy %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1> %0 = gpu.wait async %1 = gpu.memcpy async [%0] %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1> return } func.func @memset(%dst : memref<3x7xf32>, %value : f32) { gpu.memset %dst, %value : memref<3x7xf32>, f32 %0 = gpu.wait async %1 = gpu.memset async [%0] %dst, %value : memref<3x7xf32>, f32 return } func.func @mmamatrix_valid_scalar_element_type(%src : memref<32x32xf16, affine_map<(d0, d1) -> (d0 * 64 + d1)>>){ %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %cst = arith.constant 1.000000e+00 : f32 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %s = gpu.subgroup_mma_load_matrix %src[%i, %i] {leadDimension = 64 : index} : memref<32x32xf16, affine_map<(d0, d1) -> (d0 * 64 + d1)>> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %1 = gpu.subgroup_mma_constant_matrix %cst : !gpu.mma_matrix<16x16xf32, ""COp""> %2 = gpu.subgroup_mma_elementwise addf %1, %1 : (!gpu.mma_matrix<16x16xf32, ""COp"">, !gpu.mma_matrix<16x16xf32, ""COp"">) -> !gpu.mma_matrix<16x16xf32, ""COp""> %3 = gpu.subgroup_mma_elementwise maxf %2, %1 : (!gpu.mma_matrix<16x16xf32, ""COp"">, !gpu.mma_matrix<16x16xf32, ""COp"">) -> !gpu.mma_matrix<16x16xf32, ""COp""> return } func.func @mmamatrix_valid_vector_element_type(%src : memref<32x4xvector<4xf32>>, %i : index) { %s = gpu.subgroup_mma_load_matrix %src[%i, %i] {leadDimension = 4 : index} : memref<32x4xvector<4xf32>> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.subgroup_mma_store_matrix %s, %src[%i, %i] {leadDimension = 4 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x4xvector<4xf32>> return } func.func @set_default_device(%arg0: i32) { gpu.set_default_device %arg0 return } func.func @sparse_ops(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_coo async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %spmat2, %token5 = gpu.create_csr async [%token4] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnvec, %token6 = gpu.create_dn_vec async [%token5] %mem2, %arg0 : memref %bufferSz, %token7 = gpu.spmv_buffer_size async [%token6] %env, %spmat, %dnvec, %dnvec into f64 %token8 = gpu.spmv async [%token7] %env, %spmat, %dnvec, %dnvec, %mem2 : memref into f64 %dnmat, %token9 = gpu.create_dn_mat async [%token8] %arg0, %arg0, %mem2 : memref %bufferSz2, %token10 = gpu.spmm_buffer_size async [%token9] %env, %spmat, %dnmat, %dnmat into f64 %token11 = gpu.spmm async [%token10] %env, %spmat, %dnmat, %dnmat, %mem2 : memref into f64 %bufferSz3, %token12 = gpu.sddmm_buffer_size async [%token11] %env, %dnmat, %dnmat, %spmat into f64 %token13 = gpu.sddmm async [%token12] %env, %dnmat, %dnmat, %spmat, %mem2 : memref into f64 %token14 = gpu.destroy_dn_mat async [%token13] %dnmat %token15 = gpu.destroy_sp_mat async [%token14] %spmat %token16 = gpu.destroy_dn_vec async [%token15] %dnvec %token17 = gpu.destroy_sparse_env async [%token16] %env gpu.wait [%token17] return } } gpu.module @module { ""gpu.func""() ({ gpu.return }) {function_type = () -> (), sym_name = ""func""} : () -> () }", mlir-opt -allow-unregistered-dialect ,1 "module attributes {gpu.container_module} { func.func @no_args(%sz : index) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %sz, %grid_y = %sz, %grid_z = %sz) threads(%tx, %ty, %tz) in (%block_x = %sz, %block_y = %sz, %block_z = %sz) { gpu.terminator } return } func.func @args(%blk : index, %thrd : index, %float : f32, %data : memref) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%tx, %ty, %tz) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { ""use""(%float) : (f32) -> () ""use""(%data) : (memref) -> () gpu.terminator } return } func.func @launch_async(%blk : index, %thrd : index) { %t = gpu.wait async %name = gpu.launch async [%t] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } return } func.func @launch_async_no_deps(%blk : index, %thrd : index) { %t0 = gpu.launch async blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } %t1 = gpu.launch async [] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } return } gpu.module @kernels { gpu.func @kernel_1(%arg0 : f32, %arg1 : memref) kernel { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z %gIdX = gpu.global_id x %gIdY = gpu.global_id y %gIdZ = gpu.global_id z %sgId = gpu.subgroup_id : index %numSg = gpu.num_subgroups : index %SgSi = gpu.subgroup_size : index %one = arith.constant 1.0 : f32 %sum = gpu.all_reduce add %one {} : (f32) -> (f32) %sum1 = gpu.all_reduce add %one uniform {} : (f32) -> f32 %sum_subgroup = gpu.subgroup_reduce add %one : (f32) -> f32 %sum_subgroup1 = gpu.subgroup_reduce add %one uniform : (f32) -> f32 %width = arith.constant 7 : i32 %offset = arith.constant 3 : i32 %shfl, %pred = gpu.shuffle xor %arg0, %offset, %width : f32 %shfl1, %pred1 = gpu.shuffle up %arg0, %offset, %width : f32 %shfl2, %pred2 = gpu.shuffle down %arg0, %offset, %width : f32 %shfl3, %pred3 = gpu.shuffle idx %arg0, %offset, %width : f32 ""gpu.barrier""() : () -> () ""some_op""(%bIdX, %tIdX) : (index, index) -> () %42 = memref.load %arg1[%bIdX] : memref gpu.return } gpu.func @kernel_2() kernel { gpu.return } } func.func private @two_value_generator() -> (f32, memref) func.func @foo() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref) %cst = arith.constant 8 : index %c0 = arith.constant 0 : i32 %t0 = gpu.wait async gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref) gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) dynamic_shared_memory_size %c0 args(%0 : f32, %1 : memref) gpu.launch_func @kernels::@kernel_2 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) %t1 = gpu.launch_func async [%t0] @kernels::@kernel_2 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) %values:2 = func.call @two_value_generator() : () -> (f32, memref) gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%values#0 : f32, %values#1 : memref) return } gpu.module @gpu_funcs { gpu.func @kernel_1(%arg0: f32) workgroup(%arg1: memref<42xf32, 3>) private(%arg2: memref<2xf32, 5>, %arg3: memref<1xf32, 5>) kernel attributes {foo=""bar""} { ""use""(%arg1) : (memref<42xf32, 3>) -> () ""use""(%arg2) : (memref<2xf32, 5>) -> () ""use""(%arg3) : (memref<1xf32, 5>) -> () gpu.return } gpu.func @printf_test(%arg0 : i32) { gpu.printf ""Value: %d"" %arg0 : i32 gpu.return } gpu.func @no_attribution(%arg0: f32) { gpu.return } gpu.func @no_attribution_attrs(%arg0: f32) attributes {foo=""bar""} { gpu.return } gpu.func @workgroup_only() workgroup(%arg0: memref<42xf32, 3>) { gpu.return } gpu.func @private_only() private(%arg0: memref<2xf32, 5>) { gpu.return } gpu.func @empty_attribution(%arg0: f32) workgroup() private() { gpu.return } } gpu.module @explicit_attributions { ""gpu.func""() ({ ^bb0(%arg0: f32, %arg1: memref, %arg2: memref<5xf32, 3>, %arg3: memref<5xf32, 5>): ""gpu.return""() : () -> () } ) {function_type = (f32, memref) -> (), gpu.kernel, sym_name = ""kernel_1"", workgroup_attributions = 1: i64} : () -> () } func.func @alloc() { %m0 = gpu.alloc () : memref<13xf32, 1> gpu.dealloc %m0 : memref<13xf32, 1> %t0 = gpu.wait async %m1, %t1 = gpu.alloc async [%t0] () : memref<13xf32, 1> %t2 = gpu.dealloc async [%t1] %m1 : memref<13xf32, 1> %m2 = gpu.alloc host_shared () : memref<13xf32, 1> gpu.dealloc %m2 : memref<13xf32, 1> return } func.func @async_token(%arg0 : !gpu.async.token) -> !gpu.async.token { return %arg0 : !gpu.async.token } func.func @async_wait() { %0 = gpu.wait async %1 = gpu.wait async [%0] %2 = gpu.wait async [%0, %1] gpu.wait [%0, %1] gpu.wait return } func.func @memcpy(%dst : memref<3x7xf32>, %src : memref<3x7xf32, 1>) { gpu.memcpy %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1> %0 = gpu.wait async %1 = gpu.memcpy async [%0] %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1> return } func.func @memset(%dst : memref<3x7xf32>, %value : f32) { gpu.memset %dst, %value : memref<3x7xf32>, f32 %0 = gpu.wait async %1 = gpu.memset async [%0] %dst, %value : memref<3x7xf32>, f32 return } func.func @mmamatrix_valid_scalar_element_type(%src : memref<32x32xf16, affine_map<(d0, d1) -> (d0 * 64 + d1)>>){ %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %cst = arith.constant 1.000000e+00 : f32 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %s = gpu.subgroup_mma_load_matrix %src[%i, %i] {leadDimension = 64 : index} : memref<32x32xf16, affine_map<(d0, d1) -> (d0 * 64 + d1)>> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %1 = gpu.subgroup_mma_constant_matrix %cst : !gpu.mma_matrix<16x16xf32, ""COp""> %2 = gpu.subgroup_mma_elementwise addf %1, %1 : (!gpu.mma_matrix<16x16xf32, ""COp"">, !gpu.mma_matrix<16x16xf32, ""COp"">) -> !gpu.mma_matrix<16x16xf32, ""COp""> %3 = gpu.subgroup_mma_elementwise maxf %2, %1 : (!gpu.mma_matrix<16x16xf32, ""COp"">, !gpu.mma_matrix<16x16xf32, ""COp"">) -> !gpu.mma_matrix<16x16xf32, ""COp""> return } func.func @mmamatrix_valid_vector_element_type(%src : memref<32x4xvector<4xf32>>, %i : index) { %s = gpu.subgroup_mma_load_matrix %src[%i, %i] {leadDimension = 4 : index} : memref<32x4xvector<4xf32>> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.subgroup_mma_store_matrix %s, %src[%i, %i] {leadDimension = 4 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x4xvector<4xf32>> return } func.func @set_default_device(%arg0: i32) { gpu.set_default_device %arg0 return } func.func @sparse_ops(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_coo async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %spmat2, %token5 = gpu.create_csr async [%token4] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnvec, %token6 = gpu.create_dn_vec async [%token5] %mem2, %arg0 : memref %bufferSz, %token7 = gpu.spmv_buffer_size async [%token6] %env, %spmat, %dnvec, %dnvec into f64 %token8 = gpu.spmv async [%token7] %env, %spmat, %dnvec, %dnvec, %mem2 : memref into f64 %dnmat, %token9 = gpu.create_dn_mat async [%token8] %arg0, %arg0, %mem2 : memref %bufferSz2, %token10 = gpu.spmm_buffer_size async [%token9] %env, %spmat, %dnmat, %dnmat into f64 %token11 = gpu.spmm async [%token10] %env, %spmat, %dnmat, %dnmat, %mem2 : memref into f64 %bufferSz3, %token12 = gpu.sddmm_buffer_size async [%token11] %env, %dnmat, %dnmat, %spmat into f64 %token13 = gpu.sddmm async [%token12] %env, %dnmat, %dnmat, %spmat, %mem2 : memref into f64 %token14 = gpu.destroy_dn_mat async [%token13] %dnmat %token15 = gpu.destroy_sp_mat async [%token14] %spmat %token16 = gpu.destroy_dn_vec async [%token15] %dnvec %token17 = gpu.destroy_sparse_env async [%token16] %env gpu.wait [%token17] return } } gpu.module @module { ""gpu.func""() ({ gpu.return }) {function_type = () -> (), sym_name = ""func""} : () -> () }", mlir-opt -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect ,1 "module attributes {gpu.container_module} { func.func @no_args(%sz : index) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %sz, %grid_y = %sz, %grid_z = %sz) threads(%tx, %ty, %tz) in (%block_x = %sz, %block_y = %sz, %block_z = %sz) { gpu.terminator } return } func.func @args(%blk : index, %thrd : index, %float : f32, %data : memref) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%tx, %ty, %tz) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { ""use""(%float) : (f32) -> () ""use""(%data) : (memref) -> () gpu.terminator } return } func.func @launch_async(%blk : index, %thrd : index) { %t = gpu.wait async %name = gpu.launch async [%t] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } return } func.func @launch_async_no_deps(%blk : index, %thrd : index) { %t0 = gpu.launch async blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } %t1 = gpu.launch async [] blocks(%arg0, %arg1, %arg2) in (%grid_x = %blk, %grid_y = %blk, %grid_z = %blk) threads(%arg3, %arg4, %arg5) in (%block_x = %thrd, %block_y = %thrd, %block_z = %thrd) { gpu.terminator } return } gpu.module @kernels { gpu.func @kernel_1(%arg0 : f32, %arg1 : memref) kernel { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z %gIdX = gpu.global_id x %gIdY = gpu.global_id y %gIdZ = gpu.global_id z %sgId = gpu.subgroup_id : index %numSg = gpu.num_subgroups : index %SgSi = gpu.subgroup_size : index %one = arith.constant 1.0 : f32 %sum = gpu.all_reduce add %one {} : (f32) -> (f32) %sum1 = gpu.all_reduce add %one uniform {} : (f32) -> f32 %sum_subgroup = gpu.subgroup_reduce add %one : (f32) -> f32 %sum_subgroup1 = gpu.subgroup_reduce add %one uniform : (f32) -> f32 %width = arith.constant 7 : i32 %offset = arith.constant 3 : i32 %shfl, %pred = gpu.shuffle xor %arg0, %offset, %width : f32 %shfl1, %pred1 = gpu.shuffle up %arg0, %offset, %width : f32 %shfl2, %pred2 = gpu.shuffle down %arg0, %offset, %width : f32 %shfl3, %pred3 = gpu.shuffle idx %arg0, %offset, %width : f32 ""gpu.barrier""() : () -> () ""some_op""(%bIdX, %tIdX) : (index, index) -> () %42 = memref.load %arg1[%bIdX] : memref gpu.return } gpu.func @kernel_2() kernel { gpu.return } } func.func private @two_value_generator() -> (f32, memref) func.func @foo() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref) %cst = arith.constant 8 : index %c0 = arith.constant 0 : i32 %t0 = gpu.wait async gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref) gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) dynamic_shared_memory_size %c0 args(%0 : f32, %1 : memref) gpu.launch_func @kernels::@kernel_2 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) %t1 = gpu.launch_func async [%t0] @kernels::@kernel_2 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) %values:2 = func.call @two_value_generator() : () -> (f32, memref) gpu.launch_func @kernels::@kernel_1 blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%values#0 : f32, %values#1 : memref) return } gpu.module @gpu_funcs { gpu.func @kernel_1(%arg0: f32) workgroup(%arg1: memref<42xf32, 3>) private(%arg2: memref<2xf32, 5>, %arg3: memref<1xf32, 5>) kernel attributes {foo=""bar""} { ""use""(%arg1) : (memref<42xf32, 3>) -> () ""use""(%arg2) : (memref<2xf32, 5>) -> () ""use""(%arg3) : (memref<1xf32, 5>) -> () gpu.return } gpu.func @printf_test(%arg0 : i32) { gpu.printf ""Value: %d"" %arg0 : i32 gpu.return } gpu.func @no_attribution(%arg0: f32) { gpu.return } gpu.func @no_attribution_attrs(%arg0: f32) attributes {foo=""bar""} { gpu.return } gpu.func @workgroup_only() workgroup(%arg0: memref<42xf32, 3>) { gpu.return } gpu.func @private_only() private(%arg0: memref<2xf32, 5>) { gpu.return } gpu.func @empty_attribution(%arg0: f32) workgroup() private() { gpu.return } } gpu.module @explicit_attributions { ""gpu.func""() ({ ^bb0(%arg0: f32, %arg1: memref, %arg2: memref<5xf32, 3>, %arg3: memref<5xf32, 5>): ""gpu.return""() : () -> () } ) {function_type = (f32, memref) -> (), gpu.kernel, sym_name = ""kernel_1"", workgroup_attributions = 1: i64} : () -> () } func.func @alloc() { %m0 = gpu.alloc () : memref<13xf32, 1> gpu.dealloc %m0 : memref<13xf32, 1> %t0 = gpu.wait async %m1, %t1 = gpu.alloc async [%t0] () : memref<13xf32, 1> %t2 = gpu.dealloc async [%t1] %m1 : memref<13xf32, 1> %m2 = gpu.alloc host_shared () : memref<13xf32, 1> gpu.dealloc %m2 : memref<13xf32, 1> return } func.func @async_token(%arg0 : !gpu.async.token) -> !gpu.async.token { return %arg0 : !gpu.async.token } func.func @async_wait() { %0 = gpu.wait async %1 = gpu.wait async [%0] %2 = gpu.wait async [%0, %1] gpu.wait [%0, %1] gpu.wait return } func.func @memcpy(%dst : memref<3x7xf32>, %src : memref<3x7xf32, 1>) { gpu.memcpy %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1> %0 = gpu.wait async %1 = gpu.memcpy async [%0] %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1> return } func.func @memset(%dst : memref<3x7xf32>, %value : f32) { gpu.memset %dst, %value : memref<3x7xf32>, f32 %0 = gpu.wait async %1 = gpu.memset async [%0] %dst, %value : memref<3x7xf32>, f32 return } func.func @mmamatrix_valid_scalar_element_type(%src : memref<32x32xf16, affine_map<(d0, d1) -> (d0 * 64 + d1)>>){ %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %cst = arith.constant 1.000000e+00 : f32 %0 = gpu.subgroup_mma_load_matrix %wg[%i, %i] {leadDimension = 32 : index} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %s = gpu.subgroup_mma_load_matrix %src[%i, %i] {leadDimension = 64 : index} : memref<32x32xf16, affine_map<(d0, d1) -> (d0 * 64 + d1)>> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %1 = gpu.subgroup_mma_constant_matrix %cst : !gpu.mma_matrix<16x16xf32, ""COp""> %2 = gpu.subgroup_mma_elementwise addf %1, %1 : (!gpu.mma_matrix<16x16xf32, ""COp"">, !gpu.mma_matrix<16x16xf32, ""COp"">) -> !gpu.mma_matrix<16x16xf32, ""COp""> %3 = gpu.subgroup_mma_elementwise maxf %2, %1 : (!gpu.mma_matrix<16x16xf32, ""COp"">, !gpu.mma_matrix<16x16xf32, ""COp"">) -> !gpu.mma_matrix<16x16xf32, ""COp""> return } func.func @mmamatrix_valid_vector_element_type(%src : memref<32x4xvector<4xf32>>, %i : index) { %s = gpu.subgroup_mma_load_matrix %src[%i, %i] {leadDimension = 4 : index} : memref<32x4xvector<4xf32>> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.subgroup_mma_store_matrix %s, %src[%i, %i] {leadDimension = 4 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x4xvector<4xf32>> return } func.func @set_default_device(%arg0: i32) { gpu.set_default_device %arg0 return } func.func @sparse_ops(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_coo async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %spmat2, %token5 = gpu.create_csr async [%token4] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnvec, %token6 = gpu.create_dn_vec async [%token5] %mem2, %arg0 : memref %bufferSz, %token7 = gpu.spmv_buffer_size async [%token6] %env, %spmat, %dnvec, %dnvec into f64 %token8 = gpu.spmv async [%token7] %env, %spmat, %dnvec, %dnvec, %mem2 : memref into f64 %dnmat, %token9 = gpu.create_dn_mat async [%token8] %arg0, %arg0, %mem2 : memref %bufferSz2, %token10 = gpu.spmm_buffer_size async [%token9] %env, %spmat, %dnmat, %dnmat into f64 %token11 = gpu.spmm async [%token10] %env, %spmat, %dnmat, %dnmat, %mem2 : memref into f64 %bufferSz3, %token12 = gpu.sddmm_buffer_size async [%token11] %env, %dnmat, %dnmat, %spmat into f64 %token13 = gpu.sddmm async [%token12] %env, %dnmat, %dnmat, %spmat, %mem2 : memref into f64 %token14 = gpu.destroy_dn_mat async [%token13] %dnmat %token15 = gpu.destroy_sp_mat async [%token14] %spmat %token16 = gpu.destroy_dn_vec async [%token15] %dnvec %token17 = gpu.destroy_sparse_env async [%token16] %env gpu.wait [%token17] return } } gpu.module @module { ""gpu.func""() ({ gpu.return }) {function_type = () -> (), sym_name = ""func""} : () -> () }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic | mlir-opt -allow-unregistered-dialect ,1 "func.func @launch_func(%arg0 : index) { %0 = test.with_bounds { umin = 3 : index, umax = 5 : index, smin = 3 : index, smax = 5 : index } %1 = test.with_bounds { umin = 7 : index, umax = 11 : index, smin = 7 : index, smax = 11 : index } gpu.launch blocks(%block_id_x, %block_id_y, %block_id_z) in (%grid_dim_x = %0, %grid_dim_y = %1, %grid_dim_z = %arg0) threads(%thread_id_x, %thread_id_y, %thread_id_z) in (%block_dim_x = %arg0, %block_dim_y = %0, %block_dim_z = %1) { %grid_dim_x0 = test.reflect_bounds %grid_dim_x %grid_dim_y0 = test.reflect_bounds %grid_dim_y %grid_dim_z0 = test.reflect_bounds %grid_dim_z %block_id_x0 = test.reflect_bounds %block_id_x %block_id_y0 = test.reflect_bounds %block_id_y %block_id_z0 = test.reflect_bounds %block_id_z %block_dim_x0 = test.reflect_bounds %block_dim_x %block_dim_y0 = test.reflect_bounds %block_dim_y %block_dim_z0 = test.reflect_bounds %block_dim_z %thread_id_x0 = test.reflect_bounds %thread_id_x %thread_id_y0 = test.reflect_bounds %thread_id_y %thread_id_z0 = test.reflect_bounds %thread_id_z %thread_id_op = gpu.thread_id y %thread_id_op0 = test.reflect_bounds %thread_id_op gpu.terminator } func.return }", mlir-opt -test-int-range-inference -split-input-file ,1 "module attributes {gpu.container_module} { gpu.module @gpu_module { llvm.func @kernel() attributes {gpu.kernel} { %grid_dim_x = gpu.grid_dim x %grid_dim_y = gpu.grid_dim y %grid_dim_z = gpu.grid_dim z %grid_dim_x0 = test.reflect_bounds %grid_dim_x %grid_dim_y0 = test.reflect_bounds %grid_dim_y %grid_dim_z0 = test.reflect_bounds %grid_dim_z %block_id_x = gpu.block_id x %block_id_y = gpu.block_id y %block_id_z = gpu.block_id z %block_id_x0 = test.reflect_bounds %block_id_x %block_id_y0 = test.reflect_bounds %block_id_y %block_id_z0 = test.reflect_bounds %block_id_z %block_dim_x = gpu.block_dim x %block_dim_y = gpu.block_dim y %block_dim_z = gpu.block_dim z %block_dim_x0 = test.reflect_bounds %block_dim_x %block_dim_y0 = test.reflect_bounds %block_dim_y %block_dim_z0 = test.reflect_bounds %block_dim_z %thread_id_x = gpu.thread_id x %thread_id_y = gpu.thread_id y %thread_id_z = gpu.thread_id z %thread_id_x0 = test.reflect_bounds %thread_id_x %thread_id_y0 = test.reflect_bounds %thread_id_y %thread_id_z0 = test.reflect_bounds %thread_id_z %global_id_x = gpu.global_id x %global_id_y = gpu.global_id y %global_id_z = gpu.global_id z %global_id_x0 = test.reflect_bounds %global_id_x %global_id_y0 = test.reflect_bounds %global_id_y %global_id_z0 = test.reflect_bounds %global_id_z %subgroup_size = gpu.subgroup_size : index %lane_id = gpu.lane_id %num_subgroups = gpu.num_subgroups : index %subgroup_id = gpu.subgroup_id : index %subgroup_size0 = test.reflect_bounds %subgroup_size %lane_id0 = test.reflect_bounds %lane_id %num_subgroups0 = test.reflect_bounds %num_subgroups %subgroup_id0 = test.reflect_bounds %subgroup_id llvm.return } } }", mlir-opt -test-int-range-inference -split-input-file ,1 "module attributes {gpu.container_module} { gpu.module @gpu_module { gpu.func @annotated_kernel() kernel attributes {gpu.known_block_size = array, gpu.known_grid_size = array} { %grid_dim_x = gpu.grid_dim x %grid_dim_y = gpu.grid_dim y %grid_dim_z = gpu.grid_dim z %grid_dim_x0 = test.reflect_bounds %grid_dim_x %grid_dim_y0 = test.reflect_bounds %grid_dim_y %grid_dim_z0 = test.reflect_bounds %grid_dim_z %block_id_x = gpu.block_id x %block_id_y = gpu.block_id y %block_id_z = gpu.block_id z %block_id_x0 = test.reflect_bounds %block_id_x %block_id_y0 = test.reflect_bounds %block_id_y %block_id_z0 = test.reflect_bounds %block_id_z %block_dim_x = gpu.block_dim x %block_dim_y = gpu.block_dim y %block_dim_z = gpu.block_dim z %block_dim_x0 = test.reflect_bounds %block_dim_x %block_dim_y0 = test.reflect_bounds %block_dim_y %block_dim_z0 = test.reflect_bounds %block_dim_z %thread_id_x = gpu.thread_id x %thread_id_y = gpu.thread_id y %thread_id_z = gpu.thread_id z %thread_id_x0 = test.reflect_bounds %thread_id_x %thread_id_y0 = test.reflect_bounds %thread_id_y %thread_id_z0 = test.reflect_bounds %thread_id_z %global_id_x = gpu.global_id x %global_id_y = gpu.global_id y %global_id_z = gpu.global_id z %global_id_x0 = test.reflect_bounds %global_id_x %global_id_y0 = test.reflect_bounds %global_id_y %global_id_z0 = test.reflect_bounds %global_id_z %subgroup_size = gpu.subgroup_size : index %lane_id = gpu.lane_id %num_subgroups = gpu.num_subgroups : index %subgroup_id = gpu.subgroup_id : index %subgroup_size0 = test.reflect_bounds %subgroup_size %lane_id0 = test.reflect_bounds %lane_id %num_subgroups0 = test.reflect_bounds %num_subgroups %subgroup_id0 = test.reflect_bounds %subgroup_id gpu.return } } }", mlir-opt -test-int-range-inference -split-input-file ,1 "gpu.module @kernels { gpu.func @kernel(%arg0 : f32) kernel { %sum = gpu.all_reduce max %arg0 uniform {} : (f32) -> (f32) gpu.return } }", mlir-opt -test-gpu-rewrite ,1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @kernel() kernel { gpu.return } } func.func private @foo() -> () func.func @async(%sz : index) { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) %0 = gpu.alloc() : memref<7xf32> gpu.dealloc %0 : memref<7xf32> call @foo() : () -> () return } func.func @defer_wait(%sz : index) { %a0 = async.execute { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } %a1 = async.execute [%a0] { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } async.await %a1 : !async.token return } func.func @defer_wait_blocked_by_side_effect(%sz : index) { %a = async.execute { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) func.call @foo() : () -> () async.yield } async.await %a : !async.token return } func.func @defer_wait_pass_through(%sz : index) { %a0 = async.execute { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } %a1 = async.execute [%a0] { async.yield } async.await %a1 : !async.token return } func.func @async_execute_with_result(%sz : index) -> index { %a0, %f0 = async.execute -> !async.value { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield %sz : index } async.await %a0 : !async.token %x = async.await %f0 : !async.value return %x : index } func.func @async_execute_no_use(%sz : index) { %a0 = async.execute { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } return } func.func @async_execute_fork(%sz : index) { %a0 = async.execute { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } %a1 = async.execute [%a0] { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } %a2 = async.execute [%a0] { gpu.launch_func @kernels::@kernel blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz) async.yield } return } func.func @existing_tokens() { %t0 = gpu.wait async %t1 = gpu.wait async [%t0] %0 = gpu.alloc [%t0] () : memref<7xf32> %t2 = gpu.dealloc async %0 : memref<7xf32> gpu.wait gpu.wait return } }", mlir-opt -gpu-async-region ,1 "func.func @extra_constants(%arg0: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = memref.dim %arg0, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -split-input-file -verify-diagnostics ,1 "func.func @extra_constants_not_inlined(%arg0: memref) { %cst = arith.constant 8 : index %cst2 = arith.constant 2 : index %c0 = arith.constant 0 : index %cst3 = ""secret_constant""() : () -> index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { ""use""(%cst2, %arg0, %cst3) : (index, memref, index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -split-input-file -verify-diagnostics ,1 "func.func @multiple_uses(%arg0 : memref) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { ""use1""(%c2, %c2) : (index, index) -> () ""use2""(%c2) : (index) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -split-input-file -verify-diagnostics ,1 "func.func @multiple_uses2(%arg0 : memref<*xf32>) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %d = memref.dim %arg0, %c2 : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1, %block_z = %c1) { ""use1""(%d) : (index) -> () ""use2""(%c2, %c2) : (index, index) -> () ""use3""(%arg0) : (memref<*xf32>) -> () gpu.terminator } return }", mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -split-input-file -verify-diagnostics ,1 "func.func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index) { %zero = arith.constant 0 : index %one = arith.constant 1 : index %four = arith.constant 4 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%four, %four) { scf.parallel (%si0, %si1) = (%zero, %zero) to (%four, %four) step (%one, %one) { } } return }", mlir-opt -gpu-map-parallel-loops -split-input-file ,1 "func.func @parallel_loop_4d(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index) { %zero = arith.constant 0 : index %one = arith.constant 1 : index %four = arith.constant 4 : index scf.parallel (%i0, %i1, %i2, %i3) = (%zero, %zero, %zero, %zero) to (%arg0, %arg1, %arg2, %arg3) step (%four, %four, %four, %four) { scf.parallel (%si0, %si1, %si2, %si3) = (%zero, %zero, %zero, %zero) to (%four, %four, %four, %four) step (%one, %one, %one, %one) { scf.parallel (%ti0, %ti1, %ti2, %ti3) = (%zero, %zero, %zero, %zero) to (%four, %four, %four, %four) step (%one, %one, %one, %one) { } } } return }", mlir-opt -gpu-map-parallel-loops -split-input-file ,1 "func.func @entry() { %c0 = arith.constant 0: index %c1 = arith.constant 1: index %c8 = arith.constant 8: index %A = memref.alloc() : memref<8xf32> scf.for %i = %c0 to %c8 step %c1 { %i32 = arith.index_cast %i : index to i32 %fi = arith.sitofp %i32 : i32 to f32 memref.store %fi, %A[%i] : memref<8xf32> } %d0 = arith.constant -1.0 : f32 %Av = vector.transfer_read %A[%c0], %d0: memref<8xf32>, vector<8xf32> vector.print %Av : vector<8xf32> %B = memref.realloc %A : memref<8xf32> to memref<10xf32> %c10 = arith.constant 10: index scf.for %i = %c8 to %c10 step %c1 { %i32 = arith.index_cast %i : index to i32 %fi = arith.sitofp %i32 : i32 to f32 memref.store %fi, %B[%i] : memref<10xf32> } %Bv = vector.transfer_read %B[%c0], %d0: memref<10xf32>, vector<10xf32> vector.print %Bv : vector<10xf32> %Bd = memref.cast %B : memref<10xf32> to memref %c13 = arith.constant 13: index %Cd = memref.realloc %Bd(%c13) : memref to memref %C = memref.cast %Cd : memref to memref<13xf32> scf.for %i = %c10 to %c13 step %c1 { %i32 = arith.index_cast %i : index to i32 %fi = arith.sitofp %i32 : i32 to f32 memref.store %fi, %C[%i] : memref<13xf32> } %Cv = vector.transfer_read %C[%c0], %d0: memref<13xf32>, vector<13xf32> vector.print %Cv : vector<13xf32> memref.dealloc %C : memref<13xf32> return }"," mlir-opt -convert-scf-to-cf -convert-vector-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -shared-libs=%mlir_c_runner_utils // RUN: mlir-opt -convert-scf-to-cf -convert-vector-to-llvm -finalize-memref-to-llvm='use-aligned-alloc=1' -convert-func-to-llvm -arith-expand -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -shared-libs=%mlir_c_runner_utils ",1 "func.func @test_7i32_to_29() -> i32 { %arg = arith.constant 7 : i32 %0 = math.ctlz %arg : i32 func.return %0 : i32 } func.func @test_zero() -> i32 { %arg = arith.constant 0 : i32 %0 = math.ctlz %arg : i32 func.return %0 : i32 } func.func @test_7i64_to_61() -> i64 { %arg = arith.constant 7 : i64 %0 = math.ctlz %arg : i64 func.return %0 : i64 }"," mlir-opt -pass-pipeline=""builtin.module( convert-math-to-funcs{convert-ctlz}, func.func(convert-scf-to-cf,convert-arith-to-llvm), convert-func-to-llvm, convert-cf-to-llvm, reconcile-unrealized-casts)"" | mlir-cpu-runner -e test_7i32_to_29 -entry-point-result=i32 ",1 "func.func @test_7i32_to_29() -> i32 { %arg = arith.constant 7 : i32 %0 = math.ctlz %arg : i32 func.return %0 : i32 } func.func @test_zero() -> i32 { %arg = arith.constant 0 : i32 %0 = math.ctlz %arg : i32 func.return %0 : i32 } func.func @test_7i64_to_61() -> i64 { %arg = arith.constant 7 : i64 %0 = math.ctlz %arg : i64 func.return %0 : i64 }"," mlir-opt -pass-pipeline=""builtin.module( convert-math-to-funcs{convert-ctlz}, func.func(convert-scf-to-cf,convert-arith-to-llvm), convert-func-to-llvm, convert-cf-to-llvm, reconcile-unrealized-casts)"" | mlir-cpu-runner -e test_zero -entry-point-result=i32 ",1 "func.func @test_7i32_to_29() -> i32 { %arg = arith.constant 7 : i32 %0 = math.ctlz %arg : i32 func.return %0 : i32 } func.func @test_zero() -> i32 { %arg = arith.constant 0 : i32 %0 = math.ctlz %arg : i32 func.return %0 : i32 } func.func @test_7i64_to_61() -> i64 { %arg = arith.constant 7 : i64 %0 = math.ctlz %arg : i64 func.return %0 : i64 }"," mlir-opt -pass-pipeline=""builtin.module( convert-math-to-funcs, func.func(convert-scf-to-cf,convert-arith-to-llvm), convert-func-to-llvm, convert-cf-to-llvm, reconcile-unrealized-casts)"" | mlir-cpu-runner -e test_7i64_to_61 -entry-point-result=i64 ",1 "module @patterns { pdl.pattern : benefit(1) { %in_type = pdl.type %out_type = pdl.type %weight_type = pdl.type %rxact = pdl.operand : %in_type %weight = pdl.operand : %weight_type %attr0 = pdl.attribute = false %op0 = pdl.operation ""tf.MatMul"" (%rxact, %weight : !pdl.value, !pdl.value) {""transpose_a"" = %attr0, ""transpose_b"" = %attr0} -> (%out_type : !pdl.type) pdl.rewrite %op0 { %op1 = pdl.operation ""kernel.FcFwd"" (%rxact, %weight : !pdl.value, !pdl.value) -> (%out_type : !pdl.type) %val1 = pdl.result 0 of %op1 pdl.replace %op0 with (%val1 : !pdl.value) } } pdl.pattern : benefit(4) { %in_type = pdl.type %out_type = pdl.type %weight_type = pdl.type %const_type = pdl.type %rxact = pdl.operand : %in_type %rxdelta = pdl.operand : %out_type %weight = pdl.operand : %weight_type %attr0 = pdl.attribute = true %attr1 = pdl.attribute = false %op0 = pdl.operation ""tf.MatMul"" (%rxact, %rxdelta : !pdl.value, !pdl.value) {""transpose_a"" = %attr0, ""transpose_b"" = %attr1} -> (%weight_type : !pdl.type) %val0 = pdl.result 0 of %op0 %op1 = pdl.operation ""tf.Const"" -> (%const_type : !pdl.type) %val1 = pdl.result 0 of %op1 %op2 = pdl.operation ""tf.Mul"" (%val0, %val1 : !pdl.value, !pdl.value) -> (%weight_type : !pdl.type) %val2 = pdl.result 0 of %op2 %op3 = pdl.operation ""tf.Sub"" (%weight, %val2 : !pdl.value, !pdl.value) -> (%weight_type : !pdl.type) pdl.rewrite %op3 { %op4 = pdl.operation ""kernel.FcBwd"" (%rxact, %rxdelta, %weight : !pdl.value, !pdl.value, !pdl.value) -> (%weight_type : !pdl.type) %val4 = pdl.result 0 of %op4 pdl.replace %op3 with (%val4 : !pdl.value) pdl.erase %op2 pdl.erase %op1 pdl.erase %op0 } } pdl.pattern : benefit(6) { %in_type = pdl.type %label_type = pdl.type %loss_type = pdl.type %mean_loss_type = pdl.type %mean_const_type = pdl.type %mul_const_type = pdl.type %rxact = pdl.operand : %in_type %rxlabel = pdl.operand : %label_type %op0 = pdl.operation ""tf.SparseSoftmaxCrossEntropyWithLogits"" (%rxact, %rxlabel : !pdl.value, !pdl.value) -> (%loss_type, %in_type : !pdl.type, !pdl.type) %val0_0 = pdl.result 0 of %op0 %val0_1 = pdl.result 1 of %op0 %op1 = pdl.operation ""tf.Const"" -> (%mean_const_type : !pdl.type) %val1 = pdl.result 0 of %op1 %op2 = pdl.operation ""tf.Mean"" (%val0_0, %val1 : !pdl.value, !pdl.value) -> (%mean_loss_type : !pdl.type) %val2 = pdl.result 0 of %op2 %op3 = pdl.operation ""tf.PreventGradient"" (%val0_1 : !pdl.value) -> (%in_type : !pdl.type) %val3 = pdl.result 0 of %op3 %op4 = pdl.operation ""tf.Const"" -> (%mul_const_type : !pdl.type) %val4 = pdl.result 0 of %op4 %op5 = pdl.operation ""tf.Mul"" (%val3, %val4 : !pdl.value, !pdl.value) -> (%in_type : !pdl.type) pdl.rewrite { %op6 = pdl.operation ""kernel.SoftmaxCrossEntropy"" (%rxact, %rxlabel : !pdl.value, !pdl.value) -> (%mean_loss_type, %in_type : !pdl.type, !pdl.type) %val6_0 = pdl.result 0 of %op6 %val6_1 = pdl.result 1 of %op6 pdl.replace %op5 with (%val6_1 : !pdl.value) pdl.erase %op4 pdl.erase %op3 pdl.replace %op2 with (%val6_0 : !pdl.value) pdl.erase %op1 pdl.erase %op0 } } } module @ir attributes { test.mlp_split } { func.func @main(%arg0: tensor<2x20xf32>, %arg1: tensor<2xi32>, %arg2: tensor<20x10xf32>) -> (tensor, tensor<20x10xf32>) { %0 = ""tf.Const""() {value = dense<0> : tensor<1xi32>} : () -> tensor<1xi32> %1 = ""tf.Const""() {value = dense<1.000000e-01> : tensor} : () -> tensor %2 = ""tf.Const""() {value = dense<5.000000e-01> : tensor<2x1xf32>} : () -> tensor<2x1xf32> %3 = ""tf.MatMul""(%arg0, %arg2) {transpose_a = false, transpose_b = false} : (tensor<2x20xf32>, tensor<20x10xf32>) -> tensor<2x10xf32> %loss, %backprop = ""tf.SparseSoftmaxCrossEntropyWithLogits""(%3, %arg1) : (tensor<2x10xf32>, tensor<2xi32>) -> (tensor<2xf32>, tensor<2x10xf32>) %4 = ""tf.Mean""(%loss, %0) {keep_dims = false} : (tensor<2xf32>, tensor<1xi32>) -> tensor %5 = ""tf.PreventGradient""(%backprop) : (tensor<2x10xf32>) -> tensor<2x10xf32> %6 = ""tf.Mul""(%5, %2) : (tensor<2x10xf32>, tensor<2x1xf32>) -> tensor<2x10xf32> %7 = ""tf.MatMul""(%arg0, %6) {transpose_a = true, transpose_b = false} : (tensor<2x20xf32>, tensor<2x10xf32>) -> tensor<20x10xf32> %8 = ""tf.Mul""(%7, %1) : (tensor<20x10xf32>, tensor) -> tensor<20x10xf32> %9 = ""tf.Sub""(%arg2, %8) : (tensor<20x10xf32>, tensor<20x10xf32>) -> tensor<20x10xf32> return %4, %9 : tensor, tensor<20x10xf32> } }", mlir-opt -allow-unregistered-dialect -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl.pattern : benefit(3) { %const_type = pdl.type %param_type = pdl.type %param = pdl.operand : %param_type %gradient = pdl.operand : %param_type %attr0 = pdl.attribute %op0 = pdl.operation ""tf.Const"" {""value"" = %attr0} -> (%const_type : !pdl.type) %val0 = pdl.result 0 of %op0 %op1 = pdl.operation ""tf.Mul"" (%gradient, %val0 : !pdl.value, !pdl.value) -> (%param_type : !pdl.type) %val1 = pdl.result 0 of %op1 %op2 = pdl.operation ""tf.Sub"" (%param, %val1 : !pdl.value, !pdl.value) -> (%param_type : !pdl.type) pdl.rewrite %op2 { %op3 = pdl.operation ""kernel.GD"" (%param, %gradient : !pdl.value, !pdl.value) -> (%param_type : !pdl.type) %val3 = pdl.result 0 of %op3 pdl.replace %op2 with (%val3 : !pdl.value) pdl.erase %op1 } } pdl.pattern : benefit(8) { %in_type = pdl.type %out_type = pdl.type %weight_type = pdl.type %bias_type = pdl.type %rxact = pdl.operand : %in_type %rxdelta = pdl.operand : %out_type %weight = pdl.operand : %weight_type %bias = pdl.operand : %bias_type %attr0 = pdl.attribute = false %op0 = pdl.operation ""tf.MatMul"" (%rxact, %weight : !pdl.value, !pdl.value) {""transpose_a"" = %attr0, ""transpose_b"" = %attr0} -> (%out_type : !pdl.type) %val0 = pdl.result 0 of %op0 %op1 = pdl.operation ""tf.BiasAdd"" (%val0, %bias : !pdl.value, !pdl.value) -> (%out_type : !pdl.type) %val1 = pdl.result 0 of %op1 %op2 = pdl.operation ""tf.Relu"" (%val1 : !pdl.value) -> (%out_type : !pdl.type) %val2 = pdl.result 0 of %op2 %op3 = pdl.operation ""tf.ReluGrad"" (%rxdelta, %val2 : !pdl.value, !pdl.value) -> (%out_type : !pdl.type) %val3 = pdl.result 0 of %op3 %attr1 = pdl.attribute = true %op4 = pdl.operation ""tf.MatMul"" (%rxact, %val3 : !pdl.value, !pdl.value) {""transpose_a"" = %attr1, ""transpose_b"" = %attr0} -> (%weight_type : !pdl.type) %val4 = pdl.result 0 of %op4 %op5 = pdl.operation ""kernel.GD"" (%weight, %val4 : !pdl.value, !pdl.value) -> (%weight_type : !pdl.type) %op6 = pdl.operation ""tf.BiasAddGrad"" (%val3 : !pdl.value) -> (%bias_type : !pdl.type) %val6 = pdl.result 0 of %op6 %op7 = pdl.operation ""kernel.GD"" (%bias, %val6 : !pdl.value, !pdl.value) -> (%bias_type : !pdl.type) pdl.rewrite { %op8 = pdl.operation ""kernel.FcWithBias"" (%rxact, %rxdelta, %weight, %bias : !pdl.value, !pdl.value, !pdl.value, !pdl.value) -> (%out_type, %weight_type, %bias_type : !pdl.type, !pdl.type, !pdl.type) %val8_0 = pdl.result 0 of %op8 %val8_1 = pdl.result 1 of %op8 %val8_2 = pdl.result 2 of %op8 pdl.replace %op7 with (%val8_2 : !pdl.value) pdl.erase %op6 pdl.replace %op5 with (%val8_1 : !pdl.value) pdl.erase %op4 pdl.erase %op3 pdl.replace %op2 with (%val8_0 : !pdl.value) pdl.erase %op1 pdl.erase %op0 } } pdl.pattern : benefit(4) { %in_type = pdl.type %out_type = pdl.type %weight_type = pdl.type %rxact = pdl.operand : %in_type %rxdelta = pdl.operand : %out_type %weight = pdl.operand : %weight_type %attr0 = pdl.attribute = false %op0 = pdl.operation ""tf.MatMul"" (%rxact, %weight : !pdl.value, !pdl.value) {""transpose_a"" = %attr0, ""transpose_b"" = %attr0} -> (%out_type : !pdl.type) %attr1 = pdl.attribute = true %op1 = pdl.operation ""tf.MatMul"" (%rxdelta, %weight : !pdl.value, !pdl.value) {""transpose_a"" = %attr0, ""transpose_b"" = %attr1} -> (%in_type : !pdl.type) %op2 = pdl.operation ""tf.MatMul"" (%rxact, %rxdelta : !pdl.value, !pdl.value) {""transpose_a"" = %attr1, ""transpose_b"" = %attr0} -> (%weight_type : !pdl.type) %val2 = pdl.result 0 of %op2 %op3 = pdl.operation ""kernel.GD"" (%weight, %val2 : !pdl.value, !pdl.value) -> (%weight_type : !pdl.type) pdl.rewrite { %op4 = pdl.operation ""kernel.Fc"" (%rxact, %rxdelta, %weight : !pdl.value, !pdl.value, !pdl.value) -> (%out_type, %in_type, %weight_type : !pdl.type, !pdl.type, !pdl.type) %val4_0 = pdl.result 0 of %op4 %val4_1 = pdl.result 1 of %op4 %val4_2 = pdl.result 2 of %op4 pdl.replace %op3 with (%val4_2 : !pdl.value) pdl.erase %op2 pdl.replace %op1 with (%val4_1 : !pdl.value) pdl.replace %op0 with (%val4_0 : !pdl.value) } } pdl.pattern : benefit(6) { %in_type = pdl.type %label_type = pdl.type %loss_type = pdl.type %mean_loss_type = pdl.type %mean_const_type = pdl.type %mul_const_type = pdl.type %rxact = pdl.operand : %in_type %rxlabel = pdl.operand : %label_type %op0 = pdl.operation ""tf.SparseSoftmaxCrossEntropyWithLogits"" (%rxact, %rxlabel : !pdl.value, !pdl.value) -> (%loss_type, %in_type : !pdl.type, !pdl.type) %val0_0 = pdl.result 0 of %op0 %val0_1 = pdl.result 1 of %op0 %op1 = pdl.operation ""tf.Const"" -> (%mean_const_type : !pdl.type) %val1 = pdl.result 0 of %op1 %op2 = pdl.operation ""tf.Mean"" (%val0_0, %val1 : !pdl.value, !pdl.value) -> (%mean_loss_type : !pdl.type) %val2 = pdl.result 0 of %op2 %op3 = pdl.operation ""tf.PreventGradient"" (%val0_1 : !pdl.value) -> (%in_type : !pdl.type) %val3 = pdl.result 0 of %op3 %op4 = pdl.operation ""tf.Const"" -> (%mul_const_type : !pdl.type) %val4 = pdl.result 0 of %op4 %op5 = pdl.operation ""tf.Mul"" (%val3, %val4 : !pdl.value, !pdl.value) -> (%in_type : !pdl.type) pdl.rewrite { %op6 = pdl.operation ""kernel.SoftmaxCrossEntropy"" (%rxact, %rxlabel : !pdl.value, !pdl.value) -> (%mean_loss_type, %in_type : !pdl.type, !pdl.type) %val6_0 = pdl.result 0 of %op6 %val6_1 = pdl.result 1 of %op6 pdl.replace %op5 with (%val6_1 : !pdl.value) pdl.erase %op4 pdl.erase %op3 pdl.replace %op2 with (%val6_0 : !pdl.value) pdl.erase %op1 pdl.erase %op0 } } } module @ir attributes { test.mlp_fused } { func.func @main(%arg0: tensor<2x20xf32>, %arg1: tensor<2xi32>, %arg2: tensor<256xf32>, %arg3: tensor<20x256xf32>, %arg4: tensor<256x10xf32>) -> () { ""test.graph_region""() ({ %0 = ""tf.Const""() {value = dense<0> : tensor<1xi32>} : () -> tensor<1xi32> %1 = ""tf.Const""() {value = dense<1.000000e-01> : tensor} : () -> tensor %2 = ""tf.Const""() {value = dense<5.000000e-01> : tensor<2x1xf32>} : () -> tensor<2x1xf32> %3 = ""tf.MatMul""(%arg0, %arg3) {transpose_a = false, transpose_b = false} : (tensor<2x20xf32>, tensor<20x256xf32>) -> tensor<2x256xf32> %4 = ""tf.BiasAdd""(%3, %arg2) {data_format = ""NHWC""} : (tensor<2x256xf32>, tensor<256xf32>) -> tensor<2x256xf32> %5 = ""tf.Relu""(%4) : (tensor<2x256xf32>) -> tensor<2x256xf32> %6 = ""tf.MatMul""(%5, %arg4) {transpose_a = false, transpose_b = false} : (tensor<2x256xf32>, tensor<256x10xf32>) -> tensor<2x10xf32> %loss, %backprop = ""tf.SparseSoftmaxCrossEntropyWithLogits""(%6, %arg1) : (tensor<2x10xf32>, tensor<2xi32>) -> (tensor<2xf32>, tensor<2x10xf32>) %7 = ""tf.Mean""(%loss, %0) {keep_dims = false} : (tensor<2xf32>, tensor<1xi32>) -> tensor %8 = ""tf.PreventGradient""(%backprop) : (tensor<2x10xf32>) -> tensor<2x10xf32> %9 = ""tf.Mul""(%8, %2) : (tensor<2x10xf32>, tensor<2x1xf32>) -> tensor<2x10xf32> %10 = ""tf.MatMul""(%9, %arg4) {transpose_a = false, transpose_b = true} : (tensor<2x10xf32>, tensor<256x10xf32>) -> tensor<2x256xf32> %11 = ""tf.MatMul""(%5, %9) {transpose_a = true, transpose_b = false} : (tensor<2x256xf32>, tensor<2x10xf32>) -> tensor<256x10xf32> %12 = ""tf.ReluGrad""(%10, %5) : (tensor<2x256xf32>, tensor<2x256xf32>) -> tensor<2x256xf32> %13 = ""tf.BiasAddGrad""(%12) {data_format = ""NHWC""} : (tensor<2x256xf32>) -> tensor<256xf32> %14 = ""tf.MatMul""(%arg0, %12) {transpose_a = true, transpose_b = false} : (tensor<2x20xf32>, tensor<2x256xf32>) -> tensor<20x256xf32> %15 = ""tf.Mul""(%14, %1) : (tensor<20x256xf32>, tensor) -> tensor<20x256xf32> %16 = ""tf.Sub""(%arg3, %15) : (tensor<20x256xf32>, tensor<20x256xf32>) -> tensor<20x256xf32> %17 = ""tf.Mul""(%13, %1) : (tensor<256xf32>, tensor) -> tensor<256xf32> %18 = ""tf.Sub""(%arg2, %17) : (tensor<256xf32>, tensor<256xf32>) -> tensor<256xf32> %19 = ""tf.Mul""(%11, %1) : (tensor<256x10xf32>, tensor) -> tensor<256x10xf32> %20 = ""tf.Sub""(%arg4, %19) : (tensor<256x10xf32>, tensor<256x10xf32>) -> tensor<256x10xf32> }) : () -> () return } }", mlir-opt -allow-unregistered-dialect -test-pdl-bytecode-pass -split-input-file ,1 "func.func @entry() { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c8 = arith.constant 8 : index %lb = arith.constant 0 : index %ub = arith.constant 8 : index %A = memref.alloc() : memref<8x8xf32> %U = memref.cast %A : memref<8x8xf32> to memref<*xf32> scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c2, %c1) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c2) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<8x8xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -async-parallel-for -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -arith-expand -convert-async-to-llvm -convert-scf-to-cf -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O0 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ,1 "func.func @entry() { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c8 = arith.constant 8 : index %lb = arith.constant 0 : index %ub = arith.constant 8 : index %A = memref.alloc() : memref<8x8xf32> %U = memref.cast %A : memref<8x8xf32> to memref<*xf32> scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c2, %c1) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c2) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<8x8xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -async-parallel-for -async-to-async-runtime -async-runtime-policy-based-ref-counting -arith-expand -convert-async-to-llvm -convert-scf-to-cf -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O0 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ,1 "func.func @entry() { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c8 = arith.constant 8 : index %lb = arith.constant 0 : index %ub = arith.constant 8 : index %A = memref.alloc() : memref<8x8xf32> %U = memref.cast %A : memref<8x8xf32> to memref<*xf32> scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c2, %c1) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c1) { memref.store %c0, %A[%i, %j] : memref<8x8xf32> } scf.parallel (%i, %j) = (%lb, %lb) to (%ub, %ub) step (%c1, %c2) { %0 = arith.muli %i, %c8 : index %1 = arith.addi %j, %0 : index %2 = arith.index_cast %1 : index to i32 %3 = arith.sitofp %2 : i32 to f32 %4 = memref.load %A[%i, %j] : memref<8x8xf32> %5 = arith.addf %3, %4 : f32 memref.store %5, %A[%i, %j] : memref<8x8xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<8x8xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }"," mlir-opt -async-parallel-for=""async-dispatch=false num-workers=20 min-task-size=1"" -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -arith-expand -convert-async-to-llvm -convert-scf-to-cf -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O0 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "func.func private @zero() -> index { %0 = arith.constant 0 : index return %0 : index } func.func @entry() { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %lb = arith.constant 0 : index %ub = arith.constant 9 : index %A = memref.alloc() : memref<9xf32> %U = memref.cast %A : memref<9xf32> to memref<*xf32> scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } scf.parallel (%i) = (%lb) to (%ub) step (%c1) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = memref.load %A[%i] : memref<9xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %A[%i] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } scf.parallel (%i) = (%lb) to (%ub) step (%c2) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = memref.load %A[%i] : memref<9xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %A[%i] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } %lb0 = arith.constant -20 : index %ub0 = arith.constant -11 : index scf.parallel (%i) = (%lb0) to (%ub0) step (%c3) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = arith.constant 20 : index %3 = arith.addi %i, %2 : index %4 = memref.load %A[%3] : memref<9xf32> %5 = arith.addf %1, %4 : f32 memref.store %5, %A[%3] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () %lb1 = call @zero(): () -> (index) %ub1 = call @zero(): () -> (index) scf.parallel (%i) = (%lb1) to (%ub1) step (%c1) { %false = arith.constant 0 : i1 cf.assert %false, ""should never be executed"" } memref.dealloc %A : memref<9xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -async-parallel-for -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -convert-async-to-llvm -convert-scf-to-cf -finalize-memref-to-llvm -arith-expand -memref-expand -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O0 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ,1 "func.func private @zero() -> index { %0 = arith.constant 0 : index return %0 : index } func.func @entry() { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %lb = arith.constant 0 : index %ub = arith.constant 9 : index %A = memref.alloc() : memref<9xf32> %U = memref.cast %A : memref<9xf32> to memref<*xf32> scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } scf.parallel (%i) = (%lb) to (%ub) step (%c1) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = memref.load %A[%i] : memref<9xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %A[%i] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } scf.parallel (%i) = (%lb) to (%ub) step (%c2) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = memref.load %A[%i] : memref<9xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %A[%i] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } %lb0 = arith.constant -20 : index %ub0 = arith.constant -11 : index scf.parallel (%i) = (%lb0) to (%ub0) step (%c3) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = arith.constant 20 : index %3 = arith.addi %i, %2 : index %4 = memref.load %A[%3] : memref<9xf32> %5 = arith.addf %1, %4 : f32 memref.store %5, %A[%3] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () %lb1 = call @zero(): () -> (index) %ub1 = call @zero(): () -> (index) scf.parallel (%i) = (%lb1) to (%ub1) step (%c1) { %false = arith.constant 0 : i1 cf.assert %false, ""should never be executed"" } memref.dealloc %A : memref<9xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -async-parallel-for -async-to-async-runtime -async-runtime-policy-based-ref-counting -convert-async-to-llvm -convert-scf-to-cf -finalize-memref-to-llvm -arith-expand -memref-expand -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O0 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ,1 "func.func private @zero() -> index { %0 = arith.constant 0 : index return %0 : index } func.func @entry() { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %lb = arith.constant 0 : index %ub = arith.constant 9 : index %A = memref.alloc() : memref<9xf32> %U = memref.cast %A : memref<9xf32> to memref<*xf32> scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } scf.parallel (%i) = (%lb) to (%ub) step (%c1) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = memref.load %A[%i] : memref<9xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %A[%i] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } scf.parallel (%i) = (%lb) to (%ub) step (%c2) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = memref.load %A[%i] : memref<9xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %A[%i] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () scf.parallel (%i) = (%lb) to (%ub) step (%c1) { memref.store %c0, %A[%i] : memref<9xf32> } %lb0 = arith.constant -20 : index %ub0 = arith.constant -11 : index scf.parallel (%i) = (%lb0) to (%ub0) step (%c3) { %0 = arith.index_cast %i : index to i32 %1 = arith.sitofp %0 : i32 to f32 %2 = arith.constant 20 : index %3 = arith.addi %i, %2 : index %4 = memref.load %A[%3] : memref<9xf32> %5 = arith.addf %1, %4 : f32 memref.store %5, %A[%3] : memref<9xf32> } call @printMemrefF32(%U): (memref<*xf32>) -> () %lb1 = call @zero(): () -> (index) %ub1 = call @zero(): () -> (index) scf.parallel (%i) = (%lb1) to (%ub1) step (%c1) { %false = arith.constant 0 : i1 cf.assert %false, ""should never be executed"" } memref.dealloc %A : memref<9xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }"," mlir-opt -async-parallel-for=""async-dispatch=false num-workers=20 min-task-size=1"" -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -convert-async-to-llvm -convert-scf-to-cf -finalize-memref-to-llvm -arith-expand -memref-expand -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O0 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @scf_parallel(%lhs: memref, %rhs: memref, %sum: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = memref.dim %lhs, %c0 : memref %d1 = memref.dim %lhs, %c1 : memref scf.parallel (%i, %j) = (%c0, %c0) to (%d0, %d1) step (%c1, %c1) { %lv = memref.load %lhs[%i, %j] : memref %rv = memref.load %lhs[%i, %j] : memref %r = arith.addf %lv, %rv : f32 memref.store %r, %sum[%i, %j] : memref } return } func.func @entry() { %f1 = arith.constant 1.0 : f32 %f4 = arith.constant 4.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cN = arith.constant 50 : index %LHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %RHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %DST10 = memref.alloc() {alignment = 64} : memref<1x10xf32> linalg.fill ins(%f1 : f32) outs(%LHS10 : memref<1x10xf32>) linalg.fill ins(%f1 : f32) outs(%RHS10 : memref<1x10xf32>) %LHS = memref.cast %LHS10 : memref<1x10xf32> to memref %RHS = memref.cast %RHS10 : memref<1x10xf32> to memref %DST = memref.cast %DST10 : memref<1x10xf32> to memref call @scf_parallel(%LHS, %RHS, %DST) : (memref, memref, memref) -> () %U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %LHS10: memref<1x10xf32> memref.dealloc %RHS10: memref<1x10xf32> memref.dealloc %DST10: memref<1x10xf32> %LHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %RHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %DST1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %LHS0 = memref.cast %LHS1024 : memref<1024x1024xf32> to memref %RHS0 = memref.cast %RHS1024 : memref<1024x1024xf32> to memref %DST0 = memref.cast %DST1024 : memref<1024x1024xf32> to memref call @scf_parallel(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () %t0 = call @rtclock() : () -> f64 scf.for %i = %c0 to %cN step %c1 { func.call @scf_parallel(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () } %t1 = call @rtclock() : () -> f64 %t1024 = arith.subf %t1, %t0 : f64 vector.print %t1024 : f64 memref.dealloc %LHS1024: memref<1024x1024xf32> memref.dealloc %RHS1024: memref<1024x1024xf32> memref.dealloc %DST1024: memref<1024x1024xf32> return } func.func private @rtclock() -> f64 func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -async-parallel-for -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -convert-async-to-llvm -convert-linalg-to-loops -convert-scf-to-cf -arith-expand -memref-expand -convert-vector-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O3 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_async_runtime ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @scf_parallel(%lhs: memref, %rhs: memref, %sum: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = memref.dim %lhs, %c0 : memref %d1 = memref.dim %lhs, %c1 : memref scf.parallel (%i, %j) = (%c0, %c0) to (%d0, %d1) step (%c1, %c1) { %lv = memref.load %lhs[%i, %j] : memref %rv = memref.load %lhs[%i, %j] : memref %r = arith.addf %lv, %rv : f32 memref.store %r, %sum[%i, %j] : memref } return } func.func @entry() { %f1 = arith.constant 1.0 : f32 %f4 = arith.constant 4.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cN = arith.constant 50 : index %LHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %RHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %DST10 = memref.alloc() {alignment = 64} : memref<1x10xf32> linalg.fill ins(%f1 : f32) outs(%LHS10 : memref<1x10xf32>) linalg.fill ins(%f1 : f32) outs(%RHS10 : memref<1x10xf32>) %LHS = memref.cast %LHS10 : memref<1x10xf32> to memref %RHS = memref.cast %RHS10 : memref<1x10xf32> to memref %DST = memref.cast %DST10 : memref<1x10xf32> to memref call @scf_parallel(%LHS, %RHS, %DST) : (memref, memref, memref) -> () %U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %LHS10: memref<1x10xf32> memref.dealloc %RHS10: memref<1x10xf32> memref.dealloc %DST10: memref<1x10xf32> %LHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %RHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %DST1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %LHS0 = memref.cast %LHS1024 : memref<1024x1024xf32> to memref %RHS0 = memref.cast %RHS1024 : memref<1024x1024xf32> to memref %DST0 = memref.cast %DST1024 : memref<1024x1024xf32> to memref call @scf_parallel(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () %t0 = call @rtclock() : () -> f64 scf.for %i = %c0 to %cN step %c1 { func.call @scf_parallel(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () } %t1 = call @rtclock() : () -> f64 %t1024 = arith.subf %t1, %t0 : f64 vector.print %t1024 : f64 memref.dealloc %LHS1024: memref<1024x1024xf32> memref.dealloc %RHS1024: memref<1024x1024xf32> memref.dealloc %DST1024: memref<1024x1024xf32> return } func.func private @rtclock() -> f64 func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -async-parallel-for=async-dispatch=false -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -convert-async-to-llvm -convert-linalg-to-loops -convert-scf-to-cf -arith-expand -memref-expand -convert-vector-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O3 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_async_runtime ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @scf_parallel(%lhs: memref, %rhs: memref, %sum: memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = memref.dim %lhs, %c0 : memref %d1 = memref.dim %lhs, %c1 : memref scf.parallel (%i, %j) = (%c0, %c0) to (%d0, %d1) step (%c1, %c1) { %lv = memref.load %lhs[%i, %j] : memref %rv = memref.load %lhs[%i, %j] : memref %r = arith.addf %lv, %rv : f32 memref.store %r, %sum[%i, %j] : memref } return } func.func @entry() { %f1 = arith.constant 1.0 : f32 %f4 = arith.constant 4.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cN = arith.constant 50 : index %LHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %RHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %DST10 = memref.alloc() {alignment = 64} : memref<1x10xf32> linalg.fill ins(%f1 : f32) outs(%LHS10 : memref<1x10xf32>) linalg.fill ins(%f1 : f32) outs(%RHS10 : memref<1x10xf32>) %LHS = memref.cast %LHS10 : memref<1x10xf32> to memref %RHS = memref.cast %RHS10 : memref<1x10xf32> to memref %DST = memref.cast %DST10 : memref<1x10xf32> to memref call @scf_parallel(%LHS, %RHS, %DST) : (memref, memref, memref) -> () %U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %LHS10: memref<1x10xf32> memref.dealloc %RHS10: memref<1x10xf32> memref.dealloc %DST10: memref<1x10xf32> %LHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %RHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %DST1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %LHS0 = memref.cast %LHS1024 : memref<1024x1024xf32> to memref %RHS0 = memref.cast %RHS1024 : memref<1024x1024xf32> to memref %DST0 = memref.cast %DST1024 : memref<1024x1024xf32> to memref call @scf_parallel(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () %t0 = call @rtclock() : () -> f64 scf.for %i = %c0 to %cN step %c1 { func.call @scf_parallel(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () } %t1 = call @rtclock() : () -> f64 %t1024 = arith.subf %t1, %t0 : f64 vector.print %t1024 : f64 memref.dealloc %LHS1024: memref<1024x1024xf32> memref.dealloc %RHS1024: memref<1024x1024xf32> memref.dealloc %DST1024: memref<1024x1024xf32> return } func.func private @rtclock() -> f64 func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -convert-linalg-to-loops -convert-scf-to-cf -convert-vector-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O3 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_async_runtime ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @linalg_generic(%lhs: memref, %rhs: memref, %sum: memref) { linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%lhs, %rhs : memref, memref) outs(%sum : memref) { ^bb0(%lhs_in: f32, %rhs_in: f32, %sum_out: f32): %0 = arith.addf %lhs_in, %rhs_in : f32 linalg.yield %0 : f32 } return } func.func @entry() { %f1 = arith.constant 1.0 : f32 %f4 = arith.constant 4.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cN = arith.constant 50 : index %LHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %RHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %DST10 = memref.alloc() {alignment = 64} : memref<1x10xf32> linalg.fill ins(%f1 : f32) outs(%LHS10 : memref<1x10xf32>) linalg.fill ins(%f1 : f32) outs(%RHS10 : memref<1x10xf32>) %LHS = memref.cast %LHS10 : memref<1x10xf32> to memref %RHS = memref.cast %RHS10 : memref<1x10xf32> to memref %DST = memref.cast %DST10 : memref<1x10xf32> to memref call @linalg_generic(%LHS, %RHS, %DST) : (memref, memref, memref) -> () %U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %LHS10: memref<1x10xf32> memref.dealloc %RHS10: memref<1x10xf32> memref.dealloc %DST10: memref<1x10xf32> %LHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %RHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %DST1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %LHS0 = memref.cast %LHS1024 : memref<1024x1024xf32> to memref %RHS0 = memref.cast %RHS1024 : memref<1024x1024xf32> to memref %DST0 = memref.cast %DST1024 : memref<1024x1024xf32> to memref call @linalg_generic(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () %t0 = call @rtclock() : () -> f64 scf.for %i = %c0 to %cN step %c1 { func.call @linalg_generic(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () } %t1 = call @rtclock() : () -> f64 %t1024 = arith.subf %t1, %t0 : f64 vector.print %t1024 : f64 memref.dealloc %LHS1024: memref<1024x1024xf32> memref.dealloc %RHS1024: memref<1024x1024xf32> memref.dealloc %DST1024: memref<1024x1024xf32> return } func.func private @rtclock() -> f64 func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -convert-linalg-to-parallel-loops -async-parallel-for -async-to-async-runtime -async-runtime-ref-counting -async-runtime-ref-counting-opt -convert-async-to-llvm -convert-scf-to-cf -arith-expand -memref-expand -convert-vector-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O3 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_async_runtime ,1 "#map0 = affine_map<(d0, d1) -> (d0, d1)> func.func @linalg_generic(%lhs: memref, %rhs: memref, %sum: memref) { linalg.generic { indexing_maps = [#map0, #map0, #map0], iterator_types = [""parallel"", ""parallel""] } ins(%lhs, %rhs : memref, memref) outs(%sum : memref) { ^bb0(%lhs_in: f32, %rhs_in: f32, %sum_out: f32): %0 = arith.addf %lhs_in, %rhs_in : f32 linalg.yield %0 : f32 } return } func.func @entry() { %f1 = arith.constant 1.0 : f32 %f4 = arith.constant 4.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cN = arith.constant 50 : index %LHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %RHS10 = memref.alloc() {alignment = 64} : memref<1x10xf32> %DST10 = memref.alloc() {alignment = 64} : memref<1x10xf32> linalg.fill ins(%f1 : f32) outs(%LHS10 : memref<1x10xf32>) linalg.fill ins(%f1 : f32) outs(%RHS10 : memref<1x10xf32>) %LHS = memref.cast %LHS10 : memref<1x10xf32> to memref %RHS = memref.cast %RHS10 : memref<1x10xf32> to memref %DST = memref.cast %DST10 : memref<1x10xf32> to memref call @linalg_generic(%LHS, %RHS, %DST) : (memref, memref, memref) -> () %U = memref.cast %DST10 : memref<1x10xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %LHS10: memref<1x10xf32> memref.dealloc %RHS10: memref<1x10xf32> memref.dealloc %DST10: memref<1x10xf32> %LHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %RHS1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %DST1024 = memref.alloc() {alignment = 64} : memref<1024x1024xf32> %LHS0 = memref.cast %LHS1024 : memref<1024x1024xf32> to memref %RHS0 = memref.cast %RHS1024 : memref<1024x1024xf32> to memref %DST0 = memref.cast %DST1024 : memref<1024x1024xf32> to memref call @linalg_generic(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () %t0 = call @rtclock() : () -> f64 scf.for %i = %c0 to %cN step %c1 { func.call @linalg_generic(%LHS0, %RHS0, %DST0) : (memref, memref, memref) -> () } %t1 = call @rtclock() : () -> f64 %t1024 = arith.subf %t1, %t0 : f64 vector.print %t1024 : f64 memref.dealloc %LHS1024: memref<1024x1024xf32> memref.dealloc %RHS1024: memref<1024x1024xf32> memref.dealloc %DST1024: memref<1024x1024xf32> return } func.func private @rtclock() -> f64 func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }", mlir-opt -convert-linalg-to-loops -convert-scf-to-cf -convert-vector-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e entry -entry-point-result=void -O3 -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_async_runtime ,1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], posWidth = 32, crdWidth = 32 }> module { func.func @matvecCOO(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor } func.func @matvecCSR(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor } func.func @main() { %f0 = arith.constant 0.0 : f64 %f1 = arith.constant 1.0 : f64 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %DA = tensor.generate { ^bb0(%i: index, %j: index): %k = arith.addi %i, %j : index %l = arith.index_cast %k : index to i64 %f = arith.uitofp %l : i64 to f64 tensor.yield %f : f64 } : tensor<64x64xf64> %Acoo = sparse_tensor.convert %DA : tensor<64x64xf64> to tensor %Acsr = sparse_tensor.convert %DA : tensor<64x64xf64> to tensor %d1 = tensor.dim %Acoo, %c1 : tensor %x = tensor.generate %d1 { ^bb0(%i : index): %k = arith.addi %i, %c1 : index %j = arith.index_cast %k : index to i64 %f = arith.uitofp %j : i64 to f64 tensor.yield %f : f64 } : tensor %d0 = tensor.dim %Acoo, %c0 : tensor %y0 = tensor.generate %d0 { ^bb0(%i : index): tensor.yield %f0 : f64 } : tensor %y1 = tensor.generate %d0 { ^bb0(%i : index): tensor.yield %f1 : f64 } : tensor %0 = call @matvecCOO(%Acoo, %x, %y0) : (tensor, tensor, tensor) -> tensor %1 = call @matvecCSR(%Acsr, %x, %y0) : (tensor, tensor, tensor) -> tensor %2 = call @matvecCOO(%Acoo, %x, %y1) : (tensor, tensor, tensor) -> tensor %3 = call @matvecCSR(%Acsr, %x, %y1) : (tensor, tensor, tensor) -> tensor %pb0 = vector.transfer_read %0[%c0], %f0 : tensor, vector<64xf64> vector.print %pb0 : vector<64xf64> %pb1 = vector.transfer_read %1[%c0], %f0 : tensor, vector<64xf64> vector.print %pb1 : vector<64xf64> %pb2 = vector.transfer_read %2[%c0], %f0 : tensor, vector<64xf64> vector.print %pb2 : vector<64xf64> %pb3 = vector.transfer_read %3[%c0], %f0 : tensor, vector<64xf64> vector.print %pb3 : vector<64xf64> bufferization.dealloc_tensor %Acoo : tensor bufferization.dealloc_tensor %Acsr : tensor return } }"," mlir-opt --sparse-compiler=""enable-runtime-library=true enable-gpu-libgen gpu-triple=nvptx64-nvidia-cuda gpu-chip=sm_80 gpu-features=+ptx71"" | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], posWidth = 32, crdWidth = 32 }> module { func.func @matvecCOO(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor } func.func @matvecCSR(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor } func.func @main() { %f0 = arith.constant 0.0 : f64 %f1 = arith.constant 1.0 : f64 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %DA = tensor.generate { ^bb0(%i: index, %j: index): %k = arith.addi %i, %j : index %l = arith.index_cast %k : index to i64 %f = arith.uitofp %l : i64 to f64 tensor.yield %f : f64 } : tensor<64x64xf64> %Acoo = sparse_tensor.convert %DA : tensor<64x64xf64> to tensor %Acsr = sparse_tensor.convert %DA : tensor<64x64xf64> to tensor %d1 = tensor.dim %Acoo, %c1 : tensor %x = tensor.generate %d1 { ^bb0(%i : index): %k = arith.addi %i, %c1 : index %j = arith.index_cast %k : index to i64 %f = arith.uitofp %j : i64 to f64 tensor.yield %f : f64 } : tensor %d0 = tensor.dim %Acoo, %c0 : tensor %y0 = tensor.generate %d0 { ^bb0(%i : index): tensor.yield %f0 : f64 } : tensor %y1 = tensor.generate %d0 { ^bb0(%i : index): tensor.yield %f1 : f64 } : tensor %0 = call @matvecCOO(%Acoo, %x, %y0) : (tensor, tensor, tensor) -> tensor %1 = call @matvecCSR(%Acsr, %x, %y0) : (tensor, tensor, tensor) -> tensor %2 = call @matvecCOO(%Acoo, %x, %y1) : (tensor, tensor, tensor) -> tensor %3 = call @matvecCSR(%Acsr, %x, %y1) : (tensor, tensor, tensor) -> tensor %pb0 = vector.transfer_read %0[%c0], %f0 : tensor, vector<64xf64> vector.print %pb0 : vector<64xf64> %pb1 = vector.transfer_read %1[%c0], %f0 : tensor, vector<64xf64> vector.print %pb1 : vector<64xf64> %pb2 = vector.transfer_read %2[%c0], %f0 : tensor, vector<64xf64> vector.print %pb2 : vector<64xf64> %pb3 = vector.transfer_read %3[%c0], %f0 : tensor, vector<64xf64> vector.print %pb3 : vector<64xf64> bufferization.dealloc_tensor %Acoo : tensor bufferization.dealloc_tensor %Acsr : tensor return } }"," mlir-opt --sparse-compiler=""enable-runtime-library=false enable-gpu-libgen gpu-triple=nvptx64-nvidia-cuda gpu-chip=sm_80 gpu-features=+ptx71"" | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> module { func.func @matvec(%A: tensor, %x: tensor, %y_in: tensor) -> tensor { %y_out = linalg.matvec ins(%A, %x: tensor, tensor) outs(%y_in: tensor) -> tensor return %y_out : tensor } func.func @main() { %f0 = arith.constant 0.0 : f64 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %DA = tensor.generate { ^bb0(%i: index, %j: index): %k = arith.addi %i, %j : index %l = arith.index_cast %k : index to i64 %f = arith.uitofp %l : i64 to f64 tensor.yield %f : f64 } : tensor<1024x64xf64> %A = sparse_tensor.convert %DA : tensor<1024x64xf64> to tensor %d1 = tensor.dim %A, %c1 : tensor %x = tensor.generate %d1 { ^bb0(%i : index): %k = arith.addi %i, %c1 : index %j = arith.index_cast %k : index to i64 %f = arith.uitofp %j : i64 to f64 tensor.yield %f : f64 } : tensor %d0 = tensor.dim %A, %c0 : tensor %y = tensor.generate %d0 { ^bb0(%i : index): tensor.yield %f0 : f64 } : tensor %0 = call @matvec(%A, %x, %y) : (tensor, tensor, tensor) -> tensor %pb0 = vector.transfer_read %0[%c0], %f0 : tensor, vector<64xf64> vector.print %pb0 : vector<64xf64> bufferization.dealloc_tensor %A : tensor return } }"," mlir-opt --sparse-compiler=""enable-runtime-library=false parallelization-strategy=dense-outer-loop gpu-triple=nvptx64-nvidia-cuda gpu-chip=sm_80 gpu-features=+ptx71"" | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @mma_sp_sync_f16_16832( %argA: memref<16x16xf16>, %argA_meta: memref<16x2xi16>, %argB: memref<8x32xf16>, %argC: memref<16x8xf16>) kernel { %f0 = arith.constant 0.0 : f16 %c4 = arith.constant 4 : index %c8 = arith.constant 8 : index %lane_id = gpu.thread_id x %quad_id = affine.apply affine_map<()[s0]->(s0 floordiv 4)>()[%lane_id] %pair_id = affine.apply affine_map<()[s0]->(s0 mod 2)>()[%lane_id] %quad_id_plus_8 = affine.apply affine_map<()[s0]->(s0 + 8)>()[%quad_id] %meta_A_per_thread0 = memref.load %argA_meta[%quad_id , %pair_id] : memref<16x2xi16> %meta_A_per_thread1 = memref.load %argA_meta[%quad_id_plus_8, %pair_id] : memref<16x2xi16> %low_i32 = arith.extui %meta_A_per_thread0 : i16 to i32 %high_i32 = arith.extui %meta_A_per_thread1 : i16 to i32 %meta_init = arith.constant dense<0> : vector<2xi16> %meta_low = vector.insert %meta_A_per_thread0, %meta_init[0] : i16 into vector<2xi16> %meta = vector.insert %meta_A_per_thread1, %meta_low[1] : i16 into vector<2xi16> %quad_row, %col_8x4 = affine.delinearize_index %lane_id into (%c8, %c4) : index, index %quad_col = affine.apply affine_map<()[s0]->(s0 * 2)>()[%col_8x4] %A_quad00 = vector.transfer_read %argA[%quad_row, %quad_col], %f0 {in_bounds = [true]} : memref<16x16xf16>, vector<2xf16> %quad_row_plus_8 = affine.apply affine_map<(d0)[]->(d0+8)>(%quad_row)[] %A_quad10 = vector.transfer_read %argA[%quad_row_plus_8, %quad_col], %f0 {in_bounds = [true]} : memref<16x16xf16>, vector<2xf16> %quad_col_plus_8 = affine.apply affine_map<(d0)[]->(d0+8)>(%quad_col)[] %A_quad01 = vector.transfer_read %argA[%quad_row, %quad_col_plus_8], %f0 {in_bounds = [true]} : memref<16x16xf16>, vector<2xf16> %A_quad11 = vector.transfer_read %argA[%quad_row_plus_8, %quad_col_plus_8], %f0 {in_bounds = [true]} : memref<16x16xf16>, vector<2xf16> %A_init0 = arith.constant dense<0.0> : vector<4x2xf16> %A_data0 = vector.insert %A_quad00, %A_init0[0] : vector<2xf16> into vector<4x2xf16> %A_data1 = vector.insert %A_quad10, %A_data0[1] : vector<2xf16> into vector<4x2xf16> %A_data2 = vector.insert %A_quad01, %A_data1[2] : vector<2xf16> into vector<4x2xf16> %A_data = vector.insert %A_quad11, %A_data2[3] : vector<2xf16> into vector<4x2xf16> %B_quad0 = vector.transfer_read %argB[%quad_row, %quad_col], %f0 {in_bounds = [true]} : memref<8x32xf16>, vector<2xf16> %B_quad1 = vector.transfer_read %argB[%quad_row, %quad_col_plus_8], %f0 {in_bounds = [true]} : memref<8x32xf16>, vector<2xf16> %quad_col_plus_16 = affine.apply affine_map<()[s0]->(s0 + 16)>()[%quad_col] %B_quad2 = vector.transfer_read %argB[%quad_row, %quad_col_plus_16], %f0 {in_bounds = [true]} : memref<8x32xf16>, vector<2xf16> %quad_col_plus_24 = affine.apply affine_map<()[s0]->(s0 + 24)>()[%quad_col] %B_quad3 = vector.transfer_read %argB[%quad_row, %quad_col_plus_24], %f0 {in_bounds = [true]} : memref<8x32xf16>, vector<2xf16> %B_init0 = arith.constant dense<0.0> : vector<4x2xf16> %B_data0 = vector.insert %B_quad0, %B_init0[0] : vector<2xf16> into vector<4x2xf16> %B_data1 = vector.insert %B_quad1, %B_data0[1] : vector<2xf16> into vector<4x2xf16> %B_data2 = vector.insert %B_quad2, %B_data1[2] : vector<2xf16> into vector<4x2xf16> %B_data = vector.insert %B_quad3, %B_data2[3] : vector<2xf16> into vector<4x2xf16> %accum = arith.constant dense<0.0> : vector<2x2xf16> gpu.barrier %d = nvgpu.mma.sp.sync(%A_data, %B_data, %accum) metadata(%meta) {mmaShape = [16, 8, 32]} : (vector<4x2xf16>, vector<4x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> %C_0 = vector.extract %d[0] : vector<2x2xf16> %C_1 = vector.extract %d[1] : vector<2x2xf16> vector.transfer_write %C_0, %argC[%quad_row, %quad_col] {in_bounds = [true]} : vector<2xf16>, memref<16x8xf16> vector.transfer_write %C_1, %argC[%quad_row_plus_8, %quad_col] {in_bounds = [true]} : vector<2xf16>, memref<16x8xf16> gpu.return } } func.func @main() { %f0 = arith.constant 0.0 : f16 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c8 = arith.constant 8 : index %c16 = arith.constant 16 : index %c32 = arith.constant 32 : index %c64 = arith.constant 64 : index %a = memref.alloc() : memref<16x16xf16> %b = memref.alloc() : memref<8x32xf16> %c = memref.alloc() : memref<16x8xf16> %m = memref.alloc() : memref<16x2xi16> scf.for %ai = %c0 to %c16 step %c1 { scf.for %aj = %c0 to %c16 step %c1 { %a0 = arith.addi %ai, %aj : index %a1 = arith.addi %a0, %c1 : index %a2 = arith.index_cast %a1 : index to i32 %a3 = arith.sitofp %a2 : i32 to f16 memref.store %a3, %a[%ai, %aj] : memref<16x16xf16> } } %bits = arith.constant 0x8888 : i16 scf.for %mi = %c0 to %c16 step %c1 { memref.store %bits, %m[%mi, %c0] : memref<16x2xi16> memref.store %bits, %m[%mi, %c1] : memref<16x2xi16> } scf.for %bi = %c0 to %c8 step %c1 { scf.for %bj = %c0 to %c32 step %c1 { %b0 = arith.subi %bi, %bj : index %b1 = arith.index_cast %b0 : index to i32 %b2 = arith.sitofp %b1 : i32 to f16 memref.store %b2, %b[%bi, %bj] : memref<8x32xf16> } } scf.for %ci = %c0 to %c16 step %c1 { scf.for %cj = %c0 to %c8 step %c1 { memref.store %f0, %c[%ci, %cj] : memref<16x8xf16> } } scf.for %pai = %c0 to %c16 step %c1 { %pa0 = vector.transfer_read %a[%pai, %c0], %f0 : memref<16x16xf16>, vector<16xf16> vector.print %pa0 : vector<16xf16> } scf.for %pbi = %c0 to %c8 step %c1 { %pb0 = vector.transfer_read %b[%pbi, %c0], %f0 : memref<8x32xf16>, vector<32xf16> vector.print %pb0 : vector<32xf16> } %cast_a = memref.cast %a : memref<16x16xf16> to memref<*xf16> gpu.host_register %cast_a : memref<*xf16> %cast_m = memref.cast %m : memref<16x2xi16> to memref<*xi16> gpu.host_register %cast_m : memref<*xi16> %cast_b = memref.cast %b : memref<8x32xf16> to memref<*xf16> gpu.host_register %cast_b : memref<*xf16> %cast_c = memref.cast %c : memref<16x8xf16> to memref<*xf16> gpu.host_register %cast_c : memref<*xf16> %t1 = arith.constant 1 : index %t32 = arith.constant 32 : index gpu.launch_func @kernels::@mma_sp_sync_f16_16832 blocks in (%t1, %t1, %t1) threads in (%t32, %t1, %t1) args(%a : memref<16x16xf16>, %m : memref<16x2xi16>, %b : memref<8x32xf16>, %c : memref<16x8xf16>) gpu.host_unregister %cast_a : memref<*xf16> gpu.host_unregister %cast_m : memref<*xi16> gpu.host_unregister %cast_b : memref<*xf16> gpu.host_unregister %cast_c : memref<*xf16> scf.for %pci = %c0 to %c16 step %c1 { %pc0 = vector.transfer_read %c[%pci, %c0], %f0 : memref<16x8xf16>, vector<8xf16> vector.print %pc0 : vector<8xf16> } return } }"," mlir-opt --pass-pipeline=""builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,convert-nvgpu-to-nvvm,affine-expand-index-ops,lower-affine,convert-arith-to-llvm),convert-vector-to-llvm,canonicalize,cse,gpu.module(gpu-to-cubin{chip=sm_80 features=+ptx71}))"" | mlir-opt --convert-scf-to-cf -convert-cf-to-llvm --convert-vector-to-llvm --convert-arith-to-llvm --gpu-to-llvm --reconcile-unrealized-casts | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "#CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ] }> module { func.func @matvec(%A: tensor<1024x64xf64, #CSR>, %x: tensor<64xf64>, %y_in: tensor<1024xf64>) -> tensor<1024xf64> { %y_out = linalg.matvec ins(%A, %x: tensor<1024x64xf64, #CSR>, tensor<64xf64>) outs(%y_in: tensor<1024xf64>) -> tensor<1024xf64> return %y_out : tensor<1024xf64> } memref.global ""private"" constant @__constant_64xf64 : memref<64xf64> = dense<1.000000e+00> {alignment = 64 : i64} func.func @main() { %f0 = arith.constant 0.0 : f64 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %DA = tensor.generate { ^bb0(%i: index, %j: index): %k = arith.addi %i, %j : index %l = arith.index_cast %k : index to i64 %f = arith.uitofp %l : i64 to f64 tensor.yield %f : f64 } : tensor<1024x64xf64> %A = sparse_tensor.convert %DA : tensor<1024x64xf64> to tensor<1024x64xf64, #CSR> %y = tensor.generate { ^bb0(%i : index): tensor.yield %f0 : f64 } : tensor<1024xf64> %xbuf = memref.get_global @__constant_64xf64 : memref<64xf64> %x = bufferization.to_tensor %xbuf restrict : memref<64xf64> %0 = call @matvec(%A, %x, %y) : (tensor<1024x64xf64, #CSR>, tensor<64xf64>, tensor<1024xf64>) -> tensor<1024xf64> %pb0 = vector.transfer_read %0[%c0], %f0 : tensor<1024xf64>, vector<64xf64> vector.print %pb0 : vector<64xf64> bufferization.dealloc_tensor %A : tensor<1024x64xf64, #CSR> return } }"," mlir-opt --sparse-compiler=""enable-runtime-library=false parallelization-strategy=dense-outer-loop gpu-triple=nvptx64-nvidia-cuda gpu-chip=sm_80 gpu-features=+ptx71"" | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], posWidth = 32, crdWidth = 32 }> module { func.func @matmulCOO(%A: tensor<8x8xf32, #SortedCOO>, %B: tensor<8x8xf32>, %C: tensor<8x8xf32>) -> tensor<8x8xf32> { %D = linalg.matmul ins(%A, %B: tensor<8x8xf32, #SortedCOO>, tensor<8x8xf32>) outs(%C: tensor<8x8xf32>) -> tensor<8x8xf32> return %D: tensor<8x8xf32> } func.func @matmulCSR(%A: tensor<8x8xf32, #CSR>, %B: tensor<8x8xf32>, %C: tensor<8x8xf32>) -> tensor<8x8xf32> { %D = linalg.matmul ins(%A, %B: tensor<8x8xf32, #CSR>, tensor<8x8xf32>) outs(%C: tensor<8x8xf32>) -> tensor<8x8xf32> return %D: tensor<8x8xf32> } func.func @dump(%mat: tensor<8x8xf32>) { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %c7 = arith.constant 7 : index %r0 = vector.transfer_read %mat[%c0,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r0 : vector<8xf32> %r1 = vector.transfer_read %mat[%c1,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r1 : vector<8xf32> %r2 = vector.transfer_read %mat[%c2,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r2 : vector<8xf32> %r3 = vector.transfer_read %mat[%c3,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r3 : vector<8xf32> %r4 = vector.transfer_read %mat[%c4,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r4 : vector<8xf32> %r5 = vector.transfer_read %mat[%c5,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r5 : vector<8xf32> %r6 = vector.transfer_read %mat[%c6,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r6 : vector<8xf32> %r7 = vector.transfer_read %mat[%c7,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r7 : vector<8xf32> return } func.func @main() { %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %DA = tensor.generate { ^bb0(%i: index, %j: index): %k = arith.addi %i, %j : index %l = arith.index_cast %k : index to i64 %f = arith.uitofp %l : i64 to f32 tensor.yield %f : f32 } : tensor<8x8xf32> %Acoo = sparse_tensor.convert %DA : tensor<8x8xf32> to tensor<8x8xf32, #SortedCOO> %Acsr = sparse_tensor.convert %DA : tensor<8x8xf32> to tensor<8x8xf32, #CSR> %C0 = tensor.generate { ^bb0(%i: index, %j: index): tensor.yield %f0 : f32 } : tensor<8x8xf32> %C1 = tensor.generate { ^bb0(%i: index, %j: index): tensor.yield %f1 : f32 } : tensor<8x8xf32> %0 = call @matmulCOO(%Acoo, %DA, %C0) : (tensor<8x8xf32, #SortedCOO>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> %1 = call @matmulCSR(%Acsr, %DA, %C0) : (tensor<8x8xf32, #CSR>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> %2 = call @matmulCOO(%Acoo, %DA, %C1) : (tensor<8x8xf32, #SortedCOO>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> %3 = call @matmulCSR(%Acsr, %DA, %C1) : (tensor<8x8xf32, #CSR>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> call @dump(%0) : (tensor<8x8xf32>) -> () call @dump(%1) : (tensor<8x8xf32>) -> () call @dump(%2) : (tensor<8x8xf32>) -> () call @dump(%3) : (tensor<8x8xf32>) -> () bufferization.dealloc_tensor %Acoo : tensor<8x8xf32, #SortedCOO> bufferization.dealloc_tensor %Acsr : tensor<8x8xf32, #CSR> return } }"," mlir-opt --sparse-compiler=""enable-runtime-library=true enable-gpu-libgen gpu-triple=nvptx64-nvidia-cuda gpu-chip=sm_80 gpu-features=+ptx71"" | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "#SortedCOO = #sparse_tensor.encoding<{ lvlTypes = [ ""compressed-nu"", ""singleton"" ] }> #CSR = #sparse_tensor.encoding<{ lvlTypes = [ ""dense"", ""compressed"" ], posWidth = 32, crdWidth = 32 }> module { func.func @matmulCOO(%A: tensor<8x8xf32, #SortedCOO>, %B: tensor<8x8xf32>, %C: tensor<8x8xf32>) -> tensor<8x8xf32> { %D = linalg.matmul ins(%A, %B: tensor<8x8xf32, #SortedCOO>, tensor<8x8xf32>) outs(%C: tensor<8x8xf32>) -> tensor<8x8xf32> return %D: tensor<8x8xf32> } func.func @matmulCSR(%A: tensor<8x8xf32, #CSR>, %B: tensor<8x8xf32>, %C: tensor<8x8xf32>) -> tensor<8x8xf32> { %D = linalg.matmul ins(%A, %B: tensor<8x8xf32, #CSR>, tensor<8x8xf32>) outs(%C: tensor<8x8xf32>) -> tensor<8x8xf32> return %D: tensor<8x8xf32> } func.func @dump(%mat: tensor<8x8xf32>) { %f0 = arith.constant 0.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %c7 = arith.constant 7 : index %r0 = vector.transfer_read %mat[%c0,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r0 : vector<8xf32> %r1 = vector.transfer_read %mat[%c1,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r1 : vector<8xf32> %r2 = vector.transfer_read %mat[%c2,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r2 : vector<8xf32> %r3 = vector.transfer_read %mat[%c3,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r3 : vector<8xf32> %r4 = vector.transfer_read %mat[%c4,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r4 : vector<8xf32> %r5 = vector.transfer_read %mat[%c5,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r5 : vector<8xf32> %r6 = vector.transfer_read %mat[%c6,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r6 : vector<8xf32> %r7 = vector.transfer_read %mat[%c7,%c0], %f0 : tensor<8x8xf32>, vector<8xf32> vector.print %r7 : vector<8xf32> return } func.func @main() { %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %DA = tensor.generate { ^bb0(%i: index, %j: index): %k = arith.addi %i, %j : index %l = arith.index_cast %k : index to i64 %f = arith.uitofp %l : i64 to f32 tensor.yield %f : f32 } : tensor<8x8xf32> %Acoo = sparse_tensor.convert %DA : tensor<8x8xf32> to tensor<8x8xf32, #SortedCOO> %Acsr = sparse_tensor.convert %DA : tensor<8x8xf32> to tensor<8x8xf32, #CSR> %C0 = tensor.generate { ^bb0(%i: index, %j: index): tensor.yield %f0 : f32 } : tensor<8x8xf32> %C1 = tensor.generate { ^bb0(%i: index, %j: index): tensor.yield %f1 : f32 } : tensor<8x8xf32> %0 = call @matmulCOO(%Acoo, %DA, %C0) : (tensor<8x8xf32, #SortedCOO>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> %1 = call @matmulCSR(%Acsr, %DA, %C0) : (tensor<8x8xf32, #CSR>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> %2 = call @matmulCOO(%Acoo, %DA, %C1) : (tensor<8x8xf32, #SortedCOO>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> %3 = call @matmulCSR(%Acsr, %DA, %C1) : (tensor<8x8xf32, #CSR>, tensor<8x8xf32>, tensor<8x8xf32>) -> tensor<8x8xf32> call @dump(%0) : (tensor<8x8xf32>) -> () call @dump(%1) : (tensor<8x8xf32>) -> () call @dump(%2) : (tensor<8x8xf32>) -> () call @dump(%3) : (tensor<8x8xf32>) -> () bufferization.dealloc_tensor %Acoo : tensor<8x8xf32, #SortedCOO> bufferization.dealloc_tensor %Acsr : tensor<8x8xf32, #CSR> return } }"," mlir-opt --sparse-compiler=""enable-runtime-library=false enable-gpu-libgen gpu-triple=nvptx64-nvidia-cuda gpu-chip=sm_80 gpu-features=+ptx71"" | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_c_runner_utils --e main --entry-point-result=void ",1 "memref.global ""private"" constant @__constant_5x3xf32 : memref<5x3xf32> = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0], [9.0, 10.0, 11.0], [12.0, 13.0, 14.0]]> func.func @main() { %0 = memref.get_global @__constant_5x3xf32 : memref<5x3xf32> %1 = memref.subview %0[2, 0][3, 3][1, 1]: memref<5x3xf32> to memref<3x3xf32, strided<[3, 1], offset: 6>> %unranked = memref.cast %1 : memref<3x3xf32, strided<[3, 1], offset: 6>> to memref<*xf32> call @printMemrefF32(%unranked) : (memref<*xf32>) -> () %2 = memref.subview %0[0, 2][5, 1][1, 1]: memref<5x3xf32> to memref<5x1xf32, strided<[3, 1], offset: 2>> %unranked2 = memref.cast %2 : memref<5x1xf32, strided<[3, 1], offset: 2>> to memref<*xf32> call @printMemrefF32(%unranked2) : (memref<*xf32>) -> () %3 = memref.subview %0[0, 2][5, 1][1, 1]: memref<5x3xf32> to memref<5xf32, strided<[3], offset: 2>> %unranked3 = memref.cast %3 : memref<5xf32, strided<[3], offset: 2>> to memref<*xf32> call @printMemrefF32(%unranked3) : (memref<*xf32>) -> () %4 = memref.subview %0[1, 0][1, 3][1, 1]: memref<5x3xf32> to memref<3xf32, strided<[1], offset: 3>> %unranked4 = memref.cast %4 : memref<3xf32, strided<[1], offset: 3>> to memref<*xf32> call @printMemrefF32(%unranked4) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : memref<*xf32>)", mlir-opt -expand-strided-metadata -lower-affine -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_2d_filled_f32(%s1 : index, %s2 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_2d(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_2d ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile %0 [2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter2D = call @alloc_2d_filled_f32(%c3, %c3, %val) : (index, index, f32) -> (memref) %in2D = call @alloc_2d_filled_f32(%c8, %c8, %val) : (index, index, f32) -> (memref) %out2D = call @alloc_2d_filled_f32(%c6, %c6, %zero) : (index, index, f32) -> (memref) memref.store %f10, %in2D[%c0, %c3] : memref call @conv_2d(%in2D, %filter2D, %out2D) : (memref, memref, memref) -> () %out2D_ = memref.cast %out2D : memref to memref<*xf32> call @printMemrefF32(%out2D_): (memref<*xf32>) -> () memref.dealloc %filter2D : memref memref.dealloc %in2D : memref memref.dealloc %out2D : memref return }", mlir-opt -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_2d_filled_f32(%s1 : index, %s2 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_2d(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_2d ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile %0 [2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter2D = call @alloc_2d_filled_f32(%c3, %c3, %val) : (index, index, f32) -> (memref) %in2D = call @alloc_2d_filled_f32(%c8, %c8, %val) : (index, index, f32) -> (memref) %out2D = call @alloc_2d_filled_f32(%c6, %c6, %zero) : (index, index, f32) -> (memref) memref.store %f10, %in2D[%c0, %c3] : memref call @conv_2d(%in2D, %filter2D, %out2D) : (memref, memref, memref) -> () %out2D_ = memref.cast %out2D : memref to memref<*xf32> call @printMemrefF32(%out2D_): (memref<*xf32>) -> () memref.dealloc %filter2D : memref memref.dealloc %in2D : memref memref.dealloc %out2D : memref return }", mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %const = arith.constant dense<10.0> : tensor<2xf32> %insert_val = arith.constant dense<20.0> : tensor<1xf32> %inserted_at_position_0 = tensor.insert_slice %insert_val into %const[0][1][1] : tensor<1xf32> into tensor<2xf32> %inserted_at_position_1 = tensor.insert_slice %insert_val into %const[1][1][1] : tensor<1xf32> into tensor<2xf32> %unranked_at_position_0 = tensor.cast %inserted_at_position_0 : tensor<2xf32> to tensor<*xf32> call @printMemrefF32(%unranked_at_position_0) : (tensor<*xf32>) -> () %unranked_at_position_1 = tensor.cast %inserted_at_position_1 : tensor<2xf32> to tensor<*xf32> call @printMemrefF32(%unranked_at_position_1) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>)"," mlir-opt -linalg-bufferize -arith-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils ",1 "func.func @main() { %const = arith.constant dense<[[[1.0, 2.0, 3.0], [2.0, 3.0, 4.0]]]> : tensor<1x2x3xf32> %dynamic = tensor.cast %const: tensor<1x2x3xf32> to tensor<1x?x3xf32> %offset = arith.constant 2 : index %cst = arith.constant 2.3 : f32 %c0 = arith.constant 0 : index %out = tensor.pad %dynamic low[%c0, %offset, %c0] high[%c0, %c0, %offset] { ^bb0(%gen_arg1: index, %gen_arg2: index, %gen_arg3: index): tensor.yield %cst : f32 } : tensor<1x?x3xf32> to tensor<1x?x?xf32> %unranked = tensor.cast %out: tensor<1x?x?xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>)"," mlir-opt -test-linalg-transform-patterns=test-linalg-to-vector-patterns -empty-tensor-to-alloc-tensor -linalg-bufferize -arith-bufferize -bufferization-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils ",1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_4d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3, %s4) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_2d_nhwc_hwcf(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nhwc_hwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:4 = transform.structured.tile %0 [2, 3, 3, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter2D_nhwc = call @alloc_4d_filled_f32(%c3, %c3, %c3, %c1, %val) :(index, index, index, index, f32) -> (memref) %in2D_nhwc = call @alloc_4d_filled_f32(%c3, %c8, %c8, %c3, %val) : (index, index, index, index, f32) -> (memref) %out2D_nhwc = call @alloc_4d_filled_f32(%c3, %c6, %c6, %c1, %zero) : (index, index, index, index, f32) -> (memref) memref.store %f10, %in2D_nhwc[%c0, %c0, %c3, %c0] : memref call @conv_2d_nhwc_hwcf(%in2D_nhwc, %filter2D_nhwc, %out2D_nhwc) : (memref, memref, memref) -> () %out2D_nhwc_ = memref.cast %out2D_nhwc : memref to memref<*xf32> call @printMemrefF32(%out2D_nhwc_): (memref<*xf32>) -> () memref.dealloc %filter2D_nhwc : memref memref.dealloc %in2D_nhwc : memref memref.dealloc %out2D_nhwc : memref return }", mlir-opt -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_4d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3, %s4) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_2d_nhwc_hwcf(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_2d_nhwc_hwcf {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_2d_nhwc_hwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:4 = transform.structured.tile %0 [2, 3, 3, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter2D_nhwc = call @alloc_4d_filled_f32(%c3, %c3, %c3, %c1, %val) :(index, index, index, index, f32) -> (memref) %in2D_nhwc = call @alloc_4d_filled_f32(%c3, %c8, %c8, %c3, %val) : (index, index, index, index, f32) -> (memref) %out2D_nhwc = call @alloc_4d_filled_f32(%c3, %c6, %c6, %c1, %zero) : (index, index, index, index, f32) -> (memref) memref.store %f10, %in2D_nhwc[%c0, %c0, %c3, %c0] : memref call @conv_2d_nhwc_hwcf(%in2D_nhwc, %filter2D_nhwc, %out2D_nhwc) : (memref, memref, memref) -> () %out2D_nhwc_ = memref.cast %out2D_nhwc : memref to memref<*xf32> call @printMemrefF32(%out2D_nhwc_): (memref<*xf32>) -> () memref.dealloc %filter2D_nhwc : memref memref.dealloc %in2D_nhwc : memref memref.dealloc %out2D_nhwc : memref return }", mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 %f3 = arith.constant 3.0 : f32 %A = memref.alloc(%c2, %c2) : memref memref.store %f0, %A[%c0, %c0] : memref memref.store %f1, %A[%c0, %c1] : memref memref.store %f2, %A[%c1, %c0] : memref memref.store %f3, %A[%c1, %c1] : memref %B = memref.subview %A[%c1, 0][1, %c2][1, 1] : memref to memref> %C = memref.subview %A[0, %c1][%c2, 1][1, 1] : memref to memref> %A_ = memref.cast %A : memref to memref<*xf32> call @printMemrefF32(%A_) : (memref<*xf32>) -> () %B_ = memref.cast %B : memref> to memref<*xf32> call @printMemrefF32(%B_) : (memref<*xf32>) -> () %C_ = memref.cast %C : memref> to memref<*xf32> call @printMemrefF32(%C_) : (memref<*xf32>) -> () memref.dealloc %A : memref return }", mlir-opt -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %a = arith.constant dense<[1.0, 2.0, 3.0]> : tensor<3xf32> %b = arith.constant dense<[10.0, 20.0, 30.0]> : tensor<3xf32> %addf = arith.addf %a, %b : tensor<3xf32> %addf_unranked = tensor.cast %addf : tensor<3xf32> to tensor<*xf32> call @printMemrefF32(%addf_unranked) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>)", mlir-opt -convert-elementwise-to-linalg -arith-bufferize -linalg-bufferize -tensor-bufferize -func-bufferize -buffer-deallocation -convert-linalg-to-loops -convert-linalg-to-llvm --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %const = arith.constant dense<10.0> : tensor<2xf32> %insert_val = arith.constant dense<20.0> : tensor<1xf32> %inserted = tensor.insert_slice %insert_val into %const[0][1][1] : tensor<1xf32> into tensor<2xf32> %unranked = tensor.cast %inserted : tensor<2xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>)", mlir-opt -linalg-bufferize -arith-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_3d(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_3d ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_3d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2, 2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter3D = call @alloc_3d_filled_f32(%c3, %c3, %c3, %val) : (index, index, index, f32) -> (memref) %in3D = call @alloc_3d_filled_f32(%c8, %c8, %c8, %val) : (index, index, index, f32) -> (memref) %out3D = call @alloc_3d_filled_f32(%c6, %c6, %c6, %zero) : (index, index, index, f32) -> (memref) memref.store %f10, %in3D[%c0, %c0, %c3] : memref call @conv_3d(%in3D, %filter3D, %out3D) : (memref, memref, memref) -> () %out3D_ = memref.cast %out3D : memref to memref<*xf32> call @printMemrefF32(%out3D_): (memref<*xf32>) -> () memref.dealloc %filter3D : memref memref.dealloc %in3D : memref memref.dealloc %out3D : memref return }", mlir-opt -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_3d(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_3d ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_3d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [2, 2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter3D = call @alloc_3d_filled_f32(%c3, %c3, %c3, %val) : (index, index, index, f32) -> (memref) %in3D = call @alloc_3d_filled_f32(%c8, %c8, %c8, %val) : (index, index, index, f32) -> (memref) %out3D = call @alloc_3d_filled_f32(%c6, %c6, %c6, %zero) : (index, index, index, f32) -> (memref) memref.store %f10, %in3D[%c0, %c0, %c3] : memref call @conv_3d(%in3D, %filter3D, %out3D) : (memref, memref, memref) -> () %out3D_ = memref.cast %out3D : memref to memref<*xf32> call @printMemrefF32(%out3D_): (memref<*xf32>) -> () memref.dealloc %filter3D : memref memref.dealloc %in3D : memref memref.dealloc %out3D : memref return }", mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %const = arith.constant dense<[[[-3.9058,0.9072],[-2.9470,-2.2055],[18.3946,8.2997],[3.4700,5.9006],[-17.2267,4.9777],[1.0450,-0.8201]],[[17.6996,-11.1763],[26.7775,-3.8823],[-4.2492,-5.8966],[2.1259,13.1794],[-10.7136,0.8428],[16.4233,9.4589]]]> : tensor<2x6x2xf32> %dynamic = tensor.cast %const: tensor<2x6x2xf32> to tensor<2x?x?xf32> %expanded = call @expand_dynamic_shape(%dynamic) : (tensor<2x?x?xf32>) -> (tensor<2x2x?x1x?xf32>) %unranked = tensor.cast %expanded: tensor<2x2x?x1x?xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>) func.func @expand_dynamic_shape(%arg0 : tensor<2x?x?xf32>) -> tensor<2x2x?x1x?xf32> { %0 = tensor.expand_shape %arg0 [[0], [1, 2, 3], [4]]: tensor<2x?x?xf32> into tensor<2x2x?x1x?xf32> return %0 : tensor<2x2x?x1x?xf32> }", mlir-opt -linalg-bufferize -arith-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %const = arith.constant dense<[[[[-3.9058,0.9072],[-2.9470,-2.2055],[18.3946,8.2997]],[[3.4700,5.9006],[-17.2267,4.9777],[1.0450,-0.8201]]],[[[17.6996,-11.1763],[26.7775,-3.8823],[-4.2492,-5.8966]],[[2.1259,13.1794],[-10.7136,0.8428],[16.4233,9.4589]]]]> : tensor<2x2x3x2xf32> %dynamic = tensor.cast %const: tensor<2x2x3x2xf32> to tensor<2x?x?x?xf32> %collapsed = call @collapse_dynamic_shape(%dynamic) : (tensor<2x?x?x?xf32>) -> (tensor<2x?x?xf32>) %unranked = tensor.cast %collapsed: tensor<2x?x?xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>) func.func @collapse_dynamic_shape(%arg0 : tensor<2x?x?x?xf32>) -> tensor<2x?x?xf32> { %0 = tensor.collapse_shape %arg0 [[0], [1, 2], [3]]: tensor<2x?x?x?xf32> into tensor<2x?x?xf32> return %0 : tensor<2x?x?xf32> }", mlir-opt -linalg-bufferize -arith-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_1d_filled_f32(%s1 : index, %f : f32) -> memref { %buf = memref.alloc(%s1) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_1d(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_1d ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_1d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile %0 [4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } func.func @main() { %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter1D = call @alloc_1d_filled_f32(%c3, %val) : (index, f32) -> (memref) %in1D = call @alloc_1d_filled_f32(%c8, %val) : (index, f32) -> (memref) %out1D = call @alloc_1d_filled_f32(%c6, %zero) : (index, f32) -> (memref) memref.store %f10, %in1D[%c3] : memref call @conv_1d(%in1D, %filter1D, %out1D) : (memref, memref, memref) -> () %out1D_ = memref.cast %out1D : memref to memref<*xf32> call @printMemrefF32(%out1D_): (memref<*xf32>) -> () memref.dealloc %filter1D : memref memref.dealloc %in1D : memref memref.dealloc %out1D : memref return }", mlir-opt -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_1d_filled_f32(%s1 : index, %f : f32) -> memref { %buf = memref.alloc(%s1) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_1d(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_1d ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_1d""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loop = transform.structured.tile %0 [4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } func.func @main() { %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter1D = call @alloc_1d_filled_f32(%c3, %val) : (index, f32) -> (memref) %in1D = call @alloc_1d_filled_f32(%c8, %val) : (index, f32) -> (memref) %out1D = call @alloc_1d_filled_f32(%c6, %zero) : (index, f32) -> (memref) memref.store %f10, %in1D[%c3] : memref call @conv_1d(%in1D, %filter1D, %out1D) : (memref, memref, memref) -> () %out1D_ = memref.cast %out1D : memref to memref<*xf32> call @printMemrefF32(%out1D_): (memref<*xf32>) -> () memref.dealloc %filter1D : memref memref.dealloc %in1D : memref memref.dealloc %out1D : memref return }", mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @foo() -> tensor<4xf32> { %0 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : tensor<4xf32> return %0 : tensor<4xf32> } func.func @main() { %0 = call @foo() : () -> tensor<4xf32> %unranked = tensor.cast %0 : tensor<4xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : tensor<*xf32>)", mlir-opt -arith-bufferize -linalg-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-loops -convert-linalg-to-llvm --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_5d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %s5 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3, %s4, %s5) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_3d_ndhwc_dhwcf(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_3d_ndhwc_dhwcf {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_3d_ndhwc_dhwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [0, 5, 5, 5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter3D_ndhwc = call @alloc_5d_filled_f32(%c3, %c3, %c3, %c1, %c1, %val) : (index, index, index, index, index, f32) -> (memref) %in3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c8, %c8, %c8, %c1, %val) : (index, index, index, index, index, f32) -> (memref) %out3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c6, %c6, %c6, %c1, %zero) : (index, index, index, index, index, f32) -> (memref) memref.store %f10, %in3D_ndhwc[%c0, %c0, %c0, %c3, %c0] : memref call @conv_3d_ndhwc_dhwcf(%in3D_ndhwc, %filter3D_ndhwc, %out3D_ndhwc) : (memref, memref, memref) -> () %out3D_ndhwc_ = memref.cast %out3D_ndhwc : memref to memref<*xf32> call @printMemrefF32(%out3D_ndhwc_): (memref<*xf32>) -> () memref.dealloc %filter3D_ndhwc : memref memref.dealloc %in3D_ndhwc : memref memref.dealloc %out3D_ndhwc : memref return }", mlir-opt -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_5d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %s4 : index, %s5 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3, %s4, %s5) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_3d_ndhwc_dhwcf(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_3d_ndhwc_dhwcf {dilations = dense<1> : tensor<3xi64>, strides = dense<1> : tensor<3xi64>} ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_3d_ndhwc_dhwcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [0, 5, 5, 5] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter3D_ndhwc = call @alloc_5d_filled_f32(%c3, %c3, %c3, %c1, %c1, %val) : (index, index, index, index, index, f32) -> (memref) %in3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c8, %c8, %c8, %c1, %val) : (index, index, index, index, index, f32) -> (memref) %out3D_ndhwc = call @alloc_5d_filled_f32(%c1, %c6, %c6, %c6, %c1, %zero) : (index, index, index, index, index, f32) -> (memref) memref.store %f10, %in3D_ndhwc[%c0, %c0, %c0, %c3, %c0] : memref call @conv_3d_ndhwc_dhwcf(%in3D_ndhwc, %filter3D_ndhwc, %out3D_ndhwc) : (memref, memref, memref) -> () %out3D_ndhwc_ = memref.cast %out3D_ndhwc : memref to memref<*xf32> call @printMemrefF32(%out3D_ndhwc_): (memref<*xf32>) -> () memref.dealloc %filter3D_ndhwc : memref memref.dealloc %in3D_ndhwc : memref memref.dealloc %out3D_ndhwc : memref return }", mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @matmul(%A: memref, %B: memref) -> (memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %f0 = arith.constant 0.0 : f32 %x = memref.dim %A, %c0 : memref %y = memref.dim %B, %c1 : memref %C = memref.alloc(%x, %y) : memref linalg.fill ins(%f0 : f32) outs(%C : memref) linalg.matmul ins(%A, %B: memref, memref) outs(%C: memref) return %C : memref } func.func @matvec(%A: memref, %B: memref) -> (memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %f0 = arith.constant 0.0 : f32 %m = memref.dim %A, %c0 : memref %x = memref.dim %A, %c1 : memref %n = memref.dim %B, %c1 : memref %C = memref.alloc(%m, %n) : memref linalg.fill ins(%f0 : f32) outs(%C : memref) scf.for %i = %c0 to %n step %c1 { %b = memref.subview %B[0, %i][%x, 1][1, 1] : memref to memref> %c = memref.subview %C[0, %i][%m, 1][1, 1] : memref to memref> linalg.matvec ins(%A, %b: memref, memref>) outs(%c: memref>) } return %C : memref } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %m = arith.constant 5 : index %x = arith.constant 3 : index %n = arith.constant 2 : index %val1 = arith.constant 13.0 : f32 %val2 = arith.constant 17.0 : f32 %A = memref.alloc(%m, %x) : memref %B = memref.alloc(%x, %n) : memref linalg.fill ins(%val1 : f32) outs(%A : memref) linalg.fill ins(%val2 : f32) outs(%B : memref) memref.store %val1, %B[%c0, %c0] : memref %C1 = call @matmul(%A, %B) : (memref, memref) -> memref %C2 = call @matvec(%A, %B) : (memref, memref) -> memref scf.for %i = %c0 to %m step %c1 { scf.for %j = %c0 to %n step %c1 { %e1 = memref.load %C1[%i, %j] : memref %e2 = memref.load %C2[%i, %j] : memref %c = arith.cmpf oeq, %e1, %e2 : f32 cf.assert %c, ""Matmul does not produce same output as matvec"" } } %C2_ = memref.cast %C2 : memref to memref<*xf32> call @printMemrefF32(%C2_) : (memref<*xf32>) -> () memref.dealloc %C1 : memref memref.dealloc %C2 : memref return }", mlir-opt -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %A = arith.constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> : tensor<2x3xf32> %B = arith.constant dense<[[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0]]> : tensor<3x4xf32> %C = arith.constant dense<1000.0> : tensor<2x4xf32> %D = linalg.matmul ins(%A, %B: tensor<2x3xf32>, tensor<3x4xf32>) outs(%C: tensor<2x4xf32>) -> tensor<2x4xf32> %unranked = tensor.cast %D : tensor<2x4xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [1, 2, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func private @printMemrefF32(%ptr : tensor<*xf32>)"," mlir-opt -test-transform-dialect-erase-schedule -linalg-bufferize -arith-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -buffer-deallocation -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils ",1 "func.func @main() { %A = arith.constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> : tensor<2x3xf32> %B = arith.constant dense<[[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0]]> : tensor<3x4xf32> %C = arith.constant dense<1000.0> : tensor<2x4xf32> %D = linalg.matmul ins(%A, %B: tensor<2x3xf32>, tensor<3x4xf32>) outs(%C: tensor<2x4xf32>) -> tensor<2x4xf32> %unranked = tensor.cast %D : tensor<2x4xf32> to tensor<*xf32> call @printMemrefF32(%unranked) : (tensor<*xf32>) -> () return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.matmul""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:3 = transform.structured.tile %0 [1, 2, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func private @printMemrefF32(%ptr : tensor<*xf32>)"," mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -linalg-bufferize -scf-bufferize -arith-bufferize -tensor-bufferize -func-bufferize -finalizing-bufferize -convert-linalg-to-loops -convert-scf-to-cf -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils ",1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_1d_nwc_wcf(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_1d_nwc_wcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter1D_nwc = call @alloc_3d_filled_f32(%c3, %c1, %c1, %val) : (index, index, index, f32) -> (memref) %in1D_nwc = call @alloc_3d_filled_f32(%c3, %c8, %c1, %val) : (index, index, index, f32) -> (memref) %out1D_nwc = call @alloc_3d_filled_f32(%c3, %c6, %c1, %zero) : (index, index, index, f32) -> (memref) memref.store %f10, %in1D_nwc[%c0, %c3, %c0] : memref call @conv_1d_nwc_wcf(%in1D_nwc, %filter1D_nwc, %out1D_nwc) : (memref, memref, memref) -> () %out1D_nwc_ = memref.cast %out1D_nwc : memref to memref<*xf32> call @printMemrefF32(%out1D_nwc_): (memref<*xf32>) -> () memref.dealloc %filter1D_nwc : memref memref.dealloc %in1D_nwc : memref memref.dealloc %out1D_nwc : memref return }", mlir-opt -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func private @printMemrefF32(memref<*xf32>) func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> memref { %buf = memref.alloc(%s1, %s2, %s3) : memref linalg.fill ins(%f : f32) outs(%buf : memref) return %buf : memref } func.func @conv_1d_nwc_wcf(%arg0: memref, %arg1: memref, %arg2: memref) { linalg.conv_1d_nwc_wcf {dilations = dense<1> : tensor<1xi64>, strides = dense<1> : tensor<1xi64>} ins (%arg0, %arg1: memref, memref) outs (%arg2: memref) return } transform.sequence failures(propagate) { ^bb0(%arg1: !transform.any_op): %0 = transform.structured.match ops{[""linalg.conv_1d_nwc_wcf""]} in %arg1 : (!transform.any_op) -> !transform.any_op %1, %loops:2 = transform.structured.tile %0 [2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %c6 = arith.constant 6 : index %c8 = arith.constant 8 : index %f10 = arith.constant 10.00000e+00 : f32 %val = arith.constant 2.00000e+00 : f32 %zero = arith.constant 0.00000e+00 : f32 %filter1D_nwc = call @alloc_3d_filled_f32(%c3, %c1, %c1, %val) : (index, index, index, f32) -> (memref) %in1D_nwc = call @alloc_3d_filled_f32(%c3, %c8, %c1, %val) : (index, index, index, f32) -> (memref) %out1D_nwc = call @alloc_3d_filled_f32(%c3, %c6, %c1, %zero) : (index, index, index, f32) -> (memref) memref.store %f10, %in1D_nwc[%c0, %c3, %c0] : memref call @conv_1d_nwc_wcf(%in1D_nwc, %filter1D_nwc, %out1D_nwc) : (memref, memref, memref) -> () %out1D_nwc_ = memref.cast %out1D_nwc : memref to memref<*xf32> call @printMemrefF32(%out1D_nwc_): (memref<*xf32>) -> () memref.dealloc %filter1D_nwc : memref memref.dealloc %in1D_nwc : memref memref.dealloc %out1D_nwc : memref return }", mlir-opt -test-transform-dialect-interpreter -test-transform-dialect-erase-schedule -convert-linalg-to-loops -convert-scf-to-cf -convert-linalg-to-llvm -expand-strided-metadata -lower-affine -convert-arith-to-llvm -convert-scf-to-cf --finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils ,1 "func.func @main() { %arg = memref.alloc() : memref<13xi32> %dst = memref.cast %arg : memref<13xi32> to memref %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %sx = memref.dim %dst, %c0 : memref %cast_dst = memref.cast %dst : memref to memref<*xi32> gpu.host_register %cast_dst : memref<*xi32> %dst_device = call @mgpuMemGetDeviceMemRef1dInt32(%dst) : (memref) -> (memref) gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %c1, %block_z = %c1) { %t0 = arith.index_cast %tx : index to i32 memref.store %t0, %dst_device[%tx] : memref gpu.terminator } gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %c1, %block_z = %c1) { %t0 = arith.index_cast %tx : index to i32 memref.store %t0, %dst_device[%tx] : memref gpu.terminator } call @printMemrefI32(%cast_dst) : (memref<*xi32>) -> () return } func.func private @mgpuMemGetDeviceMemRef1dInt32(%ptr : memref) -> (memref) func.func private @printMemrefI32(%ptr : memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl,gpu-to-hsaco{chip=%chip}))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_rocm_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @vectransferx2(%arg0 : memref, %arg1 : memref) { %cst = arith.constant 1 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { %f0 = arith.constant 0.0: f32 %base = arith.constant 0 : i32 %f = amdgpu.raw_buffer_load {boundsCheck = true } %arg0[%base] : memref, i32 -> vector<2xf32> %c = arith.addf %f, %f : vector<2xf32> %base1 = arith.constant 1 : i32 amdgpu.raw_buffer_store { boundsCheck = false } %c -> %arg1[%base1] : vector<2xf32> -> memref, i32 gpu.terminator } return } func.func @vectransferx4(%arg0 : memref, %arg1 : memref) { %cst = arith.constant 1 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst, %block_z = %cst) { %f0 = arith.constant 0.0: f32 %base = arith.constant 0 : i32 %f = amdgpu.raw_buffer_load { boundsCheck = false } %arg0[%base] : memref, i32 -> vector<4xf32> %c = arith.addf %f, %f : vector<4xf32> amdgpu.raw_buffer_store { boundsCheck = false } %c -> %arg1[%base] : vector<4xf32> -> memref, i32 gpu.terminator } return } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c4 = arith.constant 4 : index %cf1 = arith.constant 1.0 : f32 %cf1dot23 = arith.constant 1.23 : f32 %arg0 = memref.alloc() : memref<4xf32> %arg1 = memref.alloc() : memref<4xf32> %22 = memref.cast %arg0 : memref<4xf32> to memref %23 = memref.cast %arg1 : memref<4xf32> to memref scf.for %i = %c0 to %c4 step %c1 { memref.store %cf1dot23, %22[%i] : memref memref.store %cf1dot23, %23[%i] : memref } %cast0 = memref.cast %22 : memref to memref<*xf32> %cast1 = memref.cast %23 : memref to memref<*xf32> gpu.host_register %cast0 : memref<*xf32> gpu.host_register %cast1 : memref<*xf32> %24 = call @mgpuMemGetDeviceMemRef1dFloat(%22) : (memref) -> (memref) %26 = call @mgpuMemGetDeviceMemRef1dFloat(%23) : (memref) -> (memref) call @vectransferx2(%24, %26) : (memref, memref) -> () call @printMemrefF32(%cast1) : (memref<*xf32>) -> () call @vectransferx4(%24, %26) : (memref, memref) -> () call @printMemrefF32(%cast1) : (memref<*xf32>) -> () return } func.func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref) -> (memref) func.func private @printMemrefF32(%ptr : memref<*xf32>)"," mlir-opt | mlir-opt -convert-scf-to-cf | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl{chipset=%chip index-bitwidth=32},gpu-to-hsaco{chip=%chip}))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_rocm_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @hello() kernel { %0 = gpu.thread_id x gpu.printf ""Hello from %d\n"" %0 : index gpu.return } } func.func @main() { %c2 = arith.constant 2 : index %c1 = arith.constant 1 : index gpu.launch_func @kernels::@hello blocks in (%c1, %c1, %c1) threads in (%c2, %c1, %c1) return } }"," mlir-opt | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl{index-bitwidth=32 runtime=HIP},gpu-to-hsaco{chip=%chip}))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_rocm_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @other_func(%arg0 : f32, %arg1 : memref) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %block_dim = memref.dim %arg1, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %block_dim, %block_y = %c1, %block_z = %c1) { memref.store %arg0, %arg1[%tx] : memref gpu.terminator } return } func.func @main() { %arg0 = memref.alloc() : memref<5xf32> %21 = arith.constant 5 : i32 %22 = memref.cast %arg0 : memref<5xf32> to memref %cast = memref.cast %22 : memref to memref<*xf32> gpu.host_register %cast : memref<*xf32> %23 = memref.cast %22 : memref to memref<*xf32> call @printMemrefF32(%23) : (memref<*xf32>) -> () %24 = arith.constant 1.0 : f32 %25 = call @mgpuMemGetDeviceMemRef1dFloat(%22) : (memref) -> (memref) call @other_func(%24, %25) : (f32, memref) -> () call @printMemrefF32(%23) : (memref<*xf32>) -> () return } func.func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref) -> (memref) func.func private @printMemrefF32(%ptr : memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl,gpu-to-hsaco{chip=%chip}))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_rocm_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @vecadd(%arg0 : memref<5xf32>, %arg1 : memref<5xf32>, %arg2 : memref<5xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %block_dim = arith.constant 5 : index gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %block_dim, %block_y = %c1, %block_z = %c1) { %a = memref.load %arg0[%tx] : memref<5xf32> %b = memref.load %arg1[%tx] : memref<5xf32> %c = arith.addf %a, %b : f32 memref.store %c, %arg2[%tx] : memref<5xf32> gpu.terminator } return } func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c5 = arith.constant 5 : index %cf1dot23 = arith.constant 1.23 : f32 %0 = memref.alloc() : memref<5xf32> %1 = memref.alloc() : memref<5xf32> %2 = memref.alloc() : memref<5xf32> %3 = memref.cast %0 : memref<5xf32> to memref %4 = memref.cast %1 : memref<5xf32> to memref %5 = memref.cast %2 : memref<5xf32> to memref scf.for %i = %c0 to %c5 step %c1 { memref.store %cf1dot23, %3[%i] : memref memref.store %cf1dot23, %4[%i] : memref } %6 = memref.cast %3 : memref to memref<*xf32> %7 = memref.cast %4 : memref to memref<*xf32> %8 = memref.cast %5 : memref to memref<*xf32> gpu.host_register %6 : memref<*xf32> gpu.host_register %7 : memref<*xf32> gpu.host_register %8 : memref<*xf32> %9 = call @mgpuMemGetDeviceMemRef1dFloat(%3) : (memref) -> (memref) %10 = call @mgpuMemGetDeviceMemRef1dFloat(%4) : (memref) -> (memref) %11 = call @mgpuMemGetDeviceMemRef1dFloat(%5) : (memref) -> (memref) %12 = memref.cast %9 : memref to memref<5xf32> %13 = memref.cast %10 : memref to memref<5xf32> %14 = memref.cast %11 : memref to memref<5xf32> call @vecadd(%12, %13, %14) : (memref<5xf32>, memref<5xf32>, memref<5xf32>) -> () call @printMemrefF32(%8) : (memref<*xf32>) -> () return } func.func private @mgpuMemGetDeviceMemRef1dFloat(%ptr : memref) -> (memref) func.func private @printMemrefF32(%ptr : memref<*xf32>)"," mlir-opt | mlir-opt -convert-scf-to-cf | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-rocdl{use-bare-ptr-memref-call-conv=true},gpu-to-hsaco{chip=%chip}))' | mlir-opt -gpu-to-llvm=use-bare-pointers-for-kernels=true | mlir-cpu-runner --shared-libs=%mlir_rocm_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %data = memref.alloc() : memref<2x6xi32> %sum = memref.alloc() : memref<2xi32> %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %cst2 = arith.constant 2 : i32 %cst4 = arith.constant 4 : i32 %cst8 = arith.constant 8 : i32 %cst16 = arith.constant 16 : i32 %cst3 = arith.constant 3 : i32 %cst6 = arith.constant 6 : i32 %cst7 = arith.constant 7 : i32 %cst10 = arith.constant 10 : i32 %cst11 = arith.constant 11 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %cast_data = memref.cast %data : memref<2x6xi32> to memref<*xi32> gpu.host_register %cast_data : memref<*xi32> %cast_sum = memref.cast %sum : memref<2xi32> to memref<*xi32> gpu.host_register %cast_sum : memref<*xi32> memref.store %cst0, %data[%c0, %c0] : memref<2x6xi32> memref.store %cst1, %data[%c0, %c1] : memref<2x6xi32> memref.store %cst2, %data[%c0, %c2] : memref<2x6xi32> memref.store %cst4, %data[%c0, %c3] : memref<2x6xi32> memref.store %cst8, %data[%c0, %c4] : memref<2x6xi32> memref.store %cst16, %data[%c0, %c5] : memref<2x6xi32> memref.store %cst2, %data[%c1, %c0] : memref<2x6xi32> memref.store %cst3, %data[%c1, %c1] : memref<2x6xi32> memref.store %cst6, %data[%c1, %c2] : memref<2x6xi32> memref.store %cst7, %data[%c1, %c3] : memref<2x6xi32> memref.store %cst10, %data[%c1, %c4] : memref<2x6xi32> memref.store %cst11, %data[%c1, %c5] : memref<2x6xi32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c2, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c6, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xi32> %reduced = gpu.all_reduce xor %val uniform {} : (i32) -> (i32) memref.store %reduced, %sum[%bx] : memref<2xi32> gpu.terminator } call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %data = memref.alloc() : memref<2x6xi32> %sum = memref.alloc() : memref<2xi32> %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %cst2 = arith.constant 2 : i32 %cst4 = arith.constant 4 : i32 %cst8 = arith.constant 8 : i32 %cst16 = arith.constant 16 : i32 %cst3 = arith.constant 3 : i32 %cst6 = arith.constant 6 : i32 %cst7 = arith.constant 7 : i32 %cst10 = arith.constant 10 : i32 %cst11 = arith.constant 11 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %cast_data = memref.cast %data : memref<2x6xi32> to memref<*xi32> gpu.host_register %cast_data : memref<*xi32> %cast_sum = memref.cast %sum : memref<2xi32> to memref<*xi32> gpu.host_register %cast_sum : memref<*xi32> memref.store %cst0, %data[%c0, %c0] : memref<2x6xi32> memref.store %cst1, %data[%c0, %c1] : memref<2x6xi32> memref.store %cst2, %data[%c0, %c2] : memref<2x6xi32> memref.store %cst4, %data[%c0, %c3] : memref<2x6xi32> memref.store %cst8, %data[%c0, %c4] : memref<2x6xi32> memref.store %cst16, %data[%c0, %c5] : memref<2x6xi32> memref.store %cst2, %data[%c1, %c0] : memref<2x6xi32> memref.store %cst3, %data[%c1, %c1] : memref<2x6xi32> memref.store %cst6, %data[%c1, %c2] : memref<2x6xi32> memref.store %cst7, %data[%c1, %c3] : memref<2x6xi32> memref.store %cst10, %data[%c1, %c4] : memref<2x6xi32> memref.store %cst11, %data[%c1, %c5] : memref<2x6xi32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c2, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c6, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xi32> %reduced = gpu.all_reduce min %val uniform {} : (i32) -> (i32) memref.store %reduced, %sum[%bx] : memref<2xi32> gpu.terminator } call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %data = memref.alloc() : memref<2x6xi32> %sum = memref.alloc() : memref<2xi32> %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %cst2 = arith.constant 2 : i32 %cst4 = arith.constant 4 : i32 %cst8 = arith.constant 8 : i32 %cst16 = arith.constant 16 : i32 %cst3 = arith.constant 3 : i32 %cst6 = arith.constant 6 : i32 %cst7 = arith.constant 7 : i32 %cst10 = arith.constant 10 : i32 %cst11 = arith.constant 11 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %cast_data = memref.cast %data : memref<2x6xi32> to memref<*xi32> gpu.host_register %cast_data : memref<*xi32> %cast_sum = memref.cast %sum : memref<2xi32> to memref<*xi32> gpu.host_register %cast_sum : memref<*xi32> memref.store %cst0, %data[%c0, %c0] : memref<2x6xi32> memref.store %cst1, %data[%c0, %c1] : memref<2x6xi32> memref.store %cst2, %data[%c0, %c2] : memref<2x6xi32> memref.store %cst4, %data[%c0, %c3] : memref<2x6xi32> memref.store %cst8, %data[%c0, %c4] : memref<2x6xi32> memref.store %cst16, %data[%c0, %c5] : memref<2x6xi32> memref.store %cst2, %data[%c1, %c0] : memref<2x6xi32> memref.store %cst3, %data[%c1, %c1] : memref<2x6xi32> memref.store %cst6, %data[%c1, %c2] : memref<2x6xi32> memref.store %cst7, %data[%c1, %c3] : memref<2x6xi32> memref.store %cst10, %data[%c1, %c4] : memref<2x6xi32> memref.store %cst11, %data[%c1, %c5] : memref<2x6xi32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c2, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c6, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xi32> %reduced = gpu.all_reduce and %val uniform {} : (i32) -> (i32) memref.store %reduced, %sum[%bx] : memref<2xi32> gpu.terminator } call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @other_func(%arg0 : f32, %arg1 : memref) { %cst = arith.constant 1 : index %c0 = arith.constant 0 : index %cst2 = memref.dim %arg1, %c0 : memref gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst, %grid_z = %cst) threads(%tx, %ty, %tz) in (%block_x = %cst2, %block_y = %cst, %block_z = %cst) { memref.store %arg0, %arg1[%tx] : memref gpu.terminator } return } func.func @main() { %v0 = arith.constant 0.0 : f32 %c0 = arith.constant 0: index %arg0 = memref.alloc() : memref<5xf32> %21 = arith.constant 5 : i32 %22 = memref.cast %arg0 : memref<5xf32> to memref %23 = memref.cast %22 : memref to memref<*xf32> gpu.host_register %23 : memref<*xf32> call @printMemrefF32(%23) : (memref<*xf32>) -> () %24 = arith.constant 1.0 : f32 call @other_func(%24, %22) : (f32, memref) -> () call @printMemrefF32(%23) : (memref<*xf32>) -> () %val1 = vector.transfer_read %arg0[%c0], %v0: memref<5xf32>, vector<2xf32> vector.print %val1: vector<2xf32> return } func.func private @printMemrefF32(%ptr : memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --shared-libs=%mlir_c_runner_utils --entry-point-result=void ",1 "func.func @main() { %data = memref.alloc() : memref<2x6xf32> %sum = memref.alloc() : memref<2xf32> %mul = memref.alloc() : memref<2xf32> %cst0 = arith.constant 0.0 : f32 %cst1 = arith.constant 1.0 : f32 %cst2 = arith.constant 2.0 : f32 %cst4 = arith.constant 4.0 : f32 %cst8 = arith.constant 8.0 : f32 %cst16 = arith.constant 16.0 : f32 %cst3 = arith.constant 3.0 : f32 %cst6 = arith.constant 6.0 : f32 %cst7 = arith.constant 7.0 : f32 %cst10 = arith.constant 10.0 : f32 %cst11 = arith.constant 11.0 : f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %cast_data = memref.cast %data : memref<2x6xf32> to memref<*xf32> gpu.host_register %cast_data : memref<*xf32> %cast_sum = memref.cast %sum : memref<2xf32> to memref<*xf32> gpu.host_register %cast_sum : memref<*xf32> %cast_mul = memref.cast %mul : memref<2xf32> to memref<*xf32> gpu.host_register %cast_mul : memref<*xf32> memref.store %cst0, %data[%c0, %c0] : memref<2x6xf32> memref.store %cst1, %data[%c0, %c1] : memref<2x6xf32> memref.store %cst2, %data[%c0, %c2] : memref<2x6xf32> memref.store %cst4, %data[%c0, %c3] : memref<2x6xf32> memref.store %cst8, %data[%c0, %c4] : memref<2x6xf32> memref.store %cst16, %data[%c0, %c5] : memref<2x6xf32> memref.store %cst2, %data[%c1, %c0] : memref<2x6xf32> memref.store %cst3, %data[%c1, %c1] : memref<2x6xf32> memref.store %cst6, %data[%c1, %c2] : memref<2x6xf32> memref.store %cst7, %data[%c1, %c3] : memref<2x6xf32> memref.store %cst10, %data[%c1, %c4] : memref<2x6xf32> memref.store %cst11, %data[%c1, %c5] : memref<2x6xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c2, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c6, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xf32> %reduced0 = gpu.all_reduce add %val uniform {} : (f32) -> (f32) memref.store %reduced0, %sum[%bx] : memref<2xf32> %reduced1 = gpu.all_reduce mul %val uniform {} : (f32) -> (f32) memref.store %reduced1, %mul[%bx] : memref<2xf32> gpu.terminator } call @printMemrefF32(%cast_sum) : (memref<*xf32>) -> () call @printMemrefF32(%cast_mul) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %arg = memref.alloc() : memref<2x4x13xf32> %dst = memref.cast %arg : memref<2x4x13xf32> to memref %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %sx = memref.dim %dst, %c2 : memref %sy = memref.dim %dst, %c1 : memref %sz = memref.dim %dst, %c0 : memref %cast_dst = memref.cast %dst : memref to memref<*xf32> gpu.host_register %cast_dst : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %sy, %block_z = %sz) { %t0 = arith.muli %tz, %block_y : index %t1 = arith.addi %ty, %t0 : index %t2 = arith.muli %t1, %block_x : index %idx = arith.addi %tx, %t2 : index %t3 = arith.index_cast %idx : index to i32 %val = arith.sitofp %t3 : i32 to f32 %sum = gpu.all_reduce add %val uniform {} : (f32) -> (f32) memref.store %sum, %dst[%tz, %ty, %tx] : memref gpu.terminator } call @printMemrefF32(%cast_dst) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %arg = memref.alloc() : memref<13xi32> %dst = memref.cast %arg : memref<13xi32> to memref %one = arith.constant 1 : index %c0 = arith.constant 0 : index %sx = memref.dim %dst, %c0 : memref %cast_dst = memref.cast %dst : memref to memref<*xi32> gpu.host_register %cast_dst : memref<*xi32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %one, %grid_y = %one, %grid_z = %one) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %one, %block_z = %one) { %t0 = arith.index_cast %tx : index to i32 memref.store %t0, %dst[%tx] : memref gpu.terminator } gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %one, %grid_y = %one, %grid_z = %one) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %one, %block_z = %one) { %t0 = arith.index_cast %tx : index to i32 memref.store %t0, %dst[%tx] : memref gpu.terminator } call @printMemrefI32(%cast_dst) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(%memref : memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %arg = memref.alloc() : memref<13xf32> %dst = memref.cast %arg : memref<13xf32> to memref %one = arith.constant 1 : index %c0 = arith.constant 0 : index %sx = memref.dim %dst, %c0 : memref %cast_dst = memref.cast %dst : memref to memref<*xf32> gpu.host_register %cast_dst : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %one, %grid_y = %one, %grid_z = %one) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %one, %block_z = %one) { %t0 = arith.index_cast %tx : index to i32 %val = arith.sitofp %t0 : i32 to f32 %width = arith.index_cast %block_x : index to i32 %offset = arith.constant 4 : i32 %shfl, %valid = gpu.shuffle xor %val, %offset, %width : f32 cf.cond_br %valid, ^bb1(%shfl : f32), ^bb0 ^bb0: %m1 = arith.constant -1.0 : f32 cf.br ^bb1(%m1 : f32) ^bb1(%value : f32): memref.store %value, %dst[%tx] : memref gpu.terminator } call @printMemrefF32(%cast_dst) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(%ptr : memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %count = arith.constant 2 : index %h0 = memref.alloc(%count) : memref %h0_unranked = memref.cast %h0 : memref to memref<*xi32> gpu.host_register %h0_unranked : memref<*xi32> %v0 = arith.constant 42 : i32 memref.store %v0, %h0[%c0] : memref memref.store %v0, %h0[%c1] : memref %t0, %f0 = async.execute () -> !async.value> { %b0 = gpu.alloc(%count) : memref gpu.memcpy %b0, %h0 : memref, memref async.yield %b0 : memref } %t1, %f1 = async.execute [%t0] ( %f0 as %b0 : !async.value> ) -> !async.value> { %b1 = gpu.alloc(%count) : memref gpu.memcpy %b1, %b0 : memref, memref async.yield %b1 : memref } %t2, %f2 = async.execute [%t0] ( %f0 as %b0 : !async.value> ) -> !async.value> { %b2 = gpu.alloc(%count) : memref gpu.memcpy %b2, %b0 : memref, memref async.yield %b2 : memref } %t3 = async.execute [%t1, %t2] ( %f1 as %b1 : !async.value>, %f2 as %b2 : !async.value> ) { gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %count, %block_y = %c1, %block_z = %c1) { %v1 = memref.load %b1[%tx] : memref %v2 = memref.load %b2[%tx] : memref %sum = arith.addi %v1, %v2 : i32 memref.store %sum, %h0[%tx] : memref gpu.terminator } async.yield } async.await %t3 : !async.token call @printMemrefI32(%h0_unranked) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-async-region -gpu-to-llvm | mlir-opt -async-to-async-runtime -async-runtime-ref-counting | mlir-opt -convert-async-to-llvm -convert-func-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_async_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void -O0 ",1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @hello() kernel { %0 = gpu.thread_id x %csti8 = arith.constant 2 : i8 %cstf32 = arith.constant 3.0 : f32 gpu.printf ""Hello from %lld, %d, %f\n"" %0, %csti8, %cstf32 : index, i8, f32 gpu.return } } func.func @main() { %c2 = arith.constant 2 : index %c1 = arith.constant 1 : index gpu.launch_func @kernels::@hello blocks in (%c1, %c1, %c1) threads in (%c2, %c1, %c1) return } }"," mlir-opt | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %data = memref.alloc() : memref<2x6xi32> %sum = memref.alloc() : memref<2xi32> %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %cst2 = arith.constant 2 : i32 %cst4 = arith.constant 4 : i32 %cst8 = arith.constant 8 : i32 %cst16 = arith.constant 16 : i32 %cst3 = arith.constant 3 : i32 %cst6 = arith.constant 6 : i32 %cst7 = arith.constant 7 : i32 %cst10 = arith.constant 10 : i32 %cst11 = arith.constant 11 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %cast_data = memref.cast %data : memref<2x6xi32> to memref<*xi32> gpu.host_register %cast_data : memref<*xi32> %cast_sum = memref.cast %sum : memref<2xi32> to memref<*xi32> gpu.host_register %cast_sum : memref<*xi32> memref.store %cst0, %data[%c0, %c0] : memref<2x6xi32> memref.store %cst1, %data[%c0, %c1] : memref<2x6xi32> memref.store %cst2, %data[%c0, %c2] : memref<2x6xi32> memref.store %cst4, %data[%c0, %c3] : memref<2x6xi32> memref.store %cst8, %data[%c0, %c4] : memref<2x6xi32> memref.store %cst16, %data[%c0, %c5] : memref<2x6xi32> memref.store %cst2, %data[%c1, %c0] : memref<2x6xi32> memref.store %cst3, %data[%c1, %c1] : memref<2x6xi32> memref.store %cst6, %data[%c1, %c2] : memref<2x6xi32> memref.store %cst7, %data[%c1, %c3] : memref<2x6xi32> memref.store %cst10, %data[%c1, %c4] : memref<2x6xi32> memref.store %cst11, %data[%c1, %c5] : memref<2x6xi32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c2, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c6, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xi32> %reduced = gpu.all_reduce or %val uniform {} : (i32) -> (i32) memref.store %reduced, %sum[%bx] : memref<2xi32> gpu.terminator } call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %data = memref.alloc() : memref<2x6xi32> %sum = memref.alloc() : memref<2xi32> %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %cst2 = arith.constant 2 : i32 %cst4 = arith.constant 4 : i32 %cst8 = arith.constant 8 : i32 %cst16 = arith.constant 16 : i32 %cst3 = arith.constant 3 : i32 %cst6 = arith.constant 6 : i32 %cst7 = arith.constant 7 : i32 %cst10 = arith.constant 10 : i32 %cst11 = arith.constant 11 : i32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %cast_data = memref.cast %data : memref<2x6xi32> to memref<*xi32> gpu.host_register %cast_data : memref<*xi32> %cast_sum = memref.cast %sum : memref<2xi32> to memref<*xi32> gpu.host_register %cast_sum : memref<*xi32> memref.store %cst0, %data[%c0, %c0] : memref<2x6xi32> memref.store %cst1, %data[%c0, %c1] : memref<2x6xi32> memref.store %cst2, %data[%c0, %c2] : memref<2x6xi32> memref.store %cst4, %data[%c0, %c3] : memref<2x6xi32> memref.store %cst8, %data[%c0, %c4] : memref<2x6xi32> memref.store %cst16, %data[%c0, %c5] : memref<2x6xi32> memref.store %cst2, %data[%c1, %c0] : memref<2x6xi32> memref.store %cst3, %data[%c1, %c1] : memref<2x6xi32> memref.store %cst6, %data[%c1, %c2] : memref<2x6xi32> memref.store %cst7, %data[%c1, %c3] : memref<2x6xi32> memref.store %cst10, %data[%c1, %c4] : memref<2x6xi32> memref.store %cst11, %data[%c1, %c5] : memref<2x6xi32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c2, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c6, %block_y = %c1, %block_z = %c1) { %val = memref.load %data[%bx, %tx] : memref<2x6xi32> %reduced = gpu.all_reduce max %val uniform {} : (i32) -> (i32) memref.store %reduced, %sum[%bx] : memref<2xi32> gpu.terminator } call @printMemrefI32(%cast_sum) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %arg = memref.alloc() : memref<35xf32> %dst = memref.cast %arg : memref<35xf32> to memref %one = arith.constant 1 : index %c0 = arith.constant 0 : index %sx = memref.dim %dst, %c0 : memref %cast_dst = memref.cast %dst : memref to memref<*xf32> gpu.host_register %cast_dst : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %one, %grid_y = %one, %grid_z = %one) threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %one, %block_z = %one) { %val = arith.index_cast %tx : index to i32 %xor = gpu.all_reduce %val uniform { ^bb(%lhs : i32, %rhs : i32): %xor = arith.xori %lhs, %rhs : i32 ""gpu.yield""(%xor) : (i32) -> () } : (i32) -> (i32) %res = arith.sitofp %xor : i32 to f32 memref.store %res, %dst[%tx] : memref gpu.terminator } call @printMemrefF32(%cast_dst) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin))' | mlir-opt -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %0 = memref.alloc() : memref<16x16xf16> %22 = memref.alloc() : memref<16x16xf32> %1 = memref.alloc() : memref<16x16xf32> %f1 = arith.constant 1.0e+00 : f16 %f0 = arith.constant 0.0e+00 : f32 %c0 = arith.constant 0 : index %c16 = arith.constant 16 : index %c32 = arith.constant 32 : index %c1 = arith.constant 1 : index scf.for %arg0 = %c0 to %c16 step %c1 { scf.for %arg1 = %c0 to %c16 step %c1 { memref.store %f1, %0[%arg0, %arg1] : memref<16x16xf16> } } scf.for %arg0 = %c0 to %c16 step %c1 { scf.for %arg1 = %c0 to %c16 step %c1 { memref.store %f0, %22[%arg0, %arg1] : memref<16x16xf32> } } %2 = memref.cast %0 : memref<16x16xf16> to memref<*xf16> %33 = memref.cast %22 : memref<16x16xf32> to memref<*xf32> %3 = memref.cast %1 : memref<16x16xf32> to memref<*xf32> gpu.host_register %2 : memref<*xf16> gpu.host_register %33 : memref<*xf32> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c32, %block_y = %c1, %block_z = %c1) { %A = gpu.subgroup_mma_load_matrix %0[%c0, %c0] {leadDimension = 16 : index} : memref<16x16xf16> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %B = gpu.subgroup_mma_load_matrix %0[%c0, %c0] {leadDimension = 16 : index} : memref<16x16xf16> -> !gpu.mma_matrix<16x16xf16, ""BOp""> %C = gpu.subgroup_mma_load_matrix %22[%c0, %c0] {leadDimension = 16 : index} : memref<16x16xf32> -> !gpu.mma_matrix<16x16xf32, ""COp""> %R = gpu.subgroup_mma_compute %A, %B, %C : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf32, ""COp""> gpu.subgroup_mma_store_matrix %R, %22[%c0, %c0] {leadDimension = 16 : index}: !gpu.mma_matrix<16x16xf32, ""COp"">, memref<16x16xf32> gpu.terminator } call @printMemrefF32(%33) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin{chip=sm_70}))' | mlir-opt --convert-scf-to-cf -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @main() { %0 = memref.alloc() : memref<16x16xf16> %22 = memref.alloc() : memref<16x16xf16> %1 = memref.alloc() : memref<16x16xf32> %f1 = arith.constant 1.0e+00 : f16 %f0 = arith.constant 0.0e+00 : f16 %c0 = arith.constant 0 : index %c16 = arith.constant 16 : index %c32 = arith.constant 32 : index %c1 = arith.constant 1 : index scf.for %arg0 = %c0 to %c16 step %c1 { scf.for %arg1 = %c0 to %c16 step %c1 { %2 = arith.index_cast %arg1 : index to i16 %3 = arith.sitofp %2 : i16 to f16 memref.store %3, %0[%arg0, %arg1] : memref<16x16xf16> } } scf.for %arg0 = %c0 to %c16 step %c1 { scf.for %arg1 = %c0 to %c16 step %c1 { memref.store %f0, %22[%arg0, %arg1] : memref<16x16xf16> } } %2 = memref.cast %0 : memref<16x16xf16> to memref<*xf16> %33 = memref.cast %22 : memref<16x16xf16> to memref<*xf16> %3 = memref.cast %1 : memref<16x16xf32> to memref<*xf32> gpu.host_register %2 : memref<*xf16> gpu.host_register %33 : memref<*xf16> gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1, %grid_z = %c1) threads(%tx, %ty, %tz) in (%block_x = %c32, %block_y = %c1, %block_z = %c1) { %A = gpu.subgroup_mma_load_matrix %0[%c0, %c0] {leadDimension = 16 : index, transpose} : memref<16x16xf16> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %B = gpu.subgroup_mma_load_matrix %0[%c0, %c0] {leadDimension = 16 : index} : memref<16x16xf16> -> !gpu.mma_matrix<16x16xf16, ""BOp""> %C = gpu.subgroup_mma_load_matrix %22[%c0, %c0] {leadDimension = 16 : index} : memref<16x16xf16> -> !gpu.mma_matrix<16x16xf16, ""COp""> %R = gpu.subgroup_mma_compute %A, %B, %C {a_transpose} : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.subgroup_mma_store_matrix %R, %0[%c0, %c0] {leadDimension = 16 : index}: !gpu.mma_matrix<16x16xf16, ""COp"">, memref<16x16xf16> gpu.terminator } scf.for %arg0 = %c0 to %c16 step %c1 { scf.for %arg1 = %c0 to %c16 step %c1 { %6 = memref.load %0[%arg0, %arg1] : memref<16x16xf16> %7 = arith.extf %6 : f16 to f32 memref.store %7, %1[%arg0, %arg1] : memref<16x16xf32> } } call @printMemrefF32(%3) : (memref<*xf32>) -> () return } func.func private @printMemrefF32(memref<*xf32>)"," mlir-opt | mlir-opt -gpu-kernel-outlining | mlir-opt -pass-pipeline='builtin.module(gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin{chip=sm_70}))' | mlir-opt --convert-scf-to-cf -gpu-to-llvm | mlir-cpu-runner --shared-libs=%mlir_cuda_runtime --shared-libs=%mlir_runner_utils --entry-point-result=void ",1 "func.func @func_condBranch(%cond : i1) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: cf.br ^exit ^bb2: cf.br ^exit ^exit: return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-dominance))"" -split-input-file 2>&1 ",1 "func.func @func_loop(%arg0 : i32, %arg1 : i32) { cf.br ^loopHeader(%arg0 : i32) ^loopHeader(%counter : i32): %lessThan = arith.cmpi slt, %counter, %arg1 : i32 cf.cond_br %lessThan, ^loopBody, ^exit ^loopBody: %const0 = arith.constant 1 : i32 %inc = arith.addi %counter, %const0 : i32 cf.br ^loopHeader(%inc : i32) ^exit: return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-dominance))"" -split-input-file 2>&1 ",1 "func.func @nested_region(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %arg3 = %arg0 to %arg1 step %arg2 { } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-dominance))"" -split-input-file 2>&1 ",1 "func.func @nested_region2(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %arg3 = %arg0 to %arg1 step %arg2 { scf.for %arg4 = %arg0 to %arg1 step %arg2 { scf.for %arg5 = %arg0 to %arg1 step %arg2 { } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-dominance))"" -split-input-file 2>&1 ",1 "func.func @func_loop_nested_region( %arg0 : i32, %arg1 : i32, %arg2 : index, %arg3 : index, %arg4 : index) { cf.br ^loopHeader(%arg0 : i32) ^loopHeader(%counter : i32): %lessThan = arith.cmpi slt, %counter, %arg1 : i32 cf.cond_br %lessThan, ^loopBody, ^exit ^loopBody: %const0 = arith.constant 1 : i32 %inc = arith.addi %counter, %const0 : i32 scf.for %arg5 = %arg2 to %arg3 step %arg4 { scf.for %arg6 = %arg2 to %arg3 step %arg4 { } } cf.br ^loopHeader(%inc : i32) ^exit: return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-dominance))"" -split-input-file 2>&1 ",1 "func.func @restrict(%arg: memref, %arg1: memref {local_alias_analysis.restrict}) attributes {test.ptr = ""func""} { %0 = memref.subview %arg[0][2][1] {test.ptr = ""view1""} : memref to memref<2xf32> %1 = memref.subview %arg1[0][2][1] {test.ptr = ""view2""} : memref to memref<2xf32> return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis-extending))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @no_side_effects(%arg: memref<2xf32>) attributes {test.ptr = ""func""} { %1 = memref.alloc() {test.ptr = ""alloc""} : memref<8x64xf32> memref.dealloc %1 {test.ptr = ""dealloc""} : memref<8x64xf32> return {test.ptr = ""return""} }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis-modref))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @simple(%arg: memref, %value: i32) attributes {test.ptr = ""func""} { %1 = memref.alloca() {test.ptr = ""alloc""} : memref memref.store %value, %1[] {test.ptr = ""store""} : memref %2 = memref.load %1[] {test.ptr = ""load""} : memref return {test.ptr = ""return""} }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis-modref))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @mayalias(%arg0: memref, %arg1: memref, %value: i32) attributes {test.ptr = ""func""} { memref.store %value, %arg1[] {test.ptr = ""store""} : memref %1 = memref.load %arg1[] {test.ptr = ""load""} : memref return {test.ptr = ""return""} }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis-modref))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @recursive(%arg0: memref, %arg1: memref, %cond: i1, %value: i32) attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloc""} : memref scf.if %cond { memref.store %value, %arg0[] : memref %1 = memref.load %arg0[] : memref } {test.ptr = ""if""} return {test.ptr = ""return""} }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis-modref))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @unknown(%arg0: memref) attributes {test.ptr = ""func""} { ""foo.op""() {test.ptr = ""unknown""} : () -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis-modref))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @func_empty() { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @func_simpleBranch(%arg0: i32, %arg1 : i32) -> i32 { cf.br ^exit ^exit: %result = arith.addi %arg0, %arg1 : i32 return %result : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @func_condBranch(%cond : i1, %arg1: i32, %arg2 : i32) -> i32 { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: cf.br ^exit ^bb2: cf.br ^exit ^exit: %result = arith.addi %arg1, %arg2 : i32 return %result : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @func_loop(%arg0 : i32, %arg1 : i32) -> i32 { %const0 = arith.constant 0 : i32 cf.br ^loopHeader(%const0, %arg0 : i32, i32) ^loopHeader(%counter : i32, %i : i32): %lessThan = arith.cmpi slt, %counter, %arg1 : i32 cf.cond_br %lessThan, ^loopBody(%i : i32), ^exit(%i : i32) ^loopBody(%val : i32): %const1 = arith.constant 1 : i32 %inc = arith.addi %val, %const1 : i32 %inc2 = arith.addi %counter, %const1 : i32 cf.br ^loopHeader(%inc, %inc2 : i32, i32) ^exit(%sum : i32): %result = arith.addi %sum, %arg1 : i32 return %result : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @func_ranges(%cond : i1, %arg1 : i32, %arg2 : i32, %arg3 : i32) -> i32 { %0 = arith.addi %arg1, %arg2 : i32 %const1 = arith.constant 1 : i32 %1 = arith.addi %const1, %arg2 : i32 %2 = arith.addi %const1, %arg3 : i32 %3 = arith.muli %0, %1 : i32 %4 = arith.muli %3, %2 : i32 %5 = arith.addi %4, %const1 : i32 cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %const4 = arith.constant 4 : i32 %6 = arith.muli %4, %const4 : i32 cf.br ^exit(%6 : i32) ^bb2: %7 = arith.muli %4, %5 : i32 %8 = arith.addi %4, %arg2 : i32 cf.br ^exit(%8 : i32) ^exit(%sum : i32): %result = arith.addi %sum, %arg2 : i32 return %result : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @nested_region( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : i32, %arg4 : i32, %arg5 : i32, %buffer : memref) -> i32 { %0 = arith.addi %arg3, %arg4 : i32 %1 = arith.addi %arg4, %arg5 : i32 scf.for %arg6 = %arg0 to %arg1 step %arg2 { %2 = arith.addi %0, %arg5 : i32 %3 = arith.addi %2, %0 : i32 memref.store %3, %buffer[] : memref } return %1 : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @nested_region2( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : i32, %arg4 : i32, %arg5 : i32, %buffer : memref) -> i32 { %0 = arith.addi %arg3, %arg4 : i32 %1 = arith.addi %arg4, %arg5 : i32 scf.for %arg6 = %arg0 to %arg1 step %arg2 { %2 = arith.addi %0, %arg5 : i32 scf.for %arg7 = %arg0 to %arg1 step %arg2 { %3 = arith.addi %2, %0 : i32 memref.store %3, %buffer[] : memref } } return %1 : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @nested_region3( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : i32, %arg4 : i32, %arg5 : i32, %buffer : memref) -> i32 { %0 = arith.addi %arg3, %arg4 : i32 %1 = arith.addi %arg4, %arg5 : i32 scf.for %arg6 = %arg0 to %arg1 step %arg2 { %2 = arith.addi %0, %arg5 : i32 memref.store %2, %buffer[] : memref } cf.br ^exit ^exit: scf.for %arg7 = %arg0 to %arg1 step %arg2 { %2 = arith.addi %0, %1 : i32 memref.store %2, %buffer[] : memref } return %1 : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-liveness))"" -split-input-file 2>&1 ",1 "func.func @simple(%arg: memref<2xf32>, %arg1: memref<2xf32>) attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloca_1""} : memref<8x64xf32> %1 = memref.alloca() {test.ptr = ""alloca_2""} : memref<8x64xf32> %2 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> %3 = memref.alloc() {test.ptr = ""alloc_2""} : memref<8x64xf32> return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @control_flow(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloca_1""} : memref<8x64xf32> %1 = memref.alloca() {test.ptr = ""alloca_2""} : memref<8x64xf32> %2 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> cf.cond_br %cond, ^bb1(%0 : memref<8x64xf32>), ^bb2(%0 : memref<8x64xf32>) ^bb1(%arg1: memref<8x64xf32>): cf.br ^bb2(%arg1 : memref<8x64xf32>) ^bb2(%arg2: memref<8x64xf32>): return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @control_flow_merge(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloca_1""} : memref<8x64xf32> %1 = memref.alloca() {test.ptr = ""alloca_2""} : memref<8x64xf32> %2 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> cf.cond_br %cond, ^bb1(%0 : memref<8x64xf32>), ^bb2(%2 : memref<8x64xf32>) ^bb1(%arg1: memref<8x64xf32>): cf.br ^bb2(%arg1 : memref<8x64xf32>) ^bb2(%arg2: memref<8x64xf32>): return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @region_control_flow(%arg: memref<2xf32>, %cond: i1) attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloca_1""} : memref<8x64xf32> %1 = memref.alloca() {test.ptr = ""alloca_2""} : memref<8x64xf32> %2 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> %3 = scf.if %cond -> (memref<8x64xf32>) { scf.yield %0 : memref<8x64xf32> } else { scf.yield %0 : memref<8x64xf32> } {test.ptr = ""if_alloca""} %4 = scf.if %cond -> (memref<8x64xf32>) { scf.yield %0 : memref<8x64xf32> } else { scf.yield %1 : memref<8x64xf32> } {test.ptr = ""if_alloca_merge""} %5 = scf.if %cond -> (memref<8x64xf32>) { scf.yield %2 : memref<8x64xf32> } else { scf.yield %2 : memref<8x64xf32> } {test.ptr = ""if_alloc""} return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @region_loop_control_flow(%arg: memref<2xf32>, %loopI0 : index, %loopI1 : index, %loopI2 : index) attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloca_1""} : memref<8x64xf32> %1 = memref.alloca() {test.ptr = ""alloca_2""} : memref<8x64xf32> %2 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> %result = scf.for %i0 = %loopI0 to %loopI1 step %loopI2 iter_args(%si = %0) -> (memref<8x64xf32>) { scf.yield %si : memref<8x64xf32> } {test.ptr = ""for_alloca""} return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @region_loop_zero_trip_count() attributes {test.ptr = ""func""} { %0 = memref.alloca() {test.ptr = ""alloca_1""} : memref %1 = memref.alloca() {test.ptr = ""alloca_2""} : memref %result = affine.for %i = 0 to 0 iter_args(%si = %0) -> (memref) { affine.yield %si : memref } {test.ptr = ""for_alloca""} return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @view_like(%arg: memref<2xf32>, %size: index) attributes {test.ptr = ""func""} { %1 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> %c0 = arith.constant 0 : index %2 = memref.alloca (%size) {test.ptr = ""alloca_1""} : memref %3 = memref.view %2[%c0][] {test.ptr = ""view""} : memref to memref<8x64xf32> return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @constants(%arg: memref<2xf32>) attributes {test.ptr = ""func""} { %1 = memref.alloc() {test.ptr = ""alloc_1""} : memref<8x64xf32> %c0 = arith.constant {test.ptr = ""constant_1""} 0 : index %c0_2 = arith.constant {test.ptr = ""constant_2""} 0 : index %c1 = arith.constant {test.ptr = ""constant_3""} 1 : index return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-alias-analysis))' -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @no_loop_single_block() { return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @no_loop() { cf.br ^bb1 ^bb1: return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @simple_loop(%c: i1) { cf.br ^bb1 ^bb1: cf.cond_br %c, ^bb2, ^bb3 ^bb2: cf.br ^bb1 ^bb3: return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @single_block_loop(%c: i1) { cf.br ^bb1 ^bb1: cf.cond_br %c, ^bb1, ^bb2 ^bb2: return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @nested_loop(%c: i1) { cf.br ^bb1 ^bb1: cf.cond_br %c, ^bb2, ^bb4 ^bb2: cf.cond_br %c, ^bb1, ^bb3 ^bb3: cf.br ^bb2 ^bb4: return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @multi_latch(%c: i1) { cf.br ^bb1 ^bb1: cf.cond_br %c, ^bb4, ^bb2 ^bb2: cf.cond_br %c, ^bb1, ^bb3 ^bb3: cf.br ^bb1 ^bb4: return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @multiple_loops(%c: i1) { cf.br ^bb1 ^bb1: cf.br ^bb2 ^bb2: cf.cond_br %c, ^bb3, ^bb1 ^bb3: cf.cond_br %c, ^bb5, ^bb4 ^bb4: cf.br ^bb3 ^bb5: return }"," mlir-opt -pass-pipeline=""builtin.module(any(test-cfg-loop-info))"" --split-input-file 2>&1 ",1 "func.func @test_default_init() -> () { ""test.foo""() {tag = ""a""} : () -> () return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' 2>&1 ,1 "func.func @test_one_join() -> () { ""test.foo""() {tag = ""a""} : () -> () ""test.foo""() {tag = ""b"", foo = 1 : ui64} : () -> () return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' 2>&1 ,1 "func.func @test_two_join() -> () { ""test.foo""() {tag = ""a""} : () -> () ""test.foo""() {tag = ""b"", foo = 1 : ui64} : () -> () ""test.foo""() {tag = ""c"", foo = 1 : ui64} : () -> () return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' 2>&1 ,1 "func.func @test_fork() -> () { ""test.branch""() [^bb0, ^bb1] {tag = ""init"", foo = 1 : ui64} : () -> () ^bb0: ""test.branch""() [^bb2] {tag = ""a"", foo = 2 : ui64} : () -> () ^bb1: ""test.branch""() [^bb2] {tag = ""b"", foo = 4 : ui64} : () -> () ^bb2: ""test.foo""() {tag = ""end""} : () -> () return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' 2>&1 ,1 "func.func @test_simple_loop() -> () { ""test.branch""() [^bb0] {tag = ""init"", foo = 1 : ui64} : () -> () ^bb0: ""test.foo""() {tag = ""a"", foo = 3 : ui64} : () -> () ""test.branch""() [^bb0, ^bb1] : () -> () ^bb1: ""test.foo""() {tag = ""end""} : () -> () return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' 2>&1 ,1 "func.func @test_double_loop() -> () { ""test.branch""() [^bb0] {tag = ""init"", foo = 2 : ui64} : () -> () ^bb0: ""test.foo""() {tag = ""a"", foo = 3 : ui64} : () -> () ""test.branch""() [^bb0, ^bb1] : () -> () ^bb1: ""test.foo""() {tag = ""b"", foo = 5 : ui64} : () -> () ""test.branch""() [^bb0, ^bb2] : () -> () ^bb2: ""test.foo""() {tag = ""end""} : () -> () return }", mlir-opt -split-input-file -pass-pipeline='builtin.module(func.func(test-foo-analysis))' 2>&1 ,1 "module attributes {test.name = ""simple""} { func.func @func_a() { return } func.func private @func_b() func.func @func_c() { call @func_b() : () -> () return } func.func @func_d() { call @func_c() : () -> () return } func.func @func_e() { call @func_c() : () -> () call @func_d() : () -> () call @func_e() : () -> () return } func.func @func_f() { %fn = ""test.functional_region_op""() ({ call @func_f() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } }", mlir-opt -test-print-callgraph -split-input-file -allow-unregistered-dialect 2>&1 ,1 "module attributes {test.name = ""nested""} { module @nested_module { func.func @func_a() { return } } func.func @func_b() { ""test.conversion_call_op""() { callee = @nested_module::@func_a } : () -> () return } }", mlir-opt -test-print-callgraph -split-input-file -allow-unregistered-dialect 2>&1 ,1 "module attributes {test.name = ""SCC""} { func.func @foo(%arg0 : () -> ()) { call_indirect %arg0() : () -> () return } func.func @bar(%arg1 : () -> ()) { call_indirect %arg1() : () -> () return } }", mlir-opt -test-print-callgraph -split-input-file -allow-unregistered-dialect 2>&1 ,1 "func.func @region( %arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : i32, %arg5 : i32, %arg6 : i32, %buffer : memref) { %0 = arith.addi %arg4, %arg5 {__test_sort_original_idx__ = 0} : i32 %idx = arith.addi %arg0, %arg1 {__test_sort_original_idx__ = 3} : index scf.for %arg7 = %idx to %arg2 step %arg3 { %2 = arith.addi %0, %arg5 : i32 %3 = arith.subi %2, %arg6 {__test_sort_original_idx__ = 1} : i32 memref.store %3, %buffer[] : memref } {__test_sort_original_idx__ = 2} return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-print-topological-sort))"" 2>&1 ",1 "func.func private @single_callsite_fn(%ptr: memref) -> memref { return {tag = ""test_callsite""} %ptr : memref } func.func @test_callsite() { %ptr = memref.alloc() : memref %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag_name = ""a""} : memref %0 = func.call @single_callsite_fn(%ptr) : (memref) -> memref return } func.func private @single_return_site_fn(%ptr: memref) -> memref { %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag_name = ""b""} : memref return %ptr : memref } func.func @test_return_site(%ptr: memref) -> memref { %0 = func.call @single_return_site_fn(%ptr) : (memref) -> memref return {tag = ""test_return_site""} %0 : memref } func.func private @multiple_callsite_fn(%ptr: memref) -> memref { return {tag = ""test_multiple_callsites""} %ptr : memref } func.func @test_multiple_callsites(%a: i32, %ptr: memref) -> memref { memref.store %a, %ptr[] {tag_name = ""write0""} : memref %0 = func.call @multiple_callsite_fn(%ptr) : (memref) -> memref memref.store %a, %ptr[] {tag_name = ""write1""} : memref %1 = func.call @multiple_callsite_fn(%ptr) : (memref) -> memref return %ptr : memref } func.func private @multiple_return_site_fn(%cond: i1, %a: i32, %ptr: memref) -> memref { cf.cond_br %cond, ^a, ^b ^a: memref.store %a, %ptr[] {tag_name = ""return0""} : memref return %ptr : memref ^b: memref.store %a, %ptr[] {tag_name = ""return1""} : memref return %ptr : memref } func.func @test_multiple_return_sites(%cond: i1, %a: i32, %ptr: memref) -> memref { %0 = func.call @multiple_return_site_fn(%cond, %a, %ptr) : (i1, i32, memref) -> memref return {tag = ""test_multiple_return_sites""} %0 : memref }", mlir-opt -test-last-modified 2>&1 ,1 "func.func @test_two_writes(%m0: memref, %m1: memref) -> (memref, memref) { %c0 = arith.constant {tag = ""constant0""} 0 : i32 %c1 = arith.constant {tag = ""constant1""} 1 : i32 memref.store %c0, %m0[] {tag_name = ""a""} : memref memref.store %c1, %m1[] {tag_name = ""b""} : memref return %m0, %m1 : memref, memref }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_if(%m0: memref, %m1: memref, %condition: i1) { %c0 = arith.constant {tag = ""c0""} 2 : i32 %c1 = arith.constant {tag = ""c1""} 3 : i32 %condition2 = arith.addi %condition, %condition {tag = ""condition""} : i1 %0, %1 = scf.if %condition2 -> (i32, i32) { %c2 = arith.constant {tag = ""c2""} 0 : i32 scf.yield %c2, %c0: i32, i32 } else { %c3 = arith.constant {tag = ""c3""} 1 : i32 scf.yield %c3, %c1: i32, i32 } memref.store %0, %m0[] {tag_name = ""a""} : memref memref.store %1, %m1[] {tag_name = ""b""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_blocks(%m0: memref, %m1: memref, %m2: memref, %cond : i1) { %0 = arith.constant {tag = ""c0""} 0 : i32 %1 = arith.constant {tag = ""c1""} 1 : i32 cf.cond_br %cond, ^a(%0: i32), ^b(%1: i32) {tag = ""br""} ^a(%a0: i32): memref.store %a0, %m0[] {tag_name = ""a""} : memref cf.br ^c(%a0 : i32) ^b(%b0: i32): memref.store %b0, %m1[] {tag_name = ""b""} : memref cf.br ^c(%b0 : i32) ^c(%c0 : i32): memref.store %c0, %m2[] {tag_name = ""c""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_infinite_loop(%m0: memref) { %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant {tag = ""two""} 2 : i32 %3 = arith.constant -1 : i32 cf.br ^loop(%0, %1, %2: i32, i32, i32) ^loop(%a: i32, %b: i32, %c: i32): memref.store %a, %m0[] {tag_name = ""a""} : memref cf.br ^loop(%b, %c, %3 : i32, i32, i32) }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_switch(%flag: i32, %m0: memref) { %0 = arith.constant {tag = ""c0""} 0 : i32 cf.switch %flag : i32, [ default: ^a(%0 : i32), 42: ^b(%0 : i32), 43: ^c(%0 : i32) ] ^a(%a0: i32): memref.store %a0, %m0[] {tag_name = ""a""} : memref cf.br ^c(%a0 : i32) ^b(%b0: i32): memref.store %b0, %m0[] {tag_name = ""b""} : memref cf.br ^c(%b0 : i32) ^c(%c0 : i32): memref.store %c0, %m0[] {tag_name = ""c""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_caller(%m0: memref, %arg: f32) { %0 = arith.addf %arg, %arg {tag = ""add""} : f32 %1 = func.call @callee(%0) : (f32) -> f32 %2 = arith.mulf %1, %1 : f32 %3 = arith.mulf %2, %2 : f32 %4 = arith.mulf %3, %3 : f32 memref.store %4, %m0[] {tag_name = ""a""} : memref return } func.func private @callee(%0 : f32) -> f32 { %1 = arith.mulf %0, %0 : f32 %2 = arith.mulf %1, %1 : f32 func.return %2 : f32 }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func private @callee(%0 : f32) -> f32 { %1 = arith.mulf %0, %0 : f32 func.return %1 : f32 } func.func @test_caller_below_callee(%m0: memref, %arg: f32) { %0 = arith.subf %arg, %arg {tag = ""sub""} : f32 %1 = func.call @callee(%0) : (f32) -> f32 memref.store %1, %m0[] {tag_name = ""a""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func private @callee1(%0 : f32) -> f32 { %1 = func.call @callee2(%0) : (f32) -> f32 func.return %1 : f32 } func.func private @callee2(%0 : f32) -> f32 { %1 = func.call @callee3(%0) : (f32) -> f32 func.return %1 : f32 } func.func private @callee3(%0 : f32) -> f32 { func.return %0 : f32 } func.func @test_callchain(%m0: memref, %arg: f32) { %0 = arith.mulf %arg, %arg {tag = ""mul""} : f32 %1 = func.call @callee1(%0) : (f32) -> f32 memref.store %1, %m0[] {tag_name = ""a""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_while(%m0: memref, %init : i32, %cond: i1) { %zero = arith.constant {tag = ""zero""} 0 : i32 %init2 = arith.addi %init, %init {tag = ""init""} : i32 %0, %1 = scf.while (%arg1 = %zero, %arg2 = %init2) : (i32, i32) -> (i32, i32) { memref.store %arg2, %m0[] {tag_name = ""a""} : memref scf.condition(%cond) {tag = ""condition""} %arg1, %arg2 : i32, i32 } do { ^bb0(%arg1: i32, %arg2: i32): memref.store %arg1, %m0[] {tag_name = ""c""} : memref %res = arith.addi %arg2, %arg2 : i32 scf.yield %arg1, %res: i32, i32 } memref.store %1, %m0[] {tag_name = ""b""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_for(%m0: memref) { %zero = arith.constant {tag = ""zero""} 0 : index %ten = arith.constant {tag = ""ten""} 10 : index %one = arith.constant {tag = ""one""} 1 : index %x = arith.constant {tag = ""x""} 0 : i32 %0 = scf.for %i = %zero to %ten step %one iter_args(%ix = %x) -> (i32) { scf.yield %ix : i32 } memref.store %0, %m0[] {tag_name = ""a""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_switch(%arg0 : index, %m0: memref) { %0, %1 = scf.index_switch %arg0 {tag=""switch""} -> i32, i32 case 1 { %2 = arith.constant {tag=""1a""} 10 : i32 %3 = arith.constant {tag=""1b""} 100 : i32 scf.yield %2, %3 : i32, i32 } case 2 { %4 = arith.constant {tag=""2a""} 20 : i32 %5 = arith.constant {tag=""2b""} 200 : i32 scf.yield %4, %5 : i32, i32 } default { %6 = arith.constant {tag=""default_a""} 30 : i32 %7 = arith.constant {tag=""default_b""} 300 : i32 scf.yield %6, %7 : i32, i32 } memref.store %0, %m0[] {tag_name = ""a""} : memref memref.store %1, %m0[] {tag_name = ""b""} : memref return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "llvm.func @decl(i64) llvm.func @func(%lb : i64) -> () { llvm.call @decl(%lb) : (i64) -> () llvm.return }", mlir-opt -split-input-file -test-written-to 2>&1 ,1 "func.func @test_simple_mod(%arg0: memref, %arg1: memref) -> (memref, memref) { %c0 = arith.constant 0 : i32 %c1 = arith.constant 1 : i32 memref.store %c0, %arg0[] {tag_name = ""a""} : memref memref.store %c1, %arg1[] {tag_name = ""b""} : memref return {tag = ""test_simple_mod""} %arg0, %arg1 : memref, memref } func.func @test_simple_mod_overwrite(%arg0: memref) -> memref { %c0 = arith.constant 0 : i32 memref.store %c0, %arg0[] {tag = ""test_simple_mod_overwrite_a"", tag_name = ""a""} : memref %c1 = arith.constant 1 : i32 memref.store %c1, %arg0[] {tag_name = ""b""} : memref return {tag = ""test_simple_mod_overwrite_b""} %arg0 : memref } func.func @test_mod_control_flow(%cond: i1, %ptr: memref) -> memref { cf.cond_br %cond, ^a, ^b ^a: %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag_name = ""a""} : memref cf.br ^c ^b: %c1 = arith.constant 1 : i32 memref.store %c1, %ptr[] {tag_name = ""b""} : memref cf.br ^c ^c: return {tag = ""test_mod_control_flow""} %ptr : memref } func.func @test_mod_dead_branch(%arg: i32, %ptr: memref) -> memref { %0 = arith.subi %arg, %arg : i32 %1 = arith.constant -1 : i32 %2 = arith.cmpi sgt, %0, %1 : i32 cf.cond_br %2, ^a, ^b ^a: %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag_name = ""a""} : memref cf.br ^c ^b: %c1 = arith.constant 1 : i32 memref.store %c1, %ptr[] {tag_name = ""b""} : memref cf.br ^c ^c: return {tag = ""test_mod_dead_branch""} %ptr : memref } func.func @test_mod_region_control_flow(%cond: i1, %ptr: memref) -> memref { scf.if %cond { %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag_name = ""then""}: memref } else { %c1 = arith.constant 1 : i32 memref.store %c1, %ptr[] {tag_name = ""else""} : memref } return {tag = ""test_mod_region_control_flow""} %ptr : memref } func.func @test_mod_dead_region(%ptr: memref) -> memref { %false = arith.constant false scf.if %false { %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag_name = ""then""}: memref } else { %c1 = arith.constant 1 : i32 memref.store %c1, %ptr[] {tag_name = ""else""} : memref } return {tag = ""test_mod_dead_region""} %ptr : memref } func.func @unknown_memory_effects(%ptr: memref) -> memref { %c0 = arith.constant 0 : i32 memref.store %c0, %ptr[] {tag = ""unknown_memory_effects_a"", tag_name = ""a""} : memref ""test.unknown_effects""() : () -> () return {tag = ""unknown_memory_effects_b""} %ptr : memref }", mlir-opt -test-last-modified 2>&1 ,1 "func.func @test_cfg(%cond: i1) -> () attributes {tag = ""test_cfg""} { cf.br ^bb1 ^bb1: cf.cond_br %cond, ^bb1, ^bb2 ^bb2: return } func.func @test_region_control_flow(%cond: i1, %arg0: i64, %arg1: i64) -> () { scf.if %cond { scf.yield {then} } else { scf.yield {else} } {tag = ""test_if""} %c2_i64 = arith.constant 2 : i64 %0:2 = scf.while (%arg2 = %arg0) : (i64) -> (i64, i64) { %1 = arith.cmpi slt, %arg2, %arg1 : i64 scf.condition(%1) %arg2, %arg2 : i64, i64 } do { ^bb0(%arg2: i64, %arg3: i64): %1 = arith.muli %arg3, %c2_i64 : i64 scf.yield %1 : i64 } attributes {tag = ""test_while""} return } func.func private @foo(%arg0: i32) -> i32 attributes {tag = ""foo""} { return {a} %arg0 : i32 } func.func @bar(%cond: i1) -> i32 attributes {tag = ""bar""} { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %c0 = arith.constant 0 : i32 return {b} %c0 : i32 ^bb2: %c1 = arith.constant 1 : i32 return {c} %c1 : i32 } func.func private @baz(i32) -> i32 attributes {tag = ""baz""} func.func @test_callgraph(%cond: i1, %arg0: i32) -> i32 { %0 = func.call @foo(%arg0) {tag = ""a""} : (i32) -> i32 cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %1 = func.call @foo(%arg0) {tag = ""b""} : (i32) -> i32 return %1 : i32 ^bb2: %2 = func.call @bar(%cond) {tag = ""c""} : (i1) -> i32 %3 = func.call @baz(%arg0) {tag = ""d""} : (i32) -> i32 return %2 : i32 } func.func @test_unknown_branch() -> () attributes {tag = ""test_unknown_branch""} { ""test.unknown_br""() [^bb1, ^bb2] : () -> () ^bb1: return ^bb2: return } func.func @test_unknown_region() -> () { ""test.unknown_region_br""() ({ ^bb0: ""test.unknown_region_end""() : () -> () }, { ^bb0: ""test.unknown_region_end""() : () -> () }) {tag = ""test_unknown_region""} : () -> () return } func.func @test_known_dead_block() -> () attributes {tag = ""test_known_dead_block""} { %true = arith.constant true cf.cond_br %true, ^bb1, ^bb2 ^bb1: return ^bb2: return } func.func @test_known_dead_edge(%arg0: i1) -> () attributes {tag = ""test_known_dead_edge""} { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: %true = arith.constant true cf.cond_br %true, ^bb3, ^bb2 ^bb2: return ^bb3: return } func.func @test_known_region_predecessors() -> () { %false = arith.constant false scf.if %false { scf.yield {then} } else { scf.yield {else} } {tag = ""test_known_if""} return } func.func @callable() attributes {tag = ""callable""} { return } func.func @test_dead_callsite() -> () { %true = arith.constant true scf.if %true { func.call @callable() {then} : () -> () scf.yield } else { func.call @callable() {else} : () -> () scf.yield } return } func.func private @test_dead_return(%arg0: i32) -> i32 { %true = arith.constant true cf.cond_br %true, ^bb1, ^bb1 ^bb1: return {true} %arg0 : i32 ^bb2: return {false} %arg0 : i32 } func.func @test_call_dead_return(%arg0: i32) -> () { %0 = func.call @test_dead_return(%arg0) {tag = ""test_dead_return""} : (i32) -> i32 return }", mlir-opt -test-dead-code-analysis 2>&1 ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_mul(%arg0 : memref<4x4xf32>, %arg1 : memref<4x4xf32>, %arg2 : memref<4x4xf32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %x = gpu.block_id x %y = gpu.block_id y %1 = memref.load %arg0[%x, %y] : memref<4x4xf32> %2 = memref.load %arg1[%x, %y] : memref<4x4xf32> %3 = arith.mulf %1, %2 : f32 memref.store %3, %arg2[%x, %y] : memref<4x4xf32> gpu.return } } func.func @main() { %arg0 = memref.alloc() : memref<4x4xf32> %arg1 = memref.alloc() : memref<4x4xf32> %arg2 = memref.alloc() : memref<4x4xf32> %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %value0 = arith.constant 0.0 : f32 %value1 = arith.constant 2.0 : f32 %value2 = arith.constant 3.0 : f32 %arg3 = memref.cast %arg0 : memref<4x4xf32> to memref %arg4 = memref.cast %arg1 : memref<4x4xf32> to memref %arg5 = memref.cast %arg2 : memref<4x4xf32> to memref call @fillResource2DFloat(%arg3, %value1) : (memref, f32) -> () call @fillResource2DFloat(%arg4, %value2) : (memref, f32) -> () call @fillResource2DFloat(%arg5, %value0) : (memref, f32) -> () %cst1 = arith.constant 1 : index %cst4 = arith.constant 4 : index gpu.launch_func @kernels::@kernel_mul blocks in (%cst4, %cst4, %cst1) threads in(%cst1, %cst1, %cst1) args(%arg0 : memref<4x4xf32>, %arg1 : memref<4x4xf32>, %arg2 : memref<4x4xf32>) %arg6 = memref.cast %arg5 : memref to memref<*xf32> call @printMemrefF32(%arg6) : (memref<*xf32>) -> () return } func.func private @fillResource2DFloat(%0 : memref, %1 : f32) func.func private @printMemrefF32(%ptr : memref<*xf32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_add(%arg0 : memref<8xf32>, %arg1 : memref<8xf32>, %arg2 : memref<8xf32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x %1 = memref.load %arg0[%0] : memref<8xf32> %2 = memref.load %arg1[%0] : memref<8xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %arg2[%0] : memref<8xf32> gpu.return } } func.func @main() { %arg0 = memref.alloc() : memref<8xf32> %arg1 = memref.alloc() : memref<8xf32> %arg2 = memref.alloc() : memref<8xf32> %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %value0 = arith.constant 0.0 : f32 %value1 = arith.constant 1.1 : f32 %value2 = arith.constant 2.2 : f32 %arg3 = memref.cast %arg0 : memref<8xf32> to memref %arg4 = memref.cast %arg1 : memref<8xf32> to memref %arg5 = memref.cast %arg2 : memref<8xf32> to memref call @fillResource1DFloat(%arg3, %value1) : (memref, f32) -> () call @fillResource1DFloat(%arg4, %value2) : (memref, f32) -> () call @fillResource1DFloat(%arg5, %value0) : (memref, f32) -> () %cst1 = arith.constant 1 : index %cst8 = arith.constant 8 : index gpu.launch_func @kernels::@kernel_add blocks in (%cst8, %cst1, %cst1) threads in (%cst1, %cst1, %cst1) args(%arg0 : memref<8xf32>, %arg1 : memref<8xf32>, %arg2 : memref<8xf32>) %arg6 = memref.cast %arg5 : memref to memref<*xf32> call @printMemrefF32(%arg6) : (memref<*xf32>) -> () return } func.func private @fillResource1DFloat(%0 : memref, %1 : f32) func.func private @printMemrefF32(%ptr : memref<*xf32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_addi(%arg0 : memref<8xi32>, %arg1 : memref<8x8xi32>, %arg2 : memref<8x8x8xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %x = gpu.block_id x %y = gpu.block_id y %z = gpu.block_id z %0 = memref.load %arg0[%x] : memref<8xi32> %1 = memref.load %arg1[%y, %x] : memref<8x8xi32> %2 = arith.addi %0, %1 : i32 memref.store %2, %arg2[%z, %y, %x] : memref<8x8x8xi32> gpu.return } } func.func @main() { %arg0 = memref.alloc() : memref<8xi32> %arg1 = memref.alloc() : memref<8x8xi32> %arg2 = memref.alloc() : memref<8x8x8xi32> %value0 = arith.constant 0 : i32 %value1 = arith.constant 1 : i32 %value2 = arith.constant 2 : i32 %arg3 = memref.cast %arg0 : memref<8xi32> to memref %arg4 = memref.cast %arg1 : memref<8x8xi32> to memref %arg5 = memref.cast %arg2 : memref<8x8x8xi32> to memref call @fillResource1DInt(%arg3, %value1) : (memref, i32) -> () call @fillResource2DInt(%arg4, %value2) : (memref, i32) -> () call @fillResource3DInt(%arg5, %value0) : (memref, i32) -> () %cst1 = arith.constant 1 : index %cst8 = arith.constant 8 : index gpu.launch_func @kernels::@kernel_addi blocks in (%cst8, %cst8, %cst8) threads in (%cst1, %cst1, %cst1) args(%arg0 : memref<8xi32>, %arg1 : memref<8x8xi32>, %arg2 : memref<8x8x8xi32>) %arg6 = memref.cast %arg5 : memref to memref<*xi32> call @printMemrefI32(%arg6) : (memref<*xi32>) -> () return } func.func private @fillResource1DInt(%0 : memref, %1 : i32) func.func private @fillResource2DInt(%0 : memref, %1 : i32) func.func private @fillResource3DInt(%0 : memref, %1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_add(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %arg2 : memref<8xi32>, %arg3 : memref<8xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x %lhs = memref.load %arg0[%0] : memref<8xi32> %rhs = memref.load %arg1[%0] : memref<8xi32> %low, %hi = arith.mului_extended %lhs, %rhs : i32 memref.store %low, %arg2[%0] : memref<8xi32> memref.store %hi, %arg3[%0] : memref<8xi32> gpu.return } } func.func @main() { %buf0 = memref.alloc() : memref<8xi32> %buf1 = memref.alloc() : memref<8xi32> %buf2 = memref.alloc() : memref<8xi32> %buf3 = memref.alloc() : memref<8xi32> %i32_0 = arith.constant 0 : i32 %buf4 = memref.cast %buf2 : memref<8xi32> to memref %buf5 = memref.cast %buf3 : memref<8xi32> to memref call @fillResource1DInt(%buf4, %i32_0) : (memref, i32) -> () call @fillResource1DInt(%buf5, %i32_0) : (memref, i32) -> () %idx_0 = arith.constant 0 : index %idx_1 = arith.constant 1 : index %idx_8 = arith.constant 8 : index %lhs_vals = arith.constant dense<[0, 1, -1, -1, 65535, 65535, -65535, 7]> : vector<8xi32> %rhs_vals = arith.constant dense<[0, 1, 2, -1, 16, -1337, -65535, -7]> : vector<8xi32> vector.store %lhs_vals, %buf0[%idx_0] : memref<8xi32>, vector<8xi32> vector.store %rhs_vals, %buf1[%idx_0] : memref<8xi32>, vector<8xi32> gpu.launch_func @kernels::@kernel_add blocks in (%idx_8, %idx_1, %idx_1) threads in (%idx_1, %idx_1, %idx_1) args(%buf0 : memref<8xi32>, %buf1 : memref<8xi32>, %buf2 : memref<8xi32>, %buf3 : memref<8xi32>) %buf_low = memref.cast %buf4 : memref to memref<*xi32> %buf_hi = memref.cast %buf5 : memref to memref<*xi32> call @printMemrefI32(%buf_low) : (memref<*xi32>) -> () call @printMemrefI32(%buf_hi) : (memref<*xi32>) -> () return } func.func private @fillResource1DInt(%0 : memref, %1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_add(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %arg2 : memref<8xi32>, %arg3 : memref<8xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x %lhs = memref.load %arg0[%0] : memref<8xi32> %rhs = memref.load %arg1[%0] : memref<8xi32> %low, %hi = arith.mului_extended %lhs, %rhs : i32 memref.store %low, %arg2[%0] : memref<8xi32> memref.store %hi, %arg3[%0] : memref<8xi32> gpu.return } } func.func @main() { %buf0 = memref.alloc() : memref<8xi32> %buf1 = memref.alloc() : memref<8xi32> %buf2 = memref.alloc() : memref<8xi32> %buf3 = memref.alloc() : memref<8xi32> %i32_0 = arith.constant 0 : i32 %buf4 = memref.cast %buf2 : memref<8xi32> to memref %buf5 = memref.cast %buf3 : memref<8xi32> to memref call @fillResource1DInt(%buf4, %i32_0) : (memref, i32) -> () call @fillResource1DInt(%buf5, %i32_0) : (memref, i32) -> () %idx_0 = arith.constant 0 : index %idx_1 = arith.constant 1 : index %idx_8 = arith.constant 8 : index %lhs_vals = arith.constant dense<[0, 1, -1, -1, 65535, 65535, -65535, 7]> : vector<8xi32> %rhs_vals = arith.constant dense<[0, 1, 2, -1, 16, -1337, -65535, -7]> : vector<8xi32> vector.store %lhs_vals, %buf0[%idx_0] : memref<8xi32>, vector<8xi32> vector.store %rhs_vals, %buf1[%idx_0] : memref<8xi32>, vector<8xi32> gpu.launch_func @kernels::@kernel_add blocks in (%idx_8, %idx_1, %idx_1) threads in (%idx_1, %idx_1, %idx_1) args(%buf0 : memref<8xi32>, %buf1 : memref<8xi32>, %buf2 : memref<8xi32>, %buf3 : memref<8xi32>) %buf_low = memref.cast %buf4 : memref to memref<*xi32> %buf_hi = memref.cast %buf5 : memref to memref<*xi32> call @printMemrefI32(%buf_low) : (memref<*xi32>) -> () call @printMemrefI32(%buf_hi) : (memref<*xi32>) -> () return } func.func private @fillResource1DInt(%0 : memref, %1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-vulkan-runner --vulkan-runner-spirv-webgpu-prepare --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_add(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %arg2 : memref<8xi32>, %arg3 : memref<8xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x %lhs = memref.load %arg0[%0] : memref<8xi32> %rhs = memref.load %arg1[%0] : memref<8xi32> %low, %hi = arith.mulsi_extended %lhs, %rhs : i32 memref.store %low, %arg2[%0] : memref<8xi32> memref.store %hi, %arg3[%0] : memref<8xi32> gpu.return } } func.func @main() { %buf0 = memref.alloc() : memref<8xi32> %buf1 = memref.alloc() : memref<8xi32> %buf2 = memref.alloc() : memref<8xi32> %buf3 = memref.alloc() : memref<8xi32> %i32_0 = arith.constant 0 : i32 %buf4 = memref.cast %buf2 : memref<8xi32> to memref %buf5 = memref.cast %buf3 : memref<8xi32> to memref call @fillResource1DInt(%buf4, %i32_0) : (memref, i32) -> () call @fillResource1DInt(%buf5, %i32_0) : (memref, i32) -> () %idx_0 = arith.constant 0 : index %idx_1 = arith.constant 1 : index %idx_8 = arith.constant 8 : index %lhs_vals = arith.constant dense<[0, 1, -1, -1, 65535, 65535, -65535, 2088183954]> : vector<8xi32> %rhs_vals = arith.constant dense<[0, 1, 2, -1, 16, -1337, -65535, -1028001427]> : vector<8xi32> vector.store %lhs_vals, %buf0[%idx_0] : memref<8xi32>, vector<8xi32> vector.store %rhs_vals, %buf1[%idx_0] : memref<8xi32>, vector<8xi32> gpu.launch_func @kernels::@kernel_add blocks in (%idx_8, %idx_1, %idx_1) threads in (%idx_1, %idx_1, %idx_1) args(%buf0 : memref<8xi32>, %buf1 : memref<8xi32>, %buf2 : memref<8xi32>, %buf3 : memref<8xi32>) %buf_low = memref.cast %buf4 : memref to memref<*xi32> %buf_hi = memref.cast %buf5 : memref to memref<*xi32> call @printMemrefI32(%buf_low) : (memref<*xi32>) -> () call @printMemrefI32(%buf_hi) : (memref<*xi32>) -> () return } func.func private @fillResource1DInt(%0 : memref, %1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_add(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %arg2 : memref<8xi32>, %arg3 : memref<8xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x %lhs = memref.load %arg0[%0] : memref<8xi32> %rhs = memref.load %arg1[%0] : memref<8xi32> %low, %hi = arith.mulsi_extended %lhs, %rhs : i32 memref.store %low, %arg2[%0] : memref<8xi32> memref.store %hi, %arg3[%0] : memref<8xi32> gpu.return } } func.func @main() { %buf0 = memref.alloc() : memref<8xi32> %buf1 = memref.alloc() : memref<8xi32> %buf2 = memref.alloc() : memref<8xi32> %buf3 = memref.alloc() : memref<8xi32> %i32_0 = arith.constant 0 : i32 %buf4 = memref.cast %buf2 : memref<8xi32> to memref %buf5 = memref.cast %buf3 : memref<8xi32> to memref call @fillResource1DInt(%buf4, %i32_0) : (memref, i32) -> () call @fillResource1DInt(%buf5, %i32_0) : (memref, i32) -> () %idx_0 = arith.constant 0 : index %idx_1 = arith.constant 1 : index %idx_8 = arith.constant 8 : index %lhs_vals = arith.constant dense<[0, 1, -1, -1, 65535, 65535, -65535, 2088183954]> : vector<8xi32> %rhs_vals = arith.constant dense<[0, 1, 2, -1, 16, -1337, -65535, -1028001427]> : vector<8xi32> vector.store %lhs_vals, %buf0[%idx_0] : memref<8xi32>, vector<8xi32> vector.store %rhs_vals, %buf1[%idx_0] : memref<8xi32>, vector<8xi32> gpu.launch_func @kernels::@kernel_add blocks in (%idx_8, %idx_1, %idx_1) threads in (%idx_1, %idx_1, %idx_1) args(%buf0 : memref<8xi32>, %buf1 : memref<8xi32>, %buf2 : memref<8xi32>, %buf3 : memref<8xi32>) %buf_low = memref.cast %buf4 : memref to memref<*xi32> %buf_hi = memref.cast %buf5 : memref to memref<*xi32> call @printMemrefI32(%buf_low) : (memref<*xi32>) -> () call @printMemrefI32(%buf_hi) : (memref<*xi32>) -> () return } func.func private @fillResource1DInt(%0 : memref, %1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-vulkan-runner --vulkan-runner-spirv-webgpu-prepare --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_sub(%arg0 : memref<8x4x4xf32>, %arg1 : memref<4x4xf32>, %arg2 : memref<8x4x4xf32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %x = gpu.block_id x %y = gpu.block_id y %z = gpu.block_id z %1 = memref.load %arg0[%x, %y, %z] : memref<8x4x4xf32> %2 = memref.load %arg1[%y, %z] : memref<4x4xf32> %3 = arith.subf %1, %2 : f32 memref.store %3, %arg2[%x, %y, %z] : memref<8x4x4xf32> gpu.return } } func.func @main() { %arg0 = memref.alloc() : memref<8x4x4xf32> %arg1 = memref.alloc() : memref<4x4xf32> %arg2 = memref.alloc() : memref<8x4x4xf32> %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %value0 = arith.constant 0.0 : f32 %value1 = arith.constant 3.3 : f32 %value2 = arith.constant 1.1 : f32 %arg3 = memref.cast %arg0 : memref<8x4x4xf32> to memref %arg4 = memref.cast %arg1 : memref<4x4xf32> to memref %arg5 = memref.cast %arg2 : memref<8x4x4xf32> to memref call @fillResource3DFloat(%arg3, %value1) : (memref, f32) -> () call @fillResource2DFloat(%arg4, %value2) : (memref, f32) -> () call @fillResource3DFloat(%arg5, %value0) : (memref, f32) -> () %cst1 = arith.constant 1 : index %cst4 = arith.constant 4 : index %cst8 = arith.constant 8 : index gpu.launch_func @kernels::@kernel_sub blocks in (%cst8, %cst4, %cst4) threads in (%cst1, %cst1, %cst1) args(%arg0 : memref<8x4x4xf32>, %arg1 : memref<4x4xf32>, %arg2 : memref<8x4x4xf32>) %arg6 = memref.cast %arg5 : memref to memref<*xf32> call @printMemrefF32(%arg6) : (memref<*xf32>) -> () return } func.func private @fillResource2DFloat(%0 : memref, %1 : f32) func.func private @fillResource3DFloat(%0 : memref, %1 : f32) func.func private @printMemrefF32(%ptr : memref<*xf32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_addi(%arg0 : memref<8xi8>, %arg1 : memref<8x8xi8>, %arg2 : memref<8x8x8xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %x = gpu.block_id x %y = gpu.block_id y %z = gpu.block_id z %0 = memref.load %arg0[%x] : memref<8xi8> %1 = memref.load %arg1[%y, %x] : memref<8x8xi8> %2 = arith.addi %0, %1 : i8 %3 = arith.extui %2 : i8 to i32 memref.store %3, %arg2[%z, %y, %x] : memref<8x8x8xi32> gpu.return } } func.func @main() { %arg0 = memref.alloc() : memref<8xi8> %arg1 = memref.alloc() : memref<8x8xi8> %arg2 = memref.alloc() : memref<8x8x8xi32> %value0 = arith.constant 0 : i32 %value1 = arith.constant 1 : i8 %value2 = arith.constant 2 : i8 %arg3 = memref.cast %arg0 : memref<8xi8> to memref %arg4 = memref.cast %arg1 : memref<8x8xi8> to memref %arg5 = memref.cast %arg2 : memref<8x8x8xi32> to memref call @fillResource1DInt8(%arg3, %value1) : (memref, i8) -> () call @fillResource2DInt8(%arg4, %value2) : (memref, i8) -> () call @fillResource3DInt(%arg5, %value0) : (memref, i32) -> () %cst1 = arith.constant 1 : index %cst8 = arith.constant 8 : index gpu.launch_func @kernels::@kernel_addi blocks in (%cst8, %cst8, %cst8) threads in (%cst1, %cst1, %cst1) args(%arg0 : memref<8xi8>, %arg1 : memref<8x8xi8>, %arg2 : memref<8x8x8xi32>) %arg6 = memref.cast %arg5 : memref to memref<*xi32> call @printMemrefI32(%arg6) : (memref<*xi32>) -> () return } func.func private @fillResource1DInt8(%0 : memref, %1 : i8) func.func private @fillResource2DInt8(%0 : memref, %1 : i8) func.func private @fillResource3DInt(%0 : memref, %1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @kernel_add(%arg0 : memref<16384xf32>, %arg1 : memref<16384xf32>, %arg2 : memref<16384xf32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %bid = gpu.block_id x %tid = gpu.thread_id x %cst = arith.constant 128 : index %b = arith.muli %bid, %cst : index %0 = arith.addi %b, %tid : index %1 = memref.load %arg0[%0] : memref<16384xf32> %2 = memref.load %arg1[%0] : memref<16384xf32> %3 = arith.addf %1, %2 : f32 memref.store %3, %arg2[%0] : memref<16384xf32> gpu.return } } func.func @main() { %arg0 = memref.alloc() : memref<16384xf32> %arg1 = memref.alloc() : memref<16384xf32> %arg2 = memref.alloc() : memref<16384xf32> %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %value0 = arith.constant 0.0 : f32 %value1 = arith.constant 1.1 : f32 %value2 = arith.constant 2.2 : f32 %arg3 = memref.cast %arg0 : memref<16384xf32> to memref %arg4 = memref.cast %arg1 : memref<16384xf32> to memref %arg5 = memref.cast %arg2 : memref<16384xf32> to memref call @fillResource1DFloat(%arg3, %value1) : (memref, f32) -> () call @fillResource1DFloat(%arg4, %value2) : (memref, f32) -> () call @fillResource1DFloat(%arg5, %value0) : (memref, f32) -> () %cst1 = arith.constant 1 : index %cst128 = arith.constant 128 : index gpu.launch_func @kernels::@kernel_add blocks in (%cst128, %cst1, %cst1) threads in (%cst128, %cst1, %cst1) args(%arg0 : memref<16384xf32>, %arg1 : memref<16384xf32>, %arg2 : memref<16384xf32>) %arg6 = memref.cast %arg5 : memref to memref<*xf32> return } func.func private @fillResource1DFloat(%0 : memref, %1 : f32) func.func private @printMemrefF32(%ptr : memref<*xf32>) }"," mlir-vulkan-runner --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils --entry-point-result=void ",1 "func.func @zero_whitespace() { return }", mlir-opt ,1 """test.user_op""() {attr = dense_resource : tensor<3xi64> } : () -> () {-# dialect_resources: { builtin: { blob1: ""0x08000000010000000000000002000000000000000300000000000000"" } } #-}", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file ,1 "module { }", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "module attributes {foo.attr = true} { }", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "module { %result = ""foo.result_op""() : () -> i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "module { }", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "%0 = ""op""() : () -> i32", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "module @foo { module { module @bar attributes {foo.bar} { } } }", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "module attributes { test.random_attribute = #dlti.dl_spec<>, test.another_attribute = #dlti.dl_spec<>} { }", mlir-opt -allow-unregistered-dialect -split-input-file -mlir-print-debuginfo -mlir-print-local-scope ,1 "module { %results:4 = ""dialect.op1""() { ""attribute name"" = 42 : i32 } : () -> (i1, i16, i32, i64) ""dialect.op2""() ({ ""dialect.innerop1""(%results#0, %results#1) : (i1, i16) -> () },{ ""dialect.innerop2""() : () -> () ""dialect.innerop3""(%results#0, %results#2, %results#3)[^bb1, ^bb2] : (i1, i32, i64) -> () ^bb1(%arg1 : i32): ""dialect.innerop4""() : () -> () ""dialect.innerop5""() : () -> () ^bb2(%arg2 : i64): ""dialect.innerop6""() : () -> () ""dialect.innerop7""() : () -> () }) : () -> () } ", mlir-opt -test-print-nesting -allow-unregistered-dialect ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() {interrupt = true} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-block-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "#map = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)> #map1 = affine_map<(d0) -> (d0)> #map2 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)> #inline_map_minmax_loop1 = affine_map<()[s0] -> (0, s0 - 1)> #inline_map_minmax_loop2 = affine_map<()[s0] -> (100, s0 + 1)> #bound_map1 = affine_map<(i, j)[s] -> (i + j + s)> #inline_map_loop_bounds2 = affine_map<(d0, d1) -> (d0 + d1)> #bound_map2 = affine_map<(i)[s] -> (i + s, i - s)> #set0 = affine_set<(i)[N, M] : (i >= 0, -i + N >= 0, N - 5 == 0, -i + M + 1 >= 0)> #set1 = affine_set<(d0, d1)[s0] : (d0 >= 0, d1 >= 0)> #set2 = affine_set<(d0) : (d0 - 1 == 0)> func.func private @foo(i32, i64) -> f32 func.func private @bar() -> () func.func private @baz() -> (i1, index, f32) func.func private @missingReturn() func.func private @int_types(i0, i1, i2, i4, i7, i87) -> (i1, index, i19) func.func private @sint_types(si2, si4) -> (si7, si1023) func.func private @uint_types(ui2, ui4) -> (ui7, ui1023) func.func private @float_types(f80, f128) func.func private @vectors(vector, vector<1 x f32>, vector<2x4xf32>) func.func private @tensors(tensor<* x f32>, tensor<* x vector<2x4xf32>>, tensor<1x?x4x?x?xi32>, tensor) func.func private @tensor_encoding(tensor<16x32xf64, ""sparse"">) func.func private @large_shape_dimension(tensor<9223372036854775807xf32>) func.func private @functions((memref<1x?x4x?x?xi32, #map, 0>, memref<8xi8, #map1, 0>) -> (), ()->()) func.func private @memrefs2(memref<2x4x8xi8, #map2, 1>) func.func private @memrefs3(memref<2x4x8xi8, affine_map<(d0, d1, d2) -> (d0, d1, d2)>>) func.func private @memrefs_drop_triv_id_inline(memref<2xi8, affine_map<(d0) -> (d0)>>) func.func private @memrefs_drop_triv_id_inline0(memref<2xi8, affine_map<(d0) -> (d0)>, 0>) func.func private @memrefs_drop_triv_id_inline1(memref<2xi8, affine_map<(d0) -> (d0)>, 1>) func.func private @memrefs_nomap_nospace(memref<5x6x7xf32>) func.func private @memrefs_map_nospace(memref<5x6x7xf32, #map3>) func.func private @memrefs_nomap_intspace(memref<5x6x7xf32, 3>) func.func private @memrefs_map_intspace(memref<5x6x7xf32, #map3, 5>) func.func private @memrefs_nomap_strspace(memref<5x6x7xf32, ""local"">) func.func private @memrefs_map_strspace(memref<5x6x7xf32, #map3, ""private"">) func.func private @memrefs_nomap_dictspace(memref<5x6x7xf32, {memSpace = ""special"", subIndex = 1}>) func.func private @memrefs_map_dictspace(memref<5x6x7xf32, #map3, {memSpace = ""special"", subIndex = 3}>) func.func private @complex_types(complex) -> complex func.func private @memref_with_index_elems(memref<1x?xindex>) func.func private @memref_with_complex_elems(memref<1x?xcomplex>) func.func private @memref_with_vector_elems(memref<1x?xvector<10xf32>>) func.func private @memref_with_custom_elem(memref<1x?x!test.memref_element>) func.func private @memref_of_memref(memref<1xmemref<1xf64>>) func.func private @memref_of_unranked_memref(memref<1xmemref<*xf32>>) func.func private @unranked_memref_of_memref(memref<*xmemref<1xf32>>) func.func private @unranked_memref_of_unranked_memref(memref<*xmemref<*xi32>>) func.func private @unranked_memref_with_complex_elems(memref<*xcomplex>) func.func private @unranked_memref_with_index_elems(memref<*xindex>) func.func private @unranked_memref_with_vector_elems(memref<*xvector<10xf32>>) func.func @simpleCFG(%arg0: i32, %f: f32) -> i1 { %1 = ""foo""() : ()->i64 %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) return %2#1 : i1 } func.func @simpleCFGUsingBBArgs(i32, i64) { ^bb42 (%arg0: i32, %f: i64): %2:3 = ""bar""(%f) : (i64) -> (i1,i1,i1) return } func.func @block_label_empty_list() { ^bb0(): return } func.func @multiblock() { return ^bb1: cf.br ^bb4 ^bb2: cf.br ^bb2 ^bb4: return } func.func @emptyMLF() { return } func.func @func_with_one_arg(%c : i1) -> i2 { %b = ""foo""(%c) : (i1) -> (i2) return %b : i2 } func.func @func_with_two_args(%a : f16, %b : i8) -> (i1, i32) { %c:2 = ""foo""(%a, %b) : (f16, i8)->(i1, i32) return %c#0, %c#1 : i1, i32 } func.func @second_order_func() -> (() -> ()) { %c = constant @emptyMLF : () -> () return %c : () -> () } func.func @third_order_func() -> (() -> (() -> ())) { %c = constant @second_order_func : () -> (() -> ()) return %c : () -> (() -> ()) } func.func @identity_functor(%a : () -> ()) -> (() -> ()) { return %a : () -> () } func.func @func_ops_in_loop() { %a = ""foo""() : ()->i64 affine.for %i = 1 to 10 { %b = ""doo""() : ()->f32 ""bar""(%a, %b) : (i64, f32) -> () } return } func.func @loops() { affine.for %i = 1 to 100 step 2 { affine.for %j = 1 to 200 { } } return } func.func @complex_loops() { affine.for %i1 = 1 to 100 { affine.for %j1 = 1 to 100 { ""foo""(%i1, %j1) : (index,index) -> () } ""boo""() : () -> () affine.for %j2 = 1 to 10 { affine.for %k2 = 1 to 10 { ""goo""() : () -> () } } } return } func.func @triang_loop(%arg0: index, %arg1: memref) { %c = arith.constant 0 : i32 affine.for %i0 = 1 to %arg0 { affine.for %i1 = affine_map<(d0)[]->(d0)>(%i0)[] to %arg0 { memref.store %c, %arg1[%i0, %i1] : memref } } return } func.func @minmax_loop(%arg0: index, %arg1: index, %arg2: memref<100xf32>) { affine.for %i0 = max affine_map<()[s]->(0,s-1)>()[%arg0] to min affine_map<()[s]->(100,s+1)>()[%arg1] { ""foo""(%arg2, %i0) : (memref<100xf32>, index) -> () } return } func.func @loop_bounds(%N : index) { %s = ""foo""(%N) : (index) -> index affine.for %i = %s to %N { affine.for %j = affine_map<(d0)[]->(d0)>(%i)[] to 0 step 1 { %w1 = affine.apply affine_map<(d0, d1)[s0] -> (d0+d1)> (%i, %j) [%s] %w2 = affine.apply affine_map<(d0, d1)[s0] -> (s0+1)> (%i, %j) [%s] affine.for %k = #bound_map1 (%w1, %i)[%N] to affine_map<(i, j)[s] -> (i + j + s)> (%w2, %j)[%s] { ""foo""(%i, %j, %k) : (index, index, index)->() %c = arith.constant 30 : index %u = affine.apply affine_map<(d0, d1)->(d0+d1)> (%N, %c) affine.for %l = max #bound_map2(%i)[%u] to min #bound_map2(%k)[%c] { ""bar""(%l) : (index) -> () } } } } return } func.func @ifinst(%N: index) { %c = arith.constant 200 : index affine.for %i = 1 to 10 { affine.if #set0(%i)[%N, %c] { %x = arith.constant 1 : i32 %y = ""add""(%x, %i) : (i32, index) -> i32 %z = ""mul""(%y, %y) : (i32, i32) -> i32 } else { affine.if affine_set<(i)[N] : (i - 2 >= 0, 4 - i >= 0)>(%i)[%N] { %u = arith.constant 1 : index %w = affine.apply affine_map<(d0,d1)[s0] -> (d0+d1+s0)> (%i, %i) [%u] } else { %v = arith.constant 3 : i32 } } } return } func.func @simple_ifinst(%N: index) { %c = arith.constant 200 : index affine.for %i = 1 to 10 { affine.if #set0(%i)[%N, %c] { %x = arith.constant 1 : i32 %y = ""add""(%x, %i) : (i32, index) -> i32 %z = ""mul""(%y, %y) : (i32, i32) -> i32 } } return } func.func @attributes() { ""foo""(){} : ()->() ""foo""() {a = 1, b = -423, c = [true, false], d = 16.0 } : () -> () ""foo""() {map1 = #map1} : () -> () ""foo""() {map2 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>} : () -> () ""foo""() {map12 = [#map1, #map2]} : () -> () ""foo""() {set1 = #set1} : () -> () ""foo""() {set2 = affine_set<(d0, d1, d2) : (d0 >= 0, d1 >= 0, d2 - d1 == 0)>} : () -> () ""foo""() {set12 = [#set1, #set2]} : () -> () ""foo""() {dictionary = {bool = true, fn = @ifinst}} : () -> () ""foo""() {dictionary = {fn = @ifinst, bar = false, bool = true}} : () -> () ""foo""() {if = ""foo"", func = [], i123 = 7, d = 1.e-9} : () -> () ""foo""() {fn = @attributes, if = @ifinst} : () -> () ""foo""() {int = 0 : i42} : () -> () return } func.func @ssa_values() -> (i16, i8) { %0:2 = ""foo""() : () -> (i1, i17) cf.br ^bb2 ^bb1: %1:2 = ""baz""(%2#1, %2#0, %0#1) : (f32, i11, i17) -> (i16, i8) return %1#0, %1#1 : i16, i8 ^bb2: %2:2 = ""bar""(%0#0, %0#1) : (i1, i17) -> (i11, f32) cf.br ^bb1 } func.func @bbargs() -> (i16, i8) { %0:2 = ""foo""() : () -> (i1, i17) cf.br ^bb1(%0#1, %0#0 : i17, i1) ^bb1(%x: i17, %y: i1): %1:2 = ""baz""(%x, %y, %0#1) : (i17, i1, i17) -> (i16, i8) return %1#0, %1#1 : i16, i8 } func.func @verbose_terminators() -> (i1, i17) { %0:2 = ""foo""() : () -> (i1, i17) ""cf.br""(%0#0, %0#1)[^bb1] : (i1, i17) -> () ^bb1(%x : i1, %y : i17): ""cf.cond_br""(%x, %y, %x, %y) [^bb2, ^bb3] {operand_segment_sizes = array} : (i1, i17, i1, i17) -> () ^bb2(%a : i17): %true = arith.constant true ""func.return""(%true, %a) : (i1, i17) -> () ^bb3(%b : i1, %c : i17): ""func.return""(%b, %c) : (i1, i17) -> () } func.func @condbr_simple() -> (i32) { %cond = ""foo""() : () -> i1 %a = ""bar""() : () -> i32 %b = ""bar""() : () -> i64 cf.cond_br %cond, ^bb1(%a : i32), ^bb2(%b : i64) ^bb1(%x : i32): cf.br ^bb2(%b: i64) ^bb2(%y : i64): %z = ""foo""() : () -> i32 return %z : i32 } func.func @condbr_moarargs() -> (i32) { %cond = ""foo""() : () -> i1 %a = ""bar""() : () -> i32 %b = ""bar""() : () -> i64 cf.cond_br %cond, ^bb1(%a, %b : i32, i64), ^bb2(%b, %a, %a : i64, i32, i32) ^bb1(%x : i32, %y : i64): return %x : i32 ^bb2(%x2 : i64, %y2 : i32, %z2 : i32): %z = ""foo""() : () -> i32 return %z : i32 } func.func @constants() -> (i32, i23, i23, i1, i1) { %x = arith.constant 42 : i32 %y = arith.constant 17 : i23 %z = arith.constant 17 : i23 %t = arith.constant true %f = arith.constant false %h = arith.constant 0xf32 : i32 return %x, %y, %z, %t, %f : i32, i23, i23, i1, i1 } func.func @typeattr() -> () { ^bb0: ""foo""(){bar = tensor<*xf32>} : () -> () return } func.func @stringquote() -> () { ^bb0: ""foo""(){bar = ""a\""quoted\""string""} : () -> () ""foo""(){bar = ""typed_string"" : !foo.string} : () -> () return } func.func @unitAttrs() -> () { ""foo""() {unitAttr = unit} : () -> () ""foo""() {unitAttr} : () -> () ""foo""() {nested = {unitAttr}} : () -> () return } func.func @floatAttrs() -> () { ^bb0: ""foo""(){a = 4.0, b = 2.0, c = 7.1, d = -0.0} : () -> () return } func.func private @externalfuncattr() -> () attributes {dialect.a = ""a\""quoted\""string"", dialect.b = 4.0, dialect.c = tensor<*xf32>} func.func private @funcattrempty() -> () attributes {} func.func private @funcattr() -> () attributes {dialect.a = ""a\""quoted\""string"", dialect.b = 4.0, dialect.c = tensor<*xf32>} { ^bb0: return } func.func @funcattrwithblock() -> () attributes {} { ^bb0: return } #map_simple0 = affine_map<()[] -> (10)> #map_simple1 = affine_map<()[s0] -> (s0)> #map_non_simple0 = affine_map<(d0)[] -> (d0)> #map_non_simple1 = affine_map<(d0)[s0] -> (d0 + s0)> #map_non_simple2 = affine_map<()[s0, s1] -> (s0 + s1)> #map_non_simple3 = affine_map<()[s0] -> (s0 + 3)> func.func @funcsimplemap(%arg0: index, %arg1: index) -> () { affine.for %i0 = 0 to #map_simple0()[] { affine.for %i1 = 0 to #map_simple1()[%arg1] { affine.for %i2 = 0 to #map_non_simple0(%i0)[] { affine.for %i3 = 0 to #map_non_simple1(%i0)[%arg1] { affine.for %i4 = 0 to #map_non_simple2()[%arg1, %arg0] { affine.for %i5 = 0 to #map_non_simple3()[%arg0] { %c42_i32 = arith.constant 42 : i32 } } } } } } return } func.func @splattensorattr() -> () { ^bb0: ""splatBoolTensor""(){bar = dense : tensor} : () -> () ""splatUIntTensor""(){bar = dense<222> : tensor<2x1x4xui8>} : () -> () ""splatIntTensor""(){bar = dense<5> : tensor<2x1x4xi32>} : () -> () ""splatFloatTensor""(){bar = dense<-5.0> : tensor<2x1x4xf32>} : () -> () ""splatIntVector""(){bar = dense<5> : vector<2x1x4xi64>} : () -> () ""splatFloatVector""(){bar = dense<-5.0> : vector<2x1x4xf16>} : () -> () ""splatIntScalar""() {bar = dense<5> : tensor} : () -> () ""splatFloatScalar""() {bar = dense<-5.0> : tensor} : () -> () return } func.func @densetensorattr() -> () { ^bb0: ""fooi3""(){bar = dense<[[[1, -2, 1, 2]], [[0, 2, -1, 2]]]> : tensor<2x1x4xi3>} : () -> () ""fooi6""(){bar = dense<[[[5, -6, 1, 2]], [[7, 8, 3, 4]]]> : tensor<2x1x4xi6>} : () -> () ""fooi8""(){bar = dense<[[[5]]]> : tensor<1x1x1xi8>} : () -> () ""fooi13""(){bar = dense<[[[1, -2, 1, 2]], [[0, 2, -1, 2]]]> : tensor<2x1x4xi13>} : () -> () ""fooi16""(){bar = dense<[[[-5]]]> : tensor<1x1x1xi16>} : () -> () ""fooi23""(){bar = dense<[[[1, -2, 1, 2]], [[0, 2, -1, 2]]]> : tensor<2x1x4xi23>} : () -> () ""fooi32""(){bar = dense<[[[5]]]> : tensor<1x1x1xi32>} : () -> () ""fooi33""(){bar = dense<[[[1, -2, 1, 2]], [[0, 2, -1, 2]]]> : tensor<2x1x4xi33>} : () -> () ""fooi43""(){bar = dense<[[[1, -2, 1, 2]], [[0, 2, -1, 2]]]> : tensor<2x1x4xi43>} : () -> () ""fooi53""(){bar = dense<[[[1, -2, 1, 2]], [[0, 2, -1, 2]]]> : tensor<2x1x4xi53>} : () -> () ""fooi64""(){bar = dense<[[[1, -2, 1, 2]], [[0, 3, -1, 2]]]> : tensor<2x1x4xi64>} : () -> () ""fooi64""(){bar = dense<[[[-5]]]> : tensor<1x1x1xi64>} : () -> () ""fooi67""(){bar = dense<[[[-5, 4, 6, 2]]]> : vector<1x1x4xi67>} : () -> () ""foo2""(){bar = dense<> : tensor<0xi32>} : () -> () ""foo2""(){bar = dense<> : tensor<1x0xi32>} : () -> () ""foo2""(){bar = dense<> : tensor<0x512x512xi32>} : () -> () ""foo3""(){bar = dense<[[[5, -6, 1, 2]], [[7, 8, 3, 4]]]> : tensor<2x1x4xi32>} : () -> () ""float1""(){bar = dense<[[[5.0]]]> : tensor<1x1x1xf32>} : () -> () ""float2""(){bar = dense<> : tensor<0xf32>} : () -> () ""float2""(){bar = dense<> : tensor<1x0xf32>} : () -> () ""bfloat16""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : tensor<2x1x4xbf16>} : () -> () ""float16""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : tensor<2x1x4xf16>} : () -> () ""float32""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : tensor<2x1x4xf32>} : () -> () ""float64""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : tensor<2x1x4xf64>} : () -> () ""intscalar""(){bar = dense<1> : tensor} : () -> () ""floatscalar""(){bar = dense<5.0> : tensor} : () -> () ""index""(){bar = dense<1> : tensor} : () -> () ""index""(){bar = dense<[1, 2]> : tensor<2xindex>} : () -> () ""complex_attr""(){bar = dense<(1,1)> : tensor>} : () -> () ""complex_attr""(){bar = dense<[(1,1), (2,2)]> : tensor<2xcomplex>} : () -> () ""complex_attr""(){bar = dense<(1.000000e+00,0.000000e+00)> : tensor>} : () -> () ""complex_attr""(){bar = dense<[(1.000000e+00,0.000000e+00), (2.000000e+00,2.000000e+00)]> : tensor<2xcomplex>} : () -> () return } func.func @densevectorattr() -> () { ^bb0: ""fooi8""(){bar = dense<[[[5]]]> : vector<1x1x1xi8>} : () -> () ""fooi16""(){bar = dense<[[[-5]]]> : vector<1x1x1xi16>} : () -> () ""foo32""(){bar = dense<[[[5]]]> : vector<1x1x1xi32>} : () -> () ""fooi64""(){bar = dense<[[[-5]]]> : vector<1x1x1xi64>} : () -> () ""foo3""(){bar = dense<[[[5, -6, 1, 2]], [[7, 8, 3, 4]]]> : vector<2x1x4xi32>} : () -> () ""float1""(){bar = dense<[[[5.0]]]> : vector<1x1x1xf32>} : () -> () ""bfloat16""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : vector<2x1x4xbf16>} : () -> () ""float16""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : vector<2x1x4xf16>} : () -> () ""float32""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : vector<2x1x4xf32>} : () -> () ""float64""(){bar = dense<[[[-5.0, 6.0, 1.0, 2.0]], [[7.0, -8.0, 3.0, 4.0]]]> : vector<2x1x4xf64>} : () -> () return } func.func @sparsetensorattr() -> () { ^bb0: ""fooi8""(){bar = sparse<0, -2> : tensor<1x1x1xi8>} : () -> () ""fooi16""(){bar = sparse<[[1, 1, 0], [0, 1, 0], [0, 0, 1]], [2, -1, 5]> : tensor<2x2x2xi16>} : () -> () ""fooi32""(){bar = sparse<> : tensor<1x1xi32>} : () -> () ""fooi64""(){bar = sparse<[0], [-1]> : tensor<1xi64>} : () -> () ""foo2""(){bar = sparse<> : tensor<0xi32>} : () -> () ""foo3""(){bar = sparse<> : tensor} : () -> () ""foof16""(){bar = sparse<0, -2.0> : tensor<1x1x1xf16>} : () -> () ""foobf16""(){bar = sparse<[[1, 1, 0], [0, 1, 0], [0, 0, 1]], [2.0, -1.0, 5.0]> : tensor<2x2x2xbf16>} : () -> () ""foof32""(){bar = sparse<> : tensor<1x0x1xf32>} : () -> () ""foof64""(){bar = sparse<[[0]], [-1.0]> : tensor<1xf64>} : () -> () ""foof320""(){bar = sparse<> : tensor<0xf32>} : () -> () ""foof321""(){bar = sparse<> : tensor} : () -> () ""foostr""(){bar = sparse<0, ""foo""> : tensor<1x1x1x!unknown<>>} : () -> () ""foostr""(){bar = sparse<[[1, 1, 0], [0, 1, 0], [0, 0, 1]], [""a"", ""b"", ""c""]> : tensor<2x2x2x!unknown<>>} : () -> () return } func.func @sparsevectorattr() -> () { ^bb0: ""fooi8""(){bar = sparse<0, -2> : vector<1x1x1xi8>} : () -> () ""fooi16""(){bar = sparse<[[1, 1, 0], [0, 1, 0], [0, 0, 1]], [2, -1, 5]> : vector<2x2x2xi16>} : () -> () ""fooi32""(){bar = sparse<> : vector<1x1xi32>} : () -> () ""fooi64""(){bar = sparse<[[0]], [-1]> : vector<1xi64>} : () -> () ""foof16""(){bar = sparse<0, -2.0> : vector<1x1x1xf16>} : () -> () ""foobf16""(){bar = sparse<[[1, 1, 0], [0, 1, 0], [0, 0, 1]], [2.0, -1.0, 5.0]> : vector<2x2x2xbf16>} : () -> () ""foof64""(){bar = sparse<0, [-1.0]> : vector<1xf64>} : () -> () return } func.func @unknown_dialect_type() -> !bar<> { %0 = ""foo""() : () -> !bar<> %1 = ""foo""() : () -> !bar return %0 : !bar<> } !i32_type_alias = i32 func.func @type_alias() -> !i32_type_alias { %0 = ""foo""() : () -> i32 return %0 : i32 } func.func @no_integer_set_constraints() { affine.if affine_set<() : ()> () { } return } func.func @verbose_if(%N: index) { %c = arith.constant 200 : index ""affine.if""(%c, %N, %c) ({ %y = ""add""(%c, %N) : (index, index) -> index ""affine.yield""() : () -> () }, { %z = ""add""(%c, %c) : (index, index) -> index ""affine.yield""() : () -> () }) { condition = #set0 } : (index, index, index) -> () return } func.func @terminator_with_regions() { ""region""()[^bb2] ({}) : () -> () ^bb2: return } func.func @unregistered_term(%arg0 : i1) -> i1 { ""unregistered_br""(%arg0)[^bb1] : (i1) -> () ^bb1(%arg1 : i1): return %arg1 : i1 } func.func @dialect_attrs() attributes {dialect.attr = 10} { return } func.func private @_valid.function$name() func.func private @external_func_arg_attrs(i32, i1 {dialect.attr = 10 : i64}, i32) func.func @func_arg_attrs(%arg0: i1 {dialect.attr = 10 : i64}) { return } func.func @func_result_attrs(%arg0: f32) -> (f32 {dialect.attr = 1}) { return %arg0 : f32 } func.func private @empty_tuple(tuple<>) func.func private @tuple_single_element(tuple) func.func private @tuple_multi_element(tuple) func.func private @tuple_nested(tuple>>) func.func @pretty_form_multi_result() -> (i16, i16) { %quot, %rem = ""foo_div""() : () -> (i16, i16) return %quot, %rem : i16, i16 } func.func @pretty_form_multi_result_groups() -> (i16, i16, i16, i16, i16) { %group_1:2, %group_2, %group_3:2 = ""foo_test""() : () -> (i16, i16, i16, i16, i16) return %group_1#0, %group_1#1, %group_2, %group_3#0, %group_3#1 : i16, i16, i16, i16, i16 } func.func @pretty_dialect_attribute() { ""foo.unknown_op""() {foo = #foo.simple_attr} : () -> () ""foo.unknown_op""() {foo = #foo.complexattr} : () -> () ""foo.unknown_op""() {foo = #foo.complexattr>} : () -> () ""foo.unknown_op""() {foo = #foo.complexattr>} : () -> () ""foo.unknown_op""() {foo = #foo.dialect} : () -> () return } func.func @pretty_dialect_type() { %0 = ""foo.unknown_op""() : () -> !foo.simpletype %1 = ""foo.unknown_op""() : () -> !foo.complextype %2 = ""foo.unknown_op""() : () -> !foo.complextype> %3 = ""foo.unknown_op""() : () -> !foo.complextype> %4 = ""foo.unknown_op""() : () -> !foo.dialect return } func.func @none_type() { %none_val = ""foo.unknown_op""() : () -> none return } func.func @scoped_names() { ""foo.region_op""() ({ %scoped_name = ""foo.unknown_op""() : () -> none ""foo.terminator""() : () -> () }, { %scoped_name = ""foo.unknown_op""() : () -> none ""foo.terminator""() : () -> () }) : () -> () return } func.func @dialect_attribute_with_type() { ""foo.unknown_op""() {foo = #foo.attr : i32} : () -> () } func.func @f16_special_values() { %0 = arith.constant 0x7C01 : f16 %1 = arith.constant 0x7FFF : f16 %2 = arith.constant 0xFFFF : f16 %3 = arith.constant 0x7C00 : f16 %4 = arith.constant 0xFC00 : f16 return } func.func @f32_special_values() { %0 = arith.constant 0x7F800001 : f32 %1 = arith.constant 0x7FBFFFFF : f32 %2 = arith.constant 0x7FC00000 : f32 %3 = arith.constant 0xFFFFFFFF : f32 %4 = arith.constant 0x7F800000 : f32 %5 = arith.constant 0xFF800000 : f32 return } func.func @f64_special_values() { %0 = arith.constant 0x7FF0000000000001 : f64 %1 = arith.constant 0x7FF8000000000000 : f64 %2 = arith.constant 0x7FF0000001000000 : f64 %3 = arith.constant 0xFFF0000001000000 : f64 %4 = arith.constant 0x7FF0000000000000 : f64 %5 = arith.constant 0xFFF0000000000000 : f64 %6 = arith.constant 0xC1CDC00000000000 : f64 return } func.func @bfloat16_special_values() { %0 = arith.constant 0x7F81 : bf16 %1 = arith.constant 0xFF81 : bf16 %2 = arith.constant 0x7FC0 : bf16 %3 = arith.constant 0xFFC0 : bf16 %4 = arith.constant 0x7F80 : bf16 %5 = arith.constant 0xFF80 : bf16 return } func.func @f32_potential_precision_loss() { %0 = arith.constant -1.23697901 : f32 return } func.func @special_float_values_in_tensors() { ""foo""(){bar = dense<0xFFFFFFFF> : tensor<4x4xf32>} : () -> () ""foo""(){bar = dense<[[0xFFFFFFFF, 0x7F800000], [0x7FBFFFFF, 0x7F800001]]> : tensor<2x2xf32>} : () -> () ""foo""(){bar = dense<[0xFFFFFFFF, 0.0]> : tensor<2xf32>} : () -> () ""foo""(){bar = sparse<[[1,1,0],[0,1,1]], [0xFFFFFFFF, 0x7F800001]> : tensor<2x2x2xf32>} : () -> () } func.func @op_with_region_args() { test.polyfor %i, %j, %k { ""foo""() : () -> () } return } func.func @op_with_passthrough_region_args() { %0 = arith.constant 10 : index test.isolated_region %0 { ""foo.consumer""(%0) : (index) -> () } %result:2 = ""foo.op""() : () -> (index, index) test.isolated_region %result#1 { ""foo.consumer""(%result#1) : (index) -> () } return } func.func private @ptr_to_function() -> !unreg.ptr<() -> ()> func.func private @escaped_string_char(i1 {foo.value = ""\n""}) func.func @parse_integer_literal_test() { test.parse_integer_literal : 5 return } func.func @parse_wrapped_keyword_test() { test.parse_wrapped_keyword foo.keyword return } func.func @parse_base64_test() { test.parse_b64 ""aGVsbG8gd29ybGQ="" return } func.func @""\""_string_symbol_reference\""""() { ""foo.symbol_reference""() {ref = @""\""_string_symbol_reference\""""} : () -> () return } func.func private @parse_opaque_attr_escape() { ""foo.constant""() {value = #foo<""\""escaped\\\n\"""">} : () -> () } func.func private @string_attr_name() attributes {""0 . 0"", nested = {""0 . 0""}} func.func private @nested_reference() attributes {test.ref = @some_symbol::@some_nested_symbol } func.func @custom_asm_names() -> (i32, i32, i32, i32, i32, i32) { %0, %1:2, %2 = ""test.asm_interface_op""() : () -> (i32, i32, i32, i32) %3, %4 = ""test.asm_interface_op""() : () -> (i32, i32) return %0, %1#0, %1#1, %2, %3, %4 : i32, i32, i32, i32, i32, i32 } func.func @pretty_names() { %x = test.string_attr_pretty_name %YY = test.string_attr_pretty_name attributes { names = [""y""] } %0 = ""test.string_attr_pretty_name""() { names = [""y""]} : () -> i32 %1 = ""test.string_attr_pretty_name""() { names = [""space name""]} : () -> i32 ""unknown.use""(%x, %YY, %0, %1) : (i32, i32, i32, i32) -> () %a, %b, %c = test.string_attr_pretty_name %q:3, %r = test.string_attr_pretty_name return } func.func @default_dialect(%bool : i1) { test.default_dialect { parse_integer_literal : 5 test.parse_integer_literal : 6 ""test.op_with_attr""() {test.attr = ""test.value""} : () -> () test.op.with_dot_in_name test.dialect_custom_printer.with.dot ""test.terminator""() : ()->() } func.return } func.func @unreachable_dominance_violation_ok() -> i1 { %c = arith.constant false return %c : i1 ^bb1: %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) cf.br ^bb3 ^bb2: cf.br ^bb2 ^bb3: %1 = ""foo""() : ()->i64 return %2#1 : i1 } func.func @graph_region_in_hierarchy_ok() -> i64 { cf.br ^bb2 ^bb1: test.graph_region { %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) } cf.br ^bb4 ^bb2: %1 = ""foo""() : ()->i64 cf.br ^bb1 ^bb4: return %1 : i64 } func.func @graph_region_kind() -> () { test.graph_region { %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) %1 = ""baz""(%2#0) : (i1) -> (i64) } return } func.func @graph_region_inside_ssacfg_region() -> () { ""test.ssacfg_region""() ({ %1 = ""baz""() : () -> (i64) test.graph_region { %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) } %3 = ""baz""() : () -> (i64) }) : () -> () return } func.func @graph_region_in_graph_region_ok() -> () { test.graph_region { test.graph_region { %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) } %1 = ""foo""() : ()->i64 ""test.terminator""() : ()->() } return } test.graph_region { %1 = ""op1""(%3) : (i32) -> (i32) %2 = ""test.ssacfg_region""(%1, %2, %3, %4) ({ %5 = ""op2""(%1, %2, %3, %4) : (i32, i32, i32, i32) -> (i32) }) : (i32, i32, i32, i32) -> (i32) %3 = ""op2""(%1, %4) : (i32, i32) -> (i32) %4 = ""op3""(%1) : (i32) -> (i32) } ""unregistered_func_might_have_graph_region""() ({ %1 = ""foo""(%1, %2) : (i64, i64) -> i64 %2 = ""bar""(%1) : (i64) -> i64 ""unregistered_terminator""() : () -> () }) {sym_name = ""unregistered_op_dominance_violation_ok"", function_type = () -> i1} : () -> () test.dialect_custom_printer custom_format test.dialect_custom_format_fallback custom_format_fallback test.format_optional_result_d_op : f80", mlir-opt -allow-unregistered-dialect ,1 "module { func.func @foo(%arg0: i32, %arg1: i32, %arg3: i32) -> i32 { ""test.noop""() : () -> () ""test.no_result""(%arg0) {} : (i32) -> () %1 = ""test.unused_result""(%arg0, %arg1) {} : (i32, i32) -> i32 %2 = ""test.one_result""(%arg0, %arg1) {} : (i32, i32) -> i32 %3:2 = ""test.many_results""(%2) {} : (i32) -> (i32, i32) %7:2 = ""test.many_results""() : () -> (i32, i32) %4 = ""test.foo""(%3#0) {} : (i32) -> i32 %5 = ""test.foo""(%3#1, %4, %4) {} : (i32, i32, i32) -> i32 %6 = ""test.foo""(%3#0, %3#1) {} : (i32, i32) -> i32 ""test.no_result""(%6) {} : (i32) -> () ""test.no_result""(%7#0) : (i32) -> () return %6: i32 } }", mlir-opt -allow-unregistered-dialect -mlir-print-value-users -split-input-file ,1 "module { %0 = arith.constant 42 : i32 %test = ""test.outerop""(%0) ({ ""test.innerop""(%0) : (i32) -> () }): (i32) -> i32 %p:2, %q = ""test.custom_result_name""(%test) {names = [""p"", ""p"", ""q""]} : (i32) -> (i32, i32, i32) %r, %s = ""test.custom_result_name""(%q#0, %q#0, %test) {names = [""r"", ""s""]} : (i32, i32, i32) -> (i32, i32) %u, %v = ""test.custom_result_name""(%s, %q#0, %p) {names = [""u"", ""v""]} : (i32, i32, i32) -> (i32, i32) }", mlir-opt -allow-unregistered-dialect -mlir-print-value-users -split-input-file ,1 "func.func @custom_region_names() -> () { ""test.polyfor""() ({ ^bb0(%arg0: index, %arg1: index, %arg2: index): ""foo""() : () -> () }) { arg_names = [""i"", ""j"", ""k""] } : () -> () return } func.func @weird_names() -> () { ""test.polyfor""() ({ ^bb0(%arg0: i32, %arg1: i32, %arg2: index): ""foo""() : () -> i32 }) { arg_names = [""a .^x"", ""0""] } : () -> () return }", mlir-opt -allow-unregistered-dialect ,1 "func.func private @t(f32) func.func private @erase_arg(%arg0: f32 {test.A}, %arg1: f32 {test.B}) attributes {test.set_type_from = @t}", mlir-opt -test-func-set-type -split-input-file ,1 "func.func private @t() -> (f32) func.func private @erase_result() -> (f32 {test.A}, f32 {test.B}) attributes {test.set_type_from = @t}", mlir-opt -test-func-set-type -split-input-file ,1 "func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) { %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc(""some_NameLoc"") return %res : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) { %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc(""some_NameLoc"") return %res : f32 }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -split-input-file ,1 "func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) { %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc(""some_NameLoc"") return %res : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file --mlir-print-op-generic --mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) { %0 = test.pretty_printed_region %arg1, %arg0 ({ ^bb0(%arg2: f32, %arg3: f32): %1 = ""test.non.special.op""(%arg2, %arg3) : (f32, f32) -> f32 ""test.return""(%1) : (f32) -> () }) : (f32, f32) -> f32 return %0 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) { %0 = test.pretty_printed_region %arg1, %arg0 ({ ^bb0(%arg2: f32, %arg3: f32): %1 = ""test.non.special.op""(%arg2, %arg3) : (f32, f32) -> f32 ""test.return""(%1) : (f32) -> () }) : (f32, f32) -> f32 return %0 : f32 }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -split-input-file ,1 "func.func @pretty_printed_region_op(%arg0 : f32, %arg1 : f32) -> (f32) { %0 = test.pretty_printed_region %arg1, %arg0 ({ ^bb0(%arg2: f32, %arg3: f32): %1 = ""test.non.special.op""(%arg2, %arg3) : (f32, f32) -> f32 ""test.return""(%1) : (f32) -> () }) : (f32, f32) -> f32 return %0 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file --mlir-print-op-generic --mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func @pretty_printed_region_op_deferred_loc(%arg0 : f32, %arg1 : f32) -> (f32) { %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc(""foo"") return %res : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @pretty_printed_region_op_deferred_loc(%arg0 : f32, %arg1 : f32) -> (f32) { %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc(""foo"") return %res : f32 }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -split-input-file ,1 "func.func @pretty_printed_region_op_deferred_loc(%arg0 : f32, %arg1 : f32) -> (f32) { %res = test.pretty_printed_region %arg1, %arg0 start test.special.op end : (f32, f32) -> (f32) loc(""foo"") return %res : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file --mlir-print-op-generic --mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func @block_names(%bool : i1) { test.block_names { cf.br ^foo1 ^foo1: cf.br ^foo2 ^foo2: ""test.return""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file ,1 "func.func @block_names(%bool : i1) { test.block_names { cf.br ^foo1 ^foo1: cf.br ^foo2 ^foo2: ""test.return""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -split-input-file ,1 "func.func @block_names(%bool : i1) { test.block_names { cf.br ^foo1 ^foo1: cf.br ^foo2 ^foo2: ""test.return""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file --mlir-print-op-generic --mlir-print-debuginfo -mlir-print-local-scope ,1 "#map0 = affine_map<(i, j) -> (i, j)> #map1 = affine_map<(i, j)[s0] -> (i, j)> #map2 = affine_map<() -> (0)> #map3 = affine_map<(i, j) -> (i+1, 4*j + 2)> #map3a = affine_map<(i, j) -> (1+i, 4*j + 2)> #map3b = affine_map<(i, j) -> (2 + 3 - 2*2 + i, 4*j + 2)> #map3c = affine_map<(i, j) -> (i +1 + 0, 4*j + 2)> #map3d = affine_map<(i, j) -> (i + 3 + 2 - 4, 4*j + 2)> #map3e = affine_map<(i, j) -> (1*i+3*2-2*2-1, 4*j + 2)> #map3f = affine_map<(i, j) -> (i + 1, 4*j*1 + 2)> #map3g = affine_map<(i, j) -> (i + 1, 2*2*j + 2)> #map3h = affine_map<(i, j) -> (i + 1, 2*j*2 + 2)> #map3i = affine_map<(i, j) -> (i + 1, j*2*2 + 2)> #map3j = affine_map<(i, j) -> (i + 1, j*1*4 + 2)> #map3k = affine_map<(i, j) -> (i + 1, j*4*1 + 2)> #map3l = affine_map<(i, j) -> ((j - i) + 2*(i - j + 1) + j - 1 + 0, j + j + 1 + j + j + 1)> #map4 = affine_map<(i, j) -> (3+3-2*2+i, j)> #map5 = affine_map<(i, j)[s0] -> (i + s0, j)> #map6 = affine_map<(i, j)[s0] -> (i + s0, j + 5)> #map7 = affine_map<(i, j)[s0] -> (i + j + s0, j)> #map8 = affine_map<(i, j)[s0] -> (5 + i + j + s0, j)> #map9 = affine_map<(i, j)[s0] -> ((i + j) + 5, j)> #map10 = affine_map<(i, j)[s0] -> (i + (j + 5), j)> #map11 = affine_map<(i, j)[s0] -> (2*i, 3*j)> #map12 = affine_map<(i, j)[s0] -> (i + 2*6 + 5*(j+s0*3), j)> #map13 = affine_map<(i, j)[s0] -> (5*i + j, j)> #map14 = affine_map<(i, j)[s0] -> ((i + j), (j))> #map15 = affine_map<(i, j)[s0] -> ((i + j + 2) + 5, (j)+3)> #map16 = affine_map<(i, j)[s1] -> (i, 0)> #map17 = affine_map<(i, j)[s0] -> (i, s0*j)> #map19 = affine_map<(i, j) -> (i, 3*i + j)> #map20 = affine_map<(i, j) -> (i, i + 3*j)> #map18 = affine_map<(i, j)[N] -> (i, 2 + N*N*9*i + 1)> #map21 = affine_map<(i, j) -> (1, i + 3*j + 5)> #map22 = affine_map<(i, j)[s0] -> (5*s0, i + 3*j + 5*i)> #map23 = affine_map<(i, j)[s0, s1] -> (i*(s0*s1), j)> #map24 = affine_map<(i, j)[s0, s1] -> (i, j mod 5)> #map25 = affine_map<(i, j)[s0, s1] -> (i, j floordiv 5)> #map26 = affine_map<(i, j)[s0, s1] -> (i, j ceildiv 5)> #map29 = affine_map<(i, j)[s0, s1] -> (i, i - j - 5)> #map30 = affine_map<(i, j)[M, N] -> (i, i - N*j + 2)> #map32 = affine_map<(i, j)[s0, s1] -> (-5*i, -3*j, -2, -1*(i+j), -1*s0)> #map33 = affine_map<(i, j) -> (-2+-5-(-3), -1*i)> #map34 = affine_map<(i, j)[s0, s1] -> (i, j floordiv s0, j mod s0)> #map35 = affine_map<(i, j, k)[s0, s1, s2] -> (i*s1*s2 + j*s1 + k)> #map36 = affine_map<(i, j) -> (5+3, 2*2, 8-7, 100 floordiv 32, 5 mod 3, 10 ceildiv 3)> #map37 = affine_map<(i, j) -> (5 mod 3 + 2, 5*3 - 4, 128 * (500 ceildiv 128), 40 floordiv 7 * 3)> #map38 = affine_map<(i, j) -> (1 + i*2, 2 + j)> #map39 = affine_map<(i, j)[M, N] -> (i*M, M + i, 2+i, j*2, N*2, 2 + M)> #map43 = affine_map<(i, j) [s0] -> ( i * 5 floordiv 4, j ceildiv 7 mod s0)> #map44 = affine_map<(i, j) -> (i - 2*j, j * 6 floordiv 4)> #map45 = affine_map<(i, j, k) [N] -> (1 + i + 3 + j - 3 + k, k + 5 + j - 5, 2*i*4*N)> #map46 = affine_map<(i, j, k) -> (i*0, 1*j, i * 128 floordiv 64, j * 0 floordiv 64)> #map47 = affine_map<(i, j, k) -> (i * 64 ceildiv 64, i * 512 ceildiv 128, 4 * j mod 4, 4*j*4 mod 8, k mod 1)> #map48 = affine_map<(i, j, k) -> (i * 64 floordiv 64, i * 512 floordiv 128, 4 * j mod 4, 4*j*4 mod 8)> #map49 = affine_map<(i, j)[s0] -> ( (i * 4 + 8) mod 4, 32 * j * s0 * 8 mod 256, (4*i + (j * (s0 * 2))) mod 2, (4*i + 3) mod 2)> #map50 = affine_map<(i, j)[s0] -> ( (i * 2 + 1) ceildiv 1, (j + s0) floordiv 1)> #map51 = affine_map<(i) -> (-5 floordiv 3, -5 mod 3, -5 ceildiv 3)> #map52 = affine_map<(d0) -> (16*d0 + ((d0 + 1) * -1) + 15)> #map53 = affine_map<(d0) -> (d0 - (d0 + 1))> #map54 = affine_map<(d0)[s0] -> (-s0 floordiv 4, d0 floordiv -1)> #map55 = affine_map<() -> ()> #map56 = affine_map<(d0, d1) -> ((4*d0 + 2) floordiv 4, (4*d0 + 8*d1 + 5) floordiv 2, (2*d0 + 4*d1 + 3) mod 2, (3*d0 - 4) mod 3, (4*d0 + 8*d1) mod 8)> #map57 = affine_map<(d0, d1) -> (d0 - d0 + d1, -d0 + d0 + d0, (1 + d0 + d1 floordiv 4) - (d0 + d1 floordiv 4 + 1))> #map58 = affine_map<(d0, d1) -> (4*d0 - 2*d0 + d0, (d0 + d1) + (d0 + d1), 2 * (d0 mod 2) - d0 mod 2)> #map59 = affine_map<(d0, d1) -> ((d0 mod 35) mod 5, (d1 mod 35) mod 4)> #map60 = affine_map<(i0, i1) -> (i0, i1)> #map61 = affine_map<(d0, d1)[step, loc] -> (step - d0, loc - d1)> #map62 = affine_map<(d0, d1)[mod, floordiv] -> (mod floordiv 2 - d0, floordiv mod 3 - d1)> #map63 = affine_map<(d0, d1)[mod, floordiv] -> (floordiv floordiv 2 - d0, mod mod 3 - d1)> #map64 = affine_map<(i0, i1)[mod] -> (i0 + i1 + mod)> func.func private @f0(memref<2x4xi8, #map0, 1>) func.func private @f1(memref<2x4xi8, #map1, 1>) func.func private @f2(memref) func.func private @f3(memref<2x4xi8, #map3, 1>) func.func private @f3a(memref<2x4xi8, #map3a, 1>) func.func private @f3b(memref<2x4xi8, #map3b, 1>) func.func private @f3c(memref<2x4xi8, #map3c, 1>) func.func private @f3d(memref<2x4xi8, #map3d, 1>) func.func private @f3e(memref<2x4xi8, #map3e, 1>) func.func private @f3f(memref<2x4xi8, #map3f, 1>) func.func private @f3g(memref<2x4xi8, #map3g, 1>) func.func private @f3h(memref<2x4xi8, #map3h, 1>) func.func private @f3i(memref<2x4xi8, #map3i, 1>) func.func private @f3j(memref<2x4xi8, #map3j, 1>) func.func private @f3k(memref<2x4xi8, #map3k, 1>) func.func private @f3l(memref<2x4xi8, #map3l, 1>) func.func private @f4(memref<2x4xi8, #map4, 1>) func.func private @f5(memref<2x4xi8, #map5, 1>) func.func private @f6(memref<2x4xi8, #map6, 1>) func.func private @f7(memref<2x4xi8, #map7, 1>) func.func private @f8(memref<2x4xi8, #map8, 1>) func.func private @f9(memref<2x4xi8, #map9, 1>) func.func private @f10(memref<2x4xi8, #map10, 1>) func.func private @f11(memref<2x4xi8, #map11, 1>) func.func private @f12(memref<2x4xi8, #map12, 1>) func.func private @f13(memref<2x4xi8, #map13, 1>) func.func private @f14(memref<2x4xi8, #map14, 1>) func.func private @f15(memref<2x4xi8, #map15, 1>) func.func private @f16(memref<2x4xi8, #map16, 1>) func.func private @f17(memref<2x4xi8, #map17, 1>) func.func private @f19(memref<2x4xi8, #map19, 1>) func.func private @f20(memref<2x4xi8, #map20, 1>) func.func private @f18(memref<2x4xi8, #map18, 1>) func.func private @f21(memref<2x4xi8, #map21, 1>) func.func private @f22(memref<2x4xi8, #map22, 1>) func.func private @f23(memref<2x4xi8, #map23, 1>) func.func private @f24(memref<2x4xi8, #map24, 1>) func.func private @f25(memref<2x4xi8, #map25, 1>) func.func private @f26(memref<2x4xi8, #map26, 1>) func.func private @f29(memref<2x4xi8, #map29, 1>) func.func private @f30(memref<2x4xi8, #map30, 1>) func.func private @f32(memref<2x4xi8, #map32, 1>) func.func private @f33(memref<2x4xi8, #map33, 1>) func.func private @f34(memref<2x4xi8, #map34, 1>) func.func private @f35(memref<2x4x4xi8, #map35, 1>) func.func private @f36(memref<2x4xi8, #map36, 1>) func.func private @f37(memref<2x4xi8, #map37, 1>) func.func private @f38(memref<2x4xi8, #map38, 1>) func.func private @f39(memref<2x4xi8, #map39, 1>) func.func private @f43(memref<2x4xi8, #map43>) func.func private @f44(memref<2x4xi8, #map44>) func.func private @f45(memref<100x100x100xi8, #map45>) func.func private @f46(memref<100x100x100xi8, #map46>) func.func private @f47(memref<100x100x100xi8, #map47>) func.func private @f48(memref<100x100x100xi8, #map48>) func.func private @f49(memref<100x100xi8, #map49>) func.func private @f50(memref<100x100xi8, #map50>) func.func private @f51(memref<1xi8, #map51>) func.func private @f52(memref<1xi8, #map52>) func.func private @f53(memref<1xi8, #map53>) func.func private @f54(memref<10xi32, #map54>) ""foo.op""() {map = #map55} : () -> () func.func private @f56(memref<1x1xi8, #map56>) ""f57""() {map = #map57} : () -> () ""f58""() {map = #map58} : () -> () ""f59""() {map = #map59} : () -> () ""f60""() {map = #map60} : () -> () ""f61""() {map = #map61} : () -> () ""f62""() {map = #map62} : () -> () ""f63""() {map = #map63} : () -> () ""f64""() {map = #map64} : () -> ()", mlir-opt -allow-unregistered-dialect ,1 "func.func @structured_cfg() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c1 to %c10 step %c1 { %cond = ""use0""(%i) : (index) -> (i1) scf.if %cond { ""use1""(%i) : (index) -> () } else { ""use2""(%i) : (index) -> () } ""use3""(%i) : (index) -> () } return }", mlir-opt -test-ir-visitors -allow-unregistered-dialect -split-input-file ,1 "func.func @unstructured_cfg() { ""regionOp0""() ({ ^bb0: ""op0""() : () -> () cf.br ^bb2 ^bb1: ""op1""() : () -> () cf.br ^bb2 ^bb2: ""op2""() : () -> () }) : () -> () return }", mlir-opt -test-ir-visitors -allow-unregistered-dialect -split-input-file ,1 "func.func @unordered_cfg_with_loop() { ""regionOp0""() ({ ^bb0: %c = ""op0""() : () -> (i1) cf.cond_br %c, ^bb2, ^bb3 ^bb1: ""op1""(%val) : (i32) -> () cf.br ^bb5 ^bb2: %val = ""op2""() : () -> (i32) cf.br ^bb1 ^bb3: ""op3""() : () -> () cf.br ^bb2 ^bb4: ""op4""() : () -> () cf.br ^bb2 ^bb5: ""op5""() : () -> () cf.br ^bb7 ^bb6: ""op6""() : () -> () cf.br ^bb6 ^bb7: ""op7""() : () -> () }) : () -> () return }", mlir-opt -test-ir-visitors -allow-unregistered-dialect -split-input-file ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() {interrupt = true} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-region-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 """test.top_level_op""() : () -> () ""test.top_level_op""() : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_op_strict_loc""() { strict_loc_check } : () -> () ""test.top_level_op_strict_loc""() { strict_loc_check } : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_op_loc_match""() { strict_loc_check } : () -> () loc(""foo"") ""test.top_level_op_loc_match""() { strict_loc_check } : () -> () loc(""foo"")", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_op_block_loc_mismatch""() ({ ^bb0(%a : i32): }) { strict_loc_check } : () -> () loc(""foo"") ""test.top_level_op_block_loc_mismatch""() ({ ^bb0(%a : i32): }) { strict_loc_check } : () -> () loc(""foo"")", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_op_block_loc_match""() ({ ^bb0(%a : i32 loc(""bar"")): }) { strict_loc_check } : () -> () loc(""foo"") ""test.top_level_op_block_loc_match""() ({ ^bb0(%a : i32 loc(""bar"")): }) { strict_loc_check } : () -> () loc(""foo"")", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_name_mismatch""() : () -> () ""test.top_level_name_mismatch2""() : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_op_attr_mismatch""() { foo = ""bar"" } : () -> () ""test.top_level_op_attr_mismatch""() { foo = ""bar2""} : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.top_level_op_cfg""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> () ^bb1(%arg2 : f32): ""test.some_branching_op""() : () -> () ^bb2(%arg3 : i32): ""test.some_branching_op""() : () -> () }, { ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> () ^bb1(%arg2 : f32): ""test.some_branching_op""() : () -> () ^bb2(%arg3 : i32): ""test.some_branching_op""() : () -> () }) { attr = ""foo"" } : () -> () ""test.top_level_op_cfg""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> () ^bb1(%arg2 : f32): ""test.some_branching_op""() : () -> () ^bb2(%arg3 : i32): ""test.some_branching_op""() : () -> () }, { ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> () ^bb1(%arg2 : f32): ""test.some_branching_op""() : () -> () ^bb2(%arg3 : i32): ""test.some_branching_op""() : () -> () }) { attr = ""foo"" } : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.operand_num_mismatch""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg0) : (f32, i32) -> () }) : () -> () ""test.operand_num_mismatch""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1) : (f32) -> () }) : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.operand_type_mismatch""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg0) : (f32, i32) -> () }) : () -> () ""test.operand_type_mismatch""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""(%arg1, %arg1) : (f32, f32) -> () }) : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.block_type_mismatch""() ({ ^bb0(%arg0 : f32, %arg1 : f32): ""test.some_branching_op""() : () -> () }) : () -> () ""test.block_type_mismatch""() ({ ^bb0(%arg0 : i32, %arg1 : f32): ""test.some_branching_op""() : () -> () }) : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.block_arg_num_mismatch""() ({ ^bb0(%arg0 : f32, %arg1 : f32): ""test.some_branching_op""() : () -> () }) : () -> () ""test.block_arg_num_mismatch""() ({ ^bb0(%arg0 : f32): ""test.some_branching_op""() : () -> () }) : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.dataflow_match""() ({ %0:2 = ""test.producer""() : () -> (i32, i32) ""test.consumer""(%0#0, %0#1) : (i32, i32) -> () }) : () -> () ""test.dataflow_match""() ({ %0:2 = ""test.producer""() : () -> (i32, i32) ""test.consumer""(%0#0, %0#1) : (i32, i32) -> () }) : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 """test.dataflow_mismatch""() ({ %0:2 = ""test.producer""() : () -> (i32, i32) ""test.consumer""(%0#0, %0#1) : (i32, i32) -> () }) : () -> () ""test.dataflow_mismatch""() ({ %0:2 = ""test.producer""() : () -> (i32, i32) ""test.consumer""(%0#1, %0#0) : (i32, i32) -> () }) : () -> ()", mlir-opt -split-input-file --test-operations-equality ,1 module attributes {test.invalid_attr} {}, not mlir-opt -split-input-file -mlir-print-op-on-diagnostic 2>&1 ,1 "func.func @foo() { ""test.foo""(%cst) : (index) -> () %cst = arith.constant 0 : index return }", not mlir-opt -split-input-file -mlir-print-op-on-diagnostic 2>&1 ,1 "func.func private @f() attributes {test.insert_results = [ [0, f32, {test.A}]]}", mlir-opt -test-func-insert-result -split-input-file ,1 "func.func private @f() -> (f32 {test.B}) attributes {test.insert_results = [ [0, f32, {test.A}]]}", mlir-opt -test-func-insert-result -split-input-file ,1 "func.func private @f() -> (f32 {test.A}) attributes {test.insert_results = [ [1, f32, {test.B}]]}", mlir-opt -test-func-insert-result -split-input-file ,1 "func.func private @f() -> (f32 {test.A}, f32 {test.C}) attributes {test.insert_results = [ [1, f32, {test.B}]]}", mlir-opt -test-func-insert-result -split-input-file ,1 "func.func private @f() -> (f32 {test.B}) attributes {test.insert_results = [ [0, f32, {test.A}], [1, f32, {test.C}]]}", mlir-opt -test-func-insert-result -split-input-file ,1 "func.func private @f() -> (f32 {test.C}) attributes {test.insert_results = [ [0, f32, {test.A}], [0, f32, {test.B}]]}", mlir-opt -test-func-insert-result -split-input-file ,1 "func.func @any_attr_of_pass() { ""test.any_attr_of_i32_str""() { attr = 3 : i32 } : () -> () ""test.any_attr_of_i32_str""() { attr = ""string_data"" } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @any_attr_of_fail() { ""test.any_attr_of_i32_str""() { attr = 3 : i64 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @float_attrs_pass() { ""test.float_attrs""() { float_attr = 2. : f8E5M2 } : () -> () ""test.float_attrs""() { float_attr = 2. : f8E4M3FN } : () -> () ""test.float_attrs""() { float_attr = 2. : f8E5M2FNUZ } : () -> () ""test.float_attrs""() { float_attr = 2. : f8E4M3FNUZ } : () -> () ""test.float_attrs""() { float_attr = 2. : f8E4M3B11FNUZ } : () -> () ""test.float_attrs""() { float_attr = 2. : f16 } : () -> () ""test.float_attrs""() { float_attr = 2. : bf16 } : () -> () ""test.float_attrs""() { float_attr = 2. : f32 } : () -> () ""test.float_attrs""() { float_attr = 2. : f64 } : () -> () ""test.float_attrs""() { float_attr = 2. : f80 } : () -> () ""test.float_attrs""() { float_attr = 2. : f128 } : () -> () return } func.func @int_attrs_pass() { ""test.int_attrs""() { any_i32_attr = 5 : ui32, index_attr = 8 : index, si32_attr = 7 : si32, ui32_attr = 6 : ui32 } : () -> () ""test.int_attrs""() { any_i32_attr = 5 : si32, index_attr = 8 : index, si32_attr = 7 : si32, ui32_attr = 6 : ui32 } : () -> () ""test.int_attrs""() { any_i32_attr = 5 : i32, index_attr = 8 : index, si32_attr = 7 : si32, ui32_attr = 6 : ui32 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @int_attrs_pass() { ""test.in_range_attrs""() { attr_00 = -128 : i8, attr_01 = 127 : i8, attr_02 = -128 : si8, attr_03 = 127 : si8, attr_04 = 255 : ui8, attr_05 = -32768 : i16, attr_06 = 32767 : i16, attr_07 = -32768 : si16, attr_08 = 32767 : si16, attr_09 = 65535 : ui16, attr_10 = -2147483647 : i32, attr_11 = 2147483646 : i32, attr_12 = -2147483647 : si32, attr_13 = 2147483646 : si32, attr_14 = 4294967295 : ui32, attr_15 = -9223372036854775808 : i64, attr_16 = 9223372036854775807 : i64, attr_17 = -9223372036854775808 : si64, attr_18 = 9223372036854775807 : si64, attr_19 = 18446744073709551615 : ui64, attr_20 = 1 : ui1, attr_21 = -1 : si1, attr_22 = 79228162514264337593543950335 : ui96, attr_23 = -39614081257132168796771975168 : si96 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @int_attrs_pass() { ""test.i8_attr""() { attr_00 = 255 : i8, attr_01 = 65535 : i16, attr_02 = 4294967295 : i32, attr_03 = 18446744073709551615 : i64 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @int0_attrs_pass() { ""test.i0_attr""() { attr_00 = 0 : i0, attr_01 = 0 : si0, attr_02 = 0 : ui0, attr_03 = 0x0000 : i0, attr_04 = 0x0000 : si0, attr_05 = 0x0000 : ui0 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @int0_attrs_negative_fail() { ""test.i0_attr""() { attr_00 = -1 : i0 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @int0_attrs_positive_fail() { ""test.i0_attr""() { attr_00 = 1 : i0 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_int_attrs_signedness_fail() { ""test.int_attrs""() { any_i32_attr = 5 : i32, index_attr = 8 : index, si32_attr = 7 : ui32, ui32_attr = 6 : ui32 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_int_attrs_signedness_fail() { ""test.int_attrs""() { any_i32_attr = 5 : i32, index_attr = 8 : index, si32_attr = 7 : si32, ui32_attr = 6 : si32 } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_int_attrs_type_fail() { ""test.int_attrs""() { any_i32_attr = 5.0 : f32, si32_attr = 7 : si32, ui32_attr = 6 : ui32, index_attr = 1 : index } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @non_negative_int_attr_pass() { ""test.non_negative_int_attr""() {i32attr = 5 : i32, i64attr = 10 : i64} : () -> () ""test.non_negative_int_attr""() {i32attr = 0 : i32, i64attr = 0 : i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @negative_int_attr_fail() { ""test.non_negative_int_attr""() {i32attr = -5 : i32, i64attr = 10 : i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @negative_int_attr_fail() { ""test.non_negative_int_attr""() {i32attr = 5 : i32, i64attr = -10 : i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @positive_int_attr_pass() { ""test.positive_int_attr""() {i32attr = 5 : i32, i64attr = 10 : i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @positive_int_attr_fail() { ""test.positive_int_attr""() {i32attr = 0 : i32, i64attr = 5: i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @positive_int_attr_fail() { ""test.positive_int_attr""() {i32attr = 5 : i32, i64attr = 0: i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @positive_int_attr_fail() { ""test.positive_int_attr""() {i32attr = -10 : i32, i64attr = 5 : i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @positive_int_attr_fail() { ""test.positive_int_attr""() {i32attr = 5 : i32, i64attr = -10 : i64} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @correct_type_array_attr_pass() { ""test.type_array_attr""() {attr = [i32, f32]} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @non_type_in_type_array_attr_fail() { ""test.type_array_attr""() {attr = [i32, 5 : i64]} : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @string_attr_custom_type() { test.string_attr_with_type ""string_data"" : !foo.string return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @allowed_cases_pass() { %0 = ""test.i32_enum_attr""() {attr = 5: i32} : () -> i32 %1 = ""test.i32_enum_attr""() {attr = 10: i32} : () -> i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @disallowed_case7_fail() { %0 = ""test.i32_enum_attr""() {attr = 7: i32} : () -> i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @disallowed_case7_fail() { %0 = ""test.i32_enum_attr""() {attr = 5: i64} : () -> i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @allowed_cases_pass() { %0 = ""test.i64_enum_attr""() {attr = 5: i64} : () -> i32 %1 = ""test.i64_enum_attr""() {attr = 10: i64} : () -> i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @disallowed_case7_fail() { %0 = ""test.i64_enum_attr""() {attr = 7: i64} : () -> i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @disallowed_case7_fail() { %0 = ""test.i64_enum_attr""() {attr = 5: i32} : () -> i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @allowed_cases_pass() { ""test.op_with_bit_enum""() {value = #test.bit_enum} : () -> () test.op_with_bit_enum return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @allowed_cases_pass() { ""test.op_with_bit_enum_vbar""() { value = #test.bit_enum_vbar } : () -> () test.op_with_bit_enum_vbar return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @disallowed_case_sticky_fail() { ""test.op_with_bit_enum""() {value = #test.bit_enum} : () -> () }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @correct_type_pass() { ""test.float_elements_attr""() { scalar_f32_attr = dense<5.0> : tensor<2xf32>, tensor_f64_attr = dense<6.0> : tensor<4x8xf64> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_element_type_pass() { ""test.float_elements_attr""() { scalar_f32_attr = dense<5.0> : tensor<2xf64>, tensor_f64_attr = dense<6.0> : tensor<4x8xf64> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @correct_type_pass() { ""test.float_elements_attr""() { scalar_f32_attr = dense<5.0> : tensor<2xf32>, tensor_f64_attr = dense<6.0> : tensor<4xf64> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @simple_scalar_example() { ""test.string_elements_attr""() { scalar_string_attr = dense<""example""> : tensor<2x!unknown<"""">> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @escape_string_example() { ""test.string_elements_attr""() { scalar_string_attr = dense<""new\nline""> : tensor<2x!unknown<"""">> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @simple_scalar_example() { ""test.string_elements_attr""() { scalar_string_attr = dense<[""example1"", ""example2""]> : tensor<2x!unknown<"""">> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @dense_array_attr() attributes { emptyf32attr = array, emptyf64attr = array, emptyi16attr = array, emptyi1attr = array, emptyi32attr = array, emptyi64attr = array, emptyi8attr = array, f32attr = array, f64attr = array, i16attr = array, i1attr = array, i32attr = array, i64attr = array, i8attr = array } { test.dense_array_attr i1attr = [true, false, true] i8attr = [1, -2, 3] i16attr = [3, 5, -4, 10] i32attr = [1024, 453, -6435] i64attr = [-142] f32attr = [1024., 453., -6435.] f64attr = [-142.] emptyattr = [] ""array.sizes""() { x0_i0 = array, x1_ui0 = array, x2_si0 = array, x3_i24 = array, x4_ui24 = array, x5_si24 = array, x6_bf16 = array, x7_f16 = array }: () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedDenseArrayAttr() { ""test.confined_dense_array_attr""() { i64attr = array, i32attr = array, emptyattr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedDenseArrayAttrDuplicateValues() { ""test.confined_dense_array_attr""() { emptyattr = array, i32attr = array, i64attr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedDenseArrayAttrDecreasingOrder() { ""test.confined_dense_array_attr""() { emptyattr = array, i32attr = array, i64attr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedStrictlyPositiveDenseArrayAttr() { ""test.confined_strictly_positive_attr""() { i8attr = array, i16attr = array, i32attr = array, i64attr = array, f32attr = array, f64attr = array, emptyattr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedStrictlyPositiveDenseArrayAttr() { ""test.confined_strictly_positive_attr""() { i8attr = array, i16attr = array, i32attr = array, i64attr = array, f32attr = array, f64attr = array, emptyattr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedNonNegativeDenseArrayAttr() { ""test.confined_non_negative_attr""() { i8attr = array, i16attr = array, i32attr = array, i64attr = array, f32attr = array, f64attr = array, emptyattr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testConfinedNonNegativeDenseArrayAttr() { ""test.confined_non_negative_attr""() { i8attr = array, i16attr = array, i32attr = array, i64attr = array, f32attr = array, f64attr = array, emptyattr = array } : () -> () func.return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @fn() { return } ""test.symbol_ref_attr""() {symbol = @fn} : () -> ()", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @correct_int_elements_attr_pass() { ""test.int_elements_attr""() { any_i32_attr = dense<5> : tensor<1x2x3x4xui32>, i32_attr = dense<5> : tensor<6xi32> } : () -> () ""test.int_elements_attr""() { any_i32_attr = dense<5> : tensor<1x2x3x4xsi32>, i32_attr = dense<5> : tensor<6xi32> } : () -> () ""test.int_elements_attr""() { any_i32_attr = dense<5> : tensor<1x2x3x4xi32>, i32_attr = dense<5> : tensor<6xi32> } : () -> () ""test.index_elements_attr""() { any_index_attr = dense<5> : tensor<1x2x3x4xindex>, index_attr = dense<5> : tensor<6xindex> } : () -> () ""test.hex_index_elements_attr""() { hex_index_attr = dense<""0x00000C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000080C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000100C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000180C000000000000080C0000000000001A150000000000005078000000000000B659010000000000ECBC010000000000FEC5010000000000342902000000000046320200000000007C950200000000008E9E020000000000C401030000000000D60A0300000000000C6E0300000000001E7703000000000054DA03000000000066E30300000000009C46040000000000AE4F040000000000E4B2040000000000F6BB0400000000002C1F050000000000628100000000000098E40000000000000E0C00000000000020150000000000005678000000000000BC59010000000000F2BC01000000000004C60100000000003A290200000000004C320200000000008295020000000000949E020000000000CA01030000000000DC0A030000000000126E03000000000024770300000000005ADA0300000000006CE3030000000000A246040000000000B44F040000000000EAB2040000000000FCBB040000000000321F05000000000068810000000000009EE40000000000""> : tensor<23x5xindex> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_int_elements_attr_type_fail() { ""test.int_elements_attr""() { any_i32_attr = dense<5.0> : tensor<1x2x3x4xf32>, i32_attr = dense<5> : tensor<6xi32> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_int_elements_attr_signedness_fail() { ""test.int_elements_attr""() { any_i32_attr = dense<5> : tensor<1x2x3x4xi32>, i32_attr = dense<5> : tensor<6xsi32> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @correct_type_pass() { ""test.ranked_int_elements_attr""() { matrix_i64_attr = dense<6> : tensor<4x8xi64>, vector_i32_attr = dense<5> : tensor<2xi32> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_element_type_fail() { ""test.ranked_int_elements_attr""() { matrix_i64_attr = dense<6> : tensor<4x8xi64>, vector_i32_attr = dense<5> : tensor<2xi64> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_shape_fail() { ""test.ranked_int_elements_attr""() { matrix_i64_attr = dense<6> : tensor<4xi64>, vector_i32_attr = dense<5> : tensor<2xi32> } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @wrong_shape_fail() { ""test.ranked_int_elements_attr""() { matrix_i64_attr = dense<6> : tensor<4x8xi64>, vector_i32_attr = dense<5> : tensor } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @default_value_printing(%arg0 : i32) { ""test.default_value_print""(%arg0) {""value_with_default"" = 0 : i32} : (i32) -> () ""test.default_value_print""(%arg0) {""value_with_default"" = 1 : i32} : (i32) -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @type_attr_of_fail() { test.type_attr_of i32 return }", mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics ,1 "test.array_of_attr_op a = [begin 0 : index end, begin 2 : index end], b = [0, 1, -42, 42], c = [a, b, b, a] test.array_of_attr_op a = [], b = [], c = []", mlir-opt | mlir-opt ,1 "func.func @test() -> i32 { %c5 = ""test.constant""() {value = 5 : i32} : () -> i32 %res = ""test.manual_cpp_op_with_fold""(%c5) : (i32) -> i32 return %res : i32 }", mlir-opt -canonicalize -split-input-file ,1 "func.func @testType(tensor<1x224x224x3xf32>) -> tensor<96xf32> { ^bb0(%arg0: tensor<1x224x224x3xf32>): %1 = ""arith.constant""() {value = dense<0.1> : tensor<1xf32>} : () -> (tensor<1xf32>) %2 = ""arith.constant""() {value = dense<0.1> : tensor<2xf32>} : () -> (tensor<2xf32>) %3 = ""arith.constant""() {value = dense<0.1> : tensor<3xf32>} : () -> (tensor<3xf32>) %4 = ""arith.constant""() {value = dense<0.1> : tensor<4xf32>} : () -> (tensor<4xf32>) %5 = ""arith.constant""() {value = dense<0.1> : tensor<5xf32>} : () -> (tensor<5xf32>) %6 = ""arith.constant""() {value = dense<0.1> : tensor<6xf32>} : () -> (tensor<6xf32>) %7 = ""arith.constant""() {value = dense<0.1> : tensor<7xf32>} : () -> (tensor<7xf32>) %8 = ""arith.constant""() {value = dense<0.1> : tensor<8xf32>} : () -> (tensor<8xf32>) %9 = ""arith.constant""() {value = dense<0.1> : tensor<9xf32>} : () -> (tensor<9xf32>) %10 = ""arith.constant""() {value = dense<0.1> : tensor<10xf32>} : () -> (tensor<10xf32>) %11 = ""arith.constant""() {value = dense<0.1> : tensor<11xf32>} : () -> (tensor<11xf32>) %12 = ""arith.constant""() {value = dense<0.1> : tensor<12xf32>} : () -> (tensor<12xf32>) %13 = ""arith.constant""() {value = dense<0.1> : tensor<13xf32>} : () -> (tensor<13xf32>) %14 = ""arith.constant""() {value = dense<0.1> : tensor<14xf32>} : () -> (tensor<14xf32>) %15 = ""arith.constant""() {value = dense<0.1> : tensor<15xf32>} : () -> (tensor<15xf32>) %16 = ""arith.constant""() {value = dense<0.1> : tensor<16xf32>} : () -> (tensor<16xf32>) %17 = ""arith.constant""() {value = dense<0.1> : tensor<17xf32>} : () -> (tensor<17xf32>) %18 = ""arith.constant""() {value = dense<0.1> : tensor<18xf32>} : () -> (tensor<18xf32>) %19 = ""arith.constant""() {value = dense<0.1> : tensor<19xf32>} : () -> (tensor<19xf32>) %20 = ""arith.constant""() {value = dense<0.1> : tensor<20xf32>} : () -> (tensor<20xf32>) %21 = ""arith.constant""() {value = dense<0.1> : tensor<21xf32>} : () -> (tensor<21xf32>) %22 = ""arith.constant""() {value = dense<0.1> : tensor<22xf32>} : () -> (tensor<22xf32>) %23 = ""arith.constant""() {value = dense<0.1> : tensor<23xf32>} : () -> (tensor<23xf32>) %24 = ""arith.constant""() {value = dense<0.1> : tensor<24xf32>} : () -> (tensor<24xf32>) %25 = ""arith.constant""() {value = dense<0.1> : tensor<25xf32>} : () -> (tensor<25xf32>) %26 = ""arith.constant""() {value = dense<0.1> : tensor<26xf32>} : () -> (tensor<26xf32>) %27 = ""arith.constant""() {value = dense<0.1> : tensor<27xf32>} : () -> (tensor<27xf32>) %28 = ""arith.constant""() {value = dense<0.1> : tensor<28xf32>} : () -> (tensor<28xf32>) %29 = ""arith.constant""() {value = dense<0.1> : tensor<29xf32>} : () -> (tensor<29xf32>) %30 = ""arith.constant""() {value = dense<0.1> : tensor<30xf32>} : () -> (tensor<30xf32>) %31 = ""arith.constant""() {value = dense<0.1> : tensor<31xf32>} : () -> (tensor<31xf32>) %32 = ""arith.constant""() {value = dense<0.1> : tensor<32xf32>} : () -> (tensor<32xf32>) %33 = ""arith.constant""() {value = dense<0.1> : tensor<33xf32>} : () -> (tensor<33xf32>) %34 = ""arith.constant""() {value = dense<0.1> : tensor<34xf32>} : () -> (tensor<34xf32>) %35 = ""arith.constant""() {value = dense<0.1> : tensor<35xf32>} : () -> (tensor<35xf32>) %36 = ""arith.constant""() {value = dense<0.1> : tensor<36xf32>} : () -> (tensor<36xf32>) %37 = ""arith.constant""() {value = dense<0.1> : tensor<37xf32>} : () -> (tensor<37xf32>) %38 = ""arith.constant""() {value = dense<0.1> : tensor<38xf32>} : () -> (tensor<38xf32>) %39 = ""arith.constant""() {value = dense<0.1> : tensor<39xf32>} : () -> (tensor<39xf32>) %40 = ""arith.constant""() {value = dense<0.1> : tensor<40xf32>} : () -> (tensor<40xf32>) %41 = ""arith.constant""() {value = dense<0.1> : tensor<41xf32>} : () -> (tensor<41xf32>) %42 = ""arith.constant""() {value = dense<0.1> : tensor<42xf32>} : () -> (tensor<42xf32>) %43 = ""arith.constant""() {value = dense<0.1> : tensor<43xf32>} : () -> (tensor<43xf32>) %44 = ""arith.constant""() {value = dense<0.1> : tensor<44xf32>} : () -> (tensor<44xf32>) %45 = ""arith.constant""() {value = dense<0.1> : tensor<45xf32>} : () -> (tensor<45xf32>) %46 = ""arith.constant""() {value = dense<0.1> : tensor<46xf32>} : () -> (tensor<46xf32>) %47 = ""arith.constant""() {value = dense<0.1> : tensor<47xf32>} : () -> (tensor<47xf32>) %48 = ""arith.constant""() {value = dense<0.1> : tensor<48xf32>} : () -> (tensor<48xf32>) %49 = ""arith.constant""() {value = dense<0.1> : tensor<49xf32>} : () -> (tensor<49xf32>) %50 = ""arith.constant""() {value = dense<0.1> : tensor<50xf32>} : () -> (tensor<50xf32>) %51 = ""arith.constant""() {value = dense<0.1> : tensor<51xf32>} : () -> (tensor<51xf32>) %52 = ""arith.constant""() {value = dense<0.1> : tensor<52xf32>} : () -> (tensor<52xf32>) %53 = ""arith.constant""() {value = dense<0.1> : tensor<53xf32>} : () -> (tensor<53xf32>) %54 = ""arith.constant""() {value = dense<0.1> : tensor<54xf32>} : () -> (tensor<54xf32>) %55 = ""arith.constant""() {value = dense<0.1> : tensor<55xf32>} : () -> (tensor<55xf32>) %56 = ""arith.constant""() {value = dense<0.1> : tensor<56xf32>} : () -> (tensor<56xf32>) %57 = ""arith.constant""() {value = dense<0.1> : tensor<57xf32>} : () -> (tensor<57xf32>) %58 = ""arith.constant""() {value = dense<0.1> : tensor<58xf32>} : () -> (tensor<58xf32>) %59 = ""arith.constant""() {value = dense<0.1> : tensor<59xf32>} : () -> (tensor<59xf32>) %60 = ""arith.constant""() {value = dense<0.1> : tensor<60xf32>} : () -> (tensor<60xf32>) %61 = ""arith.constant""() {value = dense<0.1> : tensor<61xf32>} : () -> (tensor<61xf32>) %62 = ""arith.constant""() {value = dense<0.1> : tensor<62xf32>} : () -> (tensor<62xf32>) %63 = ""arith.constant""() {value = dense<0.1> : tensor<63xf32>} : () -> (tensor<63xf32>) %64 = ""arith.constant""() {value = dense<0.1> : tensor<64xf32>} : () -> (tensor<64xf32>) %65 = ""arith.constant""() {value = dense<0.1> : tensor<65xf32>} : () -> (tensor<65xf32>) %66 = ""arith.constant""() {value = dense<0.1> : tensor<66xf32>} : () -> (tensor<66xf32>) %67 = ""arith.constant""() {value = dense<0.1> : tensor<67xf32>} : () -> (tensor<67xf32>) %68 = ""arith.constant""() {value = dense<0.1> : tensor<68xf32>} : () -> (tensor<68xf32>) %69 = ""arith.constant""() {value = dense<0.1> : tensor<69xf32>} : () -> (tensor<69xf32>) %70 = ""arith.constant""() {value = dense<0.1> : tensor<70xf32>} : () -> (tensor<70xf32>) %71 = ""arith.constant""() {value = dense<0.1> : tensor<71xf32>} : () -> (tensor<71xf32>) %72 = ""arith.constant""() {value = dense<0.1> : tensor<72xf32>} : () -> (tensor<72xf32>) %73 = ""arith.constant""() {value = dense<0.1> : tensor<73xf32>} : () -> (tensor<73xf32>) %74 = ""arith.constant""() {value = dense<0.1> : tensor<74xf32>} : () -> (tensor<74xf32>) %75 = ""arith.constant""() {value = dense<0.1> : tensor<75xf32>} : () -> (tensor<75xf32>) %76 = ""arith.constant""() {value = dense<0.1> : tensor<76xf32>} : () -> (tensor<76xf32>) %77 = ""arith.constant""() {value = dense<0.1> : tensor<77xf32>} : () -> (tensor<77xf32>) %78 = ""arith.constant""() {value = dense<0.1> : tensor<78xf32>} : () -> (tensor<78xf32>) %79 = ""arith.constant""() {value = dense<0.1> : tensor<79xf32>} : () -> (tensor<79xf32>) %80 = ""arith.constant""() {value = dense<0.1> : tensor<80xf32>} : () -> (tensor<80xf32>) %81 = ""arith.constant""() {value = dense<0.1> : tensor<81xf32>} : () -> (tensor<81xf32>) %82 = ""arith.constant""() {value = dense<0.1> : tensor<82xf32>} : () -> (tensor<82xf32>) %83 = ""arith.constant""() {value = dense<0.1> : tensor<83xf32>} : () -> (tensor<83xf32>) %84 = ""arith.constant""() {value = dense<0.1> : tensor<84xf32>} : () -> (tensor<84xf32>) %85 = ""arith.constant""() {value = dense<0.1> : tensor<85xf32>} : () -> (tensor<85xf32>) %86 = ""arith.constant""() {value = dense<0.1> : tensor<86xf32>} : () -> (tensor<86xf32>) %87 = ""arith.constant""() {value = dense<0.1> : tensor<87xf32>} : () -> (tensor<87xf32>) %88 = ""arith.constant""() {value = dense<0.1> : tensor<88xf32>} : () -> (tensor<88xf32>) %89 = ""arith.constant""() {value = dense<0.1> : tensor<89xf32>} : () -> (tensor<89xf32>) %90 = ""arith.constant""() {value = dense<0.1> : tensor<90xf32>} : () -> (tensor<90xf32>) %91 = ""arith.constant""() {value = dense<0.1> : tensor<91xf32>} : () -> (tensor<91xf32>) %92 = ""arith.constant""() {value = dense<0.1> : tensor<92xf32>} : () -> (tensor<92xf32>) %93 = ""arith.constant""() {value = dense<0.1> : tensor<93xf32>} : () -> (tensor<93xf32>) %94 = ""arith.constant""() {value = dense<0.1> : tensor<94xf32>} : () -> (tensor<94xf32>) %95 = ""arith.constant""() {value = dense<0.1> : tensor<95xf32>} : () -> (tensor<95xf32>) %96 = ""arith.constant""() {value = dense<0.1> : tensor<96xf32>} : () -> (tensor<96xf32>) %97 = ""arith.constant""() {value = dense<0.1> : tensor<97xf32>} : () -> (tensor<97xf32>) %98 = ""arith.constant""() {value = dense<0.1> : tensor<98xf32>} : () -> (tensor<98xf32>) %99 = ""arith.constant""() {value = dense<0.1> : tensor<99xf32>} : () -> (tensor<99xf32>) %100 = ""arith.constant""() {value = dense<0.1> : tensor<100xf32>} : () -> (tensor<100xf32>) %101 = ""arith.constant""() {value = dense<0.1> : tensor<101xf32>} : () -> (tensor<101xf32>) %102 = ""arith.constant""() {value = dense<0.1> : tensor<102xf32>} : () -> (tensor<102xf32>) return %96 : tensor<96xf32> }", mlir-opt ,1 "module attributes { test.blob_ref = #test.e1di64_elements : tensor<*xi1>} {} {-# dialect_resources: { test: { blob1: ""0x08000000010000000000000002000000000000000300000000000000"", blob2: ""0x08000000040000000000000005000000000000000600000000000000"" } }, external_resources: { external: { blob: ""0x08000000010000000000000002000000000000000300000000000000"", bool: true, string: ""string"" } } #-}", mlir-opt -split-input-file ,1 "func.func @test(%arg0 : !test.optional_value_type, %arg1 : !test.optional_value_type<3>) { test.format_maybe_empty_type %arg0 : !test.optional_value_type test.format_maybe_empty_type %arg1 : !test.optional_value_type<3> return }", mlir-opt | mlir-opt ,1 "func.func @alloc() { ^bb0: %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> %c0 = ""arith.constant""() {value = 0: index} : () -> index %c1 = ""arith.constant""() {value = 1: index} : () -> index %1 = memref.alloc(%c0, %c1) : memref (d0, d1)>, 1> %2 = memref.alloc()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1> %3 = memref.alloc(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1> %4 = memref.alloc() : memref<2 x i32> return } func.func @alloca() { ^bb0: %0 = memref.alloca() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> %c0 = ""arith.constant""() {value = 0: index} : () -> index %c1 = ""arith.constant""() {value = 1: index} : () -> index %1 = memref.alloca(%c0, %c1) : memref (d0, d1)>, 1> %2 = memref.alloca()[%c0] : memref<2x4xf32, affine_map<(d0, d1)[s0] -> ((d0 + s0), d1)>, 1> %3 = memref.alloca(%c1)[%c0] : memref<2x?xf32, affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>, 1> %4 = memref.alloca() {alignment = 64} : memref<2 x i32> return } func.func @dealloc() { ^bb0: %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0> memref.dealloc %0 : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 0> return } func.func @load_store() { ^bb0: %0 = memref.alloc() : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> %1 = arith.constant 0 : index %2 = arith.constant 1 : index %3 = memref.load %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> memref.store %3, %0[%1, %2] : memref<1024x64xf32, affine_map<(d0, d1) -> (d0, d1)>, 1> return } func.func @dma_ops() { %c0 = arith.constant 0 : index %stride = arith.constant 32 : index %elt_per_stride = arith.constant 16 : index %A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0> %Ah = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 1> %tag = memref.alloc() : memref<1 x f32> %num_elements = arith.constant 256 : index memref.dma_start %A[%c0], %Ah[%c0], %num_elements, %tag[%c0] : memref<256 x f32>, memref<256 x f32, 1>, memref<1 x f32> memref.dma_wait %tag[%c0], %num_elements : memref<1 x f32> memref.dma_start %A[%c0], %Ah[%c0], %num_elements, %tag[%c0], %stride, %elt_per_stride : memref<256 x f32>, memref<256 x f32, 1>, memref<1 x f32> memref.dma_wait %tag[%c0], %num_elements : memref<1 x f32> return }", mlir-opt ,1 "func.func @constant_out_of_range() { %x = ""arith.constant""() {value = 100} : () -> i1 loc(fused[""bar"", callsite(""foo""(""mysource1"":0:0) at callsite(""mysource2"":1:0 at ""mysource3"":2:0))]) return }", not mlir-opt -o - 2>&1 ,1 "func.func @foo() -> i32 { return }", not mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics 2>&1 ,1 "func.func @f(%arg0: f32 {test.erase_this_arg}) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "func.func @f( %arg0: f32 {test.erase_this_arg}, %arg1: f32 {test.A}) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "func.func @f( %arg0: f32 {test.A}, %arg1: f32 {test.erase_this_arg}) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "func.func @f( %arg0: f32 {test.A}, %arg1: f32 {test.erase_this_arg}, %arg2: f32 {test.B}) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "func.func @f( %arg0: f32 {test.A}, %arg1: f32 {test.erase_this_arg}, %arg2: f32 {test.erase_this_arg}, %arg3: f32 {test.B}) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "func.func @f( %arg0: f32 {test.A}, %arg1: f32 {test.erase_this_arg}, %arg2: f32 {test.B}, %arg3: f32 {test.erase_this_arg}, %arg4: f32 {test.C}) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "func.func @f( %arg0: tensor<1xf32>, %arg1: f32 {test.erase_this_arg}, %arg2: tensor<2xf32>, %arg3: f32 {test.erase_this_arg}, %arg4: tensor<3xf32>) { return }", mlir-opt -test-func-erase-arg -split-input-file ,1 "#set0 = affine_set<() : ()> #set1 = affine_set<(i) : (i == 0)> #set2 = affine_set<(i) : (i >= 0)> #set3 = affine_set<(i, j) : (i >= 0, j >= 0)> #set4 = affine_set<(i, j) : (i == 0, j >= 0)> #set5 = affine_set<(i, j)[N, M] : (i * 2 + N >= 0, j * 2 + M >= 0, i >= 0, j >= 0, N == 0, M == 0)> #set6 = affine_set<(i, j)[N, M] : (N - i >= 0, M - j >= 0, i >= 0, j >= 0)> #set7 = affine_set<(i) : (i == 1)> #set8 = affine_set<(i)[N, M] : (i >= 0, N >= i, N == 5, M + 1 >= i)> #set9 = affine_set<(i, j)[N] : (i >= 0, N >= i, j >= 0, i >= j)> #set10 = affine_set<(i0, i1)[N, M] : (0 == i0 + i1 + N + M, i0 + i1 == N + M)> #set11 = affine_set<(i0, i1)[N, M] : (0 >= i0 + i1 + N + M, i0 + i1 >= N + M)> #set12 = affine_set<(d0, d1, r0, r1) : ((d0 + d1) mod 2 == (r0 + r1) floordiv 2, ((d0) mod 2) + ((d1) mod 2) >= (r0 + r1) + r0)> #set13 = affine_set<(i) : (i <= 0)> #set14 = affine_set<(i) : (i >= 0, i <= 10)> #set15 = affine_set<(i, j)[N, M] : (i >= 0, i <= N, j >= 0, j <= M)> #set16 = affine_set<(i)[N] : (i >= 0, i <= N, i <= N floordiv 2)> #set17 = affine_set<(i0, i1, i2, i3, i4)[] : (i0 <= 0, i1 <= 0, i2 <= 0, i3 <= 0, i4 <= 0)> ""testset0""() {set = #set0} : () -> () ""testset1""() {set = #set1} : () -> () ""testset2""() {set = #set2} : () -> () ""testset3""() {set = #set3} : () -> () ""testset4""() {set = #set4} : () -> () ""testset5""() {set = #set5} : () -> () ""testset6""() {set = #set6} : () -> () ""testset7""() {set = #set7} : () -> () ""testset8""() {set = #set8} : () -> () ""testset9""() {set = #set9} : () -> () ""testset10""() {set = #set10} : () -> () ""testset11""() {set = #set11} : () -> () ""testset12""() {set = #set12} : () -> () ""testset13""() {set = #set13} : () -> () ""testset14""() {set = #set14} : () -> () ""testset15""() {set = #set15} : () -> () ""testset16""() {set = #set16} : () -> () ""testset17""() {set = #set17} : () -> ()", mlir-opt -allow-unregistered-dialect ,1 "func.func @main(tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32> { ^bb0(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>): %0 = arith.addf %arg0, %arg1 : tensor<4xf32> %1 = arith.addf %arg0, %arg1 : tensor<4xf32> %2 = arith.addf %arg0, %arg1 : tensor<4xf32> %3 = arith.addf %arg0, %arg1 : tensor<4xf32> %4 = arith.addf %arg0, %arg1 : tensor<4xf32> %5 = arith.addf %arg0, %arg1 : tensor<4xf32> %10 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %11 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %12 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %13 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %14 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %15 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %16 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %17 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %18 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %19 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %20 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %21 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %22 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %23 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %24 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %25 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %26 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %30 = ""long_op_name""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> return %1 : tensor<4xf32> }", mlir-opt -allow-unregistered-dialect -print-op-stats=json -o=/dev/null 2>&1 ,1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @inline_notation() -> i32 { %1 = ""foo""() : () -> i32 loc(""foo"") %2 = arith.constant 4 : index loc(callsite(""foo"" at ""mysource.cc"":10:8)) %3 = arith.constant 4 : index loc(callsite(""foo"" at callsite(""mysource1.cc"":10:8 at callsite(""mysource2.cc"":13:8 at ""mysource3.cc"":100:10)))) affine.for %i0 = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo"", ""foo2""]) return %1 : i32 loc(unknown) }", mlir-opt -allow-unregistered-dialect -mlir-print-debuginfo -mlir-pretty-debuginfo -mlir-print-local-scope ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() {interrupt_before_all = true} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() ({ ""bar""() : ()-> () }) {interrupt_after_all = true} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() ({ ""bar0""() : () -> () }, { ""bar1""() : () -> () }) {interrupt_after_region = 0} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main() { ""foo""() : () -> () ""test.two_region_op""()( {""work""() : () -> ()}, {""work""() : () -> ()} ) {interrupt_after_all = true} : () -> () return }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main() { ""foo""() : () -> () ""test.two_region_op""()( {""work""() : () -> ()}, {""work""() : () -> ()} ) {interrupt_after_region = 0} : () -> () return }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() ({ ""bar0""() : () -> () }, { ""bar1""() : () -> () }) {skip_before_all = true} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() ({ ""bar0""() : () -> () }, { ""bar1""() : () -> () }) {skip_after_all = true} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main(%arg0: f32) -> f32 { %v1 = ""foo""() ({ ""bar0""() : () -> () }, { ""bar1""() : () -> () }) {skip_after_region = 0} : () -> f32 %v2 = arith.addf %v1, %arg0 : f32 return %v2 : f32 }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @main(tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32> { ^bb0(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>): %0 = arith.addf %arg0, %arg1 : tensor<4xf32> %1 = arith.addf %arg0, %arg1 : tensor<4xf32> %2 = arith.addf %arg0, %arg1 : tensor<4xf32> %3 = arith.addf %arg0, %arg1 : tensor<4xf32> %4 = arith.addf %arg0, %arg1 : tensor<4xf32> %5 = arith.addf %arg0, %arg1 : tensor<4xf32> %10 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %11 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %12 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %13 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %14 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %15 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %16 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %17 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %18 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %19 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %20 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %21 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %22 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %23 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %24 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %25 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %26 = ""xla.add""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> %30 = ""long_op_name""(%0, %arg1) : (tensor<4xf32>,tensor<4xf32>)-> tensor<4xf32> return %1 : tensor<4xf32> }", mlir-opt -allow-unregistered-dialect -print-op-stats -o=/dev/null 2>&1 ,1 "func.func @large_i1_tensor_roundtrip() -> tensor<160xi1> { %cst_0 = arith.constant dense<""0xFFF00000FF000000FF000000FF000000FF000000""> : tensor<160xi1> %cst_1 = arith.constant dense<""0xFF000000FF000000FF000000FF000000FF0000F0""> : tensor<160xi1> %0 = arith.andi %cst_0, %cst_1 : tensor<160xi1> return %0 : tensor<160xi1> }", mlir-opt -canonicalize | mlir-opt ,1 """test.dense_attr""() {foo.dense_attr = dense<[1, 2, 3]> : tensor<3xi32>} : () -> () ""test.non_elided_dense_attr""() {foo.dense_attr = dense<[1, 2]> : tensor<2xi32>} : () -> () ""test.sparse_attr""() {foo.sparse_attr = sparse<[[0, 0, 5]], -2.0> : vector<1x1x10xf16>} : () -> () ""test.dense_splat""() {foo.dense_attr = dense<1> : tensor<3xi32>} : () -> ()", mlir-opt -mlir-elide-elementsattrs-if-larger=2 ,1 "func.func private @test1() attributes { test.loc = loc(callsite(""foo""(""mysource1"":0:0) at callsite(""mysource2"":1:0 at ""mysource3"":2:0))) }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-diagnostic-filter{filters=mysource1}))"" -split-input-file -o - 2>&1 ",1 "func.func private @test2() attributes { test.loc = loc(""mysource1"":0:0) }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-diagnostic-filter{filters=mysource1}))"" -split-input-file -o - 2>&1 ",1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @inline_notation() -> i32 { %1 = ""test.foo""() : () -> i32 loc(""foo"") %2 = arith.constant 4 : index loc(callsite(""foo"" at ""mysource.cc"":10:8)) affine.for %i0 = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8]) affine.for %i0 = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8, callsite(""foo"" at ""mysource.cc"":10:8)]) return %1 : i32 loc(unknown) }", mlir-opt -test-opaque-loc -mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func @parse_i64_tensor() -> tensor<4xi64> { %0 = arith.constant dense<""0xFF00000000000000FF00000000000000FF00000000000000FF00000000000000""> : tensor<4xi64> return %0 : tensor<4xi64> } func.func @parse_i32_tensor() -> tensor<8xi32> { %0 = arith.constant dense<""0xFF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000""> : tensor<8xi32> return %0 : tensor<8xi32> } func.func @parse_i16_tensor() -> tensor<16xi16> { %0 = arith.constant dense<""0xFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00""> : tensor<16xi16> return %0 : tensor<16xi16> } func.func @parse_i8_tensor() -> tensor<32xi8> { %0 = arith.constant dense<""0x0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F""> : tensor<32xi8> return %0 : tensor<32xi8> } func.func @parse_i4_tensor() -> tensor<32xi4> { %0 = arith.constant dense<""0x0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F""> : tensor<32xi4> return %0 : tensor<32xi4> } func.func @parse_i1_tensor() -> tensor<256xi1> { %0 = arith.constant dense<""0x0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F""> : tensor<256xi1> return %0 : tensor<256xi1> }", mlir-opt ,1 "func.func @structured_cfg() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c1 to %c10 step %c1 { %cond = ""use0""(%i) : (index) -> (i1) scf.if %cond { ""use1""(%i) : (index) -> () } else { ""use2""(%i) : (index) -> () } ""use3""(%i) : (index) -> () } return }", mlir-opt -test-generic-ir-visitors -allow-unregistered-dialect -split-input-file ,1 "func.func @structured_cfg() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c1 to %c10 step %c1 { %cond = ""use0""(%i) : (index) -> (i1) scf.if %cond { ""use1""(%i) : (index) -> () } else { ""use2""(%i) : (index) -> () } ""use3""(%i) : (index) -> () } return }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "func.func @correct_number_of_regions() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c1 to %c10 step %c1 { ""test.two_region_op""()( {""work""() : () -> ()}, {""work""() : () -> ()} ) : () -> () } return }", mlir-opt -test-generic-ir-visitors -allow-unregistered-dialect -split-input-file ,1 "func.func @correct_number_of_regions() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c10 = arith.constant 10 : index scf.for %i = %c1 to %c10 step %c1 { ""test.two_region_op""()( {""work""() : () -> ()}, {""work""() : () -> ()} ) : () -> () } return }", mlir-opt -test-generic-ir-visitors-interrupt -allow-unregistered-dialect -split-input-file ,1 "%results:4 = ""dialect.op1""() : () -> (i1, i16, i32, i64) ""dialect.op2""(%results#0, %results#2) : (i1, i32) -> () ""dialect.op3""() ({ ^bb0(%arg0 : i1): ""dialect.innerop1""(%arg0, %results#2) : (i1, i32) -> () }) : () -> ()", mlir-opt -test-print-defuse -allow-unregistered-dialect ,1 "func.func @test1(%a: f32, %b: f32, %c: f32) { %0 = arith.addf %a, %b: f32 %1 = arith.addf %a, %c: f32 %2 = arith.addf %c, %b: f32 %3 = arith.mulf %a, %2: f32 %4 = arith.mulf %3, %1: f32 %5 = arith.mulf %4, %4: f32 %6 = arith.mulf %5, %5: f32 return } func.func @test2(%a: f32) -> f32 { %0 = arith.constant 1.0: f32 %1 = arith.addf %a, %0: f32 %2 = arith.mulf %a, %1: f32 return %2: f32 } func.func @test3(%a: f32) -> f32 { %0 = ""test.name""() {value = 1.0 : f32} : () -> f32 %1 = arith.addf %a, %0: f32 %2 = arith.mulf %a, %1 fastmath: f32 return %2: f32 }"," mlir-opt -mlir-disable-threading=true -pass-pipeline=""builtin.module(func.func(test-matchers))"" -o /dev/null 2>&1 ",1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @inline_notation() -> i32 { %1 = ""foo""() : () -> i32 loc(""foo"") %2 = arith.constant 4 : index loc(callsite(""foo"" at ""mysource.cc"":10:8)) affine.for %i0 loc(""IVlocation"") = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo"", ""foo2""]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo""]) return %1 : i32 loc(unknown) } func.func private @loc_attr(i1 {foo.loc_attr = loc(callsite(""foo"" at ""mysource.cc"":10:8))}) func.func @escape_strings() { ""foo""() : () -> () loc(""escaped\n"") ""foo""() : () -> () loc(""escaped\0A"") ""foo""() : () -> () loc(""escaped\n"":0:0) return } ""foo.op""() : () -> () loc(#loc) func.func @argLocs(%x: i32, %y: i64 loc(""hotdog"")) { return } ""foo.unknown_op_with_bbargs""() ({ ^bb0(%x: i32, %y: i32 loc(""cheetos""), %z: i32 loc(""out_of_line_location2"")): %1 = arith.addi %x, %y : i32 ""foo.yield""(%1) : (i32) -> () }) : () -> () func.func @location_name_child_is_name() { return loc(""foo""(""foo"")) } #loc = loc(""out_of_line_location"") func.func @optional_location_specifier() { test.attr_with_loc(""foo"" loc(""foo_loc"")) return }", mlir-opt -allow-unregistered-dialect -mlir-print-debuginfo -mlir-print-local-scope ,1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @inline_notation() -> i32 { %1 = ""foo""() : () -> i32 loc(""foo"") %2 = arith.constant 4 : index loc(callsite(""foo"" at ""mysource.cc"":10:8)) affine.for %i0 loc(""IVlocation"") = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo"", ""foo2""]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo""]) return %1 : i32 loc(unknown) } func.func private @loc_attr(i1 {foo.loc_attr = loc(callsite(""foo"" at ""mysource.cc"":10:8))}) func.func @escape_strings() { ""foo""() : () -> () loc(""escaped\n"") ""foo""() : () -> () loc(""escaped\0A"") ""foo""() : () -> () loc(""escaped\n"":0:0) return } ""foo.op""() : () -> () loc(#loc) func.func @argLocs(%x: i32, %y: i64 loc(""hotdog"")) { return } ""foo.unknown_op_with_bbargs""() ({ ^bb0(%x: i32, %y: i32 loc(""cheetos""), %z: i32 loc(""out_of_line_location2"")): %1 = arith.addi %x, %y : i32 ""foo.yield""(%1) : (i32) -> () }) : () -> () func.func @location_name_child_is_name() { return loc(""foo""(""foo"")) } #loc = loc(""out_of_line_location"") func.func @optional_location_specifier() { test.attr_with_loc(""foo"" loc(""foo_loc"")) return }", mlir-opt -allow-unregistered-dialect -mlir-print-debuginfo ,1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @inline_notation() -> i32 { %1 = ""foo""() : () -> i32 loc(""foo"") %2 = arith.constant 4 : index loc(callsite(""foo"" at ""mysource.cc"":10:8)) affine.for %i0 loc(""IVlocation"") = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo"", ""foo2""]) affine.if #set0(%2) { } loc(fused<""myPass"">[""foo""]) return %1 : i32 loc(unknown) } func.func private @loc_attr(i1 {foo.loc_attr = loc(callsite(""foo"" at ""mysource.cc"":10:8))}) func.func @escape_strings() { ""foo""() : () -> () loc(""escaped\n"") ""foo""() : () -> () loc(""escaped\0A"") ""foo""() : () -> () loc(""escaped\n"":0:0) return } ""foo.op""() : () -> () loc(#loc) func.func @argLocs(%x: i32, %y: i64 loc(""hotdog"")) { return } ""foo.unknown_op_with_bbargs""() ({ ^bb0(%x: i32, %y: i32 loc(""cheetos""), %z: i32 loc(""out_of_line_location2"")): %1 = arith.addi %x, %y : i32 ""foo.yield""(%1) : (i32) -> () }) : () -> () func.func @location_name_child_is_name() { return loc(""foo""(""foo"")) } #loc = loc(""out_of_line_location"") func.func @optional_location_specifier() { test.attr_with_loc(""foo"" loc(""foo_loc"")) return }", mlir-opt -allow-unregistered-dialect -mlir-print-debuginfo | mlir-opt -allow-unregistered-dialect -mlir-print-debuginfo ,1 "func.func @f() attributes {test.insert_args = [ [0, i1, {test.A}]]} { return }", mlir-opt -test-func-insert-arg -split-input-file ,1 "func.func @f(%arg0: i2 {test.B}) attributes {test.insert_args = [ [0, i1, {test.A}]]} { return }", mlir-opt -test-func-insert-arg -split-input-file ,1 "func.func @f(%arg0: i1 {test.A}) attributes {test.insert_args = [ [1, i2, {test.B}]]} { return }", mlir-opt -test-func-insert-arg -split-input-file ,1 "func.func @f(%arg0: i1 {test.A}, %arg1: i3 {test.C}) attributes {test.insert_args = [ [1, i2, {test.B}]]} { return }", mlir-opt -test-func-insert-arg -split-input-file ,1 "func.func @f(%arg0: i2 {test.B}) attributes {test.insert_args = [ [0, i1, {test.A}], [1, i3, {test.C}]]} { return }", mlir-opt -test-func-insert-arg -split-input-file ,1 "func.func @f(%arg0: i3 {test.C}) attributes {test.insert_args = [ [0, i1, {test.A}], [0, i2, {test.B}]]} { return }", mlir-opt -test-func-insert-arg -split-input-file ,1 "func.func @correct_number_of_regions() { ""test.two_region_op""()( {""work""() : () -> ()}, {""work""() : () -> ()} ) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @missing_regions() { ""test.two_region_op""()( {""work""() : () -> ()} ) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @extra_regions() { ""test.two_region_op""()( {""work""() : () -> ()}, {""work""() : () -> ()}, {""work""() : () -> ()} ) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @unnamed_region_has_wrong_number_of_blocks() { ""test.sized_region_op""() ( { ""work""() : () -> () cf.br ^next1 ^next1: ""work""() : () -> () }, { ""work""() : () -> () cf.br ^next2 ^next2: ""work""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @named_region_has_wrong_number_of_blocks() { ""test.sized_region_op""() ( { ""work""() : () -> () }, { ""work""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.unregistered_without_terminator""() ({ ^bb0: }) : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.single_no_terminator_op""() ( { func.func @foo1() { return } func.func @foo2() { return } } ) : () -> () ""test.variadic_no_terminator_op""() ( { func.func @foo1() { return } }, { func.func @foo2() { return } } ) : () -> () test.single_no_terminator_custom_asm_op { ""important_dont_drop""() : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 func.func private @f() -> (f32 {test.erase_this_result}), mlir-opt -test-func-erase-result -split-input-file ,1 "func.func private @f() -> ( f32 {test.erase_this_result}, f32 {test.A} )", mlir-opt -test-func-erase-result -split-input-file ,1 "func.func private @f() -> ( f32 {test.A}, f32 {test.erase_this_result} )", mlir-opt -test-func-erase-result -split-input-file ,1 "func.func private @f() -> ( f32 {test.A}, f32 {test.erase_this_result}, f32 {test.B} )", mlir-opt -test-func-erase-result -split-input-file ,1 "func.func private @f() -> ( f32 {test.A}, f32 {test.erase_this_result}, f32 {test.erase_this_result}, f32 {test.B} )", mlir-opt -test-func-erase-result -split-input-file ,1 "func.func private @f() -> ( f32 {test.A}, f32 {test.erase_this_result}, f32 {test.B}, f32 {test.erase_this_result}, f32 {test.C} )", mlir-opt -test-func-erase-result -split-input-file ,1 "func.func private @f() -> ( tensor<1xf32>, f32 {test.erase_this_result}, tensor<2xf32>, f32 {test.erase_this_result}, tensor<3xf32> )", mlir-opt -test-func-erase-result -split-input-file ,1 func.func private @foo(), mlir-opt --no-implicit-module --verify-diagnostics --split-input-file ,1 "func.func private @bar() func.func private @baz()", mlir-opt --no-implicit-module --verify-diagnostics --split-input-file ,1 """test.op""() {alias_test = ""alias_test:dot_in_name""} : () -> () ""test.op""() {alias_test = ""alias_test:trailing_digit""} : () -> () ""test.op""() {alias_test = ""alias_test:prefixed_digit""} : () -> () ""test.op""() {alias_test = [""alias_test:sanitize_conflict_a"", ""alias_test:sanitize_conflict_b""]} : () -> () ""test.op""() {alias_test = ""alias_test:large_tuple""} : () -> (tuple) ""test.op""() {alias_test = ""alias_test:large_tuple""} : () -> (tuple) ""test.op""() : () -> tensor<32xf32, ""alias_test:tensor_encoding""> ""test.op""() : () -> tensor<32x!test.int> ""test.op""() {alias_test = loc(fused[""test.mlir"":10:8])} : () -> ()", mlir-opt -split-input-file ,1 """test.op""() {alias_test = ""alias_test:dot_in_name""} : () -> () ""test.op""() {alias_test = ""alias_test:trailing_digit""} : () -> () ""test.op""() {alias_test = ""alias_test:prefixed_digit""} : () -> () ""test.op""() {alias_test = [""alias_test:sanitize_conflict_a"", ""alias_test:sanitize_conflict_b""]} : () -> () ""test.op""() {alias_test = ""alias_test:large_tuple""} : () -> (tuple) ""test.op""() {alias_test = ""alias_test:large_tuple""} : () -> (tuple) ""test.op""() : () -> tensor<32xf32, ""alias_test:tensor_encoding""> ""test.op""() : () -> tensor<32x!test.int> ""test.op""() {alias_test = loc(fused[""test.mlir"":10:8])} : () -> ()", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 """test.op""() {alias_test = loc(fused>[""test.mlir"":10:8])} : () -> ()", mlir-opt -split-input-file ,1 """test.op""() {alias_test = loc(fused>[""test.mlir"":10:8])} : () -> ()", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 """test.op""() {alias_test = #test.attr_with_self_type_param : !test.int } : () -> ()", mlir-opt -split-input-file ,1 """test.op""() {alias_test = #test.attr_with_self_type_param : !test.int } : () -> ()", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 """test.op""() {alias_test = loc(fused (d0)>>>[""test.mlir"":10:8])} : () -> ()", mlir-opt -split-input-file ,1 """test.op""() {alias_test = loc(fused (d0)>>>[""test.mlir"":10:8])} : () -> ()", mlir-opt -split-input-file | mlir-opt -split-input-file ,1 "func.func @roundtrip() { ""test.dummy_op_for_roundtrip""() : () -> !test.test_rec> ""test.dummy_op_for_roundtrip""() : () -> !test.test_rec> ""test.dummy_op_for_roundtrip""() : () -> !test.test_rec> return } func.func @create() { return }", mlir-opt -test-recursive-types ,1 """foo.op""() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf32>} : () -> () ""foo.op""() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf64>} : () -> () ""foo.op""() {dense.attr = dense<""0x000020410000A040""> : tensor<2xf32>} : () -> () ""foo.op""() {dense.attr = dense<""0x00000000000024400000000000001440""> : tensor<2xf64>} : () -> () ""foo.op""() {dense.attr = dense<""0x000020410000A040000020410000A040""> : tensor<2xcomplex>} : () -> () ""foo.op""() {dense.attr = dense<""0x0000000000002440000000000000144000000000000024400000000000001440""> : tensor<2xcomplex>} : () -> () ""foo.op""() {dense.attr = dense<""0x2041A040""> : tensor<2xbf16>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 ,1 """foo.op""() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf32>} : () -> () ""foo.op""() {dense.attr = dense<[10.0, 5.0]> : tensor<2xf64>} : () -> () ""foo.op""() {dense.attr = dense<""0x000020410000A040""> : tensor<2xf32>} : () -> () ""foo.op""() {dense.attr = dense<""0x00000000000024400000000000001440""> : tensor<2xf64>} : () -> () ""foo.op""() {dense.attr = dense<""0x000020410000A040000020410000A040""> : tensor<2xcomplex>} : () -> () ""foo.op""() {dense.attr = dense<""0x0000000000002440000000000000144000000000000024400000000000001440""> : tensor<2xcomplex>} : () -> () ""foo.op""() {dense.attr = dense<""0x2041A040""> : tensor<2xbf16>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file ,1 """foo.op""() {dense.attr = dense<""00000000000024400000000000001440""> : tensor<2xf64>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 ,1 """foo.op""() {dense.attr = dense<""00000000000024400000000000001440""> : tensor<2xf64>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file ,1 """foo.op""() {dense.attr = dense<""0x0000000000002440000000000000144X""> : tensor<2xf64>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 ,1 """foo.op""() {dense.attr = dense<""0x0000000000002440000000000000144X""> : tensor<2xf64>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file ,1 """foo.op""() {dense.attr = dense<""0x00000000000024400000000000001440""> : tensor<4xf64>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file -mlir-print-elementsattrs-with-hex-if-larger=1 ,1 """foo.op""() {dense.attr = dense<""0x00000000000024400000000000001440""> : tensor<4xf64>} : () -> ()", mlir-opt -allow-unregistered-dialect -verify-diagnostics -split-input-file ,1 "func.func @func_with_ops(f32) { ^bb0(%a : f32): %t = ""getTensor""() : () -> tensor<4x4x?xf32> %c2 = arith.constant 2 : index %t2 = ""tensor.dim""(%t, %c2) : (tensor<4x4x?xf32>, index) -> index %x = ""arith.addf""(%a, %a) : (f32,f32) -> (f32) return } func.func @standard_instrs(tensor<4x4x?xf32>, f32, i32, index, i64, f16) { ^bb42(%t: tensor<4x4x?xf32>, %f: f32, %i: i32, %idx : index, %j: i64, %half: f16): %c2 = arith.constant 2 : index %a2 = tensor.dim %t, %c2 : tensor<4x4x?xf32> %10 = constant @func_with_ops : (f32) -> () %11 = constant @affine_apply : () -> () %i2 = arith.addi %i, %i: i32 %i3 = arith.addi %i2, %i : i32 %i4 = arith.addi %i2, %i3 : i32 %f3 = arith.addf %f, %f : f32 %f4 = arith.addf %f, %f3 : f32 %true = arith.constant true %tci32 = arith.constant dense<0> : tensor<42xi32> %vci32 = arith.constant dense<0> : vector<42xi32> %tci1 = arith.constant dense<1> : tensor<42xi1> %vci1 = arith.constant dense<1> : vector<42xi1> %21 = arith.select %true, %idx, %idx : index %22 = arith.select %tci1, %tci32, %tci32 : tensor<42 x i1>, tensor<42 x i32> %23 = arith.select %vci1, %vci32, %vci32 : vector<42 x i1>, vector<42 x i32> %24 = ""arith.select""(%true, %idx, %idx) : (i1, index, index) -> index %25 = arith.select %true, %tci32, %tci32 : tensor<42 x i32> %64 = arith.constant dense<0.> : vector<4 x f32> %tcf32 = arith.constant dense<0.> : tensor<42 x f32> %vcf32 = arith.constant dense<0.> : vector<4 x f32> %65 = arith.cmpf ogt, %f3, %f4 : f32 %66 = ""arith.cmpf""(%f3, %f4) {predicate = 1} : (f32, f32) -> i1 %67 = arith.cmpf olt, %vcf32, %vcf32 : vector<4 x f32> %68 = ""arith.cmpf""(%vcf32, %vcf32) {predicate = 1} : (vector<4 x f32>, vector<4 x f32>) -> vector<4 x i1> %69 = arith.cmpf oeq, %tcf32, %tcf32 : tensor<42 x f32> %70 = arith.cmpf oeq, %vcf32, %vcf32 : vector<4 x f32> %74 = arith.constant true %75 = arith.constant false %100 = ""math.absf""(%f) : (f32) -> f32 %101 = math.absf %f : f32 %102 = math.absf %vcf32 : vector<4xf32> %103 = math.absf %t : tensor<4x4x?xf32> %104 = ""math.ceil""(%f) : (f32) -> f32 %105 = math.ceil %f : f32 %106 = math.ceil %vcf32 : vector<4xf32> %107 = math.ceil %t : tensor<4x4x?xf32> %116 = ""math.copysign""(%f, %f) : (f32, f32) -> f32 %117 = math.copysign %f, %f : f32 %118 = math.copysign %vcf32, %vcf32 : vector<4xf32> %119 = math.copysign %t, %t : tensor<4x4x?xf32> %145 = math.rsqrt %f : f32 %163 = ""math.floor""(%f) : (f32) -> f32 %164 = math.floor %f : f32 %165 = math.floor %vcf32 : vector<4xf32> %166 = math.floor %t : tensor<4x4x?xf32> return } func.func @affine_apply() { %i = ""arith.constant""() {value = 0: index} : () -> index %j = ""arith.constant""() {value = 1: index} : () -> index %a = ""affine.apply"" (%i) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %b = affine.apply affine_map<()[x] -> (x+1)>()[%i] return } func.func @load_store_prefetch(memref<4x4xi32>, index) { ^bb0(%0: memref<4x4xi32>, %1: index): %2 = ""memref.load""(%0, %1, %1) : (memref<4x4xi32>, index, index)->i32 %3 = memref.load %0[%1, %1] : memref<4x4xi32> memref.prefetch %0[%1, %1], write, locality<1>, data : memref<4x4xi32> memref.prefetch %0[%1, %1], read, locality<3>, instr : memref<4x4xi32> return } func.func @zero_dim_no_idx(%arg0 : memref, %arg1 : memref, %arg2 : memref) { %0 = memref.load %arg0[] : memref memref.store %0, %arg1[] : memref return } func.func @return_op(%a : i32) -> i32 { ""func.return"" (%a) : (i32)->() } func.func @calls(%arg0: i32) { %x = call @return_op(%arg0) : (i32) -> i32 %y = call @return_op(%x) : (i32) -> i32 %z = ""func.call""(%x) {callee = @return_op} : (i32) -> i32 %f = constant @affine_apply : () -> () call_indirect %f() : () -> () %f_0 = constant @return_op : (i32) -> i32 %2 = call_indirect %f_0(%arg0) : (i32) -> i32 %3 = ""func.call_indirect""(%f_0, %arg0) : ((i32) -> i32, i32) -> i32 return } func.func @memref_cast(%arg0: memref<4xf32>, %arg1 : memref, %arg2 : memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>>) { %0 = memref.cast %arg0 : memref<4xf32> to memref %1 = memref.cast %arg1 : memref to memref<4xf32> %2 = memref.cast %arg2 : memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref<64x16x4xf32, strided<[?, ?, ?], offset: ?>> %3 = memref.cast %2 : memref<64x16x4xf32, strided<[?, ?, ?], offset: ?>> to memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>> %4 = memref.cast %1 : memref<4xf32> to memref<*xf32> %5 = memref.cast %4 : memref<*xf32> to memref<4xf32> return } func.func private @unranked_memref_roundtrip(memref<*xf32, 4>) func.func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> %c0 = arith.constant 0: index %5 = memref.view %0[%c0][] : memref<2048xi8> to memref<64x4xf32> return } func.func @test_dimop(%arg0: tensor<4x4x?xf32>) { %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c2 : tensor<4x4x?xf32> %1 = affine.apply affine_map<(d0) -> (d0)>(%0) return } func.func @tensor_load_store(%0 : memref<4x4xi32>, %1 : tensor<4x4xi32>) { memref.tensor_store %1, %0 : memref<4x4xi32> return } func.func @unranked_tensor_load_store(%0 : memref<*xi32>, %1 : tensor<*xi32>) { memref.tensor_store %1, %0 : memref<*xi32> return } func.func @assume_alignment(%0: memref<4x4xf16>) { memref.assume_alignment %0, 16 : memref<4x4xf16> return }", mlir-opt -allow-unregistered-dialect ,1 "func.func @func_with_ops(f32) { ^bb0(%a : f32): %t = ""getTensor""() : () -> tensor<4x4x?xf32> %c2 = arith.constant 2 : index %t2 = ""tensor.dim""(%t, %c2) : (tensor<4x4x?xf32>, index) -> index %x = ""arith.addf""(%a, %a) : (f32,f32) -> (f32) return } func.func @standard_instrs(tensor<4x4x?xf32>, f32, i32, index, i64, f16) { ^bb42(%t: tensor<4x4x?xf32>, %f: f32, %i: i32, %idx : index, %j: i64, %half: f16): %c2 = arith.constant 2 : index %a2 = tensor.dim %t, %c2 : tensor<4x4x?xf32> %10 = constant @func_with_ops : (f32) -> () %11 = constant @affine_apply : () -> () %i2 = arith.addi %i, %i: i32 %i3 = arith.addi %i2, %i : i32 %i4 = arith.addi %i2, %i3 : i32 %f3 = arith.addf %f, %f : f32 %f4 = arith.addf %f, %f3 : f32 %true = arith.constant true %tci32 = arith.constant dense<0> : tensor<42xi32> %vci32 = arith.constant dense<0> : vector<42xi32> %tci1 = arith.constant dense<1> : tensor<42xi1> %vci1 = arith.constant dense<1> : vector<42xi1> %21 = arith.select %true, %idx, %idx : index %22 = arith.select %tci1, %tci32, %tci32 : tensor<42 x i1>, tensor<42 x i32> %23 = arith.select %vci1, %vci32, %vci32 : vector<42 x i1>, vector<42 x i32> %24 = ""arith.select""(%true, %idx, %idx) : (i1, index, index) -> index %25 = arith.select %true, %tci32, %tci32 : tensor<42 x i32> %64 = arith.constant dense<0.> : vector<4 x f32> %tcf32 = arith.constant dense<0.> : tensor<42 x f32> %vcf32 = arith.constant dense<0.> : vector<4 x f32> %65 = arith.cmpf ogt, %f3, %f4 : f32 %66 = ""arith.cmpf""(%f3, %f4) {predicate = 1} : (f32, f32) -> i1 %67 = arith.cmpf olt, %vcf32, %vcf32 : vector<4 x f32> %68 = ""arith.cmpf""(%vcf32, %vcf32) {predicate = 1} : (vector<4 x f32>, vector<4 x f32>) -> vector<4 x i1> %69 = arith.cmpf oeq, %tcf32, %tcf32 : tensor<42 x f32> %70 = arith.cmpf oeq, %vcf32, %vcf32 : vector<4 x f32> %74 = arith.constant true %75 = arith.constant false %100 = ""math.absf""(%f) : (f32) -> f32 %101 = math.absf %f : f32 %102 = math.absf %vcf32 : vector<4xf32> %103 = math.absf %t : tensor<4x4x?xf32> %104 = ""math.ceil""(%f) : (f32) -> f32 %105 = math.ceil %f : f32 %106 = math.ceil %vcf32 : vector<4xf32> %107 = math.ceil %t : tensor<4x4x?xf32> %116 = ""math.copysign""(%f, %f) : (f32, f32) -> f32 %117 = math.copysign %f, %f : f32 %118 = math.copysign %vcf32, %vcf32 : vector<4xf32> %119 = math.copysign %t, %t : tensor<4x4x?xf32> %145 = math.rsqrt %f : f32 %163 = ""math.floor""(%f) : (f32) -> f32 %164 = math.floor %f : f32 %165 = math.floor %vcf32 : vector<4xf32> %166 = math.floor %t : tensor<4x4x?xf32> return } func.func @affine_apply() { %i = ""arith.constant""() {value = 0: index} : () -> index %j = ""arith.constant""() {value = 1: index} : () -> index %a = ""affine.apply"" (%i) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %b = affine.apply affine_map<()[x] -> (x+1)>()[%i] return } func.func @load_store_prefetch(memref<4x4xi32>, index) { ^bb0(%0: memref<4x4xi32>, %1: index): %2 = ""memref.load""(%0, %1, %1) : (memref<4x4xi32>, index, index)->i32 %3 = memref.load %0[%1, %1] : memref<4x4xi32> memref.prefetch %0[%1, %1], write, locality<1>, data : memref<4x4xi32> memref.prefetch %0[%1, %1], read, locality<3>, instr : memref<4x4xi32> return } func.func @zero_dim_no_idx(%arg0 : memref, %arg1 : memref, %arg2 : memref) { %0 = memref.load %arg0[] : memref memref.store %0, %arg1[] : memref return } func.func @return_op(%a : i32) -> i32 { ""func.return"" (%a) : (i32)->() } func.func @calls(%arg0: i32) { %x = call @return_op(%arg0) : (i32) -> i32 %y = call @return_op(%x) : (i32) -> i32 %z = ""func.call""(%x) {callee = @return_op} : (i32) -> i32 %f = constant @affine_apply : () -> () call_indirect %f() : () -> () %f_0 = constant @return_op : (i32) -> i32 %2 = call_indirect %f_0(%arg0) : (i32) -> i32 %3 = ""func.call_indirect""(%f_0, %arg0) : ((i32) -> i32, i32) -> i32 return } func.func @memref_cast(%arg0: memref<4xf32>, %arg1 : memref, %arg2 : memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>>) { %0 = memref.cast %arg0 : memref<4xf32> to memref %1 = memref.cast %arg1 : memref to memref<4xf32> %2 = memref.cast %arg2 : memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref<64x16x4xf32, strided<[?, ?, ?], offset: ?>> %3 = memref.cast %2 : memref<64x16x4xf32, strided<[?, ?, ?], offset: ?>> to memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>> %4 = memref.cast %1 : memref<4xf32> to memref<*xf32> %5 = memref.cast %4 : memref<*xf32> to memref<4xf32> return } func.func private @unranked_memref_roundtrip(memref<*xf32, 4>) func.func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> %c0 = arith.constant 0: index %5 = memref.view %0[%c0][] : memref<2048xi8> to memref<64x4xf32> return } func.func @test_dimop(%arg0: tensor<4x4x?xf32>) { %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c2 : tensor<4x4x?xf32> %1 = affine.apply affine_map<(d0) -> (d0)>(%0) return } func.func @tensor_load_store(%0 : memref<4x4xi32>, %1 : tensor<4x4xi32>) { memref.tensor_store %1, %0 : memref<4x4xi32> return } func.func @unranked_tensor_load_store(%0 : memref<*xi32>, %1 : tensor<*xi32>) { memref.tensor_store %1, %0 : memref<*xi32> return } func.func @assume_alignment(%0: memref<4x4xf16>) { memref.assume_alignment %0, 16 : memref<4x4xf16> return }", mlir-opt -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect ,1 "func.func @func_with_ops(f32) { ^bb0(%a : f32): %t = ""getTensor""() : () -> tensor<4x4x?xf32> %c2 = arith.constant 2 : index %t2 = ""tensor.dim""(%t, %c2) : (tensor<4x4x?xf32>, index) -> index %x = ""arith.addf""(%a, %a) : (f32,f32) -> (f32) return } func.func @standard_instrs(tensor<4x4x?xf32>, f32, i32, index, i64, f16) { ^bb42(%t: tensor<4x4x?xf32>, %f: f32, %i: i32, %idx : index, %j: i64, %half: f16): %c2 = arith.constant 2 : index %a2 = tensor.dim %t, %c2 : tensor<4x4x?xf32> %10 = constant @func_with_ops : (f32) -> () %11 = constant @affine_apply : () -> () %i2 = arith.addi %i, %i: i32 %i3 = arith.addi %i2, %i : i32 %i4 = arith.addi %i2, %i3 : i32 %f3 = arith.addf %f, %f : f32 %f4 = arith.addf %f, %f3 : f32 %true = arith.constant true %tci32 = arith.constant dense<0> : tensor<42xi32> %vci32 = arith.constant dense<0> : vector<42xi32> %tci1 = arith.constant dense<1> : tensor<42xi1> %vci1 = arith.constant dense<1> : vector<42xi1> %21 = arith.select %true, %idx, %idx : index %22 = arith.select %tci1, %tci32, %tci32 : tensor<42 x i1>, tensor<42 x i32> %23 = arith.select %vci1, %vci32, %vci32 : vector<42 x i1>, vector<42 x i32> %24 = ""arith.select""(%true, %idx, %idx) : (i1, index, index) -> index %25 = arith.select %true, %tci32, %tci32 : tensor<42 x i32> %64 = arith.constant dense<0.> : vector<4 x f32> %tcf32 = arith.constant dense<0.> : tensor<42 x f32> %vcf32 = arith.constant dense<0.> : vector<4 x f32> %65 = arith.cmpf ogt, %f3, %f4 : f32 %66 = ""arith.cmpf""(%f3, %f4) {predicate = 1} : (f32, f32) -> i1 %67 = arith.cmpf olt, %vcf32, %vcf32 : vector<4 x f32> %68 = ""arith.cmpf""(%vcf32, %vcf32) {predicate = 1} : (vector<4 x f32>, vector<4 x f32>) -> vector<4 x i1> %69 = arith.cmpf oeq, %tcf32, %tcf32 : tensor<42 x f32> %70 = arith.cmpf oeq, %vcf32, %vcf32 : vector<4 x f32> %74 = arith.constant true %75 = arith.constant false %100 = ""math.absf""(%f) : (f32) -> f32 %101 = math.absf %f : f32 %102 = math.absf %vcf32 : vector<4xf32> %103 = math.absf %t : tensor<4x4x?xf32> %104 = ""math.ceil""(%f) : (f32) -> f32 %105 = math.ceil %f : f32 %106 = math.ceil %vcf32 : vector<4xf32> %107 = math.ceil %t : tensor<4x4x?xf32> %116 = ""math.copysign""(%f, %f) : (f32, f32) -> f32 %117 = math.copysign %f, %f : f32 %118 = math.copysign %vcf32, %vcf32 : vector<4xf32> %119 = math.copysign %t, %t : tensor<4x4x?xf32> %145 = math.rsqrt %f : f32 %163 = ""math.floor""(%f) : (f32) -> f32 %164 = math.floor %f : f32 %165 = math.floor %vcf32 : vector<4xf32> %166 = math.floor %t : tensor<4x4x?xf32> return } func.func @affine_apply() { %i = ""arith.constant""() {value = 0: index} : () -> index %j = ""arith.constant""() {value = 1: index} : () -> index %a = ""affine.apply"" (%i) { map = affine_map<(d0) -> (d0 + 1)> } : (index) -> (index) %b = affine.apply affine_map<()[x] -> (x+1)>()[%i] return } func.func @load_store_prefetch(memref<4x4xi32>, index) { ^bb0(%0: memref<4x4xi32>, %1: index): %2 = ""memref.load""(%0, %1, %1) : (memref<4x4xi32>, index, index)->i32 %3 = memref.load %0[%1, %1] : memref<4x4xi32> memref.prefetch %0[%1, %1], write, locality<1>, data : memref<4x4xi32> memref.prefetch %0[%1, %1], read, locality<3>, instr : memref<4x4xi32> return } func.func @zero_dim_no_idx(%arg0 : memref, %arg1 : memref, %arg2 : memref) { %0 = memref.load %arg0[] : memref memref.store %0, %arg1[] : memref return } func.func @return_op(%a : i32) -> i32 { ""func.return"" (%a) : (i32)->() } func.func @calls(%arg0: i32) { %x = call @return_op(%arg0) : (i32) -> i32 %y = call @return_op(%x) : (i32) -> i32 %z = ""func.call""(%x) {callee = @return_op} : (i32) -> i32 %f = constant @affine_apply : () -> () call_indirect %f() : () -> () %f_0 = constant @return_op : (i32) -> i32 %2 = call_indirect %f_0(%arg0) : (i32) -> i32 %3 = ""func.call_indirect""(%f_0, %arg0) : ((i32) -> i32, i32) -> i32 return } func.func @memref_cast(%arg0: memref<4xf32>, %arg1 : memref, %arg2 : memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>>) { %0 = memref.cast %arg0 : memref<4xf32> to memref %1 = memref.cast %arg1 : memref to memref<4xf32> %2 = memref.cast %arg2 : memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref<64x16x4xf32, strided<[?, ?, ?], offset: ?>> %3 = memref.cast %2 : memref<64x16x4xf32, strided<[?, ?, ?], offset: ?>> to memref<64x16x4xf32, strided<[64, 4, 1], offset: 0>> %4 = memref.cast %1 : memref<4xf32> to memref<*xf32> %5 = memref.cast %4 : memref<*xf32> to memref<4xf32> return } func.func private @unranked_memref_roundtrip(memref<*xf32, 4>) func.func @memref_view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> %c0 = arith.constant 0: index %5 = memref.view %0[%c0][] : memref<2048xi8> to memref<64x4xf32> return } func.func @test_dimop(%arg0: tensor<4x4x?xf32>) { %c2 = arith.constant 2 : index %0 = tensor.dim %arg0, %c2 : tensor<4x4x?xf32> %1 = affine.apply affine_map<(d0) -> (d0)>(%0) return } func.func @tensor_load_store(%0 : memref<4x4xi32>, %1 : tensor<4x4xi32>) { memref.tensor_store %1, %0 : memref<4x4xi32> return } func.func @unranked_tensor_load_store(%0 : memref<*xi32>, %1 : tensor<*xi32>) { memref.tensor_store %1, %0 : memref<*xi32> return } func.func @assume_alignment(%0: memref<4x4xf16>) { memref.assume_alignment %0, 16 : memref<4x4xf16> return }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic | mlir-opt -allow-unregistered-dialect ,1 "func.func @succeededSameOperandsElementType(%t10x10 : tensor<10x10xf32>, %t1f: tensor<1xf32>, %v1: vector<1xf32>, %t1i: tensor<1xi32>, %sf: f32) { ""test.same_operand_element_type""(%t1f, %t1f) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi32> ""test.same_operand_element_type""(%t1f, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> tensor<1xi32> ""test.same_operand_element_type""(%t10x10, %v1) : (tensor<10x10xf32>, vector<1xf32>) -> tensor<1xi32> ""test.same_operand_element_type""(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<1xi32> ""test.same_operand_element_type""(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<121xi32> ""test.same_operand_element_type""(%sf, %sf) : (f32, f32) -> i32 ""test.same_operand_element_type""(%sf, %t1f) : (f32, tensor<1xf32>) -> tensor<121xi32> ""test.same_operand_element_type""(%sf, %v1) : (f32, vector<1xf32>) -> tensor<121xi32> ""test.same_operand_element_type""(%sf, %t10x10) : (f32, tensor<10x10xf32>) -> tensor<121xi32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandElementType(%t1f: tensor<1xf32>, %t1i: tensor<1xi32>) { ""test.same_operand_element_type""(%t1f, %t1i) : (tensor<1xf32>, tensor<1xi32>) -> tensor<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultElementType_no_operands() { ""test.same_operand_element_type""() : () -> tensor<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandElementType_scalar_type_mismatch(%si: i32, %sf: f32) { ""test.same_operand_element_type""(%sf, %si) : (f32, i32) -> tensor<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededSameOperandAndResultElementType(%t10x10 : tensor<10x10xf32>, %t1f: tensor<1xf32>, %v1: vector<1xf32>, %t1i: tensor<1xi32>, %sf: f32) { ""test.same_operand_and_result_element_type""(%t1f, %t1f) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> ""test.same_operand_and_result_element_type""(%t1f, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> tensor<1xf32> ""test.same_operand_and_result_element_type""(%t10x10, %v1) : (tensor<10x10xf32>, vector<1xf32>) -> tensor<1xf32> ""test.same_operand_and_result_element_type""(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<1xf32> ""test.same_operand_and_result_element_type""(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<121xf32> ""test.same_operand_and_result_element_type""(%sf, %sf) : (f32, f32) -> f32 ""test.same_operand_and_result_element_type""(%sf, %t1f) : (f32, tensor<1xf32>) -> tensor<121xf32> ""test.same_operand_and_result_element_type""(%sf, %v1) : (f32, vector<1xf32>) -> tensor<121xf32> ""test.same_operand_and_result_element_type""(%sf, %t10x10) : (f32, tensor<10x10xf32>) -> tensor<121xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultElementType_operand_result_mismatch(%t1f: tensor<1xf32>) { ""test.same_operand_and_result_element_type""(%t1f, %t1f) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultElementType_operand_mismatch(%t1f: tensor<1xf32>, %t1i: tensor<1xi32>) { ""test.same_operand_and_result_element_type""(%t1f, %t1i) : (tensor<1xf32>, tensor<1xi32>) -> tensor<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultElementType_result_mismatch(%t1f: tensor<1xf32>) { %0:2 = ""test.same_operand_and_result_element_type""(%t1f) : (tensor<1xf32>) -> (tensor<1xf32>, tensor<1xi32>) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultElementType_no_operands() { ""test.same_operand_and_result_element_type""() : () -> tensor<1xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultElementType_no_results(%t1f: tensor<1xf32>) { ""test.same_operand_and_result_element_type""(%t1f) : (tensor<1xf32>) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededSameOperandShape(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %m10x10 : memref<10x10xi32>, %tr: tensor<*xf32>) { ""test.same_operand_shape""(%t1, %t1) : (tensor<1xf32>, tensor<1xf32>) -> () ""test.same_operand_shape""(%t10x10, %t10x10) : (tensor<10x10xf32>, tensor<10x10xf32>) -> () ""test.same_operand_shape""(%t1, %tr) : (tensor<1xf32>, tensor<*xf32>) -> () ""test.same_operand_shape""(%t10x10, %m10x10) : (tensor<10x10xf32>, memref<10x10xi32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandShape_operand_mismatch(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>) { ""test.same_operand_shape""(%t1, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandShape_no_operands() { ""test.same_operand_shape""() : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededSameOperandAndResultShape(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %tr: tensor<*xf32>, %t1d: tensor) { ""test.same_operand_and_result_shape""(%t1, %t1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> ""test.same_operand_and_result_shape""(%t10x10, %t10x10) : (tensor<10x10xf32>, tensor<10x10xf32>) -> tensor<10x10xf32> ""test.same_operand_and_result_shape""(%t1, %tr) : (tensor<1xf32>, tensor<*xf32>) -> tensor<1xf32> ""test.same_operand_and_result_shape""(%t1, %t1d) : (tensor<1xf32>, tensor) -> tensor<1xf32> ""test.same_operand_and_result_shape""(%t1, %t1d) : (tensor<1xf32>, tensor) -> memref<1xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultShape_operand_result_mismatch(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>) { ""test.same_operand_and_result_shape""(%t1, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> tensor<10x10xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultShape_operand_result_mismatch(%t10 : tensor<10xf32>, %t1: tensor) { ""test.same_operand_and_result_shape""(%t1, %t10) : (tensor, tensor<10xf32>) -> tensor<3xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultShape_no_operands() { ""test.same_operand_and_result_shape""() : () -> (tensor<1xf32>) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultShape_no_operands(%t1: tensor<1xf32>) { ""test.same_operand_and_result_shape""(%t1) : (tensor<1xf32>) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededSameOperandAndResultType(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %tr: tensor<*xf32>, %t1d: tensor, %i32 : i32) { ""test.same_operand_and_result_type""(%t1, %t1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> ""test.same_operand_and_result_type""(%t10x10, %t10x10) : (tensor<10x10xf32>, tensor<10x10xf32>) -> tensor<10x10xf32> ""test.same_operand_and_result_type""(%t1, %tr) : (tensor<1xf32>, tensor<*xf32>) -> tensor<1xf32> ""test.same_operand_and_result_type""(%t1, %t1d) : (tensor<1xf32>, tensor) -> tensor<1xf32> ""test.same_operand_and_result_type""(%i32, %i32) : (i32, i32) -> i32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultType_operand_result_mismatch(%t10 : tensor<10xf32>, %t20 : tensor<20xf32>) { ""test.same_operand_and_result_type""(%t10, %t20) : (tensor<10xf32>, tensor<20xf32>) -> tensor<10xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSameOperandAndResultType_encoding_mismatch(%t10 : tensor<10xf32>, %t20 : tensor<10xf32>) { ""test.same_operand_and_result_type""(%t10, %t20) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xf32, ""enc""> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_different_rankedness(%arg0: tensor, %arg1: tensor<*xf32>) { %0 = ""test.elementwise_mappable""(%arg0, %arg1) : (tensor, tensor<*xf32>) -> tensor<*xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_different_rank(%arg0: tensor, %arg1: tensor) { %0 = ""test.elementwise_mappable""(%arg0, %arg1) : (tensor, tensor) -> tensor return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @elementwiseMappable_dynamic_shapes(%arg0: tensor, %arg1: tensor<5xf32>) { %0 = ""test.elementwise_mappable""(%arg0, %arg1) : (tensor, tensor<5xf32>) -> tensor return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_different_base_type(%arg0: vector<2xf32>, %arg1: tensor<2xf32>) { %0 = ""test.elementwise_mappable""(%arg0, %arg1) : (vector<2xf32>, tensor<2xf32>) -> tensor<2xf32> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_non_scalar_output(%arg0: vector<2xf32>) { %0 = ""test.elementwise_mappable""(%arg0) : (vector<2xf32>) -> f32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_non_scalar_result_all_scalar_input(%arg0: f32) { %0 = ""test.elementwise_mappable""(%arg0) : (f32) -> tensor return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_mixed_scalar_non_scalar_results(%arg0: tensor<10xf32>) { %0, %1 = ""test.elementwise_mappable""(%arg0) : (tensor<10xf32>) -> (f32, tensor<10xf32>) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_zero_results(%arg0: tensor<10xf32>) { ""test.elementwise_mappable""(%arg0) : (tensor<10xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedElementwiseMappable_zero_operands() { ""test.elementwise_mappable""() : () -> (tensor<6xf32>) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededElementwiseMappable(%arg0: vector<2xf32>) { %0 = ""test.elementwise_mappable""(%arg0) : (vector<2xf32>) -> vector<2xf16> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedHasParent_wrong_parent() { ""some.op""() ({ ""test.child""() : () -> () }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededParentOneOf() { ""test.parent""() ({ ""test.child_with_parent_one_of""() : () -> () ""test.finish""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededParent1OneOf() { ""test.parent1""() ({ ""test.child_with_parent_one_of""() : () -> () ""test.finish""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedParentOneOf_wrong_parent1() { ""some.otherop""() ({ ""test.child_with_parent_one_of""() : () -> () ""test.finish""() : () -> () }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSingleBlockImplicitTerminator_empty_block() { ""test.SingleBlockImplicitTerminator""() ({ ^entry: }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSingleBlockImplicitTerminator_too_many_blocks() { ""test.SingleBlockImplicitTerminator""() ({ ^entry: ""test.finish"" () : () -> () ^other: ""test.finish"" () : () -> () }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedSingleBlockImplicitTerminator_missing_terminator() { ""test.SingleBlockImplicitTerminator""() ({ ^entry: ""test.non_existent_op""() : () -> () }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.symbol""() {} : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.symbol""() <{sym_name = ""foo_2"", sym_visibility}> : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.symbol""() {sym_name = ""foo_2"", sym_visibility = ""foo""} : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.symbol""() {sym_name = ""foo_3"", sym_visibility = ""nested""} : () -> () ""test.symbol""() {sym_name = ""foo_4"", sym_visibility = ""private""} : () -> () ""test.symbol""() {sym_name = ""foo_5"", sym_visibility = ""public""} : () -> () ""test.symbol""() {sym_name = ""foo_6""} : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.symbol_scope""() ({ func.func private @foo() ""test.finish"" () : () -> () }) : () -> () func.func private @foo()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 """test.symbol_scope""() ({ ^entry: ""test.finish"" () : () -> () ^other: ""test.finish"" () : () -> () }) : () -> ()", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedMissingOperandSizeAttr(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) : (i32, i32, i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedOperandSizeAttrWrongType(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) {operand_segment_sizes = 10} : (i32, i32, i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedOperandSizeAttrWrongElementType(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedOperandSizeAttrNegativeValue(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedOperandSizeAttrWrongTotalSize(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedOperandSizeAttrWrongCount(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededOperandSizeAttr(%arg: i32) { ""test.attr_sized_operands""(%arg, %arg, %arg, %arg) {operand_segment_sizes = array} : (i32, i32, i32, i32) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedMissingResultSizeAttr() { %0:4 = ""test.attr_sized_results""() : () -> (i32, i32, i32, i32) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedResultSizeAttrWrongType() { %0:4 = ""test.attr_sized_results""() {result_segment_sizes = 10} : () -> (i32, i32, i32, i32) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedResultSizeAttrWrongElementType() { %0:4 = ""test.attr_sized_results""() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedResultSizeAttrNegativeValue() { %0:4 = ""test.attr_sized_results""() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedResultSizeAttrWrongTotalSize() { %0:4 = ""test.attr_sized_results""() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedResultSizeAttrWrongCount() { %0:4 = ""test.attr_sized_results""() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededResultSizeAttr() { %0:4 = ""test.attr_sized_results""() {result_segment_sizes = array} : () -> (i32, i32, i32, i32) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededOilistTrivial() { test.oilist_with_keywords_only keyword test.oilist_with_keywords_only otherKeyword test.oilist_with_keywords_only keyword otherKeyword test.oilist_with_keywords_only otherKeyword keyword test.oilist_with_keywords_only thirdKeyword test.oilist_with_keywords_only keyword thirdKeyword return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededOilistSimple(%arg0 : i32, %arg1 : i32, %arg2 : i32) { test.oilist_with_simple_args keyword %arg0 : i32 test.oilist_with_simple_args otherKeyword %arg0 : i32 test.oilist_with_simple_args thirdKeyword %arg0 : i32 test.oilist_with_simple_args keyword %arg0 : i32 otherKeyword %arg1 : i32 test.oilist_with_simple_args keyword %arg0 : i32 thirdKeyword %arg1 : i32 test.oilist_with_simple_args thirdKeyword %arg0 : i32 otherKeyword %arg1 : i32 test.oilist_with_simple_args keyword %arg0 : i32 otherKeyword %arg1 : i32 thirdKeyword %arg2 : i32 test.oilist_with_simple_args otherKeyword %arg0 : i32 keyword %arg1 : i32 thirdKeyword %arg2 : i32 test.oilist_with_simple_args otherKeyword %arg0 : i32 thirdKeyword %arg1 : i32 keyword %arg2 : i32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededOilistVariadic(%arg0: i32, %arg1: i32, %arg2: i32) { test.oilist_variadic_with_parens keyword (%arg0, %arg1 : i32, i32) test.oilist_variadic_with_parens otherKeyword (%arg2, %arg1 : i32, i32) keyword (%arg0, %arg1 : i32, i32) test.oilist_variadic_with_parens thirdKeyword (%arg2, %arg0, %arg1 : i32, i32, i32) keyword (%arg0, %arg1 : i32, i32) otherKeyword (%arg0, %arg1 : i32, i32) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededOilistCustom(%arg0: i32, %arg1: i32, %arg2: i32) { test.oilist_custom private (%arg0, %arg1 : i32, i32) test.oilist_custom private (%arg0, %arg1 : i32, i32) nowait test.oilist_custom nowait reduction (%arg1) private (%arg0, %arg1 : i32, i32) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedHasDominanceScopeOutsideDominanceFreeScope() -> () { ""test.ssacfg_region""() ({ test.graph_region { %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) } %1 = ""baz""() : () -> (i64) }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @illegalInsideDominanceFreeScope() -> () { test.graph_region { func.func @test() -> i1 { ^bb1: %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) %1 = ""baz""(%2#0) : (i1) -> (i64) return %2#1 : i1 } ""terminator""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @illegalCDFGInsideDominanceFreeScope() -> () { test.graph_region { func.func @test() -> i1 { ^bb1: %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) cf.br ^bb4 ^bb2: cf.br ^bb2 ^bb4: %1 = ""foo""() : ()->i64 return %2#1 : i1 } ""terminator""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @illegalCDFGInsideDominanceFreeScope() -> () { test.graph_region { %2:3 = ""bar""(%1) : (i64) -> (i1,i1,i1) ""terminator""() : () -> () } return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @graph_region_cant_have_blocks() { test.graph_region { ^bb42: cf.br ^bb43 ^bb43: ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeeded_type_traits() { ""test.result_type_with_trait""() : () -> !test.test_type_with_trait return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failed_type_traits() { ""test.result_type_with_trait""() : () -> i32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeeded_attr_traits() { ""test.attr_with_trait""() {attr = #test.attr_with_trait} : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failed_attr_traits() { ""test.attr_with_trait""() {attr = 42 : i32} : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededDynamicTypeVerifier() { ""unregistered_op""() : () -> !test.dynamic_singleton ""unregistered_op""() : () -> !test.dynamic_pair ""unregistered_op""() : () -> !test.dynamic_pair, !test.dynamic_singleton> return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicTypeVerifier() { ""unregistered_op""() : () -> !test.dynamic_singleton return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicTypeVerifier2() { ""unregistered_op""() : () -> !test.dynamic_pair return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @customTypeParserPrinter() { ""unregistered_op""() : () -> !test.dynamic_custom_assembly_format return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededDynamicAttributeVerifier() { ""unregistered_op""() {test_attr = #test.dynamic_singleton} : () -> () ""unregistered_op""() {test_attr = #test.dynamic_pair<3 : i32, 5 : i32>} : () -> () ""unregistered_op""() {test_attr = #test.dynamic_pair<#test.dynamic_pair<3 : i32, 5 : i32>, f64>} : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicAttributeVerifier() { ""unregistered_op""() {test_attr = #test.dynamic_singleton} : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicAttributeVerifier2() { ""unregistered_op""() {test_attr = #test.dynamic_pair} : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @customAttributeParserPrinter() { ""unregistered_op""() {test_attr = #test.dynamic_custom_assembly_format} : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @succeededDynamicOpVerifier(%a: f32) { ""test.dynamic_generic""() : () -> () ""test.dynamic_generic""(%a) : (f32) -> f64 ""test.dynamic_one_operand_two_results""(%a) : (f32) -> (f64, f64) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicOpVerifier() { ""test.dynamic_one_operand_two_results""() : () -> (f64, f64) return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicOpVerifier2(%a: f32) { ""test.dynamic_one_operand_two_results""(%a) : (f32) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @customOpParserPrinter() { test.dynamic_custom_parser_printer custom_keyword return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @failedDynamicDialectOpVerifier() { ""test_dyn.one_result""() : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_enum_attr_roundtrip() -> () { ""test.op""() {value = #test} : () -> () ""test.op""() {value = #test} : () -> () ""test.op""() {value = #test} : () -> () return } func.func @test_op_with_enum() -> () { test.op_with_enum third return } func.func @test_match_op_with_enum() -> () { test.op_with_enum third tag 0 : i32 test.op_with_enum first tag 0 : i32 return }", mlir-opt | mlir-opt -test-patterns ,1 """foo.op""() : () -> (memref (2*d0)>>)", mlir-opt -allow-unregistered-dialect -mlir-print-local-scope ,1 "func.func @test() -> i32 { %c5 = ""test.constant""() {value = 5 : i32} : () -> i32 %c1 = ""test.constant""() {value = 1 : i32} : () -> i32 %c2 = ""test.constant""() {value = 2 : i32} : () -> i32 %c3 = ""test.constant""() {value = 3 : i32} : () -> i32 %res = test.fold_with_fold_adaptor %c5, [ %c1, %c2], { (%c3), (%c3) } { %c0 = ""test.constant""() {value = 0 : i32} : () -> i32 } return %res : i32 }", mlir-opt -canonicalize -split-input-file ,1 "module attributes {sym.outside_use = @symbol_foo } { func.func private @symbol_foo() attributes {sym.new_name = ""replaced_foo"" } func.func @symbol_bar() attributes {sym.use = @symbol_foo} { ""foo.op""() { non_symbol_attr, use = [{nested_symbol = [@symbol_foo], other_use = @symbol_bar, z_use = @symbol_foo}], z_non_symbol_attr_3 } : () -> () } module attributes {test.reference = @symbol_foo} { ""foo.op""() {test.nested_reference = @symbol_foo} : () -> () } }", mlir-opt -allow-unregistered-dialect -test-symbol-rauw -split-input-file ,1 "module { module @module_a { func.func nested @foo() attributes {sym.new_name = ""replaced_foo"" } } module @module_b attributes {sym.new_name = ""replaced_module_b""} { module @module_c attributes {sym.new_name = ""replaced_module_c""} { func.func nested @foo() attributes {sym.new_name = ""replaced_foo"" } } } func.func @symbol_bar() { ""foo.op""() { use_1 = @module_a::@foo, use_2 = @module_b::@module_c::@foo } : () -> () } }", mlir-opt -allow-unregistered-dialect -test-symbol-rauw -split-input-file ,1 "module { func.func private @failed_repl() attributes {sym.new_name = ""replaced_name"" } ""foo.possibly_unknown_symbol_table""() ({ }) : () -> () }", mlir-opt -allow-unregistered-dialect -test-symbol-rauw -split-input-file ,1 "module { func.func private @symbol_foo() attributes {sym.new_name = ""replaced_foo"" } func.func @symbol_bar() { ""foo.op""() { non_symbol_attr, use = [#test.sub_elements_access<[@symbol_foo],@symbol_bar,@symbol_foo>], z_non_symbol_attr_3 } : () -> () } }", mlir-opt -allow-unregistered-dialect -test-symbol-rauw -split-input-file ,1 "module { module @foo attributes {sym.new_name = ""replaced_foo"" } { func.func private @foo() } ""foo.op""() { use = @foo::@foo } : () -> () }", mlir-opt -allow-unregistered-dialect -test-symbol-rauw -split-input-file ,1 "func.func @add_to_worklist_after_inplace_update() { ""test.any_attr_of_i32_str""() {attr = 0 : i32} : () -> () return }"," mlir-opt -test-patterns=""max-iterations=1"" -allow-unregistered-dialect --split-input-file ",1 "func.func @add_ancestors_to_worklist() { ""test.one_region_op""() ({ %0 = ""foo.maybe_eligible_op"" () : () -> (index) ""foo.yield""(%0) : (index) -> () }) {hoist_eligible_ops}: () -> () return }"," mlir-opt -test-patterns=""max-iterations=1"" -allow-unregistered-dialect --split-input-file ",1 "func.func @correct_variadic_result() -> tensor { %0:5 = ""test.mixed_normal_variadic_result""() : () -> (tensor, tensor, tensor, tensor, tensor) return %0#4 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @error_in_first_variadic_result() -> tensor { %0:5 = ""test.mixed_normal_variadic_result""() : () -> (tensor, f32, tensor, tensor, tensor) return %0#4 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @error_in_normal_result() -> tensor { %0:5 = ""test.mixed_normal_variadic_result""() : () -> (tensor, tensor, f32, tensor, tensor) return %0#4 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @error_in_second_variadic_result() -> tensor { %0:5 = ""test.mixed_normal_variadic_result""() : () -> (tensor, tensor, tensor, f32, tensor) return %0#4 : tensor }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @slicing_linalg_op(%arg0 : index, %arg1 : index, %arg2 : index) { %a = memref.alloc(%arg0, %arg2) : memref %b = memref.alloc(%arg2, %arg1) : memref %c = memref.alloc(%arg0, %arg1) : memref %d = memref.alloc(%arg0, %arg1) : memref linalg.matmul ins(%a, %b : memref, memref) outs(%c : memref) linalg.matmul ins(%a, %b : memref, memref) outs(%d : memref) memref.dealloc %c : memref memref.dealloc %b : memref memref.dealloc %a : memref memref.dealloc %d : memref return }", mlir-opt -slice-analysis-test ,1 "func.func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) { %res:3 = test.wrapping_region wraps ""some.op""(%arg1, %arg0) { test.attr = ""attr"" } : (f32, i32) -> (i1, i2, i3) loc(""some_NameLoc"") return %res#2, %res#1, %res#0 : i3, i2, i1 }", mlir-opt -allow-unregistered-dialect ,1 "func.func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) { %res:3 = test.wrapping_region wraps ""some.op""(%arg1, %arg0) { test.attr = ""attr"" } : (f32, i32) -> (i1, i2, i3) loc(""some_NameLoc"") return %res#2, %res#1, %res#0 : i3, i2, i1 }", mlir-opt -allow-unregistered-dialect -mlir-print-op-generic -mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func @correct_variadic_operand(%arg0: tensor, %arg1: f32) { ""test.mixed_normal_variadic_operand""(%arg0, %arg0, %arg0, %arg0, %arg0) : (tensor, tensor, tensor, tensor, tensor) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @error_in_first_variadic_operand(%arg0: tensor, %arg1: f32) { ""test.mixed_normal_variadic_operand""(%arg0, %arg1, %arg0, %arg0, %arg0) : (tensor, f32, tensor, tensor, tensor) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @error_in_normal_operand(%arg0: tensor, %arg1: f32) { ""test.mixed_normal_variadic_operand""(%arg0, %arg0, %arg1, %arg0, %arg0) : (tensor, tensor, f32, tensor, tensor) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @error_in_second_variadic_operand(%arg0: tensor, %arg1: f32) { ""test.mixed_normal_variadic_operand""(%arg0, %arg0, %arg0, %arg1, %arg0) : (tensor, tensor, tensor, f32, tensor) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @testfunc(%arg0: i32) { return } func.func @invalid_call_operandtype() { %0 = arith.constant 0.0 : f32 call @testfunc(%0) : (f32) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 func.func @main() {," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token, %result = async.execute -> !async.value { %0 = arith.constant 123.456 : f32 async.yield %0 : f32 } %1 = async.await %result : !async.value vector.print %1 : f32"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token0, %result0 = async.execute -> !async.value { %token1, %result2 = async.execute -> !async.value { %2 = arith.constant 456.789 : f32 async.yield %2 : f32 } %3 = async.await %result2 : !async.value async.yield %3 : f32 } %4 = async.await %result0 : !async.value vector.print %4 : f32"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token2, %result2 = async.execute[%token0] -> !async.value> { %5 = memref.alloc() : memref %c0 = arith.constant 0.25 : f32 memref.store %c0, %5[]: memref async.yield %5 : memref } %6 = async.await %result2 : !async.value> %7 = memref.cast %6 : memref to memref<*xf32> call @printMemrefF32(%7): (memref<*xf32>) -> ()"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token3 = async.execute(%result2 as %unwrapped : !async.value>) { %8 = memref.load %unwrapped[]: memref %9 = arith.addf %8, %8 : f32 memref.store %9, %unwrapped[]: memref async.yield } async.await %token3 : !async.token call @printMemrefF32(%7): (memref<*xf32>) -> () memref.dealloc %6 : memref return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "func.func @main() -> () { %A = memref.alloc() : memref<10x3xf32, 0> %f2 = arith.constant 2.00000e+00 : f32 %f5 = arith.constant 5.00000e+00 : f32 %f10 = arith.constant 10.00000e+00 : f32 %V = memref.cast %A : memref<10x3xf32, 0> to memref linalg.fill ins(%f10 : f32) outs(%V : memref) %U = memref.cast %A : memref<10x3xf32, 0> to memref<*xf32> call @printMemrefF32(%U) : (memref<*xf32>) -> () %V2 = memref.cast %U : memref<*xf32> to memref linalg.fill ins(%f5 : f32) outs(%V2 : memref) %U2 = memref.cast %V2 : memref to memref<*xf32> call @printMemrefF32(%U2) : (memref<*xf32>) -> () %V3 = memref.cast %V2 : memref to memref<*xf32> %V4 = memref.cast %V3 : memref<*xf32> to memref linalg.fill ins(%f2 : f32) outs(%V4 : memref) %U3 = memref.cast %V2 : memref to memref<*xf32> call @printMemrefF32(%U3) : (memref<*xf32>) -> () %i8_z = arith.constant 122 : i8 %I8 = memref.alloc() : memref memref.store %i8_z, %I8[]: memref %U4 = memref.cast %I8 : memref to memref<*xi8> call @printMemrefI8(%U4) : (memref<*xi8>) -> () memref.dealloc %U4 : memref<*xi8> memref.dealloc %A : memref<10x3xf32, 0> call @return_var_memref_caller() : () -> () call @return_two_var_memref_caller() : () -> () call @dim_op_of_unranked() : () -> () return } func.func private @printMemrefI8(memref<*xi8>) attributes { llvm.emit_c_interface } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } func.func @return_two_var_memref_caller() { %0 = memref.alloca() : memref<4x3xf32> %c0f32 = arith.constant 1.0 : f32 linalg.fill ins(%c0f32 : f32) outs(%0 : memref<4x3xf32>) %1:2 = call @return_two_var_memref(%0) : (memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) call @printMemrefF32(%1#0) : (memref<*xf32>) -> () call @printMemrefF32(%1#1) : (memref<*xf32>) -> () return } func.func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) { %0 = memref.cast %arg0 : memref<4x3xf32> to memref<*xf32> return %0, %0 : memref<*xf32>, memref<*xf32> } func.func @return_var_memref_caller() { %0 = memref.alloca() : memref<4x3xf32> %c0f32 = arith.constant 1.0 : f32 linalg.fill ins(%c0f32 : f32) outs(%0 : memref<4x3xf32>) %1 = call @return_var_memref(%0) : (memref<4x3xf32>) -> memref<*xf32> call @printMemrefF32(%1) : (memref<*xf32>) -> () return } func.func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> { %0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32> return %0 : memref<*xf32> } func.func private @printU64(index) -> () func.func private @printNewline() -> () func.func @dim_op_of_unranked() { %ranked = memref.alloca() : memref<4x3xf32> %unranked = memref.cast %ranked: memref<4x3xf32> to memref<*xf32> %c0 = arith.constant 0 : index %dim_0 = memref.dim %unranked, %c0 : memref<*xf32> call @printU64(%dim_0) : (index) -> () call @printNewline() : () -> () %c1 = arith.constant 1 : index %dim_1 = memref.dim %unranked, %c1 : memref<*xf32> call @printU64(%dim_1) : (index) -> () call @printNewline() : () -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils ",1 llvm.func @main(), not mlir-cpu-runner --no-implicit-module 2>&1 ,1 "llvm.func @entry() -> () { llvm.return }", mlir-cpu-runner --debug-only=jit-runner -mattr=+foo_bar -e entry -entry-point-result=void 2>&1 ,1 "llvm.func @entry() -> () { llvm.return }", not mlir-cpu-runner --debug-only=jit-runner -march=bar_foo -e entry -entry-point-result=void 2>&1 ,1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @tanh_f32(%a : f32) { %r = math.tanh %a : f32 vector.print %r : f32 return } func.func @tanh_4xf32(%a : vector<4xf32>) { %r = math.tanh %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @tanh_8xf32(%a : vector<8xf32>) { %r = math.tanh %a : vector<8xf32> vector.print %r : vector<8xf32> return } func.func @tanh() { %f0 = arith.constant 1.25 : f32 call @tanh_f32(%f0) : (f32) -> () %v1 = arith.constant dense<[0.25, 0.75, 1.0, 1.25]> : vector<4xf32> call @tanh_4xf32(%v1) : (vector<4xf32>) -> () %v2 = arith.constant dense<[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]> : vector<8xf32> call @tanh_8xf32(%v2) : (vector<8xf32>) -> () %nan = arith.constant 0x7fc00000 : f32 call @tanh_f32(%nan) : (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @log_f32(%a : f32) { %r = math.log %a : f32 vector.print %r : f32 return } func.func @log_4xf32(%a : vector<4xf32>) { %r = math.log %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @log_8xf32(%a : vector<8xf32>) { %r = math.log %a : vector<8xf32> vector.print %r : vector<8xf32> return } func.func @log() { %f1 = arith.constant 14.112233 : f32 call @log_f32(%f1) : (f32) -> () %v1 = arith.constant dense<[0.25, 0.75, 1.0, 1.25]> : vector<4xf32> call @log_4xf32(%v1) : (vector<4xf32>) -> () %v2 = arith.constant dense<[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]> : vector<8xf32> call @log_8xf32(%v2) : (vector<8xf32>) -> () %zero = arith.constant 0.0 : f32 call @log_f32(%zero) : (f32) -> () %nan = arith.constant 0x7fc00000 : f32 call @log_f32(%nan) : (f32) -> () %inf = arith.constant 0x7f800000 : f32 call @log_f32(%inf) : (f32) -> () %special_vec = arith.constant dense<[0.0, -1.0, 0x7f800000, 2.0]> : vector<4xf32> call @log_4xf32(%special_vec) : (vector<4xf32>) -> () return } func.func @log2_f32(%a : f32) { %r = math.log2 %a : f32 vector.print %r : f32 return } func.func @log2_4xf32(%a : vector<4xf32>) { %r = math.log2 %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @log2_8xf32(%a : vector<8xf32>) { %r = math.log2 %a : vector<8xf32> vector.print %r : vector<8xf32> return } func.func @log2() { %f0 = arith.constant 14.112233 : f32 call @log2_f32(%f0) : (f32) -> () %v1 = arith.constant dense<[0.25, 0.75, 1.0, 1.25]> : vector<4xf32> call @log2_4xf32(%v1) : (vector<4xf32>) -> () %v2 = arith.constant dense<[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]> : vector<8xf32> call @log2_8xf32(%v2) : (vector<8xf32>) -> () %zero = arith.constant 0.0 : f32 call @log2_f32(%zero) : (f32) -> () %neg_one = arith.constant -1.0 : f32 call @log2_f32(%neg_one) : (f32) -> () %inf = arith.constant 0x7f800000 : f32 call @log2_f32(%inf) : (f32) -> () %special_vec = arith.constant dense<[0.0, -1.0, 0x7f800000, 3.0]> : vector<4xf32> call @log2_4xf32(%special_vec) : (vector<4xf32>) -> () return } func.func @log1p_f32(%a : f32) { %r = math.log1p %a : f32 vector.print %r : f32 return } func.func @log1p_4xf32(%a : vector<4xf32>) { %r = math.log1p %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @log1p_8xf32(%a : vector<8xf32>) { %r = math.log1p %a : vector<8xf32> vector.print %r : vector<8xf32> return } func.func @log1p() { %f0 = arith.constant 0.01 : f32 call @log1p_f32(%f0) : (f32) -> () %v1 = arith.constant dense<[-0.99, -0.5, 0.0, 3.0]> : vector<4xf32> call @log1p_4xf32(%v1) : (vector<4xf32>) -> () %v2 = arith.constant dense<[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]> : vector<8xf32> call @log1p_8xf32(%v2) : (vector<8xf32>) -> () %neg_one = arith.constant -1.0 : f32 call @log1p_f32(%neg_one) : (f32) -> () %neg_two = arith.constant -2.0 : f32 call @log1p_f32(%neg_two) : (f32) -> () %inf = arith.constant 0x7f800000 : f32 call @log1p_f32(%inf) : (f32) -> () %special_vec = arith.constant dense<[-1.0, -1.1, 0x7f800000, 0.00001]> : vector<4xf32> call @log1p_4xf32(%special_vec) : (vector<4xf32>) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @erf_f32(%a : f32) { %r = math.erf %a : f32 vector.print %r : f32 return } func.func @erf_4xf32(%a : vector<4xf32>) { %r = math.erf %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @erf() { %val1 = arith.constant -2.431864e-4 : f32 call @erf_f32(%val1) : (f32) -> () %val2 = arith.constant 0.79999 : f32 call @erf_f32(%val2) : (f32) -> () %val3 = arith.constant 0.8 : f32 call @erf_f32(%val3) : (f32) -> () %val4 = arith.constant 1.99999 : f32 call @erf_f32(%val4) : (f32) -> () %val5 = arith.constant 2.0 : f32 call @erf_f32(%val5) : (f32) -> () %val6 = arith.constant 3.74999 : f32 call @erf_f32(%val6) : (f32) -> () %val7 = arith.constant 3.75 : f32 call @erf_f32(%val7) : (f32) -> () %negativeInf = arith.constant 0xff800000 : f32 call @erf_f32(%negativeInf) : (f32) -> () %vecVals1 = arith.constant dense<[-3.4028235e+38, -4.54318, -1.2130899, -7.8234202e-01]> : vector<4xf32> call @erf_4xf32(%vecVals1) : (vector<4xf32>) -> () %vecVals2 = arith.constant dense<[-1.1754944e-38, 0.0, 1.1754944e-38, 1.0793410e-01]> : vector<4xf32> call @erf_4xf32(%vecVals2) : (vector<4xf32>) -> () %vecVals3 = arith.constant dense<[1.23578, 2.34093, 3.82342, 3.4028235e+38]> : vector<4xf32> call @erf_4xf32(%vecVals3) : (vector<4xf32>) -> () %inf = arith.constant 0x7f800000 : f32 call @erf_f32(%inf) : (f32) -> () %nan = arith.constant 0x7fc00000 : f32 call @erf_f32(%nan) : (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @exp_f32(%a : f32) { %r = math.exp %a : f32 vector.print %r : f32 return } func.func @exp_4xf32(%a : vector<4xf32>) { %r = math.exp %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @exp() { %f0 = arith.constant 1.0 : f32 call @exp_f32(%f0) : (f32) -> () %v1 = arith.constant dense<[-0.25, 0.75, 1.0, 1.35]> : vector<4xf32> call @exp_4xf32(%v1) : (vector<4xf32>) -> () %zero = arith.constant 0.0 : f32 call @exp_f32(%zero) : (f32) -> () %special_vec = arith.constant dense<[-89.0, -25.0, 25.0, 89.0]> : vector<4xf32> call @exp_4xf32(%special_vec) : (vector<4xf32>) -> () %inf = arith.constant 0x7f800000 : f32 call @exp_f32(%inf) : (f32) -> () %negative_inf = arith.constant 0xff800000 : f32 call @exp_f32(%negative_inf) : (f32) -> () %nan = arith.constant 0x7fc00000 : f32 call @exp_f32(%nan) : (f32) -> () return } func.func @expm1_f32(%a : f32) { %r = math.expm1 %a : f32 vector.print %r : f32 return } func.func @expm1_3xf32(%a : vector<3xf32>) { %r = math.expm1 %a : vector<3xf32> vector.print %r : vector<3xf32> return } func.func @expm1_4xf32(%a : vector<4xf32>) { %r = math.expm1 %a : vector<4xf32> vector.print %r : vector<4xf32> return } func.func @expm1_8xf32(%a : vector<8xf32>) { %r = math.expm1 %a : vector<8xf32> vector.print %r : vector<8xf32> return } func.func @expm1() { %f0 = arith.constant 1.0e-10 : f32 call @expm1_f32(%f0) : (f32) -> () %v1 = arith.constant dense<[-0.01, 0.01, 0.5, 2.0]> : vector<4xf32> call @expm1_4xf32(%v1) : (vector<4xf32>) -> () %v2 = arith.constant dense<[-0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2]> : vector<8xf32> call @expm1_8xf32(%v2) : (vector<8xf32>) -> () %neg_inf = arith.constant 0xff800000 : f32 call @expm1_f32(%neg_inf) : (f32) -> () %inf = arith.constant 0x7f800000 : f32 call @expm1_f32(%inf) : (f32) -> () %special_vec = arith.constant dense<[0xff800000, 0x7f800000, 1.0e-10]> : vector<3xf32> call @expm1_3xf32(%special_vec) : (vector<3xf32>) -> () %nan = arith.constant 0x7fc00000 : f32 call @expm1_f32(%nan) : (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @sin_f32(%a : f32) { %r = math.sin %a : f32 vector.print %r : f32 return } func.func @sin_3xf32(%a : vector<3xf32>) { %r = math.sin %a : vector<3xf32> vector.print %r : vector<3xf32> return } func.func @sin() { %zero = arith.constant 0.0 : f32 call @sin_f32(%zero) : (f32) -> () %pi_over_4 = arith.constant 0.78539816339 : f32 call @sin_f32(%pi_over_4) : (f32) -> () %pi_over_2 = arith.constant 1.57079632679 : f32 call @sin_f32(%pi_over_2) : (f32) -> () %pi = arith.constant 3.14159265359 : f32 call @sin_f32(%pi) : (f32) -> () %pi_3_over_2 = arith.constant 4.71238898038 : f32 call @sin_f32(%pi_3_over_2) : (f32) -> () %vec_x = arith.constant dense<[9.42477796077, 2.09439510239, -1.57079632679]> : vector<3xf32> call @sin_3xf32(%vec_x) : (vector<3xf32>) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @cos_f32(%a : f32) { %r = math.cos %a : f32 vector.print %r : f32 return } func.func @cos_3xf32(%a : vector<3xf32>) { %r = math.cos %a : vector<3xf32> vector.print %r : vector<3xf32> return } func.func @cos() { %zero = arith.constant 0.0 : f32 call @cos_f32(%zero) : (f32) -> () %pi_over_4 = arith.constant 0.78539816339 : f32 call @cos_f32(%pi_over_4) : (f32) -> () %pi_over_2 = arith.constant 1.57079632679 : f32 call @cos_f32(%pi_over_2) : (f32) -> () %pi = arith.constant 3.14159265359 : f32 call @cos_f32(%pi) : (f32) -> () %pi_3_over_2 = arith.constant 4.71238898038 : f32 call @cos_f32(%pi_3_over_2) : (f32) -> () %vec_x = arith.constant dense<[9.42477796077, 2.09439510239, -1.57079632679]> : vector<3xf32> call @cos_3xf32(%vec_x) : (vector<3xf32>) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @atan_f32(%a : f32) { %r = math.atan %a : f32 vector.print %r : f32 return } func.func @atan() { %0 = arith.constant -1.0 : f32 call @atan_f32(%0) : (f32) -> () %1 = arith.constant 1.0 : f32 call @atan_f32(%1) : (f32) -> () %2 = arith.constant -0.5 : f32 call @atan_f32(%2) : (f32) -> () %3 = arith.constant 0.5 : f32 call @atan_f32(%3) : (f32) -> () %4 = arith.constant 0.0 : f32 call @atan_f32(%4) : (f32) -> () %5 = arith.constant -2.0 : f32 call @atan_f32(%5) : (f32) -> () %6 = arith.constant 2.0 : f32 call @atan_f32(%6) : (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @atan2_f32(%a : f32, %b : f32) { %r = math.atan2 %a, %b : f32 vector.print %r : f32 return } func.func @atan2() { %zero = arith.constant 0.0 : f32 %one = arith.constant 1.0 : f32 %two = arith.constant 2.0 : f32 %neg_one = arith.constant -1.0 : f32 %neg_two = arith.constant -2.0 : f32 call @atan2_f32(%zero, %one) : (f32, f32) -> () call @atan2_f32(%one, %zero) : (f32, f32) -> () call @atan2_f32(%zero, %neg_one) : (f32, f32) -> () call @atan2_f32(%neg_one, %zero) : (f32, f32) -> () call @atan2_f32(%zero, %zero) : (f32, f32) -> () call @atan2_f32(%two, %one) : (f32, f32) -> () %x6 = arith.constant -1.0 : f32 %y6 = arith.constant 2.0 : f32 call @atan2_f32(%two, %neg_one) : (f32, f32) -> () call @atan2_f32(%neg_two, %neg_one) : (f32, f32) -> () call @atan2_f32(%neg_two, %one) : (f32, f32) -> () call @atan2_f32(%one, %two) : (f32, f32) -> () %x10 = arith.constant -2.0 : f32 %y10 = arith.constant 1.0 : f32 call @atan2_f32(%one, %neg_two) : (f32, f32) -> () %x11 = arith.constant -2.0 : f32 %y11 = arith.constant -1.0 : f32 call @atan2_f32(%neg_one, %neg_two) : (f32, f32) -> () call @atan2_f32(%neg_one, %two) : (f32, f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @cbrt_f32(%a : f32) { %r = math.cbrt %a : f32 vector.print %r : f32 return } func.func @cbrt() { %a = arith.constant 1.0 : f32 call @cbrt_f32(%a) : (f32) -> () %b = arith.constant -1.0 : f32 call @cbrt_f32(%b) : (f32) -> () %c = arith.constant 0.0 : f32 call @cbrt_f32(%c) : (f32) -> () %d = arith.constant -0.0 : f32 call @cbrt_f32(%d) : (f32) -> () %e = arith.constant 1000.0 : f32 call @cbrt_f32(%e) : (f32) -> () %f = arith.constant -1000.0 : f32 call @cbrt_f32(%f) : (f32) -> () %g = arith.constant 17.0 : f32 call @cbrt_f32(%g) : (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @func_floorf32(%a : f32) { %r = math.floor %a : f32 vector.print %r : f32 return } func.func @floorf() { %a = arith.constant 3.8 : f32 call @func_floorf32(%a) : (f32) -> () %b = arith.constant -3.8 : f32 call @func_floorf32(%b) : (f32) -> () %c = arith.constant 0.0 : f32 call @func_floorf32(%c) : (f32) -> () %d = arith.constant -4.2 : f32 call @func_floorf32(%d) : (f32) -> () %e = arith.constant -2.0 : f32 call @func_floorf32(%e) : (f32) -> () %f = arith.constant 2.0 : f32 call @func_floorf32(%f) : (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @func_ceilf32(%a : f32) { %r = math.ceil %a : f32 vector.print %r : f32 return } func.func @ceilf() { %a = arith.constant 3.8 : f32 call @func_ceilf32(%a) : (f32) -> () %b = arith.constant -3.8 : f32 call @func_ceilf32(%b) : (f32) -> () %c = arith.constant 0.0 : f32 call @func_ceilf32(%c) : (f32) -> () %d = arith.constant -4.2 : f32 call @func_ceilf32(%d) : (f32) -> () %e = arith.constant -495.0 : f32 call @func_ceilf32(%e) : (f32) -> () %f = arith.constant 495.0 : f32 call @func_ceilf32(%f) : (f32) -> () return } func.func @main() { call @tanh(): () -> () call @log(): () -> () call @log2(): () -> () call @log1p(): () -> () call @erf(): () -> () call @exp(): () -> () call @expm1(): () -> () call @sin(): () -> () call @cos(): () -> () call @atan() : () -> () call @atan2() : () -> () call @cbrt() : () -> () call @floorf() : () -> () call @ceilf() : () -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } func.func @main() -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %input = memref.alloc() : memref<2x3xf32> %dim_x = memref.dim %input, %c0 : memref<2x3xf32> %dim_y = memref.dim %input, %c1 : memref<2x3xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%dim_x, %dim_y) step (%c1, %c1) { %prod = arith.muli %i, %dim_y : index %val = arith.addi %prod, %j : index %val_i64 = arith.index_cast %val : index to i64 %val_f32 = arith.sitofp %val_i64 : i64 to f32 memref.store %val_f32, %input[%i, %j] : memref<2x3xf32> } %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> call @printMemrefF32(%unranked_input) : (memref<*xf32>) -> () call @cast_ranked_memref_to_static_shape(%input) : (memref<2x3xf32>) -> () call @cast_ranked_memref_to_dynamic_shape(%input) : (memref<2x3xf32>) -> () call @cast_unranked_memref_to_static_shape(%input) : (memref<2x3xf32>) -> () call @cast_unranked_memref_to_dynamic_shape(%input) : (memref<2x3xf32>) -> () memref.dealloc %input : memref<2x3xf32> return } func.func @cast_ranked_memref_to_static_shape(%input : memref<2x3xf32>) { %output = memref.reinterpret_cast %input to offset: [0], sizes: [6, 1], strides: [1, 1] : memref<2x3xf32> to memref<6x1xf32> %unranked_output = memref.cast %output : memref<6x1xf32> to memref<*xf32> call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> () return } func.func @cast_ranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c6 = arith.constant 6 : index %output = memref.reinterpret_cast %input to offset: [%c0], sizes: [%c1, %c6], strides: [%c6, %c1] : memref<2x3xf32> to memref> %unranked_output = memref.cast %output : memref> to memref<*xf32> call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> () return } func.func @cast_unranked_memref_to_static_shape(%input : memref<2x3xf32>) { %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> %output = memref.reinterpret_cast %unranked_input to offset: [0], sizes: [6, 1], strides: [1, 1] : memref<*xf32> to memref<6x1xf32> %unranked_output = memref.cast %output : memref<6x1xf32> to memref<*xf32> call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> () return } func.func @cast_unranked_memref_to_dynamic_shape(%input : memref<2x3xf32>) { %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c6 = arith.constant 6 : index %output = memref.reinterpret_cast %unranked_input to offset: [%c0], sizes: [%c1, %c6], strides: [%c6, %c1] : memref<*xf32> to memref> %unranked_output = memref.cast %output : memref> to memref<*xf32> call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-scf-to-cf),finalize-memref-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils ",1 "async.func @async_func_empty() -> !async.token { return } async.func @async_func_assert() -> !async.token { %false = arith.constant 0 : i1 cf.assert %false, ""error"" return } async.func @async_func_nested_assert() -> !async.token { %token0 = async.call @async_func_assert() : () -> !async.token async.await %token0 : !async.token return } async.func @async_func_value_assert() -> !async.value { %false = arith.constant 0 : i1 cf.assert %false, ""error"" %0 = arith.constant 123.45 : f32 return %0 : f32 } async.func @async_func_value_nested_assert() -> !async.value { %value0 = async.call @async_func_value_assert() : () -> !async.value %ret = async.await %value0 : !async.value return %ret : f32 } async.func @async_func_return_value() -> !async.value { %0 = arith.constant 456.789 : f32 return %0 : f32 } async.func @async_func_non_blocking_await() -> !async.value { %value0 = async.call @async_func_return_value() : () -> !async.value %1 = async.await %value0 : !async.value return %1 : f32 } async.func @async_func_inside_memref() -> !async.value> { %0 = memref.alloc() : memref %c0 = arith.constant 0.25 : f32 memref.store %c0, %0[] : memref return %0 : memref } async.func @async_func_passed_memref(%arg0 : !async.value>) -> !async.token { %unwrapped = async.await %arg0 : !async.value> %0 = memref.load %unwrapped[] : memref %1 = arith.addf %0, %0 : f32 memref.store %1, %unwrapped[] : memref return } async.func @async_execute_in_async_func(%arg0 : !async.value>) -> !async.token { %token0 = async.execute { %unwrapped = async.await %arg0 : !async.value> %0 = memref.load %unwrapped[] : memref %1 = arith.addf %0, %0 : f32 memref.store %1, %unwrapped[] : memref async.yield } async.await %token0 : !async.token return } func.func @main() { %false = arith.constant 0 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token0 = async.call @async_func_empty() : () -> !async.token async.runtime.await %token0 : !async.token %err0 = async.runtime.is_error %token0 : !async.token vector.print %err0 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token1 = async.call @async_func_assert() : () -> !async.token async.runtime.await %token1 : !async.token %err1 = async.runtime.is_error %token1 : !async.token vector.print %err1 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token2 = async.call @async_func_nested_assert() : () -> !async.token async.runtime.await %token2 : !async.token %err2 = async.runtime.is_error %token2 : !async.token vector.print %err2 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %value3 = async.call @async_func_value_nested_assert() : () -> !async.value async.runtime.await %value3 : !async.value %err3_0 = async.runtime.is_error %value3 : !async.value vector.print %err3_0 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %result0 = async.call @async_func_non_blocking_await() : () -> !async.value %4 = async.await %result0 : !async.value vector.print %4 : f32"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %result1 = async.call @async_func_inside_memref() : () -> !async.value> %5 = async.await %result1 : !async.value> %6 = memref.cast %5 : memref to memref<*xf32> call @printMemrefF32(%6) : (memref<*xf32>) -> ()"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token3 = async.call @async_func_passed_memref(%result1) : (!async.value>) -> !async.token async.await %token3 : !async.token call @printMemrefF32(%6) : (memref<*xf32>) -> ()"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token4 = async.call @async_execute_in_async_func(%result1) : (!async.value>) -> !async.token async.await %token4 : !async.token call @printMemrefF32(%6) : (memref<*xf32>) -> () memref.dealloc %5 : memref return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(async-func-to-async-runtime,async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }", mlir-cpu-runner ,1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }", mlir-cpu-runner -e foo ,1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }", mlir-cpu-runner --entry-point-result=i32 -e int32_main ,1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }", mlir-cpu-runner --entry-point-result=i64 -e int64_main ,1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }", mlir-cpu-runner -O3 ,1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }"," cp %t // RUN: mlir-cpu-runner %t -dump-object-file ",1 "llvm.func @logbf(f32) -> f32 llvm.func @malloc(i64) -> !llvm.ptr llvm.func @free(!llvm.ptr) llvm.func @main() -> f32 { %0 = llvm.mlir.constant(-4.200000e+02 : f32) : f32 %1 = llvm.call @logbf(%0) : (f32) -> f32 llvm.return %1 : f32 } llvm.func @allocation() -> !llvm.ptr { %0 = llvm.mlir.constant(4 : index) : i64 %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr %2 = llvm.bitcast %1 : !llvm.ptr to !llvm.ptr llvm.return %2 : !llvm.ptr } llvm.func @deallocation(%arg0: !llvm.ptr) { %0 = llvm.bitcast %arg0 : !llvm.ptr to !llvm.ptr llvm.call @free(%0) : (!llvm.ptr) -> () llvm.return } llvm.func @foo() -> f32 { %0 = llvm.call @allocation() : () -> !llvm.ptr %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32 %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %2, %3 : !llvm.ptr %4 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr %5 = llvm.load %4 : !llvm.ptr llvm.call @deallocation(%0) : (!llvm.ptr) -> () llvm.return %5 : f32 } llvm.func @int32_main() -> i32 { %0 = llvm.mlir.constant(42 : i32) : i32 llvm.return %0 : i32 } llvm.func @int64_main() -> i64 { %0 = llvm.mlir.constant(42 : i64) : i64 llvm.return %0 : i64 }"," ls %t.o // RUN: rm %t.o // RUN: mlir-cpu-runner -dump-object-file -object-filename=%T/test.o ",1 "func.func @main() { %A = memref.alloc() : memref<16x16xf32> %B = memref.alloc() : memref<16x16xf32> %C = memref.alloc() : memref<16x16xf32> %cf1 = arith.constant 1.00000e+00 : f32 linalg.fill ins(%cf1 : f32) outs(%A : memref<16x16xf32>) linalg.fill ins(%cf1 : f32) outs(%B : memref<16x16xf32>) %num_reps = arith.constant 5 : index %t_start = call @rtclock() : () -> f64 affine.for %arg0 = 0 to %num_reps { linalg.fill ins(%cf1 : f32) outs(%C : memref<16x16xf32>) func.call @sgemm_naive(%A, %B, %C) : (memref<16x16xf32>, memref<16x16xf32>, memref<16x16xf32>) -> () } %t_end = call @rtclock() : () -> f64 %t = arith.subf %t_end, %t_start : f64 %res = affine.load %C[0, 0]: memref<16x16xf32> vector.print %res: f32 %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %M = memref.dim %C, %c0 : memref<16x16xf32> %N = memref.dim %C, %c1 : memref<16x16xf32> %K = memref.dim %A, %c1 : memref<16x16xf32> %f1 = arith.muli %M, %N : index %f2 = arith.muli %f1, %K : index %num_flops_per_iter = arith.muli %c2, %f2 : index %num_flops_total = arith.muli %num_flops_per_iter, %num_reps: index %num_flops_total_i = arith.index_cast %num_flops_total : index to i16 %num_flops_total_f = arith.uitofp %num_flops_total_i : i16 to f64 %flops_per_s = arith.divf %num_flops_total_f, %t : f64 call @printFlops(%flops_per_s) : (f64) -> () memref.dealloc %A : memref<16x16xf32> memref.dealloc %B : memref<16x16xf32> memref.dealloc %C : memref<16x16xf32> return } func.func @sgemm_naive(%arg0: memref<16x16xf32>, %arg1: memref<16x16xf32>, %arg2: memref<16x16xf32>) { %c0 = arith.constant 0 : index affine.for %arg3 = 0 to 16 { affine.for %arg4 = 0 to 16 { %m = memref.alloc() : memref<1xf32> %v = affine.load %arg2[%arg3, %arg4] : memref<16x16xf32> affine.store %v, %m[%c0] : memref<1xf32> affine.for %arg5 = 0 to 16 { %3 = affine.load %arg0[%arg3, %arg5] : memref<16x16xf32> %4 = affine.load %arg1[%arg5, %arg4] : memref<16x16xf32> %5 = affine.load %m[0] : memref<1xf32> %6 = arith.mulf %3, %4 : f32 %7 = arith.addf %6, %5 : f32 affine.store %7, %m[0] : memref<1xf32> } %s = affine.load %m[%c0] : memref<1xf32> affine.store %s, %arg2[%arg3, %arg4] : memref<16x16xf32> memref.dealloc %m : memref<1xf32> } } return } func.func private @printFlops(f64) func.func private @rtclock() -> f64"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-linalg-to-loops,lower-affine,convert-scf-to-cf,convert-arith-to-llvm),convert-vector-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_c_runner_utils ",1 "func.func @print_0d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref memref.store %f, %A[]: memref %U = memref.cast %A : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref return } func.func @print_1d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref<16xf32> %B = memref.cast %A: memref<16xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<16xf32> return } func.func @print_3d() { %f = arith.constant 2.00000e+00 : f32 %f4 = arith.constant 4.00000e+00 : f32 %A = memref.alloc() : memref<3x4x5xf32> %B = memref.cast %A: memref<3x4x5xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %c2 = arith.constant 2 : index memref.store %f4, %B[%c2, %c2, %c2]: memref %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<3x4x5xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } !vector_type_C = vector<4x4xf32> !matrix_type_CC = memref<1x1x!vector_type_C> func.func @vector_splat_2d() { %c0 = arith.constant 0 : index %f10 = arith.constant 10.0 : f32 %vf10 = vector.splat %f10: !vector_type_C %C = memref.alloc() : !matrix_type_CC memref.store %vf10, %C[%c0, %c0]: !matrix_type_CC %CC = memref.cast %C: !matrix_type_CC to memref call @printMemrefVector4x4xf32(%CC): (memref) -> () memref.dealloc %C : !matrix_type_CC return } func.func private @printMemrefVector4x4xf32(memref) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e print_0d -entry-point-result=void -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils ",1 "func.func @print_0d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref memref.store %f, %A[]: memref %U = memref.cast %A : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref return } func.func @print_1d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref<16xf32> %B = memref.cast %A: memref<16xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<16xf32> return } func.func @print_3d() { %f = arith.constant 2.00000e+00 : f32 %f4 = arith.constant 4.00000e+00 : f32 %A = memref.alloc() : memref<3x4x5xf32> %B = memref.cast %A: memref<3x4x5xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %c2 = arith.constant 2 : index memref.store %f4, %B[%c2, %c2, %c2]: memref %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<3x4x5xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } !vector_type_C = vector<4x4xf32> !matrix_type_CC = memref<1x1x!vector_type_C> func.func @vector_splat_2d() { %c0 = arith.constant 0 : index %f10 = arith.constant 10.0 : f32 %vf10 = vector.splat %f10: !vector_type_C %C = memref.alloc() : !matrix_type_CC memref.store %vf10, %C[%c0, %c0]: !matrix_type_CC %CC = memref.cast %C: !matrix_type_CC to memref call @printMemrefVector4x4xf32(%CC): (memref) -> () memref.dealloc %C : !matrix_type_CC return } func.func private @printMemrefVector4x4xf32(memref) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e print_1d -entry-point-result=void -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils ",1 "func.func @print_0d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref memref.store %f, %A[]: memref %U = memref.cast %A : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref return } func.func @print_1d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref<16xf32> %B = memref.cast %A: memref<16xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<16xf32> return } func.func @print_3d() { %f = arith.constant 2.00000e+00 : f32 %f4 = arith.constant 4.00000e+00 : f32 %A = memref.alloc() : memref<3x4x5xf32> %B = memref.cast %A: memref<3x4x5xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %c2 = arith.constant 2 : index memref.store %f4, %B[%c2, %c2, %c2]: memref %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<3x4x5xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } !vector_type_C = vector<4x4xf32> !matrix_type_CC = memref<1x1x!vector_type_C> func.func @vector_splat_2d() { %c0 = arith.constant 0 : index %f10 = arith.constant 10.0 : f32 %vf10 = vector.splat %f10: !vector_type_C %C = memref.alloc() : !matrix_type_CC memref.store %vf10, %C[%c0, %c0]: !matrix_type_CC %CC = memref.cast %C: !matrix_type_CC to memref call @printMemrefVector4x4xf32(%CC): (memref) -> () memref.dealloc %C : !matrix_type_CC return } func.func private @printMemrefVector4x4xf32(memref) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e print_3d -entry-point-result=void -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils ",1 "func.func @print_0d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref memref.store %f, %A[]: memref %U = memref.cast %A : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref return } func.func @print_1d() { %f = arith.constant 2.00000e+00 : f32 %A = memref.alloc() : memref<16xf32> %B = memref.cast %A: memref<16xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<16xf32> return } func.func @print_3d() { %f = arith.constant 2.00000e+00 : f32 %f4 = arith.constant 4.00000e+00 : f32 %A = memref.alloc() : memref<3x4x5xf32> %B = memref.cast %A: memref<3x4x5xf32> to memref linalg.fill ins(%f : f32) outs(%B : memref) %c2 = arith.constant 2 : index memref.store %f4, %B[%c2, %c2, %c2]: memref %U = memref.cast %B : memref to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<3x4x5xf32> return } func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } !vector_type_C = vector<4x4xf32> !matrix_type_CC = memref<1x1x!vector_type_C> func.func @vector_splat_2d() { %c0 = arith.constant 0 : index %f10 = arith.constant 10.0 : f32 %vf10 = vector.splat %f10: !vector_type_C %C = memref.alloc() : !matrix_type_CC memref.store %vf10, %C[%c0, %c0]: !matrix_type_CC %CC = memref.cast %C: !matrix_type_CC to memref call @printMemrefVector4x4xf32(%CC): (memref) -> () memref.dealloc %C : !matrix_type_CC return } func.func private @printMemrefVector4x4xf32(memref) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e vector_splat_2d -entry-point-result=void -shared-libs=%mlir_runner_utils -shared-libs=%mlir_c_runner_utils ",1 "func.func @main() { %i0 = arith.constant 0 : index %i1 = arith.constant 1 : index %i2 = arith.constant 2 : index %i3 = arith.constant 3 : index %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1.0 : f32 %c2 = arith.constant 2.0 : f32 %c3 = arith.constant 3.0 : f32 %c4 = arith.constant 4.0 : f32 %A = memref.alloc() : memref<4xf32> linalg.fill ins(%c0 : f32) outs(%A : memref<4xf32>) %U = memref.cast %A : memref<4xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.store %c1, %A[%i0]: memref<4xf32> call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () call @printMemrefF32(%U): (memref<*xf32>) -> () %outer = async.execute { memref.store %c2, %A[%i1]: memref<4xf32> func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () func.call @printMemrefF32(%U): (memref<*xf32>) -> () %noop = async.execute { func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () async.yield } %inner = async.execute [%noop] { memref.store %c3, %A[%i2]: memref<4xf32> func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () func.call @printMemrefF32(%U): (memref<*xf32>) -> () async.yield } async.await %inner : !async.token memref.store %c4, %A[%i3]: memref<4xf32> func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () func.call @printMemrefF32(%U): (memref<*xf32>) -> () async.yield } async.await %outer : !async.token call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<4xf32> return } func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> () func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,finalize-memref-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "llvm.func @caller() -> i32 { %0 = llvm.mlir.constant(3 : i32) : i32 %1 = llvm.mlir.constant(2 : i32) : i32 %2 = llvm.mlir.constant(1 : i32) : i32 %3 = llvm.call @foo(%2, %1, %0) : (i32, i32, i32) -> i32 llvm.return %3 : i32 } llvm.func @foo(%arg0: i32, ...) -> i32 { %0 = llvm.mlir.constant(8 : i64) : i64 %1 = llvm.mlir.constant(2 : i32) : i32 %2 = llvm.mlir.constant(0 : i64) : i64 %3 = llvm.mlir.constant(0 : i64) : i64 %4 = llvm.mlir.constant(8 : i32) : i32 %5 = llvm.mlir.constant(3 : i32) : i32 %6 = llvm.mlir.constant(0 : i64) : i64 %7 = llvm.mlir.constant(0 : i64) : i64 %8 = llvm.mlir.constant(41 : i32) : i32 %9 = llvm.mlir.constant(0 : i32) : i32 %10 = llvm.mlir.constant(0 : i64) : i64 %11 = llvm.mlir.constant(0 : i64) : i64 %12 = llvm.mlir.constant(1 : i32) : i32 %13 = llvm.alloca %12 x !llvm.array<1 x struct<""struct.va_list"", (i32, i32, ptr, ptr)>> {alignment = 8 : i64} : (i32) -> !llvm.ptr, ptr)>>> %14 = llvm.bitcast %13 : !llvm.ptr, ptr)>>> to !llvm.ptr llvm.intr.vastart %14 : !llvm.ptr %15 = llvm.getelementptr %13[%11, %10, 0] : (!llvm.ptr, ptr)>>>, i64, i64) -> !llvm.ptr %16 = llvm.load %15 : !llvm.ptr %17 = llvm.icmp ""ult"" %16, %8 : i32 llvm.cond_br %17, ^bb1, ^bb2 ^bb1: %18 = llvm.getelementptr %13[%7, %6, 3] : (!llvm.ptr, ptr)>>>, i64, i64) -> !llvm.ptr> %19 = llvm.load %18 : !llvm.ptr> %20 = llvm.zext %16 : i32 to i64 %21 = llvm.getelementptr %19[%20] : (!llvm.ptr, i64) -> !llvm.ptr %22 = llvm.add %16, %4 : i32 llvm.store %22, %15 : !llvm.ptr llvm.br ^bb3(%21 : !llvm.ptr) ^bb2: %23 = llvm.getelementptr %13[%3, %2, 2] : (!llvm.ptr, ptr)>>>, i64, i64) -> !llvm.ptr> %24 = llvm.load %23 : !llvm.ptr> %25 = llvm.getelementptr %24[%0] : (!llvm.ptr, i64) -> !llvm.ptr llvm.store %25, %23 : !llvm.ptr> llvm.br ^bb3(%24 : !llvm.ptr) ^bb3(%26: !llvm.ptr): %27 = llvm.bitcast %26 : !llvm.ptr to !llvm.ptr %28 = llvm.load %27 : !llvm.ptr llvm.intr.vaend %14 : !llvm.ptr llvm.return %28 : i32 }", mlir-cpu-runner -e caller --entry-point-result=i32 ,1 "func.func @main() { %c1 = arith.constant 1 : index %c5 = arith.constant 5 : index %group = async.create_group %c5 : !async.group %token0 = async.execute { async.yield } %token1 = async.execute { async.yield } %token2 = async.execute { async.yield } %token3 = async.execute { async.yield } %token4 = async.execute { async.yield } %0 = async.add_to_group %token0, %group : !async.token %1 = async.add_to_group %token1, %group : !async.token %2 = async.add_to_group %token2, %group : !async.token %3 = async.add_to_group %token3, %group : !async.token %4 = async.add_to_group %token4, %group : !async.token %token5 = async.execute { async.await_all %group async.yield } %group0 = async.create_group %c1 : !async.group %5 = async.add_to_group %token5, %group0 : !async.token async.await_all %group0 call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () return } func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> ()"," export LSAN_OPTIONS=detect_leaks=0 // RUN: mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "func.func @simple_add1_add2_test(%arg0: memref<2xf32>, %arg1: memref<2xf32>) { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 1.000000e+00 : f32 %cst_0 = arith.constant 2.000000e+00 : f32 scf.for %arg2 = %c0 to %c2 step %c1 { %0 = memref.load %arg0[%arg2] : memref<2xf32> %1 = arith.addf %0, %cst : f32 memref.store %1, %arg0[%arg2] : memref<2xf32> %2 = memref.load %arg1[%arg2] : memref<2xf32> %3 = arith.addf %1, %cst_0 : f32 memref.store %3, %arg1[%arg2] : memref<2xf32> } return } func.func private @printF32(%arg0: f32) func.func private @printComma() func.func private @printNewline() func.func @main() { %c2 = arith.constant 2 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 1.000000e+00 : f32 %cst_0 = arith.constant 2.000000e+00 : f32 %a = memref.alloc() : memref<2xf32> %b = memref.alloc() : memref<2xf32> scf.for %i = %c0 to %c2 step %c1 { memref.store %cst, %a[%i] : memref<2xf32> memref.store %cst, %b[%i] : memref<2xf32> } call @simple_add1_add2_test(%a, %b) : (memref<2xf32>, memref<2xf32>) -> () %l0 = memref.load %a[%c0] : memref<2xf32> call @printF32(%l0) : (f32) -> () call @printComma() : () -> () %l1 = memref.load %a[%c1] : memref<2xf32> call @printF32(%l1) : (f32) -> () call @printNewline() : () -> () %l2 = memref.load %b[%c0] : memref<2xf32> call @printF32(%l2) : (f32) -> () call @printComma() : () -> () %l3 = memref.load %b[%c1] : memref<2xf32> call @printF32(%l3) : (f32) -> () call @printNewline() : () -> () memref.dealloc %a : memref<2xf32> memref.dealloc %b : memref<2xf32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-scf-to-cf,convert-arith-to-llvm),finalize-memref-to-llvm,convert-func-to-llvm{use-bare-ptr-memref-call-conv=1},reconcile-unrealized-casts)"" | mlir-cpu-runner -shared-libs=%mlir_c_runner_utils -entry-point-result=void ",1 "func.func @trunc_bf16(%a : f32) { %b = arith.truncf %a : f32 to bf16 %c = arith.extf %b : bf16 to f32 vector.print %c : f32 return } func.func @main() { %roundOneI = arith.constant 0x3f808000 : i32 %roundOneF = arith.bitcast %roundOneI : i32 to f32 call @trunc_bf16(%roundOneF): (f32) -> () %noRoundNegOneI = arith.constant 0xbf808000 : i32 %noRoundNegOneF = arith.bitcast %noRoundNegOneI : i32 to f32 call @trunc_bf16(%noRoundNegOneF): (f32) -> () %roundNegOneI = arith.constant 0xbf808001 : i32 %roundNegOneF = arith.bitcast %roundNegOneI : i32 to f32 call @trunc_bf16(%roundNegOneF): (f32) -> () %infi = arith.constant 0x7f800000 : i32 %inff = arith.bitcast %infi : i32 to f32 call @trunc_bf16(%inff): (f32) -> () %neginfi = arith.constant 0xff800000 : i32 %neginff = arith.bitcast %neginfi : i32 to f32 call @trunc_bf16(%neginff): (f32) -> () %bigi = arith.constant 0x7f7fffff : i32 %bigf = arith.bitcast %bigi : i32 to f32 call @trunc_bf16(%bigf): (f32) -> () %negbigi = arith.constant 0xff7fffff : i32 %negbigf = arith.bitcast %negbigi : i32 to f32 call @trunc_bf16(%negbigf): (f32) -> () %exprolli = arith.constant 0x3fcfffff : i32 %exprollf = arith.bitcast %exprolli : i32 to f32 call @trunc_bf16(%exprollf): (f32) -> () %exprollnegi = arith.constant 0xbfcfffff : i32 %exprollnegf = arith.bitcast %exprollnegi : i32 to f32 call @trunc_bf16(%exprollnegf): (f32) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(arith-expand{include-bf16=true},convert-arith-to-llvm),convert-vector-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "llvm.mlir.global internal constant @str_global(""String to print\0A"") llvm.func @printCString(!llvm.ptr) func.func @main() { %0 = llvm.mlir.addressof @str_global : !llvm.ptr> %1 = llvm.mlir.constant(0 : index) : i64 %2 = llvm.getelementptr %0[%1, %1] : (!llvm.ptr>, i64, i64) -> !llvm.ptr llvm.call @printCString(%2) : (!llvm.ptr) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils ",1 "func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } func.func @main() -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c42 = arith.constant 42.0 : f32 %input = memref.alloc() : memref<2x3xf32> %dim_x = memref.dim %input, %c0 : memref<2x3xf32> %dim_y = memref.dim %input, %c1 : memref<2x3xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%dim_x, %dim_y) step (%c1, %c1) { %prod = arith.muli %i, %dim_y : index %val = arith.addi %prod, %j : index %val_i64 = arith.index_cast %val : index to i64 %val_f32 = arith.sitofp %val_i64 : i64 to f32 memref.store %val_f32, %input[%i, %j] : memref<2x3xf32> } %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> call @printMemrefF32(%unranked_input) : (memref<*xf32>) -> () %copy = memref.alloc() : memref<2x3xf32> memref.copy %input, %copy : memref<2x3xf32> to memref<2x3xf32> %unranked_copy = memref.cast %copy : memref<2x3xf32> to memref<*xf32> call @printMemrefF32(%unranked_copy) : (memref<*xf32>) -> () %copy_two = memref.alloc() : memref<3x2xf32> %copy_two_casted = memref.reinterpret_cast %copy_two to offset: [0], sizes: [2, 3], strides: [1, 2] : memref<3x2xf32> to memref<2x3xf32, strided<[1, 2], offset: 0>> memref.copy %input, %copy_two_casted : memref<2x3xf32> to memref<2x3xf32, strided<[1, 2], offset: 0>> %unranked_copy_two = memref.cast %copy_two : memref<3x2xf32> to memref<*xf32> call @printMemrefF32(%unranked_copy_two) : (memref<*xf32>) -> () %input_empty = memref.alloc() : memref<3x0x1xf32> %copy_empty = memref.alloc() : memref<3x0x1xf32> memref.copy %input_empty, %copy_empty : memref<3x0x1xf32> to memref<3x0x1xf32> %input_empty_casted = memref.reinterpret_cast %input_empty to offset: [0], sizes: [0, 3, 1], strides: [3, 1, 1] : memref<3x0x1xf32> to memref<0x3x1xf32, strided<[3, 1, 1], offset: 0>> %copy_empty_casted = memref.alloc() : memref<0x3x1xf32> memref.copy %input_empty_casted, %copy_empty_casted : memref<0x3x1xf32, strided<[3, 1, 1], offset: 0>> to memref<0x3x1xf32> %scalar = memref.alloc() : memref memref.store %c42, %scalar[] : memref %scalar_copy = memref.alloc() : memref memref.copy %scalar, %scalar_copy : memref to memref %unranked_scalar_copy = memref.cast %scalar_copy : memref to memref<*xf32> call @printMemrefF32(%unranked_scalar_copy) : (memref<*xf32>) -> () memref.dealloc %copy_empty : memref<3x0x1xf32> memref.dealloc %copy_empty_casted : memref<0x3x1xf32> memref.dealloc %input_empty : memref<3x0x1xf32> memref.dealloc %copy_two : memref<3x2xf32> memref.dealloc %copy : memref<2x3xf32> memref.dealloc %input : memref<2x3xf32> memref.dealloc %scalar : memref memref.dealloc %scalar_copy : memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-scf-to-cf,convert-arith-to-llvm),finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @func_exp2f(%a : f64) { %r = math.exp2 %a : f64 vector.print %r : f64 return } func.func @exp2f() { %a = arith.constant 1.0 : f64 call @func_exp2f(%a) : (f64) -> () %b = arith.constant 2.0 : f64 call @func_exp2f(%b) : (f64) -> () %c = arith.constant 2.5 : f64 call @func_exp2f(%c) : (f64) -> () %d = arith.constant -1.75 : f64 call @func_exp2f(%d) : (f64) -> () %e = arith.constant 0.132 : f64 call @func_exp2f(%e) : (f64) -> () %f1 = arith.constant 0.00 : f64 %f2 = arith.constant 1.00 : f64 %f = arith.divf %f2, %f1 : f64 call @func_exp2f(%f) : (f64) -> () %g = arith.constant 5038939.0 : f64 call @func_exp2f(%g) : (f64) -> () %neg_inf = arith.constant 0xff80000000000000 : f64 call @func_exp2f(%neg_inf) : (f64) -> () %i = arith.constant 0x7fc0000000000000 : f64 call @func_exp2f(%i) : (f64) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @func_roundf(%a : f32) { %r = math.round %a : f32 vector.print %r : f32 return } func.func @func_roundf$bitcast_result_to_int(%a : f32) { %b = math.round %a : f32 %c = arith.bitcast %b : f32 to i32 vector.print %c : i32 return } func.func @func_roundf$vector(%a : vector<1xf32>) { %b = math.round %a : vector<1xf32> vector.print %b : vector<1xf32> return } func.func @roundf() { %a = arith.constant 3.8 : f32 call @func_roundf(%a) : (f32) -> () %b = arith.constant -3.8 : f32 call @func_roundf(%b) : (f32) -> () %c = arith.constant -4.2 : f32 call @func_roundf(%c) : (f32) -> () %d = arith.constant -495.0 : f32 call @func_roundf(%d) : (f32) -> () %e = arith.constant 495.0 : f32 call @func_roundf(%e) : (f32) -> () %f = arith.constant 8.5 : f32 call @func_roundf(%f) : (f32) -> () %g = arith.constant -8.5 : f32 call @func_roundf(%g) : (f32) -> () %h = arith.constant -0.4 : f32 call @func_roundf(%h) : (f32) -> () %cNeg0 = arith.constant -0.0 : f32 %c0 = arith.constant 0.0 : f32 %cInfInt = arith.constant 0x7f800000 : i32 %cInf = arith.bitcast %cInfInt : i32 to f32 %cNegInfInt = arith.constant 0xff800000 : i32 %cNegInf = arith.bitcast %cNegInfInt : i32 to f32 %cNanInt = arith.constant 0x7fc00000 : i32 %cNan = arith.bitcast %cNanInt : i32 to f32 %cNegNanInt = arith.constant 0xffc00000 : i32 %cNegNan = arith.bitcast %cNegNanInt : i32 to f32 call @func_roundf(%cNeg0) : (f32) -> () call @func_roundf(%c0) : (f32) -> () call @func_roundf(%cInf) : (f32) -> () call @func_roundf(%cNegInf) : (f32) -> () call @func_roundf$bitcast_result_to_int(%cNan) : (f32) -> () vector.print %cNanInt : i32 call @func_roundf$bitcast_result_to_int(%cNegNan) : (f32) -> () vector.print %cNegNanInt : i32 %c2To100 = arith.constant 1.268e30 : f32 call @func_roundf(%c2To100) : (f32) -> () %c8388606_5 = arith.constant 8388606.5 : f32 %c8388607 = arith.constant 8388607.0 : f32 %c8388607_5 = arith.constant 8388607.5 : f32 %c8388608 = arith.constant 8388608.0 : f32 %c8388609 = arith.constant 8388609.0 : f32 call @func_roundf$bitcast_result_to_int(%c8388606_5) : (f32) -> () call @func_roundf$bitcast_result_to_int(%c8388607) : (f32) -> () call @func_roundf$bitcast_result_to_int(%c8388607_5) : (f32) -> () call @func_roundf$bitcast_result_to_int(%c8388608) : (f32) -> () call @func_roundf$bitcast_result_to_int(%c8388609) : (f32) -> () %cVec = arith.constant dense<[0.5]> : vector<1xf32> call @func_roundf$vector(%cVec) : (vector<1xf32>) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @func_powff64(%a : f64, %b : f64) { %r = math.powf %a, %b : f64 vector.print %r : f64 return } func.func @powf() { %a = arith.constant 4.0 : f64 %a_p = arith.constant 2.0 : f64 call @func_powff64(%a, %a_p) : (f64, f64) -> () %b = arith.constant -3.0 : f64 %b_p = arith.constant 3.0 : f64 call @func_powff64(%b, %b_p) : (f64, f64) -> () %c = arith.constant 2.343 : f64 %c_p = arith.constant 1.000 : f64 call @func_powff64(%c, %c_p) : (f64, f64) -> () %d = arith.constant 4.25 : f64 %d_p = arith.constant -1.2 : f64 call @func_powff64(%d, %d_p) : (f64, f64) -> () %e = arith.constant 4.385 : f64 %e_p = arith.constant 0.00 : f64 call @func_powff64(%e, %e_p) : (f64, f64) -> () %f = arith.constant 4.835 : f64 %f_p = arith.constant 1.2 : f64 call @func_powff64(%f, %f_p) : (f64, f64) -> () %g = arith.constant 0xff80000000000000 : f64 call @func_powff64(%g, %g) : (f64, f64) -> () %h = arith.constant 0x7fffffffffffffff : f64 call @func_powff64(%h, %h) : (f64, f64) -> () %i = arith.constant 1.0 : f64 call @func_powff64(%i, %h) : (f64, f64) -> () %j = arith.constant 29385.0 : f64 %j_p = arith.constant 23598.0 : f64 call @func_powff64(%j, %j_p) : (f64, f64) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @func_roundeven(%a : f32) { %b = math.roundeven %a : f32 vector.print %b : f32 return } func.func @func_roundeven$bitcast_result_to_int(%a : f32) { %b = math.roundeven %a : f32 %c = arith.bitcast %b : f32 to i32 vector.print %c : i32 return } func.func @func_roundeven$vector(%a : vector<1xf32>) { %b = math.roundeven %a : vector<1xf32> vector.print %b : vector<1xf32> return } func.func @roundeven() { %c0_25 = arith.constant 0.25 : f32 %c0_5 = arith.constant 0.5 : f32 %c0_75 = arith.constant 0.75 : f32 %c1 = arith.constant 1.0 : f32 %c1_25 = arith.constant 1.25 : f32 %c1_5 = arith.constant 1.5 : f32 %c1_75 = arith.constant 1.75 : f32 %c2 = arith.constant 2.0 : f32 %c2_25 = arith.constant 2.25 : f32 %c2_5 = arith.constant 2.5 : f32 %c2_75 = arith.constant 2.75 : f32 %c3 = arith.constant 3.0 : f32 %c3_25 = arith.constant 3.25 : f32 %c3_5 = arith.constant 3.5 : f32 %c3_75 = arith.constant 3.75 : f32 %cNeg0_25 = arith.constant -0.25 : f32 %cNeg0_5 = arith.constant -0.5 : f32 %cNeg0_75 = arith.constant -0.75 : f32 %cNeg1 = arith.constant -1.0 : f32 %cNeg1_25 = arith.constant -1.25 : f32 %cNeg1_5 = arith.constant -1.5 : f32 %cNeg1_75 = arith.constant -1.75 : f32 %cNeg2 = arith.constant -2.0 : f32 %cNeg2_25 = arith.constant -2.25 : f32 %cNeg2_5 = arith.constant -2.5 : f32 %cNeg2_75 = arith.constant -2.75 : f32 %cNeg3 = arith.constant -3.0 : f32 %cNeg3_25 = arith.constant -3.25 : f32 %cNeg3_5 = arith.constant -3.5 : f32 %cNeg3_75 = arith.constant -3.75 : f32 call @func_roundeven(%c0_25) : (f32) -> () call @func_roundeven(%c0_5) : (f32) -> () call @func_roundeven(%c0_75) : (f32) -> () call @func_roundeven(%c1) : (f32) -> () call @func_roundeven(%c1_25) : (f32) -> () call @func_roundeven(%c1_5) : (f32) -> () call @func_roundeven(%c1_75) : (f32) -> () call @func_roundeven(%c2) : (f32) -> () call @func_roundeven(%c2_25) : (f32) -> () call @func_roundeven(%c2_5) : (f32) -> () call @func_roundeven(%c2_75) : (f32) -> () call @func_roundeven(%c3) : (f32) -> () call @func_roundeven(%c3_25) : (f32) -> () call @func_roundeven(%c3_5) : (f32) -> () call @func_roundeven(%c3_75) : (f32) -> () call @func_roundeven(%cNeg0_25) : (f32) -> () call @func_roundeven(%cNeg0_5) : (f32) -> () call @func_roundeven(%cNeg0_75) : (f32) -> () call @func_roundeven(%cNeg1) : (f32) -> () call @func_roundeven(%cNeg1_25) : (f32) -> () call @func_roundeven(%cNeg1_5) : (f32) -> () call @func_roundeven(%cNeg1_75) : (f32) -> () call @func_roundeven(%cNeg2) : (f32) -> () call @func_roundeven(%cNeg2_25) : (f32) -> () call @func_roundeven(%cNeg2_5) : (f32) -> () call @func_roundeven(%cNeg2_75) : (f32) -> () call @func_roundeven(%cNeg3) : (f32) -> () call @func_roundeven(%cNeg3_25) : (f32) -> () call @func_roundeven(%cNeg3_5) : (f32) -> () call @func_roundeven(%cNeg3_75) : (f32) -> () %cNeg0 = arith.constant -0.0 : f32 %c0 = arith.constant 0.0 : f32 %cInfInt = arith.constant 0x7f800000 : i32 %cInf = arith.bitcast %cInfInt : i32 to f32 %cNegInfInt = arith.constant 0xff800000 : i32 %cNegInf = arith.bitcast %cNegInfInt : i32 to f32 %cNanInt = arith.constant 0x7fc00000 : i32 %cNan = arith.bitcast %cNanInt : i32 to f32 %cNegNanInt = arith.constant 0xffc00000 : i32 %cNegNan = arith.bitcast %cNegNanInt : i32 to f32 call @func_roundeven(%cNeg0) : (f32) -> () call @func_roundeven(%c0) : (f32) -> () call @func_roundeven(%cInf) : (f32) -> () call @func_roundeven(%cNegInf) : (f32) -> () call @func_roundeven$bitcast_result_to_int(%cNan) : (f32) -> () vector.print %cNanInt : i32 call @func_roundeven$bitcast_result_to_int(%cNegNan) : (f32) -> () vector.print %cNegNanInt : i32 %c8388606_5 = arith.constant 8388606.5 : f32 %c8388607 = arith.constant 8388607.0 : f32 %c8388607_5 = arith.constant 8388607.5 : f32 %c8388608 = arith.constant 8388608.0 : f32 %c8388609 = arith.constant 8388609.0 : f32 call @func_roundeven$bitcast_result_to_int(%c8388606_5) : (f32) -> () call @func_roundeven$bitcast_result_to_int(%c8388607) : (f32) -> () call @func_roundeven$bitcast_result_to_int(%c8388607_5) : (f32) -> () call @func_roundeven$bitcast_result_to_int(%c8388608) : (f32) -> () call @func_roundeven$bitcast_result_to_int(%c8388609) : (f32) -> () %cVec = arith.constant dense<[0.5]> : vector<1xf32> call @func_roundeven$vector(%cVec) : (vector<1xf32>) -> () return } func.func @main() { call @exp2f() : () -> () call @roundf() : () -> () call @powf() : () -> () call @roundeven() : () -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(test-expand-math,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } func.func private @printMemrefI32(memref<*xi32>) attributes { llvm.emit_c_interface } func.func private @printNewline() -> () memref.global ""private"" @gv0 : memref<4xf32> = dense<[0.0, 1.0, 2.0, 3.0]> func.func @test1DMemref() { %0 = memref.get_global @gv0 : memref<4xf32> %U = memref.cast %0 : memref<4xf32> to memref<*xf32> call @printMemrefF32(%U) : (memref<*xf32>) -> () call @printNewline() : () -> () %c0 = arith.constant 0 : index %c2 = arith.constant 2 : index %fp0 = arith.constant 4.0 : f32 %fp1 = arith.constant 5.0 : f32 memref.store %fp0, %0[%c0] : memref<4xf32> memref.store %fp1, %0[%c2] : memref<4xf32> call @printMemrefF32(%U) : (memref<*xf32>) -> () call @printNewline() : () -> () return } memref.global constant @gv1 : memref<3x2xi32> = dense<[[0, 1],[2, 3],[4, 5]]> func.func @testConstantMemref() { %0 = memref.get_global @gv1 : memref<3x2xi32> %U = memref.cast %0 : memref<3x2xi32> to memref<*xi32> call @printMemrefI32(%U) : (memref<*xi32>) -> () call @printNewline() : () -> () return } memref.global ""private"" @gv2 : memref<4x2xf32> = dense<[[0.0, 1.0], [2.0, 3.0], [4.0, 5.0], [6.0, 7.0]]> func.func @test2DMemref() { %0 = memref.get_global @gv2 : memref<4x2xf32> %U = memref.cast %0 : memref<4x2xf32> to memref<*xf32> call @printMemrefF32(%U) : (memref<*xf32>) -> () call @printNewline() : () -> () %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %fp10 = arith.constant 10.0 : f32 memref.store %fp10, %0[%c0, %c1] : memref<4x2xf32> call @printMemrefF32(%U) : (memref<*xf32>) -> () call @printNewline() : () -> () return } memref.global @gv3 : memref = dense<11> func.func @testScalarMemref() { %0 = memref.get_global @gv3 : memref %U = memref.cast %0 : memref to memref<*xi32> call @printMemrefI32(%U) : (memref<*xi32>) -> () call @printNewline() : () -> () return } func.func @main() -> () { call @test1DMemref() : () -> () call @testConstantMemref() : () -> () call @test2DMemref() : () -> () call @testScalarMemref() : () -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils ",1 "func.func @main() { %false = arith.constant 0 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token0 = async.execute { async.yield } async.runtime.await %token0 : !async.token %err0 = async.runtime.is_error %token0 : !async.token vector.print %err0 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token1 = async.execute { cf.assert %false, ""error"" async.yield } async.runtime.await %token1 : !async.token %err1 = async.runtime.is_error %token1 : !async.token vector.print %err1 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token2 = async.execute { %token = async.execute { cf.assert %false, ""error"" async.yield } async.await %token : !async.token async.yield } async.runtime.await %token2 : !async.token %err2 = async.runtime.is_error %token2 : !async.token vector.print %err2 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %token3, %value3 = async.execute -> !async.value { %token, %value = async.execute -> !async.value { cf.assert %false, ""error"" %0 = arith.constant 123.45 : f32 async.yield %0 : f32 } %ret = async.await %value : !async.value async.yield %ret : f32 } async.runtime.await %token3 : !async.token async.runtime.await %value3 : !async.value %err3_0 = async.runtime.is_error %token3 : !async.token %err3_1 = async.runtime.is_error %value3 : !async.value vector.print %err3_0 : i1 vector.print %err3_1 : i1"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 ------------------------------------------------------------------- ," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "------------------------------------------------------------------- %c2 = arith.constant 2 : index %group0 = async.create_group %c2 : !async.group %token4 = async.execute { async.yield } %token5 = async.execute { cf.assert %false, ""error"" async.yield } %idx0 = async.add_to_group %token4, %group0 : !async.token %idx1 = async.add_to_group %token5, %group0 : !async.token async.runtime.await %group0 : !async.group %err4 = async.runtime.is_error %group0 : !async.group vector.print %err4 : i1 return }"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils -shared-libs=%mlir_async_runtime ",1 "func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface } func.func @main() -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %input = memref.alloc() : memref<2x3xf32> %dim_x = memref.dim %input, %c0 : memref<2x3xf32> %dim_y = memref.dim %input, %c1 : memref<2x3xf32> scf.parallel (%i, %j) = (%c0, %c0) to (%dim_x, %dim_y) step (%c1, %c1) { %prod = arith.muli %i, %dim_y : index %val = arith.addi %prod, %j : index %val_i64 = arith.index_cast %val : index to i64 %val_f32 = arith.sitofp %val_i64 : i64 to f32 memref.store %val_f32, %input[%i, %j] : memref<2x3xf32> } %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> call @printMemrefF32(%unranked_input) : (memref<*xf32>) -> () %shape = memref.alloc() : memref<2xindex> %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index memref.store %c3, %shape[%c0] : memref<2xindex> memref.store %c2, %shape[%c1] : memref<2xindex> call @reshape_ranked_memref_to_ranked(%input, %shape) : (memref<2x3xf32>, memref<2xindex>) -> () call @reshape_unranked_memref_to_ranked(%input, %shape) : (memref<2x3xf32>, memref<2xindex>) -> () call @reshape_ranked_memref_to_unranked(%input, %shape) : (memref<2x3xf32>, memref<2xindex>) -> () call @reshape_unranked_memref_to_unranked(%input, %shape) : (memref<2x3xf32>, memref<2xindex>) -> () memref.dealloc %input : memref<2x3xf32> memref.dealloc %shape : memref<2xindex> return } func.func @reshape_ranked_memref_to_ranked(%input : memref<2x3xf32>, %shape : memref<2xindex>) { %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref<2xindex>) -> memref %unranked_output = memref.cast %output : memref to memref<*xf32> call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> () return } func.func @reshape_unranked_memref_to_ranked(%input : memref<2x3xf32>, %shape : memref<2xindex>) { %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref<2xindex>) -> memref %unranked_output = memref.cast %output : memref to memref<*xf32> call @printMemrefF32(%unranked_output) : (memref<*xf32>) -> () return } func.func @reshape_ranked_memref_to_unranked(%input : memref<2x3xf32>, %shape : memref<2xindex>) { %dyn_size_shape = memref.cast %shape : memref<2xindex> to memref %output = memref.reshape %input(%dyn_size_shape) : (memref<2x3xf32>, memref) -> memref<*xf32> call @printMemrefF32(%output) : (memref<*xf32>) -> () return } func.func @reshape_unranked_memref_to_unranked(%input : memref<2x3xf32>, %shape : memref<2xindex>) { %unranked_input = memref.cast %input : memref<2x3xf32> to memref<*xf32> %dyn_size_shape = memref.cast %shape : memref<2xindex> to memref %output = memref.reshape %input(%dyn_size_shape) : (memref<2x3xf32>, memref) -> memref<*xf32> call @printMemrefF32(%output) : (memref<*xf32>) -> () return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-scf-to-cf,memref-expand,convert-arith-to-llvm),finalize-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts)"" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils ",1 --------------------------------------------------------------------- ," mlir-opt -test-math-polynomial-approximation=""enable-avx2"" -convert-arith-to-llvm -convert-vector-to-llvm=""enable-x86vector"" -convert-math-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 "--------------------------------------------------------------------- func.func @rsqrt() { %0 = arith.constant 0.0 : f32 %rsqrt_0 = math.rsqrt %0 : f32 vector.print %rsqrt_0 : f32 %two = arith.constant 2.0: f32 %rsqrt_two = math.rsqrt %two : f32 vector.print %rsqrt_two : f32 %vec8 = arith.constant dense<2.0> : vector<8xf32> %rsqrt_vec8 = math.rsqrt %vec8 : vector<8xf32> vector.print %rsqrt_vec8 : vector<8xf32> return } func.func @main() { call @rsqrt(): () -> () return }"," mlir-opt -test-math-polynomial-approximation=""enable-avx2"" -convert-arith-to-llvm -convert-vector-to-llvm=""enable-x86vector"" -convert-math-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | mlir-cpu-runner -e main -entry-point-result=void -O0 -shared-libs=%mlir_c_runner_utils -shared-libs=%mlir_runner_utils ",1 func.func private @foo(), not mlir-reduce -opt-reduction-pass --no-implicit-module 2>&1 ,1 func.func private @foo(), not mlir-reduce -reduction-tree --no-implicit-module 2>&1 ,1 "func.func private @dead_private_function() func.func nested @dead_nested_function() func.func @simple1(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { ""test.op_crash"" () : () -> () return }", mlir-reduce -opt-reduction-pass='opt-pass=symbol-dce test=%S/failure-test.sh' ,1 "func.func @simple1() { return } func.func @simple2(%arg0: i32, %arg1: i32, %arg2: i32) { %0 = ""test.op_crash_long"" (%arg0, %arg1, %arg2) : (i32, i32, i32) -> i32 return } func.func @simple5() { return }", mlir-reduce -reduction-tree='traversal-mode=0 test=%S/failure-test.sh' ,1 "func.func @simple1() { return } func.func @simple2() { return } func.func @simple3() { ""test.op_crash"" () : () -> () return } func.func @simple4(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): ""test.op_crash""(%1, %arg2) : (memref<2xf32>, memref<2xf32>) -> () return } func.func @simple5() { return }", mlir-reduce -reduction-tree='traversal-mode=0 test=%S/failure-test.sh' ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.apply_constraint ""multi_entity_constraint""(%root, %root : !pdl.operation, !pdl.operation) -> ^pat, ^end ^pat: pdl_interp.apply_constraint ""single_entity_constraint""(%root : !pdl.operation) -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.replaced_by_pattern"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.apply_constraint_1 } { ""test.op""() { test_attr } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %results = pdl_interp.get_results of %root : !pdl.range %types = pdl_interp.get_value_type of %results : !pdl.range pdl_interp.apply_constraint ""multi_entity_var_constraint""(%results, %types : !pdl.range, !pdl.range) -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.replaced_by_pattern"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.apply_constraint_2 } { ""test.failure_op""() { test_attr } : () -> () ""test.success_op""() : () -> (i32, i64) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %operand = pdl_interp.get_operand 0 of %root pdl_interp.apply_rewrite ""rewriter""(%root, %operand : !pdl.operation, !pdl.value) pdl_interp.finalize } } } module @ir attributes { test.apply_rewrite_1 } { %input = ""test.op_input""() : () -> i32 ""test.op""(%input) : (i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.apply_rewrite ""creator""(%root : !pdl.operation) : !pdl.operation pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.apply_rewrite_2 } { ""test.op""() : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %operands, %types = pdl_interp.apply_rewrite ""var_creator""(%root : !pdl.operation) : !pdl.range, !pdl.range %op = pdl_interp.create_operation ""test.success""(%operands : !pdl.range) -> (%types : !pdl.range) pdl_interp.replace %root with (%operands : !pdl.range) pdl_interp.finalize } } } module @ir attributes { test.apply_rewrite_3 } { %first_operand = ""test.producer""() : () -> (i32) %operand = ""test.op""(%first_operand) : (i32) -> (i32) ""test.consumer""(%operand) : (i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %attr = pdl_interp.apply_rewrite ""str_creator"" : !pdl.attribute %type = pdl_interp.apply_rewrite ""type_creator"" : !pdl.type %newOp = pdl_interp.create_operation ""test.success"" {""attr"" = %attr} -> (%type : !pdl.type) pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.apply_rewrite_4 } { ""test.op""() : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %test_attr = pdl_interp.create_attribute unit %attr = pdl_interp.get_attribute ""test_attr"" of %root pdl_interp.are_equal %test_attr, %attr : !pdl.attribute -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.are_equal_1 } { ""test.op""() { test_attr } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %const_types = pdl_interp.create_types [i32, i64] %results = pdl_interp.get_results of %root : !pdl.range %result_types = pdl_interp.get_value_type of %results : !pdl.range pdl_interp.are_equal %result_types, %const_types : !pdl.range -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.are_equal_2 } { ""test.not_equal""() : () -> (i32) ""test.op""() : () -> (i32, i64) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat1, ^end ^pat1: pdl_interp.branch ^pat2 ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(2), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.branch_1 } { ""test.op""() : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %attr = pdl_interp.get_attribute ""test_attr"" of %root pdl_interp.check_attribute %attr is unit -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.check_attribute_1 } { ""test.op""() { test_attr } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operand_count of %root is at_least 1 -> ^exact_check, ^end ^exact_check: pdl_interp.check_operand_count of %root is 2 -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.check_operand_count_1 } { %operand = ""test.op""() : () -> i32 ""test.op""(%operand, %operand) : (i32, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.check_operation_name_1 } { ""test.op""() : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_result_count of %root is at_least 1 -> ^exact_check, ^end ^exact_check: pdl_interp.check_result_count of %root is 2 -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.check_result_count_1 } { ""test.op""() : () -> i32 ""test.op""() : () -> (i32, i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %attr = pdl_interp.get_attribute ""test_attr"" of %root pdl_interp.is_not_null %attr : !pdl.attribute -> ^pat1, ^end ^pat1: %type = pdl_interp.get_attribute_type of %attr pdl_interp.check_type %type is i32 -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.check_type_1 } { ""test.op""() { test_attr = 10 : i32 } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %results = pdl_interp.get_results of %root : !pdl.range %result_types = pdl_interp.get_value_type of %results : !pdl.range pdl_interp.check_types %result_types are [i32] -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.check_types_1 } { ""test.op""() : () -> (i32, i64) ""test.op""() : () -> i32 }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "arith.constant 10 module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %attr = pdl_interp.create_attribute true %cst = pdl_interp.create_operation ""arith.constant"" {""value"" = %attr} -> %cstResults = pdl_interp.get_results of %cst : !pdl.range %op = pdl_interp.create_operation ""test.success""(%cstResults : !pdl.range) pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.create_op_infer_results } { %results:2 = ""test.op""() : () -> (i64, i64) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operand_count of %root is 2 -> ^pat1, ^end ^pat1: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root: !pdl.operation) { %rootOperand = pdl_interp.get_operand 0 of %root %rootOperands = pdl_interp.get_operands of %root : !pdl.range %operandRange = pdl_interp.create_range %rootOperand, %rootOperands : !pdl.value, !pdl.range %operandType = pdl_interp.get_value_type of %rootOperand : !pdl.type %operandTypes = pdl_interp.get_value_type of %rootOperands : !pdl.range %typeRange = pdl_interp.create_range %operandType, %operandTypes : !pdl.type, !pdl.range %op = pdl_interp.create_operation ""test.success""(%operandRange : !pdl.range) -> (%typeRange : !pdl.range) pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.create_range_1 } { %values:2 = ""test.input""() : () -> (i32, i32) ""test.op""(%values#0, %values#1) : (i32, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %attr = pdl_interp.get_attribute ""test_attr"" of %root pdl_interp.is_not_null %attr : !pdl.attribute -> ^pat1, ^end ^pat1: %test_type = pdl_interp.create_type i32 %type = pdl_interp.get_attribute_type of %attr pdl_interp.are_equal %type, %test_type : !pdl.type -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.create_type_1 } { ""test.op""() { test_attr = 0 : i32 } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %val = pdl_interp.get_result 0 of %root %ops = pdl_interp.get_users of %val : !pdl.value %op1 = pdl_interp.extract 1 of %ops : !pdl.operation pdl_interp.is_not_null %op1 : !pdl.operation -> ^success, ^end ^success: pdl_interp.record_match @rewriters::@success(%op1 : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.extract_op } { %operand = ""test.op""() : () -> i32 ""test.op""(%operand) : (i32) -> (i32) ""test.op""(%operand, %operand) : (i32, i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %vals = pdl_interp.get_results of %root : !pdl.range %types = pdl_interp.get_value_type of %vals : !pdl.range %type1 = pdl_interp.extract 1 of %types : !pdl.type pdl_interp.is_not_null %type1 : !pdl.type -> ^success, ^end ^success: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.extract_type } { %operand = ""test.op""() : () -> i32 ""test.op""(%operand) : (i32) -> (i32, i32) ""test.op""(%operand) : (i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %vals = pdl_interp.get_results of %root : !pdl.range %val1 = pdl_interp.extract 1 of %vals : !pdl.value pdl_interp.is_not_null %val1 : !pdl.value -> ^success, ^end ^success: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.extract_value } { %operand = ""test.op""() : () -> i32 ""test.op""(%operand) : (i32) -> (i32, i32) ""test.op""(%operand) : (i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %val1 = pdl_interp.get_result 0 of %root %ops1 = pdl_interp.get_users of %val1 : !pdl.value pdl_interp.foreach %op1 : !pdl.operation in %ops1 { %val2 = pdl_interp.get_result 0 of %op1 %ops2 = pdl_interp.get_users of %val2 : !pdl.value pdl_interp.foreach %op2 : !pdl.operation in %ops2 { pdl_interp.record_match @rewriters::@success(%op2 : !pdl.operation) : benefit(1), loc([%root]) -> ^cont ^cont: pdl_interp.continue } -> ^cont ^cont: pdl_interp.continue } -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.foreach } { %root = ""test.op""() : () -> i32 %valA = ""test.op""(%root) : (i32) -> (i32) ""test.op""(%valA) : (i32) -> (i32) ""test.op""(%valA) : (i32) -> (i32) %valB = ""test.op""(%root) : (i32) -> (i32) ""test.op""(%valB) : (i32) -> (i32) ""test.op""(%valB) : (i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %val = pdl_interp.get_result 0 of %root %ops = pdl_interp.get_users of %val : !pdl.value pdl_interp.foreach %op : !pdl.operation in %ops { pdl_interp.record_match @rewriters::@success(%op : !pdl.operation) : benefit(1), loc([%root]) -> ^cont ^cont: pdl_interp.continue } -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.get_users_of_value } { %operand = ""test.op""() : () -> i32 ""test.op""(%operand) : (i32) -> (i32) ""test.op""(%operand, %operand) : (i32, i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_result_count of %root is at_least 2 -> ^next, ^end ^next: %vals = pdl_interp.get_results of %root : !pdl.range %ops = pdl_interp.get_users of %vals : !pdl.range pdl_interp.foreach %op : !pdl.operation in %ops { pdl_interp.record_match @rewriters::@success(%op : !pdl.operation) : benefit(1), loc([%root]) -> ^cont ^cont: pdl_interp.continue } -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.get_all_users_of_range } { %operands:2 = ""test.op""() : () -> (i32, i32) ""test.op""(%operands#0) : (i32) -> (i32) ""test.op""(%operands#1) : (i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_result_count of %root is at_least 2 -> ^next, ^end ^next: %vals = pdl_interp.get_results of %root : !pdl.range %val = pdl_interp.extract 0 of %vals : !pdl.value %ops = pdl_interp.get_users of %val : !pdl.value pdl_interp.foreach %op : !pdl.operation in %ops { pdl_interp.record_match @rewriters::@success(%op : !pdl.operation) : benefit(1), loc([%root]) -> ^cont ^cont: pdl_interp.continue } -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%matched : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %matched pdl_interp.finalize } } } module @ir attributes { test.get_first_users_of_range } { %operands:2 = ""test.op""() : () -> (i32, i32) ""test.op""(%operands#0) : (i32) -> (i32) ""test.op""(%operands#1) : (i32) -> (i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operand_count of %root is 5 -> ^pat1, ^end ^pat1: %operand0 = pdl_interp.get_operand 0 of %root %operand4 = pdl_interp.get_operand 4 of %root %defOp0 = pdl_interp.get_defining_op of %operand0 : !pdl.value %defOp4 = pdl_interp.get_defining_op of %operand4 : !pdl.value pdl_interp.are_equal %defOp0, %defOp4 : !pdl.operation -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.get_defining_op_1 } { %operand = ""test.op""() : () -> i32 %other_operand = ""test.op""() : () -> i32 ""test.op""(%operand, %operand, %operand, %operand, %operand) : (i32, i32, i32, i32, i32) -> () ""test.op""(%operand, %operand, %operand, %operand, %other_operand) : (i32, i32, i32, i32, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operand_count of %root is 2 -> ^pat1, ^end ^pat1: %operands = pdl_interp.get_operands 0 of %root : !pdl.range %full_operands = pdl_interp.get_operands of %root : !pdl.range pdl_interp.are_equal %operands, %full_operands : !pdl.range -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.get_operands_1 } { %inputs:2 = ""test.producer""() : () -> (i32, i32) ""test.op""(%inputs#0, %inputs#1) : (i32, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.attr_sized_operands"" -> ^pat1, ^end ^pat1: %operands_0 = pdl_interp.get_operands 0 of %root : !pdl.range pdl_interp.is_not_null %operands_0 : !pdl.range -> ^pat2, ^end ^pat2: %operands_0_single = pdl_interp.get_operands 0 of %root : !pdl.value pdl_interp.is_not_null %operands_0_single : !pdl.value -> ^end, ^pat3 ^pat3: %operands_1 = pdl_interp.get_operands 1 of %root : !pdl.range pdl_interp.is_not_null %operands_1 : !pdl.range -> ^pat4, ^end ^pat4: %operands_1_single = pdl_interp.get_operands 1 of %root : !pdl.value pdl_interp.is_not_null %operands_1_single : !pdl.value -> ^end, ^pat5 ^pat5: %operands_2 = pdl_interp.get_operands 2 of %root : !pdl.range pdl_interp.is_not_null %operands_2 : !pdl.range -> ^pat6, ^end ^pat6: %operands_2_single = pdl_interp.get_operands 2 of %root : !pdl.value pdl_interp.is_not_null %operands_2_single : !pdl.value -> ^pat7, ^end ^pat7: %invalid_operands = pdl_interp.get_operands 50 of %root : !pdl.value pdl_interp.is_not_null %invalid_operands : !pdl.value -> ^end, ^pat8 ^pat8: pdl_interp.record_match @rewriters::@success(%root, %operands_0, %operands_1, %operands_2, %operands_2_single : !pdl.operation, !pdl.range, !pdl.range, !pdl.range, !pdl.value) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root: !pdl.operation, %operands_0: !pdl.range, %operands_1: !pdl.range, %operands_2: !pdl.range, %operands_2_single: !pdl.value) { %op0 = pdl_interp.create_operation ""test.success""(%operands_0 : !pdl.range) %op1 = pdl_interp.create_operation ""test.success""(%operands_1 : !pdl.range) %op2 = pdl_interp.create_operation ""test.success""(%operands_2 : !pdl.range) %op3 = pdl_interp.create_operation ""test.success""(%operands_2_single : !pdl.value) pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.get_operands_2 } { %inputs:5 = ""test.producer""() : () -> (i32, i32, i32, i32, i32) ""test.attr_sized_operands""(%inputs#0, %inputs#1, %inputs#2, %inputs#3, %inputs#4) {operand_segment_sizes = array} : (i32, i32, i32, i32, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_result_count of %root is 5 -> ^pat1, ^end ^pat1: %result0 = pdl_interp.get_result 0 of %root %result4 = pdl_interp.get_result 4 of %root %result0_type = pdl_interp.get_value_type of %result0 : !pdl.type %result4_type = pdl_interp.get_value_type of %result4 : !pdl.type pdl_interp.are_equal %result0_type, %result4_type : !pdl.type -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.get_result_1 } { %a:5 = ""test.op""() : () -> (i32, i32, i32, i32, i32) %b:5 = ""test.op""() : () -> (i32, i32, i32, i32, i64) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_result_count of %root is 5 -> ^pat1, ^end ^pat1: %results = pdl_interp.get_results 0 of %root : !pdl.range %full_results = pdl_interp.get_results of %root : !pdl.range pdl_interp.are_equal %results, %full_results : !pdl.range -> ^pat2, ^end ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.get_results_1 } { %a:5 = ""test.producer""() : () -> (i32, i32, i32, i32, i32) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.attr_sized_results"" -> ^pat1, ^end ^pat1: %results_0 = pdl_interp.get_results 0 of %root : !pdl.range pdl_interp.is_not_null %results_0 : !pdl.range -> ^pat2, ^end ^pat2: %results_0_single = pdl_interp.get_results 0 of %root : !pdl.value pdl_interp.is_not_null %results_0_single : !pdl.value -> ^end, ^pat3 ^pat3: %results_1 = pdl_interp.get_results 1 of %root : !pdl.range pdl_interp.is_not_null %results_1 : !pdl.range -> ^pat4, ^end ^pat4: %results_1_single = pdl_interp.get_results 1 of %root : !pdl.value pdl_interp.is_not_null %results_1_single : !pdl.value -> ^end, ^pat5 ^pat5: %results_2 = pdl_interp.get_results 2 of %root : !pdl.range pdl_interp.is_not_null %results_2 : !pdl.range -> ^pat6, ^end ^pat6: %results_2_single = pdl_interp.get_results 2 of %root : !pdl.value pdl_interp.is_not_null %results_2_single : !pdl.value -> ^pat7, ^end ^pat7: %invalid_results = pdl_interp.get_results 50 of %root : !pdl.value pdl_interp.is_not_null %invalid_results : !pdl.value -> ^end, ^pat8 ^pat8: pdl_interp.record_match @rewriters::@success(%root, %results_0, %results_1, %results_2, %results_2_single : !pdl.operation, !pdl.range, !pdl.range, !pdl.range, !pdl.value) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root: !pdl.operation, %results_0: !pdl.range, %results_1: !pdl.range, %results_2: !pdl.range, %results_2_single: !pdl.value) { %results_0_types = pdl_interp.get_value_type of %results_0 : !pdl.range %results_1_types = pdl_interp.get_value_type of %results_1 : !pdl.range %results_2_types = pdl_interp.get_value_type of %results_2 : !pdl.range %results_2_single_types = pdl_interp.get_value_type of %results_2_single : !pdl.type %op0 = pdl_interp.create_operation ""test.success"" -> (%results_0_types : !pdl.range) %op1 = pdl_interp.create_operation ""test.success"" -> (%results_1_types : !pdl.range) %op2 = pdl_interp.create_operation ""test.success"" -> (%results_2_types : !pdl.range) %op3 = pdl_interp.create_operation ""test.success"" -> (%results_2_single_types : !pdl.type) %new_results_0 = pdl_interp.get_results of %op0 : !pdl.range %new_results_1 = pdl_interp.get_results of %op1 : !pdl.range %new_results_2 = pdl_interp.get_results of %op2 : !pdl.range pdl_interp.replace %root with (%new_results_0, %new_results_1, %new_results_2 : !pdl.range, !pdl.range, !pdl.range) pdl_interp.finalize } } } module @ir attributes { test.get_results_2 } { %results:5 = ""test.attr_sized_results""() {result_segment_sizes = array} : () -> (i32, i32, i32, i32, i32) ""test.consumer""(%results#0, %results#1, %results#2, %results#3, %results#4) : (i32, i32, i32, i32, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat1, ^end ^pat1: pdl_interp.record_match @rewriters::@failure(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^pat2 ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(2), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @failure(%root : !pdl.operation) { pdl_interp.erase %root pdl_interp.finalize } pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.record_match_1 } { ""test.op""() : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat1, ^end ^pat1: %operands = pdl_interp.get_operands of %root : !pdl.range %results = pdl_interp.get_results of %root : !pdl.range %types = pdl_interp.get_value_type of %results : !pdl.range pdl_interp.record_match @rewriters::@success(%operands, %types, %root : !pdl.range, !pdl.range, !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%operands: !pdl.range, %types: !pdl.range, %root: !pdl.operation) { %op = pdl_interp.create_operation ""test.success""(%operands : !pdl.range) -> (%types : !pdl.range) %results = pdl_interp.get_results of %op : !pdl.range pdl_interp.replace %root with (%results : !pdl.range) pdl_interp.finalize } } } module @ir attributes { test.record_match_2 } { %input = ""test.producer""() : () -> i32 %results:2 = ""test.op""(%input) : (i32) -> (i64, i32) ""test.consumer""(%results#0, %results#1) : (i64, i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.check_operation_name of %root is ""test.op"" -> ^pat, ^end ^pat: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %operand = pdl_interp.get_operand 0 of %root pdl_interp.replace %root with (%operand : !pdl.value) pdl_interp.finalize } } } module @ir attributes { test.replace_op_1 } { %input = ""test.op_input""() : () -> i32 %result = ""test.op""(%input) : (i32) -> i32 ""test.op_consumer""(%result) : (i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %attr = pdl_interp.get_attribute ""test_attr"" of %root pdl_interp.switch_attribute %attr to [0, unit](^end, ^pat) -> ^end ^pat: %attr_2 = pdl_interp.get_attribute ""test_attr_2"" of %root pdl_interp.switch_attribute %attr_2 to [0, unit](^end, ^end) -> ^pat2 ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.switch_attribute_1 } { ""test.op""() { test_attr } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.switch_operand_count of %root to dense<[0, 1]> : vector<2xi32>(^end, ^pat) -> ^end ^pat: pdl_interp.switch_operand_count of %root to dense<[0, 2]> : vector<2xi32>(^end, ^end) -> ^pat2 ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.switch_operand_1 } { %input = ""test.op_input""() : () -> i32 ""test.op""(%input) : (i32) -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.switch_operation_name of %root to [""foo.op"", ""test.op""](^end, ^pat1) -> ^end ^pat1: pdl_interp.switch_operation_name of %root to [""foo.op"", ""bar.op""](^end, ^end) -> ^pat2 ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.switch_operation_name_1 } { ""test.op""() : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { pdl_interp.switch_result_count of %root to dense<[0, 1]> : vector<2xi32>(^end, ^pat) -> ^end ^pat: pdl_interp.switch_result_count of %root to dense<[0, 2]> : vector<2xi32>(^end, ^end) -> ^pat2 ^pat2: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.switch_result_1 } { ""test.op""() : () -> i32 }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %attr = pdl_interp.get_attribute ""test_attr"" of %root pdl_interp.is_not_null %attr : !pdl.attribute -> ^pat1, ^end ^pat1: %type = pdl_interp.get_attribute_type of %attr pdl_interp.switch_type %type to [i32, i64](^pat2, ^end) -> ^end ^pat2: pdl_interp.switch_type %type to [i16, i64](^end, ^end) -> ^pat3 ^pat3: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.switch_type_1 } { ""test.op""() { test_attr = 10 : i32 } : () -> () }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "module @patterns { pdl_interp.func @matcher(%root : !pdl.operation) { %results = pdl_interp.get_results of %root : !pdl.range %types = pdl_interp.get_value_type of %results : !pdl.range pdl_interp.switch_types %types to [[i64, i64], [i32]](^pat2, ^end) -> ^end ^pat2: pdl_interp.switch_types %types to [[i32], [i64, i32]](^end, ^end) -> ^pat3 ^pat3: pdl_interp.record_match @rewriters::@success(%root : !pdl.operation) : benefit(1), loc([%root]) -> ^end ^end: pdl_interp.finalize } module @rewriters { pdl_interp.func @success(%root : !pdl.operation) { %op = pdl_interp.create_operation ""test.success"" pdl_interp.erase %root pdl_interp.finalize } } } module @ir attributes { test.switch_types_1 } { %results:2 = ""test.op""() : () -> (i64, i64) }", mlir-opt -test-pdl-bytecode-pass -split-input-file ,1 "llvm.func @foo() { llvm.return }", mlir-translate --mlir-to-llvmir -mlir-timing 2>&1 ,1 "func.func @trivial() { ""simple.terminator""() : () -> () }", not mlir-translate --allow-unregistered-dialect --mlir-to-llvmir -verify-diagnostics 2>&1 ,1 "func.func @trivial() { ""simple.terminator""() : () -> () }", not mlir-translate --mlir-to-llvmir -verify-diagnostics 2>&1 ,1 "func.func @scf_loop_unroll_single(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = scf.for %iv = %from to %to step %step iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 scf.yield %next : f32 } return %sum : f32 } func.func @scf_loop_unroll_double_symbolic_ub(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %from = arith.constant 0 : index %step = arith.constant 1 : index %sum:2 = scf.for %iv = %from to %n step %step iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %arg0 : f32 %sum1 = arith.addf %i1, %arg1 : f32 scf.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @scf_loop_unroll_factor_1_promote() -> () { %step = arith.constant 1 : index %lo = arith.constant 0 : index %hi = arith.constant 1 : index scf.for %i = %lo to %hi step %step { %x = ""test.foo""(%i) : (index) -> i32 } return }"," mlir-opt --test-loop-unrolling=""unroll-factor=3"" -split-input-file -canonicalize ",1 "func.func @scf_loop_unroll_single(%arg0 : f32, %arg1 : f32) -> f32 { %from = arith.constant 0 : index %to = arith.constant 10 : index %step = arith.constant 1 : index %sum = scf.for %iv = %from to %to step %step iter_args(%sum_iter = %arg0) -> (f32) { %next = arith.addf %sum_iter, %arg1 : f32 scf.yield %next : f32 } return %sum : f32 } func.func @scf_loop_unroll_double_symbolic_ub(%arg0 : f32, %arg1 : f32, %n : index) -> (f32,f32) { %from = arith.constant 0 : index %step = arith.constant 1 : index %sum:2 = scf.for %iv = %from to %n step %step iter_args(%i0 = %arg0, %i1 = %arg1) -> (f32, f32) { %sum0 = arith.addf %i0, %arg0 : f32 %sum1 = arith.addf %i1, %arg1 : f32 scf.yield %sum0, %sum1 : f32, f32 } return %sum#0, %sum#1 : f32, f32 } func.func @scf_loop_unroll_factor_1_promote() -> () { %step = arith.constant 1 : index %lo = arith.constant 0 : index %hi = arith.constant 1 : index scf.for %i = %lo to %hi step %step { %x = ""test.foo""(%i) : (index) -> i32 } return }"," mlir-opt --test-loop-unrolling=""unroll-factor=1"" -split-input-file -canonicalize ",1 "func.func @foo() -> i32 { %c42 = arith.constant 42 : i32 %0 = ""test.op_in_place_fold_anchor""(%c42) : (i32) -> (i32) return %0 : i32 } func.func @test_fold_before_previously_folded_op() -> (i32, i32) { %0 = ""test.cast""() {test_fold_before_previously_folded_op} : () -> (i32) %1 = ""test.cast""() {test_fold_before_previously_folded_op} : () -> (i32) return %0, %1 : i32, i32 } func.func @test_dont_reorder_constants() -> (i32, i32, i32) { %0 = arith.constant 1 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 3 : i32 return %0, %1, %2 : i32, i32, i32 }", mlir-opt -test-patterns='top-down=false' ,1 "func.func @foo() -> i32 { %c42 = arith.constant 42 : i32 %0 = ""test.op_in_place_fold_anchor""(%c42) : (i32) -> (i32) return %0 : i32 } func.func @test_fold_before_previously_folded_op() -> (i32, i32) { %0 = ""test.cast""() {test_fold_before_previously_folded_op} : () -> (i32) %1 = ""test.cast""() {test_fold_before_previously_folded_op} : () -> (i32) return %0, %1 : i32, i32 } func.func @test_dont_reorder_constants() -> (i32, i32, i32) { %0 = arith.constant 1 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 3 : i32 return %0, %1, %2 : i32, i32, i32 }", mlir-opt -test-patterns='top-down=true' ,1 "func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: 3456>> { %0 = memref.subview %input[2, 256] [2, 256] [1, 1] : memref<4x1024xf32> to memref<2x256xf32, strided<[1024, 1], offset: 2304>> %1 = memref.subview %0[1, 128] [1, 128] [1, 1] : memref<2x256xf32, strided<[1024, 1], offset: 2304>> to memref<1x128xf32, strided<[1024, 1], offset: 3456>> return %1 : memref<1x128xf32, strided<[1024, 1], offset: 3456>> }", mlir-opt -test-compose-subview -split-input-file ,1 "func.func @main(%input: memref<4x1024xf32>) -> memref<1x10xf32, strided<[1024, 1], offset: 3745>> { %0 = memref.subview %input[1, 512] [3, 256] [1, 1] : memref<4x1024xf32> to memref<3x256xf32, strided<[1024, 1], offset: 1536>> %1 = memref.subview %0[1, 128] [2, 128] [1, 1] : memref<3x256xf32, strided<[1024, 1], offset: 1536>> to memref<2x128xf32, strided<[1024, 1], offset: 2688>> %2 = memref.subview %1[1, 33] [1, 10] [1, 1] : memref<2x128xf32, strided<[1024, 1], offset: 2688>> to memref<1x10xf32, strided<[1024, 1], offset: 3745>> return %2 : memref<1x10xf32, strided<[1024, 1], offset: 3745>> }", mlir-opt -test-compose-subview -split-input-file ,1 "func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { %cst_1 = arith.constant 1 : index %cst_2 = arith.constant 2 : index %0 = memref.subview %input[%cst_2, 256] [2, 256] [1, 1] : memref<4x1024xf32> to memref<2x256xf32, strided<[1024, 1], offset: ?>> %1 = memref.subview %0[%cst_1, 128] [1, 128] [1, 1] : memref<2x256xf32, strided<[1024, 1], offset: ?>> to memref<1x128xf32, strided<[1024, 1], offset: ?>> return %1 : memref<1x128xf32, strided<[1024, 1], offset: ?>> }", mlir-opt -test-compose-subview -split-input-file ,1 "func.func @main(%input: memref<4x1024xf32>) -> memref<1x128xf32, strided<[1024, 1], offset: ?>> { %cst_2 = arith.constant 2 : index %cst_128 = arith.constant 128 : index %0 = memref.subview %input[%cst_2, 256] [2, 256] [1, 1] : memref<4x1024xf32> to memref<2x256xf32, strided<[1024, 1], offset: ?>> %1 = memref.subview %0[1, %cst_128] [1, 128] [1, 1] : memref<2x256xf32, strided<[1024, 1], offset: ?>> to memref<1x128xf32, strided<[1024, 1], offset: ?>> return %1 : memref<1x128xf32, strided<[1024, 1], offset: ?>> }", mlir-opt -test-compose-subview -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2 floordiv 32, d3 floordiv 64, d2 mod 32, d3 mod 64)> func.func @test_norm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () { %0 = memref.alloc() : memref<1x16x14x14xf32, #map0> ""test.op_norm""(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32, #map0>) -> () memref.dealloc %0 : memref<1x16x14x14xf32, #map0> return } func.func @test_nonnorm(%arg0 : memref<1x16x14x14xf32, #map0>) -> () { %0 = memref.alloc() : memref<1x16x14x14xf32, #map0> ""test.op_nonnorm""(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32, #map0>) -> () memref.dealloc %0 : memref<1x16x14x14xf32, #map0> return } func.func @test_nonnorm_identity_layout(%arg0 : memref<1x16x14x14xf32, #map0>) -> () { %0 = memref.alloc() : memref<1x16x14x14xf32> ""test.op_nonnorm""(%0, %0) : (memref<1x16x14x14xf32>, memref<1x16x14x14xf32>) -> () ""test.op_norm""(%arg0, %0) : (memref<1x16x14x14xf32, #map0>, memref<1x16x14x14xf32>) -> () memref.dealloc %0 : memref<1x16x14x14xf32> return } func.func @test_norm_mix(%arg0 : memref<1x16x1x1x32x64xf32>) -> () { %0 = memref.alloc() : memref<1x16x14x14xf32, #map0> ""test.op_norm""(%arg0, %0) : (memref<1x16x1x1x32x64xf32>, memref<1x16x14x14xf32, #map0>) -> () memref.dealloc %0 : memref<1x16x14x14xf32, #map0> return } #map_tile = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2 floordiv 32, d3 floordiv 32, d2 mod 32, d3 mod 32)> func.func @test_load_store(%arg0 : memref<1x16x14x14xf32>) -> () { %0 = memref.alloc() : memref<1x16x14x14xf32, #map_tile> %1 = memref.alloc() : memref<1x16x14x14xf32> ""test.op_norm""(%0, %1) : (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) -> () %cst = arith.constant 3.0 : f32 affine.for %i = 0 to 1 { affine.for %j = 0 to 16 { affine.for %k = 0 to 14 { affine.for %l = 0 to 14 { %2 = memref.load %1[%i, %j, %k, %l] : memref<1x16x14x14xf32> %3 = arith.addf %2, %cst : f32 memref.store %3, %arg0[%i, %j, %k, %l] : memref<1x16x14x14xf32> } } } } memref.dealloc %0 : memref<1x16x14x14xf32, #map_tile> memref.dealloc %1 : memref<1x16x14x14xf32> return } func.func @test_norm_ret(%arg0: memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) { %0 = memref.alloc() : memref<1x16x14x14xf32, #map_tile> %1, %2 = ""test.op_norm_ret""(%arg0) : (memref<1x16x14x14xf32, #map_tile>) -> (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32>) ""test.op_norm""(%1, %0) : (memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32, #map_tile>) -> () memref.dealloc %0 : memref<1x16x14x14xf32, #map_tile> return %1, %2 : memref<1x16x14x14xf32, #map_tile>, memref<1x16x14x14xf32> } ""test.op_funcref""() {func = @test_norm_mix} : () -> ()", mlir-opt -normalize-memrefs ,1 "#map_1d_tile = affine_map<(d0) -> (d0 floordiv 32, d0 mod 32)> func.func @test_norm_reinterpret_cast(%arg0 : memref<3xf32, #map_1d_tile>) -> (memref<3x1x1xf32>) { %0 = memref.alloc() : memref<3xf32> ""test.op_norm""(%arg0, %0) : (memref<3xf32, #map_1d_tile>, memref<3xf32>) -> () %1 = memref.reinterpret_cast %0 to offset: [0], sizes: [3, 1, 1], strides: [1, 1, 1] : memref<3xf32> to memref<3x1x1xf32> return %1 : memref<3x1x1xf32> }", mlir-opt -normalize-memrefs ,1 "func.func @no_control_flow(%arg0: i32) -> i32 { %cond = arith.constant true %cst_1 = arith.constant 1 : i32 %select = arith.select %cond, %cst_1, %arg0 : i32 return %select : i32 } func.func @simple_control_flow(%arg0 : i32) -> i32 { %cond = arith.constant true %1 = arith.constant 1 : i32 cf.cond_br %cond, ^bb1, ^bb2(%arg0 : i32) ^bb1: cf.br ^bb2(%1 : i32) ^bb2(%arg : i32): return %arg : i32 } func.func @simple_control_flow_overdefined(%arg0 : i32, %arg1 : i1) -> i32 { %1 = arith.constant 1 : i32 cf.cond_br %arg1, ^bb1, ^bb2(%arg0 : i32) ^bb1: cf.br ^bb2(%1 : i32) ^bb2(%arg : i32): return %arg : i32 } func.func @simple_control_flow_constant_overdefined(%arg0 : i32, %arg1 : i1) -> i32 { %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 cf.cond_br %arg1, ^bb1, ^bb2(%arg0 : i32) ^bb1: cf.br ^bb2(%2 : i32) ^bb2(%arg : i32): return %arg : i32 } func.func @unknown_terminator(%arg0 : i32, %arg1 : i1) -> i32 { %1 = arith.constant 1 : i32 ""foo.cond_br""() [^bb1, ^bb2] : () -> () ^bb1: cf.br ^bb2(%1 : i32) ^bb2(%arg : i32): return %arg : i32 } func.func private @ext_cond_fn() -> i1 func.func @simple_loop(%arg0 : i32, %cond1 : i1) -> i32 { %cst_1 = arith.constant 1 : i32 cf.cond_br %cond1, ^bb1(%cst_1 : i32), ^bb2(%cst_1 : i32) ^bb1(%iv: i32): %cst_0 = arith.constant 0 : i32 %res = arith.addi %iv, %cst_0 : i32 %cond2 = call @ext_cond_fn() : () -> i1 cf.cond_br %cond2, ^bb1(%res : i32), ^bb2(%res : i32) ^bb2(%arg : i32): return %arg : i32 } func.func @simple_loop_inner_control_flow(%arg0 : i32) -> i32 { %cst_1 = arith.constant 1 : i32 cf.br ^bb1(%cst_1 : i32) ^bb1(%iv: i32): %cond2 = call @ext_cond_fn() : () -> i1 cf.cond_br %cond2, ^bb5(%iv : i32), ^bb2 ^bb2: %cst_20 = arith.constant 20 : i32 %cond = arith.cmpi ult, %iv, %cst_20 : i32 cf.cond_br %cond, ^bb3, ^bb4 ^bb3: %cst_1_2 = arith.constant 1 : i32 cf.br ^bb1(%cst_1_2 : i32) ^bb4: %iv_inc = arith.addi %iv, %cst_1 : i32 cf.br ^bb1(%iv_inc : i32) ^bb5(%result: i32): return %result : i32 } func.func private @ext_cond_and_value_fn() -> (i1, i32) func.func @simple_loop_overdefined(%arg0 : i32, %cond1 : i1) -> i32 { %cst_1 = arith.constant 1 : i32 cf.cond_br %cond1, ^bb1(%cst_1 : i32), ^bb2(%cst_1 : i32) ^bb1(%iv: i32): %cond2, %res = call @ext_cond_and_value_fn() : () -> (i1, i32) cf.cond_br %cond2, ^bb1(%res : i32), ^bb2(%res : i32) ^bb2(%arg : i32): return %arg : i32 } func.func @recheck_executable_edge(%cond0: i1) -> (i1, i1) { %true = arith.constant true %false = arith.constant false cf.cond_br %cond0, ^bb_1a, ^bb2(%false : i1) ^bb_1a: cf.br ^bb2(%true : i1) ^bb2(%x: i1): cf.br ^bb3(%x : i1) ^bb3(%y: i1): return %x, %y : i1, i1 } func.func @simple_produced_operand() -> (i32, i32) { %1 = arith.constant 1 : i32 ""test.internal_br""(%1) [^bb1, ^bb2] { operand_segment_sizes = array } : (i32) -> () ^bb1: cf.br ^bb2(%1, %1 : i32, i32) ^bb2(%arg1 : i32, %arg2 : i32): return %arg1, %arg2 : i32, i32 } func.func @inplace_fold() -> (i32) { %0 = ""test.op_in_place_fold_success""() : () -> i1 %1 = arith.constant 5 : i32 cf.cond_br %0, ^a, ^b ^a: %3 = arith.addi %1, %1 : i32 return %3 : i32 ^b: return %1 : i32 } func.func @op_with_region() -> (i32) { %0 = ""test.op_with_region""() ({}) : () -> i1 %1 = arith.constant 5 : i32 cf.cond_br %0, ^a, ^b ^a: %3 = arith.addi %1, %1 : i32 return %3 : i32 ^b: return %1 : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func @remap_input_1_to_1(%arg0: i32) { %0 = ""test.one_variadic_out_one_variadic_in1""(%arg0) : (i32) -> i32 %1 = ""test.one_variadic_out_one_variadic_in1""(%0) : (i32) -> i32 ""test.return""() : () -> () } func.func @remap_unconverted() { %region_result = ""test.remapped_value_region""() ({ %result = ""test.type_producer""() : () -> f32 ""test.return""(%result) : (f32) -> () }) : () -> (f32) ""test.type_consumer""(%region_result) : (f32) -> () ""test.return""() : () -> () }", mlir-opt -test-remapped-value ,1 "func.func @too_few_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @too_many_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3, %arg4, %arg5) = (%arg0, %arg0, %arg0) to (%arg1, %arg1, %arg1) step (%arg2, %arg2, %arg2) { scf.yield } return }", not mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing))' 2>&1 ,1 "func.func @too_few_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @too_many_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3, %arg4, %arg5) = (%arg0, %arg0, %arg0) to (%arg1, %arg1, %arg1) step (%arg2, %arg2, %arg2) { scf.yield } return }", not mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-1=1}))' 2>&1 ,1 "func.func @too_few_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @too_many_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3, %arg4, %arg5) = (%arg0, %arg0, %arg0) to (%arg1, %arg1, %arg1) step (%arg2, %arg2, %arg2) { scf.yield } return }", not mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-0=1 collapsed-indices-2=2}))' 2>&1 ,1 "func.func @too_few_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @too_many_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3, %arg4, %arg5) = (%arg0, %arg0, %arg0) to (%arg1, %arg1, %arg1) step (%arg2, %arg2, %arg2) { scf.yield } return }", not mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-0=1 collapsed-indices-1=2}))' 2>&1 ,1 "func.func @too_few_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3) = (%arg0) to (%arg1) step (%arg2) { scf.yield } return } func.func @too_many_iters(%arg0: index, %arg1: index, %arg2: index) { scf.parallel (%arg3, %arg4, %arg5) = (%arg0, %arg0, %arg0) to (%arg1, %arg1, %arg1) step (%arg2, %arg2, %arg2) { scf.yield } return }", not mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-0=0 collapsed-indices-1=2}))' 2>&1 ,1 "func.func @should_fuse_raw_dep_for_locality() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_reduction_to_pointwise() { %a = memref.alloc() : memref<10x10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %v0 = affine.load %b[%i0] : memref<10xf32> %v1 = affine.load %a[%i0, %i1] : memref<10x10xf32> %v3 = arith.addf %v0, %v1 : f32 affine.store %v3, %b[%i0] : memref<10xf32> } } affine.for %i2 = 0 to 10 { %v4 = affine.load %b[%i2] : memref<10xf32> affine.store %v4, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_loop_nests_with_shifts() { %a = memref.alloc() : memref<10x10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 9 { affine.for %i1 = 0 to 9 { affine.store %cf7, %a[%i0 + 1, %i1 + 1] : memref<10x10xf32> } } affine.for %i2 = 1 to 10 { affine.for %i3 = 1 to 10 { %v0 = affine.load %a[%i2, %i3] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_loop_nest() { %a = memref.alloc() : memref<10x10xf32> %b = memref.alloc() : memref<10x10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cf7, %a[%i0, %i1] : memref<10x10xf32> } } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 10 { %v0 = affine.load %a[%i3, %i2] : memref<10x10xf32> affine.store %v0, %b[%i2, %i3] : memref<10x10xf32> } } affine.for %i4 = 0 to 10 { affine.for %i5 = 0 to 10 { %v1 = affine.load %b[%i4, %i5] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_across_intermediate_loop_with_no_deps() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %v0, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_all_loops() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %b[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v0 = affine.load %a[%i2] : memref<10xf32> %v1 = affine.load %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_first_and_second_loops() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %a[%i1] : memref<10xf32> affine.store %cf7, %b[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_would_create_cycle() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %cf7, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %a[%i1] : memref<10xf32> %v1 = affine.load %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v2 = affine.load %b[%i2] : memref<10xf32> affine.store %cf7, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_producer_consumer() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %m[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %m[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_and_move_to_preserve_war_dep() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %v0, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %a[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_if_top_level_access() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } %c0 = arith.constant 4 : index %v1 = affine.load %m[%c0] : memref<10xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_but_not_remove_src() { %m = memref.alloc() : memref<100xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 100 { affine.store %cf7, %m[%i0] : memref<100xf32> } affine.for %i1 = 0 to 17 { %v0 = affine.load %m[%i1] : memref<100xf32> } %v1 = affine.load %m[99] : memref<100xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_no_top_level_access() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @should_not_fuse_if_op_at_top_level() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } %c0 = arith.constant 4 : index affine.if #set0(%c0) { } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @should_not_fuse_if_op_in_loop_nest() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %c4 = arith.constant 4 : index affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.if #set0(%c4) { } %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "#set = affine_set<(d0) : (d0 - 1 >= 0)> func.func @should_fuse_if_op_in_loop_nest_not_sandwiched() -> memref<10xf32> { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %a[%i1] : memref<10xf32> affine.store %v0, %b[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { affine.if #set(%i2) { %v0 = affine.load %b[%i2] : memref<10xf32> } } return %a : memref<10xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "#set = affine_set<(d0) : (d0 - 1 >= 0)> func.func @should_not_fuse_if_op_in_loop_nest_between_src_and_dest() -> memref<10xf32> { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.if #set(%i1) { affine.store %cf7, %a[%i1] : memref<10xf32> } } affine.for %i3 = 0 to 10 { %v0 = affine.load %a[%i3] : memref<10xf32> affine.store %v0, %b[%i3] : memref<10xf32> } return %b : memref<10xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @permute_and_fuse() { %m = memref.alloc() : memref<10x20x30xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 20 { affine.for %i2 = 0 to 30 { affine.store %cf7, %m[%i0, %i1, %i2] : memref<10x20x30xf32> } } } affine.for %i3 = 0 to 30 { affine.for %i4 = 0 to 10 { affine.for %i5 = 0 to 20 { %v0 = affine.load %m[%i4, %i5, %i3] : memref<10x20x30xf32> ""foo""(%v0) : (f32) -> () } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fuse_reshape_64_16_4(%in : memref<64xf32>) { %out = memref.alloc() : memref<16x4xf32> affine.for %i0 = 0 to 64 { %v = affine.load %in[%i0] : memref<64xf32> affine.store %v, %out[%i0 floordiv 4, %i0 mod 4] : memref<16x4xf32> } affine.for %i1 = 0 to 16 { affine.for %i2 = 0 to 4 { %w = affine.load %out[%i1, %i2] : memref<16x4xf32> ""foo""(%w) : (f32) -> () } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fuse_reshape_16_4_64() { %in = memref.alloc() : memref<16x4xf32> %out = memref.alloc() : memref<64xf32> affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 4 { %v = affine.load %in[%i0, %i1] : memref<16x4xf32> affine.store %v, %out[4*%i0 + %i1] : memref<64xf32> } } affine.for %i2 = 0 to 64 { %w = affine.load %out[%i2] : memref<64xf32> ""foo""(%w) : (f32) -> () } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @R6_to_R2_reshape_square() -> memref<64x9xi32> { %in = memref.alloc() : memref<2x2x3x3x16x1xi32> %out = memref.alloc() : memref<64x9xi32> %live_out = memref.alloc() : memref<64x9xi32> affine.for %i0 = 0 to 2 { affine.for %i1 = 0 to 2 { affine.for %i2 = 0 to 3 { affine.for %i3 = 0 to 3 { affine.for %i4 = 0 to 16 { affine.for %i5 = 0 to 1 { %val = ""foo""(%i0, %i1, %i2, %i3, %i4, %i5) : (index, index, index, index, index, index) -> i32 affine.store %val, %in[%i0, %i1, %i2, %i3, %i4, %i5] : memref<2x2x3x3x16x1xi32> } } } } } } affine.for %ii = 0 to 64 { affine.for %jj = 0 to 9 { %a0 = affine.apply affine_map<(d0, d1) -> (d0 * 9 + d1)> (%ii, %jj) %0 = affine.apply affine_map<(d0) -> (d0 floordiv (2 * 3 * 3 * 16 * 1))>(%a0) %1 = affine.apply affine_map<(d0) -> ((d0 mod 288) floordiv (3 * 3 * 16 * 1))>(%a0) %2 = affine.apply affine_map<(d0) -> (((d0 mod 288) mod 144) floordiv (3 * 16 * 1))>(%a0) %3 = affine.apply affine_map<(d0) -> ((((d0 mod 288) mod 144) mod 48) floordiv (16 * 1))>(%a0) %4 = affine.apply affine_map<(d0) -> ((((d0 mod 288) mod 144) mod 48) mod 16)>(%a0) %5 = affine.apply affine_map<(d0) -> (((((d0 mod 144) mod 144) mod 48) mod 16) mod 1)>(%a0) %v = affine.load %in[%0, %1, %2, %3, %4, %5] : memref<2x2x3x3x16x1xi32> affine.store %v, %out[%ii, %jj] : memref<64x9xi32> } } affine.for %i = 0 to 64 { affine.for %j = 0 to 9 { %a = affine.load %out[%i, %j] : memref<64x9xi32> %b = arith.muli %a, %a : i32 affine.store %b, %live_out[%i, %j] : memref<64x9xi32> } } return %live_out : memref<64x9xi32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fuse_symbolic_bounds(%M : index, %N : index) { %N_plus_5 = affine.apply affine_map<(d0) -> (d0 + 5)>(%N) %m = memref.alloc(%M, %N_plus_5) : memref %c0 = arith.constant 0.0 : f32 %s = arith.constant 5 : index affine.for %i0 = 0 to %M { affine.for %i1 = 0 to affine_map<(d0) -> (d0 + 5)> (%N) { affine.store %c0, %m[%i0, %i1] : memref } } affine.for %i2 = 0 to %M { affine.for %i3 = 0 to %N { %v = affine.load %m[%i2, %i3 + symbol(%s)] : memref } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_reduction_at_depth_of_one() { %a = memref.alloc() : memref<10x100xf32> %b = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 100 { %v0 = affine.load %b[%i0] : memref<10xf32> %v1 = affine.load %a[%i0, %i1] : memref<10x100xf32> %v2 = ""maxf""(%v0, %v1) : (f32, f32) -> f32 affine.store %v2, %b[%i0] : memref<10xf32> } } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 100 { %v3 = affine.load %b[%i2] : memref<10xf32> %v4 = affine.load %a[%i2, %i3] : memref<10x100xf32> %v5 = arith.subf %v4, %v3 : f32 affine.store %v5, %b[%i2] : memref<10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_at_src_depth1_and_dst_depth1() { %a = memref.alloc() : memref<100x16xf32> %b = memref.alloc() : memref<100x16xf32> affine.for %i0 = 0 to 100 { affine.for %i1 = 0 to 16 { %v0 = affine.load %a[%i0, %i1] : memref<100x16xf32> ""op0""(%v0) : (f32) -> () } affine.for %i2 = 0 to 16 { %v1 = ""op1""() : () -> (f32) affine.store %v1, %b[%i0, %i2] : memref<100x16xf32> } } affine.for %i3 = 0 to 100 { affine.for %i4 = 0 to 16 { %v2 = affine.load %b[%i3, %i4] : memref<100x16xf32> ""op2""(%v2) : (f32) -> () } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_src_depth1_at_dst_depth2() { %a = memref.alloc() : memref<100xf32> %c0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 100 { affine.store %c0, %a[%i0] : memref<100xf32> } affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %a0 = affine.apply affine_map<(d0, d1) -> (d0 * 10 + d1)> (%i1, %i2) %v0 = affine.load %a[%a0] : memref<100xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fusion_at_depth0_not_currently_supported() { %0 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %1 = affine.load %0[%c0] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_deep_loop_nests() { %0 = memref.alloc() : memref<2x2x3x3x16x10xf32, 2> %1 = memref.alloc() : memref<2x2x3x3x16x10xf32, 2> %2 = memref.alloc() : memref<3x3x3x3x16x10xf32, 2> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c1_0 = arith.constant 1 : index %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 2 { affine.for %i1 = 0 to 2 { affine.for %i2 = 0 to 3 { affine.for %i3 = 0 to 3 { affine.for %i4 = 0 to 16 { affine.for %i5 = 0 to 10 { %3 = affine.load %0[%i0, %i1, %i2, %i3, %i4, %i5] : memref<2x2x3x3x16x10xf32, 2> } } affine.for %i6 = 0 to 16 { affine.for %i7 = 0 to 10 { affine.store %cst, %1[%i0, %i1, %i2, %i3, %i6, %i7] : memref<2x2x3x3x16x10xf32, 2> } } } } } } affine.for %i8 = 0 to 3 { affine.for %i9 = 0 to 3 { affine.for %i10 = 0 to 2 { affine.for %i11 = 0 to 2 { affine.for %i12 = 0 to 3 { affine.for %i13 = 0 to 3 { affine.for %i14 = 0 to 2 { affine.for %i15 = 0 to 2 { affine.for %i16 = 0 to 16 { affine.for %i17 = 0 to 10 { %5 = affine.load %0[%i14, %i15, %i12, %i13, %i16, %i17] : memref<2x2x3x3x16x10xf32, 2> } } affine.for %i18 = 0 to 16 { affine.for %i19 = 0 to 10 { %6 = affine.load %1[%i10, %i11, %i8, %i9, %i18, %i19] : memref<2x2x3x3x16x10xf32, 2> } } } } } } } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_at_depth1_and_reduce_slice_trip_count() { %a = memref.alloc() : memref<4x256xf32> %b = memref.alloc() : memref<4x256xf32> %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 4 { affine.for %i1 = 0 to 256 { %v0 = affine.load %b[%i0, %i1] : memref<4x256xf32> } affine.for %i2 = 0 to 256 { affine.store %cf0, %a[%i0, %i2] : memref<4x256xf32> } } affine.for %d0 = 0 to 4 { affine.for %d1 = 0 to 16 { %v1 = affine.load %a[%d0, %d1] : memref<4x256xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_at_depth1_with_trip_count_20() { %a = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 100 { affine.store %cf0, %a[%i0]: memref<100xf32> } affine.for %i1 = 0 to 5 { affine.for %i2 = 0 to 10 { %v0 = affine.load %a[%i2]: memref<100xf32> } affine.for %i3 = 0 to 10 { affine.for %i4 = 0 to 20 { %v1 = affine.load %a[%i4]: memref<100xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_at_depth1_with_trip_count_19() { %a = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 100 { affine.store %cf0, %a[%i0]: memref<100xf32> } affine.for %i1 = 0 to 5 { affine.for %i2 = 0 to 19 { %v0 = affine.load %a[%i2]: memref<100xf32> } affine.for %i3 = 0 to 10 { affine.for %i4 = 0 to 10 { %v1 = affine.load %a[%i4]: memref<100xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_with_private_memref() { %m = memref.alloc() : memref<100xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 100 { affine.store %cf7, %m[%i0] : memref<100xf32> } affine.for %i1 = 0 to 17 { %v0 = affine.load %m[%i1] : memref<100xf32> } affine.for %i2 = 0 to 82 { %v1 = affine.load %m[%i2] : memref<100xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_live_out_arg_but_preserve_src_loop(%arg0: memref<10xf32>) { %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %arg0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 9 { %v0 = affine.load %arg0[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_live_out_arg(%arg0: memref<10xf32>) { %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %arg0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %arg0[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_escaping_memref_but_preserve_src_loop() -> memref<10xf32> { %cf7 = arith.constant 7.0 : f32 %m = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 9 { %v0 = affine.load %m[%i1] : memref<10xf32> } return %m : memref<10xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @R3_to_R2_reshape() { %in = memref.alloc() : memref<2x3x16xi32> %c0 = arith.constant 0 : index affine.for %i0 = 0 to 2 { affine.for %i1 = 0 to 3 { affine.for %i2 = 0 to 16 { %val = ""foo""(%i0, %i1, %i2) : (index, index, index) -> i32 affine.store %val, %in[%i0, %i1, %i2] : memref<2x3x16xi32> } } } affine.for %ii = 0 to 32 { affine.for %jj = 0 to 3 { %a0 = affine.apply affine_map<(d0, d1) -> (d0 * 3 + d1)> (%ii, %jj) %idx = affine.apply affine_map<(d0) -> (d0 floordiv (3 * 16))> (%a0) %v = affine.load %in[%idx, %jj, %c0] : memref<2x3x16xi32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_multi_output_producer() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> affine.store %cf7, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %a[%i1] : memref<10xf32> %v1 = affine.load %b[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fusion_preventing_deps_on_middle_loop() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %v0, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %a[%i1] : memref<10xf32> %v1 = affine.load %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v2 = affine.load %b[%i2] : memref<10xf32> affine.store %v2, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_and_move_to_preserve_war_dep() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %b[%i0] : memref<10xf32> affine.store %v0, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 3 { %v2 = affine.load %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 5 { affine.store %cf7, %b[%i2] : memref<10xf32> } affine.for %i3 = 0 to 10 { %v1 = affine.load %a[%i3] : memref<10xf32> affine.store %cf7, %c[%i3] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fusion_preventing_dep_on_constant() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %b[%i0] : memref<10xf32> affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %b[%i1] : memref<10xf32> } %cf11 = arith.constant 11.0 : f32 affine.for %i2 = 0 to 10 { %v2 = affine.load %a[%i2] : memref<10xf32> affine.store %cf11, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_and_preserve_dep_on_constant() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf11 = arith.constant 11.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %b[%i0] : memref<10xf32> affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %b[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v2 = affine.load %a[%i2] : memref<10xf32> affine.store %cf11, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @outline_if_else(%cond: i1, %a: index, %b: memref, %c: i8) { %r = scf.if %cond -> (i8) { %r = ""some_op""(%cond, %b) : (i1, memref) -> (i8) scf.yield %r : i8 } else { scf.yield %c : i8 } return }", mlir-opt -allow-unregistered-dialect -test-scf-if-utils -split-input-file ,1 "func.func @outline_if(%cond: i1, %a: index, %b: memref, %c: i8) { scf.if %cond { ""some_op""(%cond, %b) : (i1, memref) -> () scf.yield } return }", mlir-opt -allow-unregistered-dialect -test-scf-if-utils -split-input-file ,1 "func.func @outline_empty_if_else(%cond: i1, %a: index, %b: memref, %c: i8) { scf.if %cond { } else { ""some_op""(%cond, %b) : (i1, memref) -> () } return }", mlir-opt -allow-unregistered-dialect -test-scf-if-utils -split-input-file ,1 "func.func @test_erase() { %0 = ""test.arg0""() : () -> (i32) %1 = ""test.arg1""() : () -> (i32) %erase = ""test.erase_op""(%0, %1) : (i32, i32) -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=AnyOp"" --split-input-file ",1 "func.func @test_erase() { %0 = ""test.arg0""() : () -> (i32) %1 = ""test.arg1""() : () -> (i32) %erase = ""test.erase_op""(%0, %1) : (i32, i32) -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingAndNewOps"" --split-input-file ",1 "func.func @test_erase() { %0 = ""test.arg0""() : () -> (i32) %1 = ""test.arg1""() : () -> (i32) %erase = ""test.erase_op""(%0, %1) : (i32, i32) -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingOps"" --split-input-file ",1 "func.func @test_insert_same_op() { %0 = ""test.insert_same_op""() : () -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=AnyOp"" --split-input-file ",1 "func.func @test_insert_same_op() { %0 = ""test.insert_same_op""() : () -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingAndNewOps"" --split-input-file ",1 "func.func @test_insert_same_op() { %0 = ""test.insert_same_op""() : () -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingOps"" --split-input-file ",1 "func.func @test_replace_with_new_op() { %0 = ""test.replace_with_new_op""() : () -> (i32) %1 = ""test.dummy_user""(%0) : (i32) -> (i32) %2 = ""test.dummy_user""(%0) : (i32) -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=AnyOp"" --split-input-file ",1 "func.func @test_replace_with_new_op() { %0 = ""test.replace_with_new_op""() : () -> (i32) %1 = ""test.dummy_user""(%0) : (i32) -> (i32) %2 = ""test.dummy_user""(%0) : (i32) -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingAndNewOps"" --split-input-file ",1 "func.func @test_replace_with_new_op() { %0 = ""test.replace_with_new_op""() : () -> (i32) %1 = ""test.dummy_user""(%0) : (i32) -> (i32) %2 = ""test.dummy_user""(%0) : (i32) -> (i32) return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingOps"" --split-input-file ",1 "func.func @test_replace_with_erase_op() { ""test.replace_with_new_op""() {create_erase_op} : () -> () return }"," mlir-opt -test-strict-pattern-driver=""strictness=AnyOp"" --split-input-file ",1 "func.func @test_replace_with_erase_op() { ""test.replace_with_new_op""() {create_erase_op} : () -> () return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingAndNewOps"" --split-input-file ",1 "func.func @test_replace_with_erase_op() { ""test.replace_with_new_op""() {create_erase_op} : () -> () return }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingOps"" --split-input-file ",1 "func.func @test_trigger_rewrite_through_block() { return ^bb1: ""test.change_block_op""() [^bb1, ^bb2] : () -> () ^bb2: return ^bb3: ""test.implicit_change_op""() [^bb1] : () -> () }"," mlir-opt -test-strict-pattern-driver=""strictness=AnyOp"" --split-input-file ",1 "func.func @test_trigger_rewrite_through_block() { return ^bb1: ""test.change_block_op""() [^bb1, ^bb2] : () -> () ^bb2: return ^bb3: ""test.implicit_change_op""() [^bb1] : () -> () }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingAndNewOps"" --split-input-file ",1 "func.func @test_trigger_rewrite_through_block() { return ^bb1: ""test.change_block_op""() [^bb1, ^bb2] : () -> () ^bb2: return ^bb3: ""test.implicit_change_op""() [^bb1] : () -> () }"," mlir-opt -test-strict-pattern-driver=""strictness=ExistingOps"" --split-input-file ",1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @store_may_execute_before_load() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %c0 = arith.constant 4 : index affine.if #set0(%c0) { affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @dependent_loops() { %0 = memref.alloc() : memref<10xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %1 = affine.load %0[%i1] : memref<10xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @different_memrefs() { %m.a = memref.alloc() : memref<100xf32> %m.b = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1.0 : f32 affine.store %c1, %m.a[%c0] : memref<100xf32> %v0 = affine.load %m.b[%c0] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_different_elements() { %m = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c7 = arith.constant 7.0 : f32 affine.store %c7, %m[%c0] : memref<100xf32> %v0 = affine.load %m[%c1] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @load_store_different_elements() { %m = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c7 = arith.constant 7.0 : f32 %v0 = affine.load %m[%c1] : memref<100xf32> affine.store %c7, %m[%c0] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_same_element() { %m = memref.alloc() : memref<100xf32> %c11 = arith.constant 11 : index %c7 = arith.constant 7.0 : f32 affine.store %c7, %m[%c11] : memref<100xf32> %v0 = affine.load %m[%c11] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @load_load_same_element() { %m = memref.alloc() : memref<100xf32> %c11 = arith.constant 11 : index %c7 = arith.constant 7.0 : f32 %v0 = affine.load %m[%c11] : memref<100xf32> %v1 = affine.load %m[%c11] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_same_symbol(%arg0: index) { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 affine.store %c7, %m[%arg0] : memref<100xf32> %v0 = affine.load %m[%arg0] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_different_symbols(%arg0: index, %arg1: index) { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 affine.store %c7, %m[%arg0] : memref<100xf32> %v0 = affine.load %m[%arg1] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_diff_element_affine_apply_const() { %m = memref.alloc() : memref<100xf32> %c1 = arith.constant 1 : index %c8 = arith.constant 8.0 : f32 %a0 = affine.apply affine_map<(d0) -> (d0)> (%c1) affine.store %c8, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%c1) %v0 = affine.load %m[%a1] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_same_element_affine_apply_const() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %c9 = arith.constant 9 : index %c11 = arith.constant 11 : index %a0 = affine.apply affine_map<(d0) -> (d0 + 1)> (%c9) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0 - 1)> (%c11) %v0 = affine.load %m[%a1] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_affine_apply_symbol(%arg0: index) { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%arg0) %v0 = affine.load %m[%a1] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_affine_apply_symbol_offset(%arg0: index) { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%arg0) %v0 = affine.load %m[%a1] : memref<100xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_range_load_after_range() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %c10 = arith.constant 10 : index affine.for %i0 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%c10) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_load_func_symbol(%arg0: index, %arg1: index) { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %c10 = arith.constant 10 : index affine.for %i0 = 0 to %arg1 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%arg0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%arg0) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_range_load_last_in_range() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %c10 = arith.constant 10 : index affine.for %i0 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0 - 1)> (%c10) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_range_load_before_range() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %c0 = arith.constant 0 : index affine.for %i0 = 1 to 11 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%c0) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_range_load_first_in_range() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 %c0 = arith.constant 0 : index affine.for %i0 = 1 to 11 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%c0) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @store_plus_3() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 1 to 11 { %a0 = affine.apply affine_map<(d0) -> (d0 + 3)> (%i0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%i0) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @load_minus_2() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 2 to 11 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) affine.store %c7, %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0 - 2)> (%i0) %v0 = affine.load %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @perfectly_nested_loops_loop_independent() { %m = memref.alloc() : memref<10x10xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 11 { affine.for %i1 = 0 to 11 { %a00 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a01 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) affine.store %c7, %m[%a00, %a01] : memref<10x10xf32> %a10 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a11 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) %v0 = affine.load %m[%a10, %a11] : memref<10x10xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @perfectly_nested_loops_loop_carried_at_depth1() { %m = memref.alloc() : memref<10x10xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 9 { affine.for %i1 = 0 to 9 { %a00 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a01 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) affine.store %c7, %m[%a00, %a01] : memref<10x10xf32> %a10 = affine.apply affine_map<(d0, d1) -> (d0 - 2)> (%i0, %i1) %a11 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) %v0 = affine.load %m[%a10, %a11] : memref<10x10xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @perfectly_nested_loops_loop_carried_at_depth2() { %m = memref.alloc() : memref<10x10xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %a00 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a01 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) affine.store %c7, %m[%a00, %a01] : memref<10x10xf32> %a10 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a11 = affine.apply affine_map<(d0, d1) -> (d1 - 3)> (%i0, %i1) %v0 = affine.load %m[%a10, %a11] : memref<10x10xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @one_common_loop() { %m = memref.alloc() : memref<10x10xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %a00 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a01 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) affine.store %c7, %m[%a00, %a01] : memref<10x10xf32> } affine.for %i2 = 0 to 9 { %a10 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i2) %a11 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i2) %v0 = affine.load %m[%a10, %a11] : memref<10x10xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @dependence_cycle() { %m.a = memref.alloc() : memref<100xf32> %m.b = memref.alloc() : memref<100xf32> affine.for %i0 = 0 to 9 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) %v0 = affine.load %m.a[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%i0) affine.store %v0, %m.b[%a1] : memref<100xf32> %a2 = affine.apply affine_map<(d0) -> (d0)> (%i0) %v1 = affine.load %m.b[%a2] : memref<100xf32> %a3 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i0) affine.store %v1, %m.a[%a3] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) { %m = memref.alloc() : memref<10x10xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to %arg0 { affine.for %i1 = 0 to %arg1 { %a00 = affine.apply affine_map<(d0, d1) -> (d0 - 1)> (%i0, %i1) %a01 = affine.apply affine_map<(d0, d1) -> (d1 + 1)> (%i0, %i1) %v0 = affine.load %m[%a00, %a01] : memref<10x10xf32> %a10 = affine.apply affine_map<(d0, d1) -> (d0)> (%i0, %i1) %a11 = affine.apply affine_map<(d0, d1) -> (d1)> (%i0, %i1) affine.store %c7, %m[%a10, %a11] : memref<10x10xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @war_raw_waw_deps() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i1) %v0 = affine.load %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> (d0)> (%i1) affine.store %c7, %m[%a1] : memref<100xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @mod_deps() { %m = memref.alloc() : memref<100xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0 mod 2)> (%i0) %v0 = affine.load %m[%a0] : memref<100xf32> %a1 = affine.apply affine_map<(d0) -> ( (d0 + 1) mod 2)> (%i0) affine.store %c7, %m[%a1] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @loop_nest_depth() { %0 = memref.alloc() : memref<100x100xf32> %c7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 128 { affine.for %i1 = 0 to 8 { affine.store %c7, %0[%i0, %i1] : memref<100x100xf32> } } affine.for %i2 = 0 to 8 { affine.for %i3 = 0 to 8 { affine.for %i4 = 0 to 8 { affine.for %i5 = 0 to 16 { %8 = affine.apply affine_map<(d0, d1) -> (d0 * 16 + d1)>(%i4, %i5) %9 = affine.load %0[%8, %i3] : memref<100x100xf32> } } } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @mod_div_3d() { %M = memref.alloc() : memref<2x2x2xi32> %c0 = arith.constant 0 : i32 affine.for %i0 = 0 to 8 { affine.for %i1 = 0 to 8 { affine.for %i2 = 0 to 8 { %idx0 = affine.apply affine_map<(d0, d1, d2) -> (d0 floordiv 4)> (%i0, %i1, %i2) %idx1 = affine.apply affine_map<(d0, d1, d2) -> (d1 mod 2)> (%i0, %i1, %i2) %idx2 = affine.apply affine_map<(d0, d1, d2) -> (d2 floordiv 4)> (%i0, %i1, %i2) affine.store %c0, %M[%idx0, %idx1, %idx2] : memref<2 x 2 x 2 x i32> } } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @delinearize_mod_floordiv() { %c0 = arith.constant 0 : index %val = arith.constant 0 : i32 %in = memref.alloc() : memref<2x2x3x3x16x1xi32> %out = memref.alloc() : memref<64x9xi32> affine.for %i0 = 0 to 2 { affine.for %i1 = 0 to 2 { affine.for %i2 = 0 to 3 { affine.for %i3 = 0 to 3 { affine.for %i4 = 0 to 16 { affine.for %i5 = 0 to 1 { affine.store %val, %in[%i0, %i1, %i2, %i3, %i4, %i5] : memref<2x2x3x3x16x1xi32> } } } } } } affine.for %ii = 0 to 64 { affine.for %jj = 0 to 9 { %a0 = affine.apply affine_map<(d0, d1) -> (d0 * (9 * 1024) + d1 * 128)> (%ii, %jj) %a10 = affine.apply affine_map<(d0) -> (d0 floordiv (2 * 3 * 3 * 128 * 128))> (%a0) %a11 = affine.apply affine_map<(d0) -> ((d0 mod 294912) floordiv (3 * 3 * 128 * 128))> (%a0) %a12 = affine.apply affine_map<(d0) -> ((((d0 mod 294912) mod 147456) floordiv 1152) floordiv 8)> (%a0) %a13 = affine.apply affine_map<(d0) -> ((((d0 mod 294912) mod 147456) mod 1152) floordiv 384)> (%a0) %a14 = affine.apply affine_map<(d0) -> (((((d0 mod 294912) mod 147456) mod 1152) mod 384) floordiv 128)> (%a0) %a15 = affine.apply affine_map<(d0) -> ((((((d0 mod 294912) mod 147456) mod 1152) mod 384) mod 128) floordiv 128)> (%a0) %v0 = affine.load %in[%a10, %a11, %a13, %a14, %a12, %a15] : memref<2x2x3x3x16x1xi32> affine.store %v0, %out[%ii, %jj] : memref<64x9xi32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @strided_loop_with_dependence_at_depth2() { %0 = memref.alloc() : memref<10xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 8 step 2 { affine.store %cf0, %0[%i0] : memref<10xf32> %v0 = affine.load %0[%i0] : memref<10xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @strided_loop_with_no_dependence() { %0 = memref.alloc() : memref<10xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 8 step 2 { %a0 = affine.apply affine_map<(d0) -> (d0 + 1)>(%i0) affine.store %cf0, %0[%a0] : memref<10xf32> %v0 = affine.load %0[%i0] : memref<10xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @strided_loop_with_loop_carried_dependence_at_depth1() { %0 = memref.alloc() : memref<10xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 8 step 2 { %a0 = affine.apply affine_map<(d0) -> (d0 + 4)>(%i0) affine.store %cf0, %0[%a0] : memref<10xf32> %v0 = affine.load %0[%i0] : memref<10xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @test_dep_store_depth1_load_depth2() { %0 = memref.alloc() : memref<100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0 - 1)>(%i0) affine.store %cst, %0[%a0] : memref<100xf32> affine.for %i1 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 1)>(%i0) { %1 = affine.load %0[%i1] : memref<100xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @test_dep_store_depth2_load_depth1() { %0 = memref.alloc() : memref<100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = affine_map<(d0) -> (d0)>(%i0) to affine_map<(d0) -> (d0 + 1)>(%i0) { affine.store %cst, %0[%i1] : memref<100xf32> } %a0 = affine.apply affine_map<(d0) -> (d0 - 2)>(%i0) %1 = affine.load %0[%a0] : memref<100xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "#set = affine_set<(d0): (d0 - 50 >= 0)> func.func @test_affine_for_if_same_block() { %0 = memref.alloc() : memref<100xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 100 { affine.if #set(%i0) { %1 = affine.load %0[%i0] : memref<100xf32> affine.store %cf7, %0[%i0] : memref<100xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "#set = affine_set<(d0): (d0 - 50 >= 0)> func.func @test_affine_for_if_separated() { %0 = memref.alloc() : memref<100xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.if #set(%i0) { %1 = affine.load %0[%i0] : memref<100xf32> } else { affine.store %cf7, %0[%i0] : memref<100xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "#set1 = affine_set<(d0): ( d0 - 25 >= 0)> #set2 = affine_set<(d0): (- d0 + 75 >= 0)> func.func @test_affine_for_if_partially_joined() { %0 = memref.alloc() : memref<100xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 100 { affine.if #set1(%i0) { %1 = affine.load %0[%i0] : memref<100xf32> } affine.if #set2(%i0) { affine.store %cf7, %0[%i0] : memref<100xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "#set1 = affine_set<(d0): (d0 - 50 >= 0)> #set2 = affine_set<(d0, d1): (d0 - 75 >= 0, d1 - 50 >= 0)> func.func @test_interleaved_affine_for_if() { %0 = memref.alloc() : memref<100x100xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 100 { affine.if #set1(%i0) { affine.for %i1 = 0 to 100 { %1 = affine.load %0[%i0, %i1] : memref<100x100xf32> affine.if #set2(%i0, %i1) { affine.store %cf7, %0[%i0, %i1] : memref<100x100xf32> } } } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "#set1 = affine_set<(d0)[s0]: ( d0 - s0 floordiv 2 >= 0)> #set2 = affine_set<(d0): (- d0 + 51 >= 0)> func.func @test_interleaved_affine_for_if() { %0 = memref.alloc() : memref<101xf32> %c0 = arith.constant 0 : index %N = memref.dim %0, %c0 : memref<101xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 101 { affine.if #set1(%i0)[%N] { %1 = affine.load %0[%i0] : memref<101xf32> } affine.if #set2(%i0) { affine.store %cf7, %0[%i0] : memref<101xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @dependent_parallel() { %0 = memref.alloc() : memref<10xf32> %cst = arith.constant 7.000000e+00 : f32 affine.parallel (%i0) = (0) to (10) { affine.store %cst, %0[%i0] : memref<10xf32> } affine.parallel (%i1) = (0) to (10) { %1 = affine.load %0[%i1] : memref<10xf32> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @affine_if_no_dependence() { %c1 = arith.constant 1 : index %alloc = memref.alloc() : memref<15xi1> %true = arith.constant true affine.store %true, %alloc[%c1] : memref<15xi1> affine.if affine_set<(d0, d1, d2, d3) : ((d0 + 1) mod 8 >= 0, d0 * -8 >= 0)>(%c1, %c1, %c1, %c1){ %265 = affine.load %alloc[%c1] : memref<15xi1> } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @affine_parallel_dep_check_1() { %memref_23 = memref.alloc() : memref<1x130xf32> %memref_25 = memref.alloc() : memref<1x130x130xf32> %cst = arith.constant 0.0 : f32 affine.parallel (%arg4, %arg5) = (0, 0) to (1, 130) { affine.store %cst, %memref_25[%arg4, %arg5, 129] : memref<1x130x130xf32> } %memref_27 = memref.alloc() : memref<1x128x128xf32> affine.parallel (%arg4) = (0) to (130) { affine.parallel (%arg5, %arg6) = (0, 0) to (1, 130) { affine.load %memref_25[0, %arg4 + %arg5, %arg6] : memref<1x130x130xf32> } } return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @affine_parallel_dep_check_2() { %m = memref.alloc() : memref<128xf32> %cst = arith.constant 0.0 : f32 affine.parallel (%arg4) = (0) to (127) { affine.store %cst, %m[%arg4] : memref<128xf32> } affine.load %m[127]: memref<128xf32> return }", mlir-opt -test-memref-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @permute() { %A = memref.alloc() : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>> affine.for %i = 0 to 64 { affine.for %j = 0 to 256 { %1 = affine.load %A[%i, %j] : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>> ""prevent.dce""(%1) : (f32) -> () } } memref.dealloc %A : memref<64x256xf32, affine_map<(d0, d1) -> (d1, d0)>> return } func.func @shift(%idx : index) { %A = memref.alloc() : memref<64xf32, affine_map<(d0) -> (d0 + 1)>> affine.load %A[%idx] : memref<64xf32, affine_map<(d0) -> (d0 + 1)>> affine.for %i = 0 to 64 { %1 = affine.load %A[%i] : memref<64xf32, affine_map<(d0) -> (d0 + 1)>> ""prevent.dce""(%1) : (f32) -> () } return } func.func @high_dim_permute() { %A = memref.alloc() : memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>> affine.for %i = 0 to 64 { affine.for %j = 0 to 128 { affine.for %k = 0 to 256 { %1 = affine.load %A[%i, %j, %k] : memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>> ""prevent.dce""(%1) : (f32) -> () } } } return } func.func @invalid_map() { %A = memref.alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (d0, -d1 - 10)>> return } func.func @data_tiling(%idx : index) { %A = memref.alloc() : memref<64x512xf32, affine_map<(d0, d1) -> (d0 floordiv 8, d1 floordiv 16, d0 mod 8, d1 mod 16)>> %1 = affine.load %A[%idx, %idx] : memref<64x512xf32, affine_map<(d0, d1) -> (d0 floordiv 8, d1 floordiv 16, d0 mod 8, d1 mod 16)>> ""prevent.dce""(%1) : (f32) -> () return } func.func @strided() { %A = memref.alloc() : memref<64x128xf32, affine_map<(d0, d1) -> (2*d0, 4*d1)>> affine.for %i = 0 to 64 { affine.for %j = 0 to 128 { %1 = affine.load %A[%i, %j] : memref<64x128xf32, affine_map<(d0, d1) -> (2*d0, 4*d1)>> ""prevent.dce""(%1) : (f32) -> () } } return } func.func @strided_cumulative() { %A = memref.alloc() : memref<2x5xf32, affine_map<(d0, d1) -> (3*d0 + 17*d1)>> affine.for %i = 0 to 2 { affine.for %j = 0 to 5 { %1 = affine.load %A[%i, %j] : memref<2x5xf32, affine_map<(d0, d1) -> (3*d0 + 17*d1)>> ""prevent.dce""(%1) : (f32) -> () } } return } func.func @symbolic_operands(%s : index) { %A = memref.alloc()[%s] : memref<10x10xf32, affine_map<(d0,d1)[s0] -> (10*d0 + d1)>> affine.for %i = 0 to 10 { affine.for %j = 0 to 10 { %1 = affine.load %A[%i, %j] : memref<10x10xf32, affine_map<(d0,d1)[s0] -> (10*d0 + d1)>> ""prevent.dce""(%1) : (f32) -> () } } return } func.func @semi_affine_layout_map(%s0: index, %s1: index) { %A = memref.alloc()[%s0, %s1] : memref<256x1024xf32, affine_map<(d0, d1)[s0, s1] -> (d0*s0 + d1*s1)>> affine.for %i = 0 to 256 { affine.for %j = 0 to 1024 { affine.load %A[%i, %j] : memref<256x1024xf32, affine_map<(d0, d1)[s0, s1] -> (d0*s0 + d1*s1)>> } } return } func.func @alignment() { %A = memref.alloc() {alignment = 32 : i64}: memref<64x128x256xf32, affine_map<(d0, d1, d2) -> (d2, d0, d1)>> return } #tile = affine_map < (i)->(i floordiv 4, i mod 4) > func.func @multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf64, #tile>, %D: memref<24xf64>) -> f64 { %a = affine.load %A[0] : memref<16xf64, #tile> %p = arith.mulf %a, %a : f64 affine.store %p, %A[10] : memref<16xf64, #tile> call @single_argument_type(%C): (memref<8xf64, #tile>) -> () return %B : f64 } func.func @single_argument_type(%C : memref<8xf64, #tile>) { %a = memref.alloc(): memref<8xf64, #tile> %b = memref.alloc(): memref<16xf64, #tile> %d = arith.constant 23.0 : f64 %e = memref.alloc(): memref<24xf64> call @single_argument_type(%a): (memref<8xf64, #tile>) -> () call @single_argument_type(%C): (memref<8xf64, #tile>) -> () call @multiple_argument_type(%b, %d, %a, %e): (memref<16xf64, #tile>, f64, memref<8xf64, #tile>, memref<24xf64>) -> f64 return } func.func @non_memref_ret(%A: memref<8xf64, #tile>) -> i1 { %d = arith.constant 1 : i1 return %d : i1 } func.func @ret_multiple_argument_type(%A: memref<16xf64, #tile>, %B: f64, %C: memref<8xf64, #tile>) -> (memref<8xf64, #tile>, f64) { %a = affine.load %A[0] : memref<16xf64, #tile> %p = arith.mulf %a, %a : f64 %cond = arith.constant 1 : i1 cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %res1, %res2 = call @ret_single_argument_type(%C) : (memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>) return %res2, %p: memref<8xf64, #tile>, f64 ^bb2: return %C, %p: memref<8xf64, #tile>, f64 } func.func @ret_single_argument_type(%C: memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>){ %a = memref.alloc() : memref<8xf64, #tile> %b = memref.alloc() : memref<16xf64, #tile> %d = arith.constant 23.0 : f64 call @ret_single_argument_type(%a) : (memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>) call @ret_single_argument_type(%C) : (memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>) %res1, %res2 = call @ret_multiple_argument_type(%b, %d, %a) : (memref<16xf64, #tile>, f64, memref<8xf64, #tile>) -> (memref<8xf64, #tile>, f64) %res3, %res4 = call @ret_single_argument_type(%res1) : (memref<8xf64, #tile>) -> (memref<16xf64, #tile>, memref<8xf64, #tile>) return %b, %a: memref<16xf64, #tile>, memref<8xf64, #tile> } func.func @func_A(%A: memref<8xf64, #tile>) { call @func_B(%A) : (memref<8xf64, #tile>) -> () return } func.func @func_B(%A: memref<8xf64, #tile>) { call @func_C(%A) : (memref<8xf64, #tile>) -> () return } func.func @func_C(%A: memref<8xf64, #tile>) { return } func.func @some_func_A(%A: memref<8xf64, #tile>) { call @some_func_B(%A) : (memref<8xf64, #tile>) -> () return } func.func @some_func_B(%A: memref<8xf64, #tile>) { ""test.test""(%A) : (memref<8xf64, #tile>) -> () call @some_func_C(%A) : (memref<8xf64, #tile>) -> () return } func.func @some_func_C(%A: memref<8xf64, #tile>) { return } func.func private @external_func_A(memref<16xf64, #tile>) -> () func.func private @external_func_B(memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>) func.func @simply_call_external() { %a = memref.alloc() : memref<16xf64, #tile> call @external_func_A(%a) : (memref<16xf64, #tile>) -> () return } func.func @use_value_of_external(%A: memref<16xf64, #tile>, %B: f64) -> (memref<8xf64, #tile>) { %res = call @external_func_B(%A, %B) : (memref<16xf64, #tile>, f64) -> (memref<8xf64, #tile>) return %res : memref<8xf64, #tile> } func.func @affine_parallel_norm() -> memref<8xf32, #tile> { %c = arith.constant 23.0 : f32 %a = memref.alloc() : memref<8xf32, #tile> %1 = affine.parallel (%i) = (0) to (8) reduce (""assign"") -> memref<8xf32, #tile> { affine.store %c, %a[%i] : memref<8xf32, #tile> affine.yield %a : memref<8xf32, #tile> } return %1 : memref<8xf32, #tile> } #map = affine_map<(d0, d1)[s0] -> (d0 * 3 + s0 + d1)> func.func @map_symbol() -> memref<2x3xf32, #map> { %c1 = arith.constant 1 : index %0 = memref.alloc()[%c1] : memref<2x3xf32, #map> return %0 : memref<2x3xf32, #map> } #neg = affine_map<(d0, d1) -> (d0, d1 - 100)> func.func @neg_map() -> memref<2x3xf32, #neg> { %0 = memref.alloc() : memref<2x3xf32, #neg> return %0 : memref<2x3xf32, #neg> }", mlir-opt -normalize-memrefs -allow-unregistered-dialect ,1 "func.func @A() { call @B() { inA } : () -> () return } func.func @B() { call @E() : () -> () return } func.func @C() { call @D() : () -> () return } func.func private @D() { call @B() { inD } : () -> () return } func.func @E() { call @fabsf() : () -> () return } func.func private @fabsf()", mlir-opt -inline ,1 "func.func @f(%arg0: f32) { %0 = ""arith.addf""(%arg0, %arg0) : (f32, f32) -> f32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) { ""test.br""(%arg0)[^succ] : (f32) -> () ^succ(%0: f32): return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) { cf.br ^loop(%arg0: f32) ^loop(%loop: f32): cf.br ^loop(%loop: f32) }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) { cf.br ^loop(%arg0: f32) ^loop(%0: f32): %1 = ""math.exp""(%0) : (f32) -> f32 cf.br ^loop(%1: f32) }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32, %pred: i1) { %exp = ""math.exp""(%arg0) : (f32) -> f32 cf.cond_br %pred, ^true(%exp: f32), ^false(%exp: f32) ^true(%0: f32): return ^false(%1: f32): return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) { func.func @g(%arg1: f32) { %0 = ""arith.addf""(%arg1, %arg1) : (f32, f32) -> f32 return } return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) -> f32 { %0 = ""arith.addf""(%arg0, %arg0) : (f32, f32) -> f32 return %0 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) { ""foo.print""(%arg0) : (f32) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f(%arg0: f32) { %0 = ""math.exp""(%arg0) : (f32) -> f32 ""foo.has_region""() ({ %1 = ""math.exp""(%0) : (f32) -> f32 ""foo.return""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f( %arg0: tensor<1xf32>, %arg1: tensor<2xf32>, %arg2: tensor<3xf32>, %arg3: tensor<4xf32>, %arg4: tensor<5xf32>) { ""test.br""(%arg0, %arg1, %arg2, %arg3, %arg4)[^succ] : (tensor<1xf32>, tensor<2xf32>, tensor<3xf32>, tensor<4xf32>, tensor<5xf32>) -> () ^succ(%t1: tensor<1xf32>, %t2: tensor<2xf32>, %t3: tensor<3xf32>, %t4: tensor<4xf32>, %t5: tensor<5xf32>): ""foo.print""(%t2) : (tensor<2xf32>) -> () ""foo.print""(%t4) : (tensor<4xf32>) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f() { test.graph_region { %0 = ""math.exp""(%1) : (f32) -> f32 %1 = ""math.exp""(%0) : (f32) -> f32 ""test.terminator""() : ()->() } return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @f() { %0 = ""test.test_effects_result""() : () -> i32 return }", mlir-opt -allow-unregistered-dialect -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @test_subi_zero(%arg0: i32) -> i32 { %y = arith.subi %arg0, %arg0 : i32 return %y: i32 } func.func @test_subi_zero_vector(%arg0: vector<4xi32>) -> vector<4xi32> { %y = arith.subi %arg0, %arg0 : vector<4xi32> return %y: vector<4xi32> } func.func @test_subi_zero_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %y = arith.subi %arg0, %arg0 : tensor<4x5xi32> return %y: tensor<4x5xi32> } func.func @dim(%arg0: tensor<8x4xf32>) -> index { %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c1 : tensor<8x4xf32> return %0 : index } func.func @test_commutative(%arg0: i32) -> (i32, i32) { %c42_i32 = arith.constant 42 : i32 %y = arith.addi %c42_i32, %arg0 : i32 %z = arith.subi %c42_i32, %arg0 : i32 return %y, %z: i32, i32 } func.func @trivial_dce(%arg0: tensor<8x4xf32>) { %c1 = arith.constant 1 : index %0 = tensor.dim %arg0, %c1 : tensor<8x4xf32> return } func.func @load_dce(%arg0: index) { %c4 = arith.constant 4 : index %a = memref.alloc(%c4) : memref %2 = memref.load %a[%arg0] : memref memref.dealloc %a: memref return } func.func @addi_zero(%arg0: i32) -> i32 { %c0_i32 = arith.constant 0 : i32 %y = arith.addi %c0_i32, %arg0 : i32 return %y: i32 } func.func @addi_zero_index(%arg0: index) -> index { %c0_index = arith.constant 0 : index %y = arith.addi %c0_index, %arg0 : index return %y: index } func.func @addi_zero_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> { %c0_v4i32 = arith.constant dense<0> : vector<4 x i32> %y = arith.addi %c0_v4i32, %arg0 : vector<4 x i32> return %y: vector<4 x i32> } func.func @addi_zero_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> { %c0_t45i32 = arith.constant dense<0> : tensor<4 x 5 x i32> %y = arith.addi %arg0, %c0_t45i32 : tensor<4 x 5 x i32> return %y: tensor<4 x 5 x i32> } func.func @muli_zero(%arg0: i32) -> i32 { %c0_i32 = arith.constant 0 : i32 %y = arith.muli %c0_i32, %arg0 : i32 return %y: i32 } func.func @muli_zero_index(%arg0: index) -> index { %c0_index = arith.constant 0 : index %y = arith.muli %c0_index, %arg0 : index return %y: index } func.func @muli_zero_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> { %cst = arith.constant dense<0> : vector<4 x i32> %y = arith.muli %cst, %arg0 : vector<4 x i32> return %y: vector<4 x i32> } func.func @muli_zero_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> { %cst = arith.constant dense<0> : tensor<4 x 5 x i32> %y = arith.muli %arg0, %cst : tensor<4 x 5 x i32> return %y: tensor<4 x 5 x i32> } func.func @muli_one(%arg0: i32) -> i32 { %c0_i32 = arith.constant 1 : i32 %y = arith.muli %c0_i32, %arg0 : i32 return %y: i32 } func.func @muli_one_index(%arg0: index) -> index { %c0_index = arith.constant 1 : index %y = arith.muli %c0_index, %arg0 : index return %y: index } func.func @muli_one_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> { %c1_v4i32 = arith.constant dense<1> : vector<4 x i32> %y = arith.muli %c1_v4i32, %arg0 : vector<4 x i32> return %y: vector<4 x i32> } func.func @muli_one_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> { %c1_t45i32 = arith.constant dense<1> : tensor<4 x 5 x i32> %y = arith.muli %arg0, %c1_t45i32 : tensor<4 x 5 x i32> return %y: tensor<4 x 5 x i32> } func.func @and_self(%arg0: i32) -> i32 { %1 = arith.andi %arg0, %arg0 : i32 return %1 : i32 } func.func @and_self_vector(%arg0: vector<4xi32>) -> vector<4xi32> { %1 = arith.andi %arg0, %arg0 : vector<4xi32> return %1 : vector<4xi32> } func.func @and_self_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %1 = arith.andi %arg0, %arg0 : tensor<4x5xi32> return %1 : tensor<4x5xi32> } func.func @and_zero(%arg0: i32) -> i32 { %c0_i32 = arith.constant 0 : i32 %1 = arith.andi %arg0, %c0_i32 : i32 return %1 : i32 } func.func @and_zero_index(%arg0: index) -> index { %c0_index = arith.constant 0 : index %1 = arith.andi %arg0, %c0_index : index return %1 : index } func.func @and_zero_vector(%arg0: vector<4xi32>) -> vector<4xi32> { %cst = arith.constant dense<0> : vector<4xi32> %1 = arith.andi %arg0, %cst : vector<4xi32> return %1 : vector<4xi32> } func.func @and_zero_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %cst = arith.constant dense<0> : tensor<4x5xi32> %1 = arith.andi %arg0, %cst : tensor<4x5xi32> return %1 : tensor<4x5xi32> } func.func @or_self(%arg0: i32) -> i32 { %1 = arith.ori %arg0, %arg0 : i32 return %1 : i32 } func.func @or_self_vector(%arg0: vector<4xi32>) -> vector<4xi32> { %1 = arith.ori %arg0, %arg0 : vector<4xi32> return %1 : vector<4xi32> } func.func @or_self_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %1 = arith.ori %arg0, %arg0 : tensor<4x5xi32> return %1 : tensor<4x5xi32> } func.func @or_zero(%arg0: i32) -> i32 { %c0_i32 = arith.constant 0 : i32 %1 = arith.ori %arg0, %c0_i32 : i32 return %1 : i32 } func.func @or_zero_index(%arg0: index) -> index { %c0_index = arith.constant 0 : index %1 = arith.ori %arg0, %c0_index : index return %1 : index } func.func @or_zero_vector(%arg0: vector<4xi32>) -> vector<4xi32> { %cst = arith.constant dense<0> : vector<4xi32> %1 = arith.ori %arg0, %cst : vector<4xi32> return %1 : vector<4xi32> } func.func @or_zero_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %cst = arith.constant dense<0> : tensor<4x5xi32> %1 = arith.ori %arg0, %cst : tensor<4x5xi32> return %1 : tensor<4x5xi32> } func.func @or_all_ones(%arg0: i1, %arg1: i4) -> (i1, i4) { %c1_i1 = arith.constant 1 : i1 %c15 = arith.constant 15 : i4 %1 = arith.ori %arg0, %c1_i1 : i1 %2 = arith.ori %arg1, %c15 : i4 return %1, %2 : i1, i4 } func.func @xor_self(%arg0: i32) -> i32 { %1 = arith.xori %arg0, %arg0 : i32 return %1 : i32 } func.func @xor_self_vector(%arg0: vector<4xi32>) -> vector<4xi32> { %1 = arith.xori %arg0, %arg0 : vector<4xi32> return %1 : vector<4xi32> } func.func @xor_self_tensor(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %1 = arith.xori %arg0, %arg0 : tensor<4x5xi32> return %1 : tensor<4x5xi32> } func.func @memref_cast_folding(%arg0: memref<4 x f32>, %arg1: f32) -> (f32, f32) { %0 = memref.cast %arg0 : memref<4xf32> to memref %c0 = arith.constant 0 : index %dim = memref.dim %0, %c0 : memref %1 = affine.load %0[%dim - 1] : memref memref.store %arg1, %0[%c0] : memref %2 = memref.load %0[%c0] : memref memref.dealloc %0: memref return %1, %2 : f32, f32 } func.func @fold_memref_cast_in_memref_cast(%0: memref<42x42xf64>) { %4 = memref.cast %0 : memref<42x42xf64> to memref %5 = memref.cast %4 : memref to memref ""test.user""(%5) : (memref) -> () return } func.func @fold_memref_cast_chain(%0: memref<42x42xf64>) { %4 = memref.cast %0 : memref<42x42xf64> to memref %5 = memref.cast %4 : memref to memref<42x42xf64> ""test.user""(%5) : (memref<42x42xf64>) -> () return } func.func @dead_alloc_fold() { %c4 = arith.constant 4 : index %a = memref.alloc(%c4) : memref return } func.func @dead_dealloc_fold() { %a = memref.alloc() : memref<4xf32> memref.dealloc %a: memref<4xf32> return } func.func @dead_dealloc_fold_multi_use(%cond : i1) { %a = memref.alloc() : memref<4xf32> cf.cond_br %cond, ^bb1, ^bb2 ^bb1: memref.dealloc %a: memref<4xf32> return ^bb2: memref.dealloc %a: memref<4xf32> return } func.func @write_only_alloc_fold(%v: f32) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %a = memref.alloc(%c4) : memref memref.store %v, %a[%c0] : memref memref.dealloc %a: memref return } func.func @write_only_alloca_fold(%v: f32) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %a = memref.alloca(%c4) : memref memref.store %v, %a[%c0] : memref return } func.func @dead_block_elim() { func.func @nested() { return ^bb1: return } return ^bb1: return } func.func @dyn_shape_fold(%L : index, %M : index) -> (memref<4 x ? x 8 x ? x ? x f32>, memref, memref, memref<4 x ? x 8 x ? x ? x f32>) { %zero = arith.constant 0 : index %nine = arith.constant 9 : index %N = arith.constant 1024 : index %K = arith.constant 512 : index %a = memref.alloc(%L, %N) : memref %b = memref.alloc(%N, %K, %M) : memref<4 x ? x 8 x ? x ? x f32> %c = memref.alloc(%K, %N) : memref %d = memref.alloc(%nine, %nine) : memref %e = memref.alloca(%N, %K, %M) : memref<4 x ? x 8 x ? x ? x f32> affine.for %i = 0 to %L { affine.for %j = 0 to 10 { %v = memref.load %a[%i, %j] : memref memref.store %v, %b[%zero, %zero, %i, %j, %zero] : memref<4x?x8x?x?xf32> } } return %b, %c, %d, %e : memref<4 x ? x 8 x ? x ? x f32>, memref, memref, memref<4 x ? x 8 x ? x ? x f32> } func.func @dim_op_fold(%arg0: index, %arg1: index, %arg2: index, %BUF: memref, %M : index, %N : index, %K : index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.alloc(%arg0, %arg1) : memref %1 = memref.alloc(%arg1, %arg2) : memref %2 = memref.dim %1, %c2 : memref affine.for %arg3 = 0 to %2 { %3 = memref.alloc(%arg0) : memref %ub = memref.dim %3, %c0 : memref affine.for %arg4 = 0 to %ub { %s = memref.dim %0, %c0 : memref %v = memref.view %3[%c0][%arg4, %s] : memref to memref %sv = memref.subview %0[%c0, %c0][%s,%arg4][%c1,%c1] : memref to memref> %l = memref.dim %v, %c1 : memref %u = memref.dim %sv, %c0 : memref> affine.for %arg5 = %l to %u { ""foo""() : () -> () } %sv2 = memref.subview %0[0, 0][17, %arg4][1, 1] : memref to memref<17x?xf32, strided<[?, 1], offset: ?>> %l2 = memref.dim %v, %c1 : memref %u2 = memref.dim %sv2, %c1 : memref<17x?xf32, strided<[?, 1], offset: ?>> scf.for %arg5 = %l2 to %u2 step %c1 { ""foo""() : () -> () } } } %A = memref.view %BUF[%c0][%M, %K] : memref to memref %B = memref.view %BUF[%c0][%K, %N] : memref to memref %C = memref.view %BUF[%c0][%M, %N] : memref to memref %M_ = memref.dim %A, %c0 : memref %K_ = memref.dim %A, %c1 : memref %N_ = memref.dim %C, %c1 : memref scf.for %i = %c0 to %M_ step %c1 { scf.for %j = %c0 to %N_ step %c1 { scf.for %k = %c0 to %K_ step %c1 { } } } return } func.func @merge_constants() -> (index, index) { %0 = arith.constant 42 : index %1 = arith.constant 42 : index return %0, %1: index, index } func.func @hoist_constant(%arg0: memref<8xi32>) { affine.for %arg1 = 0 to 8 { %c42_i32 = arith.constant 42 : i32 memref.store %c42_i32, %arg0[%arg1] : memref<8xi32> } return } func.func @const_fold_propagate() -> memref { %VT_i = arith.constant 512 : index %VT_i_s = affine.apply affine_map<(d0) -> (d0 floordiv 8)> (%VT_i) %VT_k_l = affine.apply affine_map<(d0) -> (d0 floordiv 16)> (%VT_i) %Av = memref.alloc(%VT_i_s, %VT_k_l) : memref return %Av : memref } func.func @indirect_target() { return } func.func @indirect_call_folding() { %indirect_fn = constant @indirect_target : () -> () call_indirect %indirect_fn() : () -> () return } func.func @lowered_affine_mod() -> (index, index) { %c-43 = arith.constant -43 : index %c42 = arith.constant 42 : index %0 = arith.remsi %c-43, %c42 : index %c0 = arith.constant 0 : index %1 = arith.cmpi slt, %0, %c0 : index %2 = arith.addi %0, %c42 : index %3 = arith.select %1, %2, %0 : index %c43 = arith.constant 43 : index %c42_0 = arith.constant 42 : index %4 = arith.remsi %c43, %c42_0 : index %c0_1 = arith.constant 0 : index %5 = arith.cmpi slt, %4, %c0_1 : index %6 = arith.addi %4, %c42_0 : index %7 = arith.select %5, %6, %4 : index return %3, %7 : index, index } func.func @lowered_affine_floordiv() -> (index, index) { %c-43 = arith.constant -43 : index %c42 = arith.constant 42 : index %c0 = arith.constant 0 : index %c-1 = arith.constant -1 : index %0 = arith.cmpi slt, %c-43, %c0 : index %1 = arith.subi %c-1, %c-43 : index %2 = arith.select %0, %1, %c-43 : index %3 = arith.divsi %2, %c42 : index %4 = arith.subi %c-1, %3 : index %5 = arith.select %0, %4, %3 : index %c43 = arith.constant 43 : index %c42_0 = arith.constant 42 : index %c0_1 = arith.constant 0 : index %c-1_2 = arith.constant -1 : index %6 = arith.cmpi slt, %c43, %c0_1 : index %7 = arith.subi %c-1_2, %c43 : index %8 = arith.select %6, %7, %c43 : index %9 = arith.divsi %8, %c42_0 : index %10 = arith.subi %c-1_2, %9 : index %11 = arith.select %6, %10, %9 : index return %5, %11 : index, index } func.func @lowered_affine_ceildiv() -> (index, index) { %c-43 = arith.constant -43 : index %c42 = arith.constant 42 : index %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = arith.cmpi sle, %c-43, %c0 : index %1 = arith.subi %c0, %c-43 : index %2 = arith.subi %c-43, %c1 : index %3 = arith.select %0, %1, %2 : index %4 = arith.divsi %3, %c42 : index %5 = arith.subi %c0, %4 : index %6 = arith.addi %4, %c1 : index %7 = arith.select %0, %5, %6 : index %c43 = arith.constant 43 : index %c42_0 = arith.constant 42 : index %c0_1 = arith.constant 0 : index %c1_2 = arith.constant 1 : index %8 = arith.cmpi sle, %c43, %c0_1 : index %9 = arith.subi %c0_1, %c43 : index %10 = arith.subi %c43, %c1_2 : index %11 = arith.select %8, %9, %10 : index %12 = arith.divsi %11, %c42_0 : index %13 = arith.subi %c0_1, %12 : index %14 = arith.addi %12, %c1_2 : index %15 = arith.select %8, %13, %14 : index return %7, %15 : index, index } func.func @cast_values(%arg0: memref) -> memref<2xi32> { %1 = memref.cast %arg0 : memref to memref %3 = memref.cast %1 : memref to memref<2xi32> %5 = memref.cast %3 : memref<2xi32> to memref<2xi32> return %5 : memref<2xi32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @view(%arg0 : index) -> (f32, f32, f32, f32) { %0 = memref.alloc() : memref<2048xi8> %c0 = arith.constant 0 : index %c7 = arith.constant 7 : index %c11 = arith.constant 11 : index %c15 = arith.constant 15 : index %1 = memref.view %0[%c15][%c7, %c11] : memref<2048xi8> to memref %r0 = memref.load %1[%c0, %c0] : memref %2 = memref.view %0[%c15][%arg0, %arg0, %c7] : memref<2048xi8> to memref %r1 = memref.load %2[%c0, %c0, %c0] : memref %3 = memref.view %0[%c15][%c7] : memref<2048xi8> to memref %r2 = memref.load %3[%c0, %c0] : memref %4 = memref.cast %0 : memref<2048xi8> to memref %5 = memref.view %4[%c15][%c15, %c7] : memref to memref %r3 = memref.load %5[%c0, %c0] : memref return %r0, %r1, %r2, %r3 : f32, f32, f32, f32 }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @subview(%arg0 : index, %arg1 : index) -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c7 = arith.constant 7 : index %c11 = arith.constant 11 : index %c15 = arith.constant 15 : index %0 = memref.alloc() : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> %1 = memref.subview %0[%c0, %c0, %c0] [%c7, %c11, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> %v0 = memref.load %1[%c0, %c0, %c0] : memref> %2 = memref.subview %0[%c0, %arg0, %c0] [%c7, %c11, %c15] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> memref.store %v0, %2[%c0, %c0, %c0] : memref> %3 = memref.alloc(%arg0) : memref> %4 = memref.subview %3[%c0, %c0, %c0] [%c7, %c11, %c15] [%c1, %c1, %c1] : memref> to memref> memref.store %v0, %4[%c0, %c0, %c0] : memref> %5 = memref.subview %0[%c1, %c2, %c7] [%c7, %c11, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> memref.store %v0, %5[%c0, %c0, %c0] : memref> %6 = memref.subview %0[%c0, %c0, %c0] [%c7, %c11, %c2] [%c2, %c7, %c11] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> memref.store %v0, %6[%c0, %c0, %c0] : memref> %10 = memref.subview %0[%arg0, %arg0, %arg0] [%c7, %c11, %c2] [%arg1, %arg1, %arg1] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> memref.store %v0, %10[%arg1, %arg1, %arg1] : memref> %11 = memref.subview %0[%arg0, %arg0, %arg0] [%arg1, %arg1, %arg1] [%c2, %c7, %c11] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> memref.store %v0, %11[%arg0, %arg0, %arg0] : memref> %13 = memref.subview %0[%c1, %c2, %c7] [%arg1, %arg1, %arg1] [%arg0, %arg0, %arg0] : memref<8x16x4xf32, strided<[64, 4, 1], offset: 0>> to memref> memref.store %v0, %13[%arg1, %arg1, %arg1] : memref> %14 = memref.alloc(%arg0, %arg0, %arg1) : memref %15 = memref.subview %14[%arg0, %arg0, %arg0] [%c7, %c11, %c2] [%arg1, %arg1, %arg1] : memref to memref> memref.store %v0, %15[%arg1, %arg1, %arg1] : memref> %16 = memref.subview %14[%arg0, %arg0, %arg0] [%arg1, %arg1, %arg1] [%c2, %c2, %c2] : memref to memref> memref.store %v0, %16[%arg0, %arg0, %arg0] : memref> %17 = memref.subview %14[%c1, %c1, %c1] [%arg0, %arg0, %arg0] [%arg1, %arg1, %arg1] : memref to memref> memref.store %v0, %17[%arg0, %arg0, %arg0] : memref> %18 = memref.alloc() : memref<12x4xf32> %c4 = arith.constant 4 : index %19 = memref.subview %18[%arg1, %arg1] [%c2, %c4] [1, 1] : memref<12x4xf32> to memref> memref.store %v0, %19[%arg1, %arg1] : memref> %20 = memref.subview %18[%c2, %c4] [12, 4] [1, 1] : memref<12x4xf32> to memref<12x4xf32, strided<[4, 1], offset: ?>> memref.store %v0, %20[%arg1, %arg1] : memref<12x4xf32, strided<[4, 1], offset: ?>> %7 = memref.dim %4, %c0 : memref> %8 = memref.dim %4, %c1 : memref> return %7, %8 : index, index } func.func @index_cast(%arg0: i16) -> (i16) { %11 = arith.index_cast %arg0 : i16 to index %12 = arith.index_cast %11 : index to i16 return %12 : i16 } func.func @index_cast_fold() -> (i16, index) { %c4 = arith.constant 4 : index %1 = arith.index_cast %c4 : index to i16 %c4_i16 = arith.constant 4 : i16 %2 = arith.index_cast %c4_i16 : i16 to index return %1, %2 : i16, index } func.func @remove_dead_else(%M : memref<100 x i32>) { affine.for %i = 0 to 100 { affine.load %M[%i] : memref<100xi32> affine.if affine_set<(d0) : (d0 - 2 >= 0)>(%i) { affine.for %j = 0 to 100 { %1 = affine.load %M[%j] : memref<100xi32> ""prevent.dce""(%1) : (i32) -> () } } else { } affine.load %M[%i] : memref<100xi32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @divi_signed_by_one(%arg0: i32) -> (i32) { %c1 = arith.constant 1 : i32 %res = arith.divsi %arg0, %c1 : i32 return %res : i32 } func.func @divi_unsigned_by_one(%arg0: i32) -> (i32) { %c1 = arith.constant 1 : i32 %res = arith.divui %arg0, %c1 : i32 return %res : i32 } func.func @tensor_divi_signed_by_one(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %c1 = arith.constant dense<1> : tensor<4x5xi32> %res = arith.divsi %arg0, %c1 : tensor<4x5xi32> return %res : tensor<4x5xi32> } func.func @tensor_divi_unsigned_by_one(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %c1 = arith.constant dense<1> : tensor<4x5xi32> %res = arith.divui %arg0, %c1 : tensor<4x5xi32> return %res : tensor<4x5xi32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @arith.floordivsi_by_one(%arg0: i32) -> (i32) { %c1 = arith.constant 1 : i32 %res = arith.floordivsi %arg0, %c1 : i32 return %res : i32 } func.func @tensor_arith.floordivsi_by_one(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %c1 = arith.constant dense<1> : tensor<4x5xi32> %res = arith.floordivsi %arg0, %c1 : tensor<4x5xi32> return %res : tensor<4x5xi32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @arith.ceildivsi_by_one(%arg0: i32) -> (i32) { %c1 = arith.constant 1 : i32 %res = arith.ceildivsi %arg0, %c1 : i32 return %res : i32 } func.func @tensor_arith.ceildivsi_by_one(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %c1 = arith.constant dense<1> : tensor<4x5xi32> %res = arith.ceildivsi %arg0, %c1 : tensor<4x5xi32> return %res : tensor<4x5xi32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @arith.ceildivui_by_one(%arg0: i32) -> (i32) { %c1 = arith.constant 1 : i32 %res = arith.ceildivui %arg0, %c1 : i32 return %res : i32 } func.func @tensor_arith.ceildivui_by_one(%arg0: tensor<4x5xi32>) -> tensor<4x5xi32> { %c1 = arith.constant dense<1> : tensor<4x5xi32> %res = arith.ceildivui %arg0, %c1 : tensor<4x5xi32> return %res : tensor<4x5xi32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @memref_cast_folding_subview(%arg0: memref<4x5xf32>, %i: index) -> (memref>) { %0 = memref.cast %arg0 : memref<4x5xf32> to memref %1 = memref.subview %0[%i, %i][%i, %i][%i, %i]: memref to memref> return %1: memref> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @memref_cast_folding_subview_static(%V: memref<16x16xf32>, %a: index, %b: index) -> memref<3x4xf32, strided<[?, 1], offset: ?>> { %0 = memref.cast %V : memref<16x16xf32> to memref %1 = memref.subview %0[0, 0][3, 4][1, 1] : memref to memref<3x4xf32, strided<[?, 1], offset: ?>> return %1: memref<3x4xf32, strided<[?, 1], offset: ?>> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @slice(%t: tensor<8x16x4xf32>, %arg0 : index, %arg1 : index) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c7 = arith.constant 7 : index %c11 = arith.constant 11 : index %1 = tensor.extract_slice %t[%c0, %c0, %c0] [%c7, %c11, %c2] [%c1, %c1, %c1] : tensor<8x16x4xf32> to tensor %2 = tensor.extract_slice %1[%c0, %c0, %c0] [%c2, %arg0, %c2] [%c1, %c1, %c1] : tensor to tensor return %2 : tensor }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_trunci(%arg0: i1) -> i1 attributes {} { %0 = arith.extui %arg0 : i1 to i8 %1 = arith.trunci %0 : i8 to i1 return %1 : i1 }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_trunci_vector(%arg0: vector<4xi1>) -> vector<4xi1> attributes {} { %0 = arith.extui %arg0 : vector<4xi1> to vector<4xi8> %1 = arith.trunci %0 : vector<4xi8> to vector<4xi1> return %1 : vector<4xi1> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_trunci(%arg0: i1) -> i2 attributes {} { %0 = arith.extui %arg0 : i1 to i8 %1 = arith.trunci %0 : i8 to i2 return %1 : i2 }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_trunci_vector(%arg0: vector<4xi1>) -> vector<4xi2> attributes {} { %0 = arith.extui %arg0 : vector<4xi1> to vector<4xi8> %1 = arith.trunci %0 : vector<4xi8> to vector<4xi2> return %1 : vector<4xi2> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @fold_trunci_sexti(%arg0: i1) -> i1 attributes {} { %0 = arith.extsi %arg0 : i1 to i8 %1 = arith.trunci %0 : i8 to i1 return %1 : i1 } func.func @simple_clone_elimination() -> memref<5xf32> { %ret = memref.alloc() : memref<5xf32> %temp = bufferization.clone %ret : memref<5xf32> to memref<5xf32> memref.dealloc %temp : memref<5xf32> return %ret : memref<5xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @clone_loop_alloc(%arg0: index, %arg1: index, %arg2: index, %arg3: memref<2xf32>, %arg4: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> memref.dealloc %0 : memref<2xf32> %1 = bufferization.clone %arg3 : memref<2xf32> to memref<2xf32> %2 = scf.for %arg5 = %arg0 to %arg1 step %arg2 iter_args(%arg6 = %1) -> (memref<2xf32>) { %3 = arith.cmpi eq, %arg5, %arg1 : index memref.dealloc %arg6 : memref<2xf32> %4 = memref.alloc() : memref<2xf32> %5 = bufferization.clone %4 : memref<2xf32> to memref<2xf32> memref.dealloc %4 : memref<2xf32> %6 = bufferization.clone %5 : memref<2xf32> to memref<2xf32> memref.dealloc %5 : memref<2xf32> scf.yield %6 : memref<2xf32> } memref.copy %2, %arg4 : memref<2xf32> to memref<2xf32> memref.dealloc %2 : memref<2xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "func.func @clone_nested_region(%arg0: index, %arg1: index, %arg2: index) -> memref { %cmp = arith.cmpi eq, %arg0, %arg1 : index %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { %3 = scf.if %cmp -> (memref) { %9 = bufferization.clone %1 : memref to memref scf.yield %9 : memref } else { %7 = memref.alloc(%arg0, %arg1) : memref %10 = bufferization.clone %7 : memref to memref memref.dealloc %7 : memref scf.yield %10 : memref } %6 = bufferization.clone %3 : memref to memref memref.dealloc %3 : memref scf.yield %6 : memref } else { %3 = memref.alloc(%arg1, %arg1) : memref %6 = bufferization.clone %3 : memref to memref memref.dealloc %3 : memref scf.yield %6 : memref } memref.dealloc %1 : memref return %2 : memref }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' -split-input-file ,1 "test.graph_region attributes{""root""} { %0 = ""test.foo""() {selected} : () -> i32 ""test.bar""(%1, %0) {selected} : (i32, i32) -> () %1 = ""test.baz""() {selected} : () -> i32 } test.graph_region attributes{""root""} { %2 = ""test.c""(%1) {selected} : (i32) -> i32 %1 = ""test.b""(%0, %2) : (i32, i32) -> i32 %0 = ""test.a""(%3) {selected} : (i32) -> i32 %3 = ""test.d""() {selected} : () -> i32 } test.graph_region attributes{""root""} { %0 = ""test.a""(%1) {selected} : (i32) -> i32 %1 = ""test.b""(%0) {selected} : (i32) -> i32 } func.func @test_multiple_blocks() -> (i32) attributes{""root"", ""ordered""} { %0 = ""test.foo""() {selected = 2} : () -> (i32) %1 = ""test.foo""() : () -> (i32) cf.br ^bb0 ^bb0: %2 = ""test.foo""() {selected = 3} : () -> (i32) %3 = ""test.bar""(%0, %1, %2) {selected = 0} : (i32, i32, i32) -> (i32) cf.br ^bb1 (%2 : i32) ^bb1(%arg0: i32): %4 = ""test.qux""(%arg0, %0) {selected = 1} : (i32, i32) -> (i32) return %4 : i32 } test.graph_region { ^entry(%arg0: i32): %0 = ""test.foo""(%arg0) : (i32) -> i32 ""test.bar""(%1, %0) : (i32, i32) -> () %1 = ""test.baz""(%arg0) : (i32) -> i32 } func.func @test_graph_cfg() -> () { %0 = ""test.foo""() : () -> i32 cf.br ^next(%0 : i32) ^next(%1: i32): test.graph_region { %2 = ""test.foo""(%1) : (i32) -> i32 ""test.bar""(%3, %2) : (i32, i32) -> () %3 = ""test.baz""(%0) : (i32) -> i32 } return } test.graph_region { %0 = ""test.foo""(%1) : (i32) -> i32 test.graph_region attributes {a} { %a = ""test.a""(%b) : (i32) -> i32 %b = ""test.b""(%2) : (i32) -> i32 } %1 = ""test.bar""(%2) : (i32) -> i32 %2 = ""test.baz""() : () -> i32 }", mlir-opt -topological-sort ,1 "test.graph_region attributes{""root""} { %0 = ""test.foo""() {selected} : () -> i32 ""test.bar""(%1, %0) {selected} : (i32, i32) -> () %1 = ""test.baz""() {selected} : () -> i32 } test.graph_region attributes{""root""} { %2 = ""test.c""(%1) {selected} : (i32) -> i32 %1 = ""test.b""(%0, %2) : (i32, i32) -> i32 %0 = ""test.a""(%3) {selected} : (i32) -> i32 %3 = ""test.d""() {selected} : () -> i32 } test.graph_region attributes{""root""} { %0 = ""test.a""(%1) {selected} : (i32) -> i32 %1 = ""test.b""(%0) {selected} : (i32) -> i32 } func.func @test_multiple_blocks() -> (i32) attributes{""root"", ""ordered""} { %0 = ""test.foo""() {selected = 2} : () -> (i32) %1 = ""test.foo""() : () -> (i32) cf.br ^bb0 ^bb0: %2 = ""test.foo""() {selected = 3} : () -> (i32) %3 = ""test.bar""(%0, %1, %2) {selected = 0} : (i32, i32, i32) -> (i32) cf.br ^bb1 (%2 : i32) ^bb1(%arg0: i32): %4 = ""test.qux""(%arg0, %0) {selected = 1} : (i32, i32) -> (i32) return %4 : i32 } test.graph_region { ^entry(%arg0: i32): %0 = ""test.foo""(%arg0) : (i32) -> i32 ""test.bar""(%1, %0) : (i32, i32) -> () %1 = ""test.baz""(%arg0) : (i32) -> i32 } func.func @test_graph_cfg() -> () { %0 = ""test.foo""() : () -> i32 cf.br ^next(%0 : i32) ^next(%1: i32): test.graph_region { %2 = ""test.foo""(%1) : (i32) -> i32 ""test.bar""(%3, %2) : (i32, i32) -> () %3 = ""test.baz""(%0) : (i32) -> i32 } return } test.graph_region { %0 = ""test.foo""(%1) : (i32) -> i32 test.graph_region attributes {a} { %a = ""test.a""(%b) : (i32) -> i32 %b = ""test.b""(%2) : (i32) -> i32 } %1 = ""test.bar""(%2) : (i32) -> i32 %2 = ""test.baz""() : () -> i32 }", mlir-opt -test-topological-sort-analysis -verify-diagnostics ,1 "func.func @test() { %zero = arith.constant 0 : index %minusone = arith.constant -1 : index %sym = arith.constant 111 : index %A = memref.alloc() : memref<9 x 9 x i32> %B = memref.alloc() : memref<111 x i32> affine.for %i = -1 to 10 { affine.for %j = -1 to 10 { %idx0 = affine.apply affine_map<(d0, d1) -> (d0)>(%i, %j) %idx1 = affine.apply affine_map<(d0, d1) -> (d1)>(%i, %j) %x = affine.load %A[%idx0, %idx1] : memref<9 x 9 x i32> %idy = affine.apply affine_map<(d0, d1) -> (10*d0 - d1 + 19)>(%i, %j) %y = affine.load %B[%idy] : memref<111 x i32> } } affine.for %k = 0 to 10 { %u = affine.load %B[%zero] : memref<111 x i32> %v = affine.load %B[%sym] : memref<111 x i32> affine.store %v, %B[%minusone] : memref<111 x i32> } return } func.func @test_mod_floordiv_ceildiv() { %zero = arith.constant 0 : index %A = memref.alloc() : memref<128 x 64 x 64 x i32> affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { %idx0 = affine.apply affine_map<(d0, d1, d2) -> (d0 mod 128 + 1)>(%i, %j, %j) %idx1 = affine.apply affine_map<(d0, d1, d2) -> (d1 floordiv 4 + 1)>(%i, %j, %j) %idx2 = affine.apply affine_map<(d0, d1, d2) -> (d2 ceildiv 4)>(%i, %j, %j) %x = affine.load %A[%idx0, %idx1, %idx2] : memref<128 x 64 x 64 x i32> %idy0 = affine.apply affine_map<(d0, d1, d2) -> (d0 mod 128)>(%i, %j, %j) %idy1 = affine.apply affine_map<(d0, d1, d2) -> (d1 floordiv 4)>(%i, %j, %j) %idy2 = affine.apply affine_map<(d0, d1, d2) -> (d2 ceildiv 4 - 1)>(%i, %j, %j) affine.store %x, %A[%idy0, %idy1, %idy2] : memref<128 x 64 x 64 x i32> } } return } func.func @test_no_out_of_bounds() { %zero = arith.constant 0 : index %A = memref.alloc() : memref<257 x 256 x i32> %C = memref.alloc() : memref<257 x i32> %B = memref.alloc() : memref<1 x i32> affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { %idx0 = affine.apply affine_map<(d0, d1) -> ( 64 * (d0 ceildiv 64))>(%i, %j) %x = affine.load %A[%idx0, %zero] : memref<257 x 256 x i32> %idy = affine.apply affine_map<(d0, d1) -> (d0 floordiv 256)>(%i, %i) %y = affine.load %B[%idy] : memref<1 x i32> } } return } func.func @mod_div() { %zero = arith.constant 0 : index %A = memref.alloc() : memref<128 x 64 x 64 x i32> affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { %idx0 = affine.apply affine_map<(d0, d1, d2) -> (d0 mod 128 + 1)>(%i, %j, %j) %idx1 = affine.apply affine_map<(d0, d1, d2) -> (d1 floordiv 4 + 1)>(%i, %j, %j) %idx2 = affine.apply affine_map<(d0, d1, d2) -> (d2 ceildiv 4)>(%i, %j, %j) %x = affine.load %A[%idx0, %idx1, %idx2] : memref<128 x 64 x 64 x i32> %idy0 = affine.apply affine_map<(d0, d1, d2) -> (d0 mod 128)>(%i, %j, %j) %idy1 = affine.apply affine_map<(d0, d1, d2) -> (d1 floordiv 4)>(%i, %j, %j) %idy2 = affine.apply affine_map<(d0, d1, d2) -> (d2 ceildiv 4 - 1)>(%i, %j, %j) affine.store %x, %A[%idy0, %idy1, %idy2] : memref<128 x 64 x 64 x i32> } } return } func.func @mod_floordiv_nested() { %A = memref.alloc() : memref<256 x 256 x i32> affine.for %i = 0 to 256 { affine.for %j = 0 to 256 { %idx0 = affine.apply affine_map<(d0, d1) -> ((d0 mod 1024) floordiv 4)>(%i, %j) %idx1 = affine.apply affine_map<(d0, d1) -> ((((d1 mod 128) mod 32) ceildiv 4) * 32)>(%i, %j) affine.load %A[%idx0, %idx1] : memref<256 x 256 x i32> } } return } func.func @test_semi_affine_bailout(%N : index) { %B = memref.alloc() : memref<10 x i32> affine.for %i = 0 to 10 { %idx = affine.apply affine_map<(d0)[s0] -> (d0 * s0)>(%i)[%N] %y = affine.load %B[%idx] : memref<10 x i32> } return } func.func @multi_mod_floordiv() { %A = memref.alloc() : memref<2x2xi32> affine.for %ii = 0 to 64 { %idx0 = affine.apply affine_map<(d0) -> ((d0 mod 147456) floordiv 1152)> (%ii) %idx1 = affine.apply affine_map<(d0) -> (((d0 mod 147456) mod 1152) floordiv 384)> (%ii) %v = affine.load %A[%idx0, %idx1] : memref<2x2xi32> } return } func.func @delinearize_mod_floordiv() { %c0 = arith.constant 0 : index %in = memref.alloc() : memref<2x2x3x3x16x1xi32> %out = memref.alloc() : memref<64x9xi32> affine.for %ii = 0 to 64 { affine.for %jj = 0 to 9 { %a0 = affine.apply affine_map<(d0, d1) -> (d0 * (9 * 1024) + d1 * 128)> (%ii, %jj) %a10 = affine.apply affine_map<(d0) -> (d0 floordiv (2 * 3 * 3 * 128 * 128))> (%a0) %a11 = affine.apply affine_map<(d0) -> ((d0 mod 294912) floordiv (3 * 3 * 128 * 128))> (%a0) %a12 = affine.apply affine_map<(d0) -> ((((d0 mod 294912) mod 147456) floordiv 1152) floordiv 8)> (%a0) %a13 = affine.apply affine_map<(d0) -> ((((d0 mod 294912) mod 147456) mod 1152) floordiv 384)> (%a0) %a14 = affine.apply affine_map<(d0) -> (((((d0 mod 294912) mod 147456) mod 1152) mod 384) floordiv 128)> (%a0) %a15 = affine.apply affine_map<(d0) -> ((((((d0 mod 294912) mod 147456) mod 1152) mod 384) mod 128) floordiv 128)> (%a0) %v0 = affine.load %in[%a10, %a11, %a13, %a14, %a12, %a15] : memref<2x2x3x3x16x1xi32> } } return } func.func @zero_d_memref(%arg0: memref) { %c0 = arith.constant 0 : i32 affine.store %c0, %arg0[] : memref return } func.func @out_of_bounds() { %in = memref.alloc() : memref<1xi32> %c9 = arith.constant 9 : i32 affine.for %i0 = 10 to 11 { %idy = affine.apply affine_map<(d0) -> (100 * d0 floordiv 1000)> (%i0) affine.store %c9, %in[%idy] : memref<1xi32> } return }", mlir-opt -test-memref-bound-check -split-input-file -verify-diagnostics ,1 "#map3 = affine_map<(d0, d1) -> ((d0 * 72 + d1) floordiv 2304 + ((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) floordiv 3)> #map4 = affine_map<(d0, d1) -> ((d0 * 72 + d1) mod 2304 - (((d0 * 72 + d1) mod 2304) floordiv 1152) * 1151 - ((((d0 * 72 + d1) mod 2304) mod 1152) floordiv 9) * 9 - (((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) floordiv 3) * 3)> #map5 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) floordiv 9) floordiv 8)> func.func @test_complex_mod_floordiv(%arg0: memref<4x4x16x1xf32>) { %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<1x2x3x3x16x1xf32> affine.for %i0 = 0 to 64 { affine.for %i1 = 0 to 9 { %2 = affine.apply #map3(%i0, %i1) %3 = affine.apply #map4(%i0, %i1) %4 = affine.apply #map5(%i0, %i1) %5 = affine.load %arg0[%2, %c0, %4, %c0] : memref<4x4x16x1xf32> } } return }", mlir-opt -test-memref-bound-check -split-input-file -verify-diagnostics ,1 "#map0 = affine_map<(d0) -> (d0 mod 4)> #map1 = affine_map<(d0) -> (d0 mod 4 + 4)> func.func @test_mod_bound() { %0 = memref.alloc() : memref<7 x f32> %1 = memref.alloc() : memref<6 x f32> affine.for %i0 = 0 to 4096 { affine.for %i1 = #map0(%i0) to #map1(%i0) { affine.load %0[%i1] : memref<7 x f32> affine.load %1[%i1] : memref<6 x f32> } } return }", mlir-opt -test-memref-bound-check -split-input-file -verify-diagnostics ,1 "#map0 = affine_map<(d0) -> (d0 floordiv 4)> #map1 = affine_map<(d0) -> (d0 floordiv 4 + 4)> #map2 = affine_map<(d0) -> (4 * (d0 floordiv 4) + d0 mod 4)> func.func @test_floordiv_bound() { %0 = memref.alloc() : memref<1027 x f32> %1 = memref.alloc() : memref<1026 x f32> %2 = memref.alloc() : memref<4096 x f32> %N = arith.constant 2048 : index affine.for %i0 = 0 to 4096 { affine.for %i1 = #map0(%i0) to #map1(%i0) { affine.load %0[%i1] : memref<1027 x f32> affine.load %1[%i1] : memref<1026 x f32> } affine.for %i2 = 0 to #map2(%N) { %v = affine.load %2[%i2] : memref<4096 x f32> } } return }", mlir-opt -test-memref-bound-check -split-input-file -verify-diagnostics ,1 "#map_lb = affine_map<(d0) -> (d0)> #map_ub = affine_map<(d0) -> (d0 + 4)> func.func @non_composed_bound_operand(%arg0: memref<1024xf32>) { affine.for %i0 = 4 to 1028 step 4 { %i1 = affine.apply affine_map<(d0) -> (d0 - 4)> (%i0) affine.for %i2 = #map_lb(%i1) to #map_ub(%i1) { %0 = affine.load %arg0[%i2] : memref<1024xf32> } } return } func.func @zero_d_memref() { %Z = memref.alloc() : memref affine.for %i = 0 to 100 { affine.load %Z[] : memref } return } func.func @affine_parallel(%M: memref<2048x2048xf64>) { affine.parallel (%i) = (0) to (3000) { affine.for %j = 0 to 2048 { affine.load %M[%i, %j] : memref<2048x2048xf64> } } return }", mlir-opt -test-memref-bound-check -split-input-file -verify-diagnostics ,1 "func.func @mul_add_0(%arg0: memref<3x4xf32>, %arg1: memref<4x3xf32>, %arg2: memref<3x3xf32>, %arg3: memref<3x3xf32>) { %cst = arith.constant 0.000000e+00 : f32 %0 = memref.alloc() : memref<3x3xf32> affine.for %arg4 = 0 to 3 { affine.for %arg5 = 0 to 3 { affine.store %cst, %0[%arg4, %arg5] : memref<3x3xf32> } } affine.for %arg4 = 0 to 3 { affine.for %arg5 = 0 to 3 { affine.for %arg6 = 0 to 4 { %1 = affine.load %arg1[%arg6, %arg5] : memref<4x3xf32> %2 = affine.load %arg0[%arg4, %arg6] : memref<3x4xf32> %3 = arith.mulf %2, %1 : f32 %4 = affine.load %0[%arg4, %arg5] : memref<3x3xf32> %5 = arith.addf %4, %3 : f32 affine.store %5, %0[%arg4, %arg5] : memref<3x3xf32> } } } affine.for %arg4 = 0 to 3 { affine.for %arg5 = 0 to 3 { %6 = affine.load %arg2[%arg4, %arg5] : memref<3x3xf32> %7 = affine.load %0[%arg4, %arg5] : memref<3x3xf32> %8 = arith.addf %7, %6 : f32 affine.store %8, %arg3[%arg4, %arg5] : memref<3x3xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @mul_add_0(%arg0: memref<3x4xf32>, %arg1: memref<4x3xf32>, %arg2: memref<3x3xf32>, %arg3: memref<3x3xf32>) { %cst = arith.constant 0.000000e+00 : f32 %0 = memref.alloc() : memref<3x3xf32> affine.for %arg4 = 0 to 3 { affine.for %arg5 = 0 to 3 { affine.store %cst, %0[%arg4, %arg5] : memref<3x3xf32> } } affine.for %arg4 = 0 to 3 { affine.for %arg5 = 0 to 3 { affine.for %arg6 = 0 to 4 { %1 = affine.load %arg1[%arg6, %arg5] : memref<4x3xf32> %2 = affine.load %arg0[%arg4, %arg6] : memref<3x4xf32> %3 = arith.mulf %2, %1 : f32 %4 = affine.load %0[%arg4, %arg5] : memref<3x3xf32> %5 = arith.addf %4, %3 : f32 affine.store %5, %0[%arg4, %arg5] : memref<3x3xf32> } } } affine.for %arg4 = 0 to 3 { affine.for %arg5 = 0 to 3 { %6 = affine.load %arg2[%arg4, %arg5] : memref<3x3xf32> %7 = affine.load %0[%arg4, %arg5] : memref<3x3xf32> %8 = arith.addf %7, %6 : f32 affine.store %8, %arg3[%arg4, %arg5] : memref<3x3xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_multi_outgoing_edge_store_producer(%a : memref<1xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %arg0 = 0 to 1 { affine.store %cst, %a[%arg0] : memref<1xf32> } affine.for %arg0 = 0 to 1 { %0 = affine.load %a[%arg0] : memref<1xf32> } affine.for %arg0 = 0 to 1 { %0 = affine.load %a[%arg0] : memref<1xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_multi_outgoing_edge_store_producer(%a : memref<1xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %arg0 = 0 to 1 { affine.store %cst, %a[%arg0] : memref<1xf32> } affine.for %arg0 = 0 to 1 { %0 = affine.load %a[%arg0] : memref<1xf32> } affine.for %arg0 = 0 to 1 { %0 = affine.load %a[%arg0] : memref<1xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_producer_with_multi_outgoing_edges(%a : memref<1xf32>, %b : memref<1xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %arg0 = 0 to 1 { %0 = affine.load %a[%arg0] : memref<1xf32> affine.store %cst, %b[%arg0] : memref<1xf32> } affine.for %arg0 = 0 to 1 { affine.store %cst, %a[%arg0] : memref<1xf32> %1 = affine.load %b[%arg0] : memref<1xf32> } return } func.func @reshape_into_matmul(%lhs : memref<1024x1024xf32>, %R: memref<16x64x1024xf32>, %out: memref<1024x1024xf32>) { %rhs = memref.alloc() : memref<1024x1024xf32> affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 64 { affine.for %k = 0 to 1024 { %v = affine.load %R[%i0, %i1, %k] : memref<16x64x1024xf32> affine.store %v, %rhs[64*%i0 + %i1, %k] : memref<1024x1024xf32> } } } affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %0 = affine.load %rhs[%k, %j] : memref<1024x1024xf32> %1 = affine.load %lhs[%i, %k] : memref<1024x1024xf32> %2 = arith.mulf %1, %0 : f32 %3 = affine.load %out[%i, %j] : memref<1024x1024xf32> %4 = arith.addf %3, %2 : f32 affine.store %4, %out[%i, %j] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_producer_with_multi_outgoing_edges(%a : memref<1xf32>, %b : memref<1xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %arg0 = 0 to 1 { %0 = affine.load %a[%arg0] : memref<1xf32> affine.store %cst, %b[%arg0] : memref<1xf32> } affine.for %arg0 = 0 to 1 { affine.store %cst, %a[%arg0] : memref<1xf32> %1 = affine.load %b[%arg0] : memref<1xf32> } return } func.func @reshape_into_matmul(%lhs : memref<1024x1024xf32>, %R: memref<16x64x1024xf32>, %out: memref<1024x1024xf32>) { %rhs = memref.alloc() : memref<1024x1024xf32> affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 64 { affine.for %k = 0 to 1024 { %v = affine.load %R[%i0, %i1, %k] : memref<16x64x1024xf32> affine.store %v, %rhs[64*%i0 + %i1, %k] : memref<1024x1024xf32> } } } affine.for %i = 0 to 1024 { affine.for %j = 0 to 1024 { affine.for %k = 0 to 1024 { %0 = affine.load %rhs[%k, %j] : memref<1024x1024xf32> %1 = affine.load %lhs[%i, %k] : memref<1024x1024xf32> %2 = arith.mulf %1, %0 : f32 %3 = affine.load %out[%i, %j] : memref<1024x1024xf32> %4 = arith.addf %3, %2 : f32 affine.store %4, %out[%i, %j] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @vector_loop(%a : memref<10x20xf32>, %b : memref<10x20xf32>, %c : memref<10x20xf32>) { affine.for %j = 0 to 10 { affine.for %i = 0 to 5 { %ld0 = affine.vector_load %a[%j, %i*4] : memref<10x20xf32>, vector<4xf32> affine.vector_store %ld0, %b[%j, %i*4] : memref<10x20xf32>, vector<4xf32> } } affine.for %j = 0 to 10 { affine.for %i = 0 to 5 { %ld0 = affine.vector_load %b[%j, %i*4] : memref<10x20xf32>, vector<4xf32> affine.vector_store %ld0, %c[%j, %i*4] : memref<10x20xf32>, vector<4xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @vector_loop(%a : memref<10x20xf32>, %b : memref<10x20xf32>, %c : memref<10x20xf32>) { affine.for %j = 0 to 10 { affine.for %i = 0 to 5 { %ld0 = affine.vector_load %a[%j, %i*4] : memref<10x20xf32>, vector<4xf32> affine.vector_store %ld0, %b[%j, %i*4] : memref<10x20xf32>, vector<4xf32> } } affine.for %j = 0 to 10 { affine.for %i = 0 to 5 { %ld0 = affine.vector_load %b[%j, %i*4] : memref<10x20xf32>, vector<4xf32> affine.vector_store %ld0, %c[%j, %i*4] : memref<10x20xf32>, vector<4xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @multi_outgoing_edges(%in0 : memref<32xf32>, %in1 : memref<32xf32>) { affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.subf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.mulf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.divf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @multi_outgoing_edges(%in0 : memref<32xf32>, %in1 : memref<32xf32>) { affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.subf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.mulf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.divf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @calc(%arg0: memref, %arg1: memref, %arg2: memref, %len: index) { %c1 = arith.constant 1 : index %1 = memref.alloc(%len) : memref affine.for %arg4 = 1 to 10 { %7 = affine.load %arg0[%arg4] : memref %8 = affine.load %arg1[%arg4] : memref %9 = arith.addf %7, %8 : f32 affine.store %9, %1[%arg4] : memref } affine.for %arg4 = 1 to 10 { %7 = affine.load %1[%arg4] : memref %8 = affine.load %arg1[%arg4] : memref %9 = arith.mulf %7, %8 : f32 affine.store %9, %arg2[%arg4] : memref } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @calc(%arg0: memref, %arg1: memref, %arg2: memref, %len: index) { %c1 = arith.constant 1 : index %1 = memref.alloc(%len) : memref affine.for %arg4 = 1 to 10 { %7 = affine.load %arg0[%arg4] : memref %8 = affine.load %arg1[%arg4] : memref %9 = arith.addf %7, %8 : f32 affine.store %9, %1[%arg4] : memref } affine.for %arg4 = 1 to 10 { %7 = affine.load %1[%arg4] : memref %8 = affine.load %arg1[%arg4] : memref %9 = arith.mulf %7, %8 : f32 affine.store %9, %arg2[%arg4] : memref } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_since_non_affine_users(%in0 : memref<32xf32>, %in1 : memref<32xf32>) { affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = memref.load %in0[%d] : memref<32xf32> %rhs = memref.load %in1[%d] : memref<32xf32> %add = arith.subf %lhs, %rhs : f32 memref.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.mulf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_since_non_affine_users(%in0 : memref<32xf32>, %in1 : memref<32xf32>) { affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = memref.load %in0[%d] : memref<32xf32> %rhs = memref.load %in1[%d] : memref<32xf32> %add = arith.subf %lhs, %rhs : f32 memref.store %add, %in0[%d] : memref<32xf32> } affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.mulf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_since_top_level_non_affine_users(%in0 : memref<32xf32>, %in1 : memref<32xf32>) { %sum = memref.alloc() : memref affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 memref.store %add, %sum[] : memref affine.store %add, %in0[%d] : memref<32xf32> } %load_sum = memref.load %sum[] : memref affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.mulf %lhs, %rhs : f32 %sub = arith.subf %add, %load_sum: f32 affine.store %sub, %in0[%d] : memref<32xf32> } memref.dealloc %sum : memref return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_since_top_level_non_affine_users(%in0 : memref<32xf32>, %in1 : memref<32xf32>) { %sum = memref.alloc() : memref affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 memref.store %add, %sum[] : memref affine.store %add, %in0[%d] : memref<32xf32> } %load_sum = memref.load %sum[] : memref affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.mulf %lhs, %rhs : f32 %sub = arith.subf %add, %load_sum: f32 affine.store %sub, %in0[%d] : memref<32xf32> } memref.dealloc %sum : memref return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_since_top_level_non_affine_mem_write_users( %in0 : memref<32xf32>, %in1 : memref<32xf32>) { %c0 = arith.constant 0 : index %cst_0 = arith.constant 0.000000e+00 : f32 affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } memref.store %cst_0, %in0[%c0] : memref<32xf32> affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs: f32 affine.store %add, %in0[%d] : memref<32xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_since_top_level_non_affine_mem_write_users( %in0 : memref<32xf32>, %in1 : memref<32xf32>) { %c0 = arith.constant 0 : index %cst_0 = arith.constant 0.000000e+00 : f32 affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs : f32 affine.store %add, %in0[%d] : memref<32xf32> } memref.store %cst_0, %in0[%c0] : memref<32xf32> affine.for %d = 0 to 32 { %lhs = affine.load %in0[%d] : memref<32xf32> %rhs = affine.load %in1[%d] : memref<32xf32> %add = arith.addf %lhs, %rhs: f32 affine.store %add, %in0[%d] : memref<32xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @fuse_minor_affine_map(%in: memref<128xf32>, %out: memref<20x512xf32>) { %tmp = memref.alloc() : memref<128xf32> affine.for %arg4 = 0 to 128 { %ld = affine.load %in[%arg4] : memref<128xf32> affine.store %ld, %tmp[%arg4] : memref<128xf32> } affine.for %arg3 = 0 to 20 { affine.for %arg4 = 0 to 512 { %ld = affine.load %tmp[%arg4 mod 128] : memref<128xf32> affine.store %ld, %out[%arg3, %arg4] : memref<20x512xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fuse_minor_affine_map(%in: memref<128xf32>, %out: memref<20x512xf32>) { %tmp = memref.alloc() : memref<128xf32> affine.for %arg4 = 0 to 128 { %ld = affine.load %in[%arg4] : memref<128xf32> affine.store %ld, %tmp[%arg4] : memref<128xf32> } affine.for %arg3 = 0 to 20 { affine.for %arg4 = 0 to 512 { %ld = affine.load %tmp[%arg4 mod 128] : memref<128xf32> affine.store %ld, %out[%arg3, %arg4] : memref<20x512xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_multi_store_producer_and_privatize_memfefs() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cst = arith.constant 0.000000e+00 : f32 affine.for %arg0 = 0 to 10 { affine.store %cst, %a[%arg0] : memref<10xf32> affine.store %cst, %b[%arg0] : memref<10xf32> affine.store %cst, %c[%arg0] : memref<10xf32> %0 = affine.load %c[%arg0] : memref<10xf32> } affine.for %arg0 = 0 to 10 { %0 = affine.load %a[%arg0] : memref<10xf32> } affine.for %arg0 = 0 to 10 { %0 = affine.load %b[%arg0] : memref<10xf32> } return } func.func @should_fuse_multi_store_producer_with_escaping_memrefs_and_remove_src( %a : memref<10xf32>, %b : memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> affine.store %cst, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %0 = affine.load %a[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %0 = affine.load %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_multi_store_producer_and_privatize_memfefs() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cst = arith.constant 0.000000e+00 : f32 affine.for %arg0 = 0 to 10 { affine.store %cst, %a[%arg0] : memref<10xf32> affine.store %cst, %b[%arg0] : memref<10xf32> affine.store %cst, %c[%arg0] : memref<10xf32> %0 = affine.load %c[%arg0] : memref<10xf32> } affine.for %arg0 = 0 to 10 { %0 = affine.load %a[%arg0] : memref<10xf32> } affine.for %arg0 = 0 to 10 { %0 = affine.load %b[%arg0] : memref<10xf32> } return } func.func @should_fuse_multi_store_producer_with_escaping_memrefs_and_remove_src( %a : memref<10xf32>, %b : memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> affine.store %cst, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %0 = affine.load %a[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %0 = affine.load %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_multi_store_producer_with_escaping_memrefs_and_preserve_src( %a : memref<10xf32>, %b : memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> affine.store %cst, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 5 { %0 = affine.load %a[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %0 = affine.load %b[%i2] : memref<10xf32> } return } func.func @should_not_fuse_due_to_dealloc(%arg0: memref<16xf32>){ %A = memref.alloc() : memref<16xf32> %C = memref.alloc() : memref<16xf32> %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg1 = 0 to 16 { %a = affine.load %arg0[%arg1] : memref<16xf32> affine.store %a, %A[%arg1] : memref<16xf32> affine.store %a, %C[%arg1] : memref<16xf32> } memref.dealloc %C : memref<16xf32> %B = memref.alloc() : memref<16xf32> affine.for %arg1 = 0 to 16 { %a = affine.load %A[%arg1] : memref<16xf32> %b = arith.addf %cst_1, %a : f32 affine.store %b, %B[%arg1] : memref<16xf32> } memref.dealloc %A : memref<16xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_multi_store_producer_with_escaping_memrefs_and_preserve_src( %a : memref<10xf32>, %b : memref<10xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> affine.store %cst, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 5 { %0 = affine.load %a[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %0 = affine.load %b[%i2] : memref<10xf32> } return } func.func @should_not_fuse_due_to_dealloc(%arg0: memref<16xf32>){ %A = memref.alloc() : memref<16xf32> %C = memref.alloc() : memref<16xf32> %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg1 = 0 to 16 { %a = affine.load %arg0[%arg1] : memref<16xf32> affine.store %a, %A[%arg1] : memref<16xf32> affine.store %a, %C[%arg1] : memref<16xf32> } memref.dealloc %C : memref<16xf32> %B = memref.alloc() : memref<16xf32> affine.for %arg1 = 0 to 16 { %a = affine.load %A[%arg1] : memref<16xf32> %b = arith.addf %cst_1, %a : f32 affine.store %b, %B[%arg1] : memref<16xf32> } memref.dealloc %A : memref<16xf32> return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_defining_node_has_no_dependence_from_source_node( %a : memref<10xf32>, %b : memref) -> () { affine.for %i0 = 0 to 10 { %0 = affine.load %b[] : memref affine.store %0, %a[%i0] : memref<10xf32> } %0 = affine.load %b[] : memref affine.for %i1 = 0 to 10 { %1 = affine.load %a[%i1] : memref<10xf32> %2 = arith.divf %0, %1 : f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_defining_node_has_no_dependence_from_source_node( %a : memref<10xf32>, %b : memref) -> () { affine.for %i0 = 0 to 10 { %0 = affine.load %b[] : memref affine.store %0, %a[%i0] : memref<10xf32> } %0 = affine.load %b[] : memref affine.for %i1 = 0 to 10 { %1 = affine.load %a[%i1] : memref<10xf32> %2 = arith.divf %0, %1 : f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_defining_node_has_dependence_from_source_loop( %a : memref<10xf32>, %b : memref) -> () { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %b[] : memref affine.store %cst, %a[%i0] : memref<10xf32> } %0 = affine.load %b[] : memref affine.for %i1 = 0 to 10 { %1 = affine.load %a[%i1] : memref<10xf32> %2 = arith.divf %0, %1 : f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_defining_node_has_dependence_from_source_loop( %a : memref<10xf32>, %b : memref) -> () { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %b[] : memref affine.store %cst, %a[%i0] : memref<10xf32> } %0 = affine.load %b[] : memref affine.for %i1 = 0 to 10 { %1 = affine.load %a[%i1] : memref<10xf32> %2 = arith.divf %0, %1 : f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_defining_node_has_transitive_dependence_from_source_loop( %a : memref<10xf32>, %b : memref<10xf32>, %c : memref) -> () { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> affine.store %cst, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %1 = affine.load %b[%i1] : memref<10xf32> affine.store %1, %c[] : memref } %0 = affine.load %c[] : memref affine.for %i2 = 0 to 10 { %1 = affine.load %a[%i2] : memref<10xf32> %2 = arith.divf %0, %1 : f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_defining_node_has_transitive_dependence_from_source_loop( %a : memref<10xf32>, %b : memref<10xf32>, %c : memref) -> () { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> affine.store %cst, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %1 = affine.load %b[%i1] : memref<10xf32> affine.store %1, %c[] : memref } %0 = affine.load %c[] : memref affine.for %i2 = 0 to 10 { %1 = affine.load %a[%i2] : memref<10xf32> %2 = arith.divf %0, %1 : f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_dest_loop_nest_return_value( %a : memref<10xf32>) -> () { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> } %b = affine.for %i1 = 0 to 10 step 2 iter_args(%b_iter = %cst) -> f32 { %load_a = affine.load %a[%i1] : memref<10xf32> affine.yield %load_a: f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_dest_loop_nest_return_value( %a : memref<10xf32>) -> () { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %a[%i0] : memref<10xf32> } %b = affine.for %i1 = 0 to 10 step 2 iter_args(%b_iter = %cst) -> f32 { %load_a = affine.load %a[%i1] : memref<10xf32> affine.yield %load_a: f32 } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_fuse_src_loop_nest_return_value( %a : memref<10xf32>) -> () { %cst = arith.constant 1.000000e+00 : f32 %b = affine.for %i = 0 to 10 step 2 iter_args(%b_iter = %cst) -> f32 { %c = arith.addf %b_iter, %b_iter : f32 affine.store %c, %a[%i] : memref<10xf32> affine.yield %c: f32 } affine.for %i1 = 0 to 10 { %1 = affine.load %a[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_fuse_src_loop_nest_return_value( %a : memref<10xf32>) -> () { %cst = arith.constant 1.000000e+00 : f32 %b = affine.for %i = 0 to 10 step 2 iter_args(%b_iter = %cst) -> f32 { %c = arith.addf %b_iter, %b_iter : f32 affine.store %c, %a[%i] : memref<10xf32> affine.yield %c: f32 } affine.for %i1 = 0 to 10 { %1 = affine.load %a[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func private @some_function(memref<16xf32>) func.func @call_op_prevents_fusion(%arg0: memref<16xf32>){ %A = memref.alloc() : memref<16xf32> %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg1 = 0 to 16 { %a = affine.load %arg0[%arg1] : memref<16xf32> affine.store %a, %A[%arg1] : memref<16xf32> } call @some_function(%A) : (memref<16xf32>) -> () %B = memref.alloc() : memref<16xf32> affine.for %arg1 = 0 to 16 { %a = affine.load %A[%arg1] : memref<16xf32> %b = arith.addf %cst_1, %a : f32 affine.store %b, %B[%arg1] : memref<16xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func private @some_function(memref<16xf32>) func.func @call_op_prevents_fusion(%arg0: memref<16xf32>){ %A = memref.alloc() : memref<16xf32> %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg1 = 0 to 16 { %a = affine.load %arg0[%arg1] : memref<16xf32> affine.store %a, %A[%arg1] : memref<16xf32> } call @some_function(%A) : (memref<16xf32>) -> () %B = memref.alloc() : memref<16xf32> affine.for %arg1 = 0 to 16 { %a = affine.load %A[%arg1] : memref<16xf32> %b = arith.addf %cst_1, %a : f32 affine.store %b, %B[%arg1] : memref<16xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func private @some_function() func.func @call_op_does_not_prevent_fusion(%arg0: memref<16xf32>){ %A = memref.alloc() : memref<16xf32> %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg1 = 0 to 16 { %a = affine.load %arg0[%arg1] : memref<16xf32> affine.store %a, %A[%arg1] : memref<16xf32> } call @some_function() : () -> () %B = memref.alloc() : memref<16xf32> affine.for %arg1 = 0 to 16 { %a = affine.load %A[%arg1] : memref<16xf32> %b = arith.addf %cst_1, %a : f32 affine.store %b, %B[%arg1] : memref<16xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func private @some_function() func.func @call_op_does_not_prevent_fusion(%arg0: memref<16xf32>){ %A = memref.alloc() : memref<16xf32> %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg1 = 0 to 16 { %a = affine.load %arg0[%arg1] : memref<16xf32> affine.store %a, %A[%arg1] : memref<16xf32> } call @some_function() : () -> () %B = memref.alloc() : memref<16xf32> affine.for %arg1 = 0 to 16 { %a = affine.load %A[%arg1] : memref<16xf32> %b = arith.addf %cst_1, %a : f32 affine.store %b, %B[%arg1] : memref<16xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_with_both_consumers_separately(%arg0: memref<10xf32>) { %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %arg0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 7 { %v0 = affine.load %arg0[%i1] : memref<10xf32> } affine.for %i1 = 5 to 9 { %v0 = affine.load %arg0[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_with_both_consumers_separately(%arg0: memref<10xf32>) { %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %arg0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 7 { %v0 = affine.load %arg0[%i1] : memref<10xf32> } affine.for %i1 = 5 to 9 { %v0 = affine.load %arg0[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @no_fusion_cannot_compute_valid_slice() { %A = memref.alloc() : memref<5xf32> %B = memref.alloc() : memref<6xf32> %C = memref.alloc() : memref<5xf32> %cst = arith.constant 0. : f32 affine.for %arg0 = 0 to 5 { %a = affine.load %A[%arg0] : memref<5xf32> affine.store %a, %B[%arg0 + 1] : memref<6xf32> } affine.for %arg0 = 0 to 5 { %a = affine.load %B[%arg0] : memref<6xf32> %b = arith.mulf %a, %cst : f32 affine.store %b, %C[%arg0] : memref<5xf32> } return } func.func @reduce_add_f32_f32(%arg0: memref<64x64xf32, 1>, %arg1: memref<1x64xf32, 1>, %arg2: memref<1x64xf32, 1>) { %cst_0 = arith.constant 0.000000e+00 : f32 %cst_1 = arith.constant 1.000000e+00 : f32 %0 = memref.alloca() : memref %1 = memref.alloca() : memref affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_0) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.addf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_dbl = arith.addf %accum, %accum : f32 affine.store %accum_dbl, %arg1[%arg3, %arg4] : memref<1x64xf32, 1> } } affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_1) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.mulf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_sqr = arith.mulf %accum, %accum : f32 affine.store %accum_sqr, %arg2[%arg3, %arg4] : memref<1x64xf32, 1> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @no_fusion_cannot_compute_valid_slice() { %A = memref.alloc() : memref<5xf32> %B = memref.alloc() : memref<6xf32> %C = memref.alloc() : memref<5xf32> %cst = arith.constant 0. : f32 affine.for %arg0 = 0 to 5 { %a = affine.load %A[%arg0] : memref<5xf32> affine.store %a, %B[%arg0 + 1] : memref<6xf32> } affine.for %arg0 = 0 to 5 { %a = affine.load %B[%arg0] : memref<6xf32> %b = arith.mulf %a, %cst : f32 affine.store %b, %C[%arg0] : memref<5xf32> } return } func.func @reduce_add_f32_f32(%arg0: memref<64x64xf32, 1>, %arg1: memref<1x64xf32, 1>, %arg2: memref<1x64xf32, 1>) { %cst_0 = arith.constant 0.000000e+00 : f32 %cst_1 = arith.constant 1.000000e+00 : f32 %0 = memref.alloca() : memref %1 = memref.alloca() : memref affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_0) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.addf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_dbl = arith.addf %accum, %accum : f32 affine.store %accum_dbl, %arg1[%arg3, %arg4] : memref<1x64xf32, 1> } } affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_1) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.mulf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_sqr = arith.mulf %accum, %accum : f32 affine.store %accum_sqr, %arg2[%arg3, %arg4] : memref<1x64xf32, 1> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @reduce_add_non_innermost(%arg0: memref<64x64xf32, 1>, %arg1: memref<1x64xf32, 1>, %arg2: memref<1x64xf32, 1>) { %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = memref.alloca() : memref %1 = memref.alloca() : memref affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.addf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_dbl = arith.addf %accum, %accum : f32 affine.store %accum_dbl, %arg1[%arg3, %arg4] : memref<1x64xf32, 1> } } affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_0) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.mulf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_sqr = arith.mulf %accum, %accum : f32 affine.store %accum_sqr, %arg2[%arg3, %arg4] : memref<1x64xf32, 1> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @reduce_add_non_innermost(%arg0: memref<64x64xf32, 1>, %arg1: memref<1x64xf32, 1>, %arg2: memref<1x64xf32, 1>) { %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %0 = memref.alloca() : memref %1 = memref.alloca() : memref affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.addf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_dbl = arith.addf %accum, %accum : f32 affine.store %accum_dbl, %arg1[%arg3, %arg4] : memref<1x64xf32, 1> } } affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_0) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.mulf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_sqr = arith.mulf %accum, %accum : f32 affine.store %accum_sqr, %arg2[%arg3, %arg4] : memref<1x64xf32, 1> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @fuse_large_number_of_loops(%arg0: memref<20x10xf32, 1>, %arg1: memref<20x10xf32, 1>, %arg2: memref<20x10xf32, 1>, %arg3: memref<20x10xf32, 1>, %arg4: memref<20x10xf32, 1>, %arg5: memref, %arg6: memref, %arg7: memref, %arg8: memref, %arg9: memref<20x10xf32, 1>, %arg10: memref<20x10xf32, 1>, %arg11: memref<20x10xf32, 1>, %arg12: memref<20x10xf32, 1>) { %cst = arith.constant 1.000000e+00 : f32 %0 = memref.alloc() : memref affine.store %cst, %0[] : memref %1 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg6[] : memref affine.store %21, %1[%arg13, %arg14] : memref<20x10xf32, 1> } } %2 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg3[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %2[%arg13, %arg14] : memref<20x10xf32, 1> } } %3 = memref.alloc() : memref %4 = affine.load %arg6[] : memref %5 = affine.load %0[] : memref %6 = arith.subf %5, %4 : f32 affine.store %6, %3[] : memref %7 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %3[] : memref affine.store %21, %7[%arg13, %arg14] : memref<20x10xf32, 1> } } %8 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %7[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %8[%arg13, %arg14] : memref<20x10xf32, 1> } } %9 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %8[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %9[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %9[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %2[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %arg11[%arg13, %arg14] : memref<20x10xf32, 1> } } %10 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg2[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %10[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %8[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %10[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %arg10[%arg13, %arg14] : memref<20x10xf32, 1> } } %11 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg10[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg10[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %11[%arg13, %arg14] : memref<20x10xf32, 1> } } %12 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %11[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg11[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.subf %22, %21 : f32 affine.store %23, %12[%arg13, %arg14] : memref<20x10xf32, 1> } } %13 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg7[] : memref affine.store %21, %13[%arg13, %arg14] : memref<20x10xf32, 1> } } %14 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg4[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %13[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %14[%arg13, %arg14] : memref<20x10xf32, 1> } } %15 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg8[] : memref affine.store %21, %15[%arg13, %arg14] : memref<20x10xf32, 1> } } %16 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %15[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %12[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %16[%arg13, %arg14] : memref<20x10xf32, 1> } } %17 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %16[%arg13, %arg14] : memref<20x10xf32, 1> %22 = math.sqrt %21 : f32 affine.store %22, %17[%arg13, %arg14] : memref<20x10xf32, 1> } } %18 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg5[] : memref affine.store %21, %18[%arg13, %arg14] : memref<20x10xf32, 1> } } %19 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %18[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %19[%arg13, %arg14] : memref<20x10xf32, 1> } } %20 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %17[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %19[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.divf %22, %21 : f32 affine.store %23, %20[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %20[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %14[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %arg12[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg12[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg0[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.subf %22, %21 : f32 affine.store %23, %arg9[%arg13, %arg14] : memref<20x10xf32, 1> } } return } func.func @alias_escaping_memref(%a : memref<2x5xf32>) { %cst = arith.constant 0.000000e+00 : f32 %alias = memref.reinterpret_cast %a to offset: [0], sizes: [10], strides: [1] : memref<2x5xf32> to memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cst, %alias[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %0 = affine.load %alias[%i1] : memref<10xf32> } return } func.func @unknown_memref_def_op() { %cst = arith.constant 0.000000e+00 : f32 %may_alias = call @bar() : () -> memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cst, %may_alias[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %0 = affine.load %may_alias[%i1] : memref<10xf32> } return } func.func private @bar() -> memref<10xf32>", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @fuse_large_number_of_loops(%arg0: memref<20x10xf32, 1>, %arg1: memref<20x10xf32, 1>, %arg2: memref<20x10xf32, 1>, %arg3: memref<20x10xf32, 1>, %arg4: memref<20x10xf32, 1>, %arg5: memref, %arg6: memref, %arg7: memref, %arg8: memref, %arg9: memref<20x10xf32, 1>, %arg10: memref<20x10xf32, 1>, %arg11: memref<20x10xf32, 1>, %arg12: memref<20x10xf32, 1>) { %cst = arith.constant 1.000000e+00 : f32 %0 = memref.alloc() : memref affine.store %cst, %0[] : memref %1 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg6[] : memref affine.store %21, %1[%arg13, %arg14] : memref<20x10xf32, 1> } } %2 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg3[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %2[%arg13, %arg14] : memref<20x10xf32, 1> } } %3 = memref.alloc() : memref %4 = affine.load %arg6[] : memref %5 = affine.load %0[] : memref %6 = arith.subf %5, %4 : f32 affine.store %6, %3[] : memref %7 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %3[] : memref affine.store %21, %7[%arg13, %arg14] : memref<20x10xf32, 1> } } %8 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %7[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %8[%arg13, %arg14] : memref<20x10xf32, 1> } } %9 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %8[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %9[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %9[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %2[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %arg11[%arg13, %arg14] : memref<20x10xf32, 1> } } %10 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg2[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %10[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %8[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %10[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %arg10[%arg13, %arg14] : memref<20x10xf32, 1> } } %11 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg10[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg10[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %11[%arg13, %arg14] : memref<20x10xf32, 1> } } %12 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %11[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg11[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.subf %22, %21 : f32 affine.store %23, %12[%arg13, %arg14] : memref<20x10xf32, 1> } } %13 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg7[] : memref affine.store %21, %13[%arg13, %arg14] : memref<20x10xf32, 1> } } %14 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg4[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %13[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %14[%arg13, %arg14] : memref<20x10xf32, 1> } } %15 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg8[] : memref affine.store %21, %15[%arg13, %arg14] : memref<20x10xf32, 1> } } %16 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %15[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %12[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %16[%arg13, %arg14] : memref<20x10xf32, 1> } } %17 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %16[%arg13, %arg14] : memref<20x10xf32, 1> %22 = math.sqrt %21 : f32 affine.store %22, %17[%arg13, %arg14] : memref<20x10xf32, 1> } } %18 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg5[] : memref affine.store %21, %18[%arg13, %arg14] : memref<20x10xf32, 1> } } %19 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg1[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %18[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.mulf %22, %21 : f32 affine.store %23, %19[%arg13, %arg14] : memref<20x10xf32, 1> } } %20 = memref.alloc() : memref<20x10xf32, 1> affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %17[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %19[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.divf %22, %21 : f32 affine.store %23, %20[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %20[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %14[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.addf %22, %21 : f32 affine.store %23, %arg12[%arg13, %arg14] : memref<20x10xf32, 1> } } affine.for %arg13 = 0 to 20 { affine.for %arg14 = 0 to 10 { %21 = affine.load %arg12[%arg13, %arg14] : memref<20x10xf32, 1> %22 = affine.load %arg0[%arg13, %arg14] : memref<20x10xf32, 1> %23 = arith.subf %22, %21 : f32 affine.store %23, %arg9[%arg13, %arg14] : memref<20x10xf32, 1> } } return } func.func @alias_escaping_memref(%a : memref<2x5xf32>) { %cst = arith.constant 0.000000e+00 : f32 %alias = memref.reinterpret_cast %a to offset: [0], sizes: [10], strides: [1] : memref<2x5xf32> to memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cst, %alias[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %0 = affine.load %alias[%i1] : memref<10xf32> } return } func.func @unknown_memref_def_op() { %cst = arith.constant 0.000000e+00 : f32 %may_alias = call @bar() : () -> memref<10xf32> affine.for %i0 = 0 to 10 { affine.store %cst, %may_alias[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %0 = affine.load %may_alias[%i1] : memref<10xf32> } return } func.func private @bar() -> memref<10xf32>", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @loop_nest_dma() { %A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0> %Ah = memref.alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> %tag = memref.alloc() : memref<1 x f32> %zero = arith.constant 0 : index %num_elts = arith.constant 32 : index affine.for %i = 0 to 8 { affine.dma_start %A[%i], %Ah[%i], %tag[%zero], %num_elts : memref<256 x f32>, memref<32 x f32, 1>, memref<1 x f32> affine.dma_wait %tag[%zero], %num_elts : memref<1 x f32> %v = affine.load %Ah[%i] : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> %r = ""compute""(%v) : (f32) -> (f32) affine.store %r, %Ah[%i] : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> affine.for %j = 0 to 32 { ""do_more_compute""(%i, %j) : (index, index) -> () } } memref.dealloc %tag : memref<1 x f32> memref.dealloc %Ah : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "func.func @loop_step(%arg0: memref<512xf32>, %arg1: memref<512xf32>) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index affine.for %i0 = 0 to 512 step 4 { %1 = memref.alloc() : memref<4xf32, 1> %2 = memref.alloc() : memref<1xi32> affine.dma_start %arg0[%i0], %1[%c0], %2[%c0], %c4, : memref<512xf32>, memref<4xf32, 1>, memref<1xi32> affine.dma_wait %2[%c0], %c4 : memref<1xi32> ""compute""(%i0) : (index) -> () memref.dealloc %2 : memref<1xi32> memref.dealloc %1 : memref<4xf32, 1> } return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "#map1 = affine_map<(d0, d1) -> ((d0 * 2048 + d1 * 256) floordiv 32)> #map2 = affine_map<(d0) -> ((d0 * 2048) floordiv 32)> func.func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>>, %arg1: memref<512x32xvector<8xf32>>, %arg2: memref<512x32xvector<8xf32>>) { %num_elts = arith.constant 256 : index %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<64x4xvector<8xf32>, 2> %1 = memref.alloc() : memref<64x4xvector<8xf32>, 2> %2 = memref.alloc() : memref<64x4xvector<8xf32>, 2> %3 = memref.alloc() : memref<2xi32> %4 = memref.alloc() : memref<2xi32> %5 = memref.alloc() : memref<2xi32> affine.for %i0 = 0 to 8 { %6 = affine.apply #map2(%i0) affine.dma_start %arg2[%6, %c0], %2[%c0, %c0], %5[%c0], %num_elts : memref<512x32xvector<8xf32>>, memref<64x4xvector<8xf32>, 2>, memref<2xi32> affine.dma_wait %5[%c0], %num_elts : memref<2xi32> affine.for %i1 = 0 to 8 { %7 = affine.apply #map1(%i0, %i1) %8 = affine.apply #map2(%i1) affine.dma_start %arg0[%7, %c0], %0[%c0, %c0], %3[%c0], %num_elts : memref<512x32xvector<8xf32>>, memref<64x4xvector<8xf32>, 2>, memref<2xi32> affine.dma_start %arg1[%8, %c0], %1[%c0, %c0], %4[%c0], %num_elts : memref<512x32xvector<8xf32>>, memref<64x4xvector<8xf32>, 2>, memref<2xi32> affine.dma_wait %3[%c0], %num_elts : memref<2xi32> affine.dma_wait %4[%c0], %num_elts : memref<2xi32> affine.for %i2 = 0 to 4 { ""foo""() : () -> () } } } memref.dealloc %5 : memref<2xi32> memref.dealloc %4 : memref<2xi32> memref.dealloc %3 : memref<2xi32> memref.dealloc %2 : memref<64x4xvector<8xf32>, 2> memref.dealloc %1 : memref<64x4xvector<8xf32>, 2> memref.dealloc %0 : memref<64x4xvector<8xf32>, 2> return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "#map2 = affine_map<(d0) -> ((d0 * 2048) floordiv 32)> func.func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) { %num_elts = arith.constant 256 : index %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<64x4xvector<8xf32>, 2> %1 = memref.alloc() : memref<64x4xvector<8xf32>, 2> %2 = memref.alloc() : memref<64x4xvector<8xf32>, 2> %3 = memref.alloc() : memref<2xi32> %4 = memref.alloc() : memref<2xi32> %5 = memref.alloc() : memref<2xi32> affine.for %i0 = 0 to 8 { %6 = affine.apply #map2(%i0) affine.dma_start %arg2[%6, %c0], %2[%c0, %c0], %5[%c0], %num_elts : memref<512x32xvector<8xf32>>, memref<64x4xvector<8xf32>, 2>, memref<2xi32> affine.dma_wait %5[%c0], %num_elts : memref<2xi32> affine.dma_start %2[%c0, %c0], %arg2[%6, %c0], %5[%c0], %num_elts : memref<64x4xvector<8xf32>, 2>, memref<512x32xvector<8xf32>>, memref<2xi32> affine.dma_wait %5[%c0], %num_elts : memref<2xi32> } memref.dealloc %5 : memref<2xi32> memref.dealloc %4 : memref<2xi32> memref.dealloc %3 : memref<2xi32> memref.dealloc %2 : memref<64x4xvector<8xf32>, 2> memref.dealloc %1 : memref<64x4xvector<8xf32>, 2> memref.dealloc %0 : memref<64x4xvector<8xf32>, 2> return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "func.func @escaping_use(%arg0: memref<512 x 32 x f32>) { %c32 = arith.constant 32 : index %num_elt = arith.constant 512 : index %zero = arith.constant 0 : index %Av = memref.alloc() : memref<32 x 32 x f32, 2> %tag = memref.alloc() : memref<1 x i32> affine.for %kTT = 0 to 16 { affine.dma_start %arg0[%zero, %zero], %Av[%zero, %zero], %tag[%zero], %num_elt : memref<512 x 32 x f32>, memref<32 x 32 x f32, 2>, memref<1 x i32> affine.dma_wait %tag[%zero], %num_elt : memref<1 x i32> ""foo""(%Av) : (memref<32 x 32 x f32, 2>) -> () } memref.dealloc %tag : memref<1 x i32> memref.dealloc %Av : memref<32 x 32 x f32, 2> return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "func.func @escaping_tag(%arg0: memref<512 x 32 x f32>) { %c32 = arith.constant 32 : index %num_elt = arith.constant 512 : index %zero = arith.constant 0 : index %Av = memref.alloc() : memref<32 x 32 x f32, 2> %tag = memref.alloc() : memref<1 x i32> affine.for %kTT = 0 to 16 { affine.dma_start %arg0[%zero, %zero], %Av[%zero, %zero], %tag[%zero], %num_elt : memref<512 x 32 x f32>, memref<32 x 32 x f32, 2>, memref<1 x i32> affine.dma_wait %tag[%zero], %num_elt : memref<1 x i32> ""foo""(%tag) : (memref<1 x i32>) -> () } memref.dealloc %tag : memref<1 x i32> memref.dealloc %Av : memref<32 x 32 x f32, 2> return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "func.func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 { %c32 = arith.constant 32 : index %num_elt = arith.constant 512 : index %zero = arith.constant 0 : index %Av = memref.alloc() : memref<32 x 32 x f32, 2> %tag = memref.alloc() : memref<1 x i32> affine.for %kTT = 0 to 16 { affine.dma_start %arg0[%zero, %zero], %Av[%zero, %zero], %tag[%zero], %num_elt : memref<512 x 32 x f32>, memref<32 x 32 x f32, 2>, memref<1 x i32> affine.dma_wait %tag[%zero], %num_elt : memref<1 x i32> } %v = affine.load %Av[%zero, %zero] : memref<32 x 32 x f32, 2> memref.dealloc %tag : memref<1 x i32> memref.dealloc %Av : memref<32 x 32 x f32, 2> return %v : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "func.func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>, %Av: memref) { %num_elt = arith.constant 512 : index %zero = arith.constant 0 : index %tag = memref.alloc() : memref<1 x i32> affine.for %kTT = 0 to 16 { affine.dma_start %arg0[%zero, %zero], %Av[%zero, %zero], %tag[%zero], %num_elt : memref<512 x 32 x f32>, memref, memref<1 x i32> affine.dma_wait %tag[%zero], %num_elt : memref<1 x i32> } return } func.func @escaping_and_indexed_use_mix() { %A = memref.alloc() : memref<256 x f32, affine_map<(d0) -> (d0)>, 0> %Ah = memref.alloc() : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> %tag = memref.alloc() : memref<1 x f32> %zero = arith.constant 0 : index %num_elts = arith.constant 32 : index affine.for %i = 0 to 8 { affine.dma_start %A[%i], %Ah[%i], %tag[%zero], %num_elts : memref<256 x f32>, memref<32 x f32, 1>, memref<1 x f32> affine.dma_wait %tag[%zero], %num_elts : memref<1 x f32> ""compute""(%Ah) : (memref<32 x f32, 1>) -> () %v = affine.load %Ah[%i] : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> ""foo""(%v) : (f32) -> () } memref.dealloc %A : memref<256 x f32, affine_map<(d0) -> (d0)>, 0> memref.dealloc %Ah : memref<32 x f32, affine_map<(d0) -> (d0)>, 1> return }", mlir-opt -allow-unregistered-dialect -split-input-file -affine-pipeline-data-transfer ,1 "func.func @map1d(%lb: index, %ub: index, %step: index) { %0:2 = ""new_processor_id_and_range""() : () -> (index, index) scf.for %i = %lb to %ub step %step {} return } func.func @map2d(%lb : index, %ub : index, %step : index) { %0:2 = ""new_processor_id_and_range""() : () -> (index, index) %1:2 = ""new_processor_id_and_range""() : () -> (index, index) scf.for %i = %lb to %ub step %step {} return }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(test-mapping-to-processing-elements))"" ",1 "func.func @merge_blocks(%arg0: i32, %arg1 : i32) -> () { %0 = arith.constant dense<[[0, 1], [2, 3]]> : tensor<2x2xi32> %1 = arith.constant dense<1> : tensor<5xi32> %2 = arith.constant dense<[[0, 1]]> : tensor<1x2xi32> %a = arith.constant 10 : i32 %b = ""test.func""() : () -> i32 %3:2 = ""test.merge_blocks""() ({ ^bb0: ""test.br""(%arg0, %b, %a)[^bb1] : (i32, i32, i32) -> () ^bb1(%arg3 : i32, %arg4 : i32, %arg5: i32): ""test.return""(%arg3, %arg4) : (i32, i32) -> () }) : () -> (i32, i32) ""test.return""(%3#0, %3#1) : (i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -mlir-elide-elementsattrs-if-larger=2 -view-op-graph -o %t 2>&1 ,1 "func.func @merge_blocks(%arg0: i32, %arg1 : i32) -> () { %0 = arith.constant dense<[[0, 1], [2, 3]]> : tensor<2x2xi32> %1 = arith.constant dense<1> : tensor<5xi32> %2 = arith.constant dense<[[0, 1]]> : tensor<1x2xi32> %a = arith.constant 10 : i32 %b = ""test.func""() : () -> i32 %3:2 = ""test.merge_blocks""() ({ ^bb0: ""test.br""(%arg0, %b, %a)[^bb1] : (i32, i32, i32) -> () ^bb1(%arg3 : i32, %arg4 : i32, %arg5: i32): ""test.return""(%arg3, %arg4) : (i32, i32) -> () }) : () -> (i32, i32) ""test.return""(%3#0, %3#1) : (i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -mlir-elide-elementsattrs-if-larger=2 -view-op-graph='print-data-flow-edges=false print-control-flow-edges=true' -o %t 2>&1 ,1 "func.func @remove_op_with_inner_ops_pattern() { ""test.op_with_region_pattern""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @remove_op_with_inner_ops_pattern() { ""test.op_with_region_pattern""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{enable-patterns=TestRemoveOpWithInnerOps}))' ,1 "func.func @remove_op_with_inner_ops_pattern() { ""test.op_with_region_pattern""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{disable-patterns=TestRemoveOpWithInnerOps}))' ,1 "func.func private @private(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @simple_private() -> i32 { %1 = arith.constant 1 : i32 %result = call @private(%1) : (i32) -> i32 return %result : i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @private(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @simple_private() -> i32 { %1 = arith.constant 1 : i32 %result = call @private(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @private(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @simple_private() -> i32 { %1 = arith.constant 1 : i32 %result = call @private(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func nested @nested(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @simple_nested() -> i32 { %1 = arith.constant 1 : i32 %result = call @nested(%1) : (i32) -> i32 return %result : i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func nested @nested(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @simple_nested() -> i32 { %1 = arith.constant 1 : i32 %result = call @nested(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func nested @nested(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @simple_nested() -> i32 { %1 = arith.constant 1 : i32 %result = call @nested(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "module { module @nested_module attributes { sym_visibility = ""public"" } { func.func nested @nested(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @nested_not_all_uses_visible() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @nested(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 } } }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "module { module @nested_module attributes { sym_visibility = ""public"" } { func.func nested @nested(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @nested_not_all_uses_visible() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @nested(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 } } }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "module { module @nested_module attributes { sym_visibility = ""public"" } { func.func nested @nested(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @nested_not_all_uses_visible() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @nested(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 } } }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func @public(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @simple_public() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @public(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func @public(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @simple_public() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @public(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func @public(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @simple_public() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @public(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @non_call_users() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @callable(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 } ""live.user""() {uses = [@callable]} : () -> ()", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @callable(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @non_call_users() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @callable(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 } ""live.user""() {uses = [@callable]} : () -> ()"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 return %1, %arg0 : i32, i32 } func.func @non_call_users() -> (i32, i32) { %1 = arith.constant 1 : i32 %result:2 = call @callable(%1) : (i32) -> (i32, i32) return %result#0, %result#1 : i32, i32 } ""live.user""() {uses = [@callable]} : () -> ()"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> i32 { ""unknown.return""(%arg0) : (i32) -> () } func.func @unknown_terminator() -> i32 { %1 = arith.constant 1 : i32 %result = call @callable(%1) : (i32) -> i32 return %result : i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @callable(%arg0 : i32) -> i32 { ""unknown.return""(%arg0) : (i32) -> () } func.func @unknown_terminator() -> i32 { %1 = arith.constant 1 : i32 %result = call @callable(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> i32 { ""unknown.return""(%arg0) : (i32) -> () } func.func @unknown_terminator() -> i32 { %1 = arith.constant 1 : i32 %result = call @callable(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @conflicting_constant() -> (i32, i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %result = call @callable(%1) : (i32) -> i32 %result2 = call @callable(%2) : (i32) -> i32 return %result, %result2 : i32, i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @callable(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @conflicting_constant() -> (i32, i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %result = call @callable(%1) : (i32) -> i32 %result2 = call @callable(%2) : (i32) -> i32 return %result, %result2 : i32, i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> i32 { return %arg0 : i32 } func.func @conflicting_constant() -> (i32, i32) { %1 = arith.constant 1 : i32 %2 = arith.constant 2 : i32 %result = call @callable(%1) : (i32) -> i32 %result2 = call @callable(%2) : (i32) -> i32 return %result, %result2 : i32, i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> i32 { ""unknown.return""(%arg0) : (i32) -> () } func.func @conflicting_constant(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 %result = call @callable(%1) : (i32) -> i32 %result2 = call @callable(%arg0) : (i32) -> i32 return %result, %result2 : i32, i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @callable(%arg0 : i32) -> i32 { ""unknown.return""(%arg0) : (i32) -> () } func.func @conflicting_constant(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 %result = call @callable(%1) : (i32) -> i32 %result2 = call @callable(%arg0) : (i32) -> i32 return %result, %result2 : i32, i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @callable(%arg0 : i32) -> i32 { ""unknown.return""(%arg0) : (i32) -> () } func.func @conflicting_constant(%arg0 : i32) -> (i32, i32) { %1 = arith.constant 1 : i32 %result = call @callable(%1) : (i32) -> i32 %result2 = call @callable(%arg0) : (i32) -> i32 return %result, %result2 : i32, i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @complex_inner_if(%arg0 : i32) -> i32 { %cst_20 = arith.constant 20 : i32 %cond = arith.cmpi ult, %arg0, %cst_20 : i32 cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %cst_1 = arith.constant 1 : i32 return %cst_1 : i32 ^bb2: %cst_1_2 = arith.constant 1 : i32 %arg_inc = arith.addi %arg0, %cst_1_2 : i32 return %arg_inc : i32 } func.func private @complex_cond() -> i1 func.func private @complex_callee(%arg0 : i32) -> i32 { %loop_cond = call @complex_cond() : () -> i1 cf.cond_br %loop_cond, ^bb1, ^bb2 ^bb1: return %arg0 : i32 ^bb2: %updated_arg = call @complex_inner_if(%arg0) : (i32) -> i32 %res = call @complex_callee(%updated_arg) : (i32) -> i32 return %res : i32 } func.func @complex_caller(%arg0 : i32) -> i32 { %1 = arith.constant 1 : i32 %result = call @complex_callee(%1) : (i32) -> i32 return %result : i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @complex_inner_if(%arg0 : i32) -> i32 { %cst_20 = arith.constant 20 : i32 %cond = arith.cmpi ult, %arg0, %cst_20 : i32 cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %cst_1 = arith.constant 1 : i32 return %cst_1 : i32 ^bb2: %cst_1_2 = arith.constant 1 : i32 %arg_inc = arith.addi %arg0, %cst_1_2 : i32 return %arg_inc : i32 } func.func private @complex_cond() -> i1 func.func private @complex_callee(%arg0 : i32) -> i32 { %loop_cond = call @complex_cond() : () -> i1 cf.cond_br %loop_cond, ^bb1, ^bb2 ^bb1: return %arg0 : i32 ^bb2: %updated_arg = call @complex_inner_if(%arg0) : (i32) -> i32 %res = call @complex_callee(%updated_arg) : (i32) -> i32 return %res : i32 } func.func @complex_caller(%arg0 : i32) -> i32 { %1 = arith.constant 1 : i32 %result = call @complex_callee(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @complex_inner_if(%arg0 : i32) -> i32 { %cst_20 = arith.constant 20 : i32 %cond = arith.cmpi ult, %arg0, %cst_20 : i32 cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %cst_1 = arith.constant 1 : i32 return %cst_1 : i32 ^bb2: %cst_1_2 = arith.constant 1 : i32 %arg_inc = arith.addi %arg0, %cst_1_2 : i32 return %arg_inc : i32 } func.func private @complex_cond() -> i1 func.func private @complex_callee(%arg0 : i32) -> i32 { %loop_cond = call @complex_cond() : () -> i1 cf.cond_br %loop_cond, ^bb1, ^bb2 ^bb1: return %arg0 : i32 ^bb2: %updated_arg = call @complex_inner_if(%arg0) : (i32) -> i32 %res = call @complex_callee(%updated_arg) : (i32) -> i32 return %res : i32 } func.func @complex_caller(%arg0 : i32) -> i32 { %1 = arith.constant 1 : i32 %result = call @complex_callee(%1) : (i32) -> i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func @non_symbol_defining_callable() -> i32 { %fn = ""test.functional_region_op""() ({ %1 = arith.constant 1 : i32 ""test.return""(%1) : (i32) -> () }) : () -> (() -> i32) %res = call_indirect %fn() : () -> (i32) return %res : i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func @non_symbol_defining_callable() -> i32 { %fn = ""test.functional_region_op""() ({ %1 = arith.constant 1 : i32 ""test.return""(%1) : (i32) -> () }) : () -> (() -> i32) %res = call_indirect %fn() : () -> (i32) return %res : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func @non_symbol_defining_callable() -> i32 { %fn = ""test.functional_region_op""() ({ %1 = arith.constant 1 : i32 ""test.return""(%1) : (i32) -> () }) : () -> (() -> i32) %res = call_indirect %fn() : () -> (i32) return %res : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @unreferenced_private_function() -> i32 { %true = arith.constant true %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %result = arith.select %true, %cst0, %cst1 : i32 return %result : i32 }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @unreferenced_private_function() -> i32 { %true = arith.constant true %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %result = arith.select %true, %cst0, %cst1 : i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @unreferenced_private_function() -> i32 { %true = arith.constant true %cst0 = arith.constant 0 : i32 %cst1 = arith.constant 1 : i32 %result = arith.select %true, %cst0, %cst1 : i32 return %result : i32 }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func private @foo() -> index { %0 = arith.constant 10 : index return %0 : index } func.func @bar(%arg0: index) -> index { %c0 = arith.constant 0 : index %1 = arith.constant 420 : index %7 = arith.cmpi eq, %arg0, %c0 : index cf.cond_br %7, ^bb1(%1 : index), ^bb2 ^bb1(%8: index): return %8 : index ^bb2: %13 = call @foo() : () -> index cf.br ^bb1(%13 : index) }", mlir-opt -allow-unregistered-dialect -sccp -split-input-file ,1 "func.func private @foo() -> index { %0 = arith.constant 10 : index return %0 : index } func.func @bar(%arg0: index) -> index { %c0 = arith.constant 0 : index %1 = arith.constant 420 : index %7 = arith.cmpi eq, %arg0, %c0 : index cf.cond_br %7, ^bb1(%1 : index), ^bb2 ^bb1(%8: index): return %8 : index ^bb2: %13 = call @foo() : () -> index cf.br ^bb1(%13 : index) }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(sccp))"" -split-input-file ",1 "func.func private @foo() -> index { %0 = arith.constant 10 : index return %0 : index } func.func @bar(%arg0: index) -> index { %c0 = arith.constant 0 : index %1 = arith.constant 420 : index %7 = arith.cmpi eq, %arg0, %c0 : index cf.cond_br %7, ^bb1(%1 : index), ^bb2 ^bb1(%8: index): return %8 : index ^bb2: %13 = call @foo() : () -> index cf.br ^bb1(%13 : index) }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func @collapse_to_single() { %c0 = arith.constant 3 : index %c1 = arith.constant 7 : index %c2 = arith.constant 11 : index %c3 = arith.constant 29 : index %c4 = arith.constant 3 : index %c5 = arith.constant 4 : index scf.parallel (%i0, %i1) = (%c0, %c1) to (%c2, %c3) step (%c4, %c5) { %result = ""magic.op""(%i0, %i1): (index, index) -> index } return }"," mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-0=0,1}, canonicalize))' ",1 "func.func @default_insertion_position(%cond: i1) { scf.if %cond { %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () } return } func.func @custom_insertion_position() { ""test.one_region_op""() ({ %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize{top-down=true}))' ,1 "func.func @default_insertion_position(%cond: i1) { scf.if %cond { %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () } return } func.func @custom_insertion_position() { ""test.one_region_op""() ({ %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @merge_blocks(%arg0: i32, %arg1 : i32) -> () { %0:2 = ""test.merge_blocks""() ({ ^bb0: ""test.br""(%arg0, %arg1)[^bb1] : (i32, i32) -> () ^bb1(%arg3 : i32, %arg4 : i32): ""test.return""(%arg3, %arg4) : (i32, i32) -> () }) : () -> (i32, i32) ""test.return""(%0#0, %0#1) : (i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -test-merge-blocks -verify-diagnostics ,1 "func.func @undo_blocks_merge(%arg0: i32) { ""test.undo_blocks_merge""() ({ ""unregistered.return""(%arg0)[^bb1] : (i32) -> () ^bb1(%arg1 : i32): ""unregistered.return""(%arg1) : (i32) -> () }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -test-merge-blocks -verify-diagnostics ,1 "func.func @inline_regions() -> () { ""test.SingleBlockImplicitTerminator""() ({ ^bb0: %0 = ""test.type_producer""() : () -> i32 ""test.SingleBlockImplicitTerminator""() ({ ^bb1: ""test.type_consumer""(%0) : (i32) -> () ""test.finish""() : () -> () }) : () -> () ""test.finish""() : () -> () }) : () -> () ""test.return""() : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -test-merge-blocks -verify-diagnostics ,1 "func.func @test_sink() { %0 = ""test.sink_me""() : () -> i32 ""test.sink_target""() ({ ""test.use""(%0) : (i32) -> () }) : () -> () return } func.func @test_sink_first_region_only() { %0 = ""test.sink_me""() {first} : () -> i32 %1 = ""test.sink_me""() {second} : () -> i32 ""test.sink_target""() ({ ""test.use""(%0) : (i32) -> () }, { ""test.use""(%1) : (i32) -> () }) : () -> () return } func.func @test_sink_targeted_op_only() { %0 = ""test.sink_me""() : () -> i32 %1 = ""test.dont_sink_me""() : () -> i32 ""test.sink_target""() ({ ""test.use""(%0, %1) : (i32, i32) -> () }) : () -> () return }", mlir-opt -test-control-flow-sink ,1 "func.func @test_reorder_constants_and_match(%arg0 : i32) -> (i32) { %cst = arith.constant 43 : i32 %y = ""test.op_commutative2""(%cst, %arg0) : (i32, i32) -> i32 %x = ""test.op_commutative2""(%y, %arg0) : (i32, i32) -> i32 return %x : i32 }"," mlir-opt --pass-pipeline=""builtin.module(func.func(test-patterns))"" ",1 "#map0 = affine_map<(d0) -> (d0 mod 2)> func.func @simple_constant() -> (i32, i32) { %0 = arith.constant 1 : i32 %1 = arith.constant 1 : i32 return %0, %1 : i32, i32 } func.func @basic() -> (index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 0 : index %0 = affine.apply #map0(%c0) %1 = affine.apply #map0(%c1) return %0, %1 : index, index } func.func @many(f32, f32) -> (f32) { ^bb0(%a : f32, %b : f32): %c = arith.addf %a, %b : f32 %d = arith.addf %a, %b : f32 %e = arith.addf %a, %b : f32 %f = arith.addf %a, %b : f32 %g = arith.addf %c, %d : f32 %h = arith.addf %e, %f : f32 %i = arith.addf %c, %e : f32 %j = arith.addf %g, %h : f32 %k = arith.addf %h, %i : f32 %l = arith.addf %j, %k : f32 return %l : f32 } func.func @different_ops() -> (i32, i32) { %0 = arith.constant 0 : i32 %1 = arith.constant 1 : i32 return %0, %1 : i32, i32 } func.func @different_results(%arg0: tensor<*xf32>) -> (tensor, tensor<4x?xf32>) { %0 = tensor.cast %arg0 : tensor<*xf32> to tensor %1 = tensor.cast %arg0 : tensor<*xf32> to tensor<4x?xf32> return %0, %1 : tensor, tensor<4x?xf32> } func.func @different_attributes(index, index) -> (i1, i1, i1) { ^bb0(%a : index, %b : index): %0 = arith.cmpi slt, %a, %b : index %1 = arith.cmpi ne, %a, %b : index %2 = ""arith.cmpi""(%a, %b) {predicate = 1} : (index, index) -> i1 return %0, %1, %2 : i1, i1, i1 } func.func @side_effect() -> (memref<2x1xf32>, memref<2x1xf32>) { %0 = memref.alloc() : memref<2x1xf32> %1 = memref.alloc() : memref<2x1xf32> return %0, %1 : memref<2x1xf32>, memref<2x1xf32> } func.func @down_propagate_for() { %0 = arith.constant 1 : i32 affine.for %i = 0 to 4 { %1 = arith.constant 1 : i32 ""foo""(%0, %1) : (i32, i32) -> () } return } func.func @down_propagate() -> i32 { %0 = arith.constant 1 : i32 %cond = arith.constant true cf.cond_br %cond, ^bb1, ^bb2(%0 : i32) ^bb1: %1 = arith.constant 1 : i32 cf.br ^bb2(%1 : i32) ^bb2(%arg : i32): return %arg : i32 } func.func @up_propagate_for() -> i32 { affine.for %i = 0 to 4 { %0 = arith.constant 1 : i32 ""foo""(%0) : (i32) -> () } %1 = arith.constant 1 : i32 return %1 : i32 } func.func @up_propagate() -> i32 { %0 = arith.constant 0 : i32 %cond = arith.constant true cf.cond_br %cond, ^bb1, ^bb2(%0 : i32) ^bb1: %1 = arith.constant 1 : i32 cf.br ^bb2(%1 : i32) ^bb2(%arg : i32): %2 = arith.constant 1 : i32 %add = arith.addi %arg, %2 : i32 return %add : i32 } func.func @up_propagate_region() -> i32 { %0 = ""foo.region""() ({ %1 = arith.constant 0 : i32 %true = arith.constant true cf.cond_br %true, ^bb1, ^bb2(%1 : i32) ^bb1: %c1_i32 = arith.constant 1 : i32 cf.br ^bb2(%c1_i32 : i32) ^bb2(%arg : i32): %c1_i32_0 = arith.constant 1 : i32 %2 = arith.addi %arg, %c1_i32_0 : i32 ""foo.yield"" (%2) : (i32) -> () }) : () -> (i32) return %0 : i32 } func.func @nested_isolated() -> i32 { %0 = arith.constant 1 : i32 func.func @nested_func() { %foo = arith.constant 1 : i32 ""foo.yield""(%foo) : (i32) -> () } ""foo.region""() ({ %foo = arith.constant 1 : i32 ""foo.yield""(%foo) : (i32) -> () }) : () -> () return %0 : i32 } func.func @use_before_def() { test.graph_region { %0 = arith.addi %1, %2 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant 1 : i32 ""foo.yield""(%0) : (i32) -> () } return } func.func @remove_direct_duplicated_read_op() -> i32 { %0 = ""test.op_with_memread""() : () -> (i32) %1 = ""test.op_with_memread""() : () -> (i32) %2 = arith.addi %0, %1 : i32 return %2 : i32 } func.func @remove_multiple_duplicated_read_op() -> i64 { %0 = ""test.op_with_memread""() : () -> (i64) %1 = ""test.op_with_memread""() : () -> (i64) %2 = arith.addi %0, %1 : i64 %3 = ""test.op_with_memread""() : () -> (i64) %4 = arith.addi %2, %3 : i64 %5 = ""test.op_with_memread""() : () -> (i64) %6 = arith.addi %4, %5 : i64 return %6 : i64 } func.func @dont_remove_duplicated_read_op_with_sideeffecting() -> i32 { %0 = ""test.op_with_memread""() : () -> (i32) ""test.op_with_memwrite""() : () -> () %1 = ""test.op_with_memread""() : () -> (i32) %2 = arith.addi %0, %1 : i32 return %2 : i32 } func.func @check_cummutative_cse(%a : i32, %b : i32) -> i32 { %1 = arith.addi %a, %b : i32 %2 = arith.addi %b, %a : i32 %3 = arith.muli %1, %2 : i32 return %3 : i32 } func.func @cse_single_block_ops(%a : tensor, %b : tensor) -> (tensor, tensor) { %0 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32): test.region_yield %arg0 : f32 } : tensor, tensor -> tensor %1 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32): test.region_yield %arg0 : f32 } : tensor, tensor -> tensor return %0, %1 : tensor, tensor } func.func @no_cse_varied_bbargs(%a : tensor, %b : tensor) -> (tensor, tensor) { %0 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): test.region_yield %arg0 : f32 } : tensor, tensor -> tensor %1 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32): test.region_yield %arg0 : f32 } : tensor, tensor -> tensor return %0, %1 : tensor, tensor } func.func @no_cse_region_difference_simple(%a : tensor, %b : tensor) -> (tensor, tensor) { %0 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): test.region_yield %arg0 : f32 } : tensor, tensor -> tensor %1 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): test.region_yield %arg1 : f32 } : tensor, tensor -> tensor return %0, %1 : tensor, tensor } func.func @cse_single_block_ops_identical_bodies(%a : tensor, %b : tensor, %c : f32, %d : i1) -> (tensor, tensor) { %0 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): %1 = arith.divf %arg0, %arg1 : f32 %2 = arith.remf %arg0, %c : f32 %3 = arith.select %d, %1, %2 : f32 test.region_yield %3 : f32 } : tensor, tensor -> tensor %1 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): %1 = arith.divf %arg0, %arg1 : f32 %2 = arith.remf %arg0, %c : f32 %3 = arith.select %d, %1, %2 : f32 test.region_yield %3 : f32 } : tensor, tensor -> tensor return %0, %1 : tensor, tensor } func.func @no_cse_single_block_ops_different_bodies(%a : tensor, %b : tensor, %c : f32, %d : i1) -> (tensor, tensor) { %0 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): %1 = arith.divf %arg0, %arg1 : f32 %2 = arith.remf %arg0, %c : f32 %3 = arith.select %d, %1, %2 : f32 test.region_yield %3 : f32 } : tensor, tensor -> tensor %1 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): %1 = arith.divf %arg0, %arg1 : f32 %2 = arith.remf %arg0, %c : f32 %3 = arith.select %d, %2, %1 : f32 test.region_yield %3 : f32 } : tensor, tensor -> tensor return %0, %1 : tensor, tensor } func.func @cse_single_block_with_commutative_ops(%a : tensor, %b : tensor, %c : f32) -> (tensor, tensor) { %0 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): %1 = arith.addf %arg0, %arg1 : f32 %2 = arith.mulf %1, %c : f32 test.region_yield %2 : f32 } : tensor, tensor -> tensor %1 = test.cse_of_single_block_op inputs(%a, %b) { ^bb0(%arg0 : f32, %arg1 : f32): %1 = arith.addf %arg1, %arg0 : f32 %2 = arith.mulf %c, %1 : f32 test.region_yield %2 : f32 } : tensor, tensor -> tensor return %0, %1 : tensor, tensor } func.func @failing_issue_59135(%arg0: tensor<2x2xi1>, %arg1: f32, %arg2 : tensor<2xi1>) -> (tensor<2xi1>, tensor<2xi1>) { %false_2 = arith.constant false %true_5 = arith.constant true %9 = test.cse_of_single_block_op inputs(%arg2) { ^bb0(%out: i1): %true_144 = arith.constant true test.region_yield %true_144 : i1 } : tensor<2xi1> -> tensor<2xi1> %15 = test.cse_of_single_block_op inputs(%arg2) { ^bb0(%out: i1): %true_144 = arith.constant true test.region_yield %true_144 : i1 } : tensor<2xi1> -> tensor<2xi1> %93 = arith.maxsi %false_2, %true_5 : i1 return %9, %15 : tensor<2xi1>, tensor<2xi1> } func.func @cse_multiple_regions(%c: i1, %t: tensor<5xf32>) -> (tensor<5xf32>, tensor<5xf32>) { %r1 = scf.if %c -> (tensor<5xf32>) { %0 = tensor.empty() : tensor<5xf32> scf.yield %0 : tensor<5xf32> } else { scf.yield %t : tensor<5xf32> } %r2 = scf.if %c -> (tensor<5xf32>) { %0 = tensor.empty() : tensor<5xf32> scf.yield %0 : tensor<5xf32> } else { scf.yield %t : tensor<5xf32> } return %r1, %r2 : tensor<5xf32>, tensor<5xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(cse))' ,1 "func.func @test_simple_sink(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 { %0 = arith.subi %arg1, %arg2 : i32 %1 = arith.subi %arg2, %arg1 : i32 %2 = arith.addi %arg1, %arg1 : i32 %3 = arith.addi %arg2, %arg2 : i32 %4 = test.region_if %arg0: i32 -> i32 then { ^bb0(%arg3: i32): test.region_if_yield %0 : i32 } else { ^bb0(%arg3: i32): %5 = arith.addi %1, %2 : i32 test.region_if_yield %5 : i32 } join { ^bb0(%arg3: i32): %5 = arith.addi %3, %1 : i32 test.region_if_yield %5 : i32 } return %4 : i32 } func.func @test_region_sink(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 { %0 = arith.subi %arg1, %arg2 : i32 %1 = test.region_if %arg0: i32 -> i32 then { ^bb0(%arg3: i32): test.region_if_yield %arg1 : i32 } else { ^bb0(%arg3: i32): test.region_if_yield %0 : i32 } join { ^bb0(%arg3: i32): test.region_if_yield %arg2 : i32 } %2 = test.region_if %arg0: i32 -> i32 then { ^bb0(%arg3: i32): test.region_if_yield %1 : i32 } else { ^bb0(%arg3: i32): test.region_if_yield %arg1 : i32 } join { ^bb0(%arg3: i32): test.region_if_yield %arg2 : i32 } return %2 : i32 } func.func @test_subgraph_sink(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 { %0 = arith.addi %arg1, %arg2 : i32 %1 = arith.subi %arg1, %arg2 : i32 %2 = arith.subi %arg2, %arg1 : i32 %3 = arith.muli %0, %1 : i32 %4 = arith.muli %2, %2 : i32 %5 = arith.addi %3, %4 : i32 %6 = test.region_if %arg0: i32 -> i32 then { ^bb0(%arg3: i32): test.region_if_yield %5 : i32 } else { ^bb0(%arg3: i32): test.region_if_yield %arg1 : i32 } join { ^bb0(%arg3: i32): test.region_if_yield %arg2 : i32 } return %6 : i32 } func.func @test_multiblock_region_sink(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 { %0 = arith.addi %arg1, %arg2 : i32 %1 = arith.addi %0, %arg2 : i32 %2 = arith.addi %1, %arg1 : i32 %3 = ""test.any_cond""() ({ cf.br ^bb1(%2 : i32) ^bb1(%5: i32): %6 = arith.addi %5, %2 : i32 ""test.yield""(%6) : (i32) -> () }) : () -> i32 %4 = arith.addi %0, %3 : i32 return %4 : i32 } func.func @test_nested_region_sink(%arg0: i32, %arg1: i32) -> i32 { %0 = arith.addi %arg1, %arg1 : i32 %1 = test.region_if %arg0: i32 -> i32 then { ^bb0(%arg3: i32): %2 = test.region_if %arg0: i32 -> i32 then { ^bb0(%arg4: i32): test.region_if_yield %0 : i32 } else { ^bb0(%arg4: i32): test.region_if_yield %arg1 : i32 } join { ^bb0(%arg4: i32): test.region_if_yield %arg1 : i32 } test.region_if_yield %2 : i32 } else { ^bb0(%arg3: i32): test.region_if_yield %arg1 : i32 } join { ^bb0(%arg3: i32): test.region_if_yield %arg1 : i32 } return %1 : i32 } func.func @test_not_sunk_deeply(%arg0: i32) -> i32 { %0 = arith.addi %arg0, %arg0 : i32 %1 = ""test.any_cond""() ({ cf.br ^bb1 ^bb1: ""test.yield""(%0) : (i32) -> () }) : () -> i32 return %1 : i32 }", mlir-opt -control-flow-sink ,1 "func.func private @callee(!test.test_type) -> i32 func.func @caller() -> i32 { %arg = ""test.type_producer""() : () -> !test.test_type %out = call @callee(%arg) : (!test.test_type) -> i32 return %out : i32 }", mlir-opt -test-convert-call-op ,1 "func.func @TestSingleConversion() { %result = ""test.cast""() : () -> (i64) ""test.return""(%result) : (i64) -> () } func.func @TestLingeringConversion() -> i64 { %result = ""test.cast""() : () -> (i64) return %result : i64 }", mlir-opt -test-dialect-conversion-pdll ,1 "func.func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32>, %arg1: memref<64x4xf32>) { %out = memref.alloc() : memref<64x4xf32> %0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 64 { affine.for %i1 = 0 to 4 { affine.store %0, %out[%i0, %i1] : memref<64x4xf32> } } affine.for %i2 = 0 to 4 { affine.for %i3 = 0 to 4 { affine.for %i4 = 0 to 16 { %v = affine.load %arg1[16 * %i3 - %i4 + 15, %i2] : memref<64x4xf32> ""op0""(%v) : (f32) -> () } affine.for %i5 = 0 to 4 { affine.for %i6 = 0 to 16 { %v = affine.load %arg0[16 * %i5 - %i6 + 15, %i3] : memref<64x4xf32> ""op1""(%v) : (f32) -> () } affine.for %i7 = 0 to 16 { %r = ""op2""() : () -> (f32) %v = affine.load %out[16 * %i5 + %i7, %i2] : memref<64x4xf32> %s = arith.addf %v, %r : f32 affine.store %s, %out[16 * %i5 + %i7, %i2] : memref<64x4xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_at_depth_above_loop_carried_dependence(%arg0: memref<64x4xf32>, %arg1: memref<64x4xf32>) { %out = memref.alloc() : memref<64x4xf32> %0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 64 { affine.for %i1 = 0 to 4 { affine.store %0, %out[%i0, %i1] : memref<64x4xf32> } } affine.for %i2 = 0 to 4 { affine.for %i3 = 0 to 4 { affine.for %i4 = 0 to 16 { %v = affine.load %arg1[16 * %i3 - %i4 + 15, %i2] : memref<64x4xf32> ""op0""(%v) : (f32) -> () } affine.for %i5 = 0 to 4 { affine.for %i6 = 0 to 16 { %v = affine.load %arg0[16 * %i5 - %i6 + 15, %i3] : memref<64x4xf32> ""op1""(%v) : (f32) -> () } affine.for %i7 = 0 to 16 { %r = ""op2""() : () -> (f32) %v = affine.load %out[16 * %i5 + %i7, %i2] : memref<64x4xf32> %s = arith.addf %v, %r : f32 affine.store %s, %out[16 * %i5 + %i7, %i2] : memref<64x4xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_only_two_loops_and_remove_producer() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %a[%i1] : memref<10xf32> affine.store %v0, %b[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %a[%i2] : memref<10xf32> affine.store %v1, %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_only_two_loops_and_remove_producer() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %a[%i1] : memref<10xf32> affine.store %v0, %b[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %a[%i2] : memref<10xf32> affine.store %v1, %b[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_after_one_loop_interchange() { %a = memref.alloc() : memref<10xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf0, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 5 { affine.for %i2 = 0 to 10 { %v0 = affine.load %a[%i2] : memref<10xf32> affine.store %v0, %a[%i2] : memref<10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_after_one_loop_interchange() { %a = memref.alloc() : memref<10xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf0, %a[%i0] : memref<10xf32> } affine.for %i1 = 0 to 5 { affine.for %i2 = 0 to 10 { %v0 = affine.load %a[%i2] : memref<10xf32> affine.store %v0, %a[%i2] : memref<10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_after_two_loop_interchanges() { %a = memref.alloc() : memref<6x8xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 6 { affine.for %i1 = 0 to 8 { affine.store %cf0, %a[%i0, %i1] : memref<6x8xf32> } } affine.for %i2 = 0 to 4 { affine.for %i3 = 0 to 6 { affine.for %i4 = 0 to 2 { affine.for %i5 = 0 to 8 { %v0 = affine.load %a[%i3, %i5] : memref<6x8xf32> %v1 = arith.addf %v0, %v0 : f32 affine.store %v1, %a[%i3, %i5] : memref<6x8xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_after_two_loop_interchanges() { %a = memref.alloc() : memref<6x8xf32> %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 6 { affine.for %i1 = 0 to 8 { affine.store %cf0, %a[%i0, %i1] : memref<6x8xf32> } } affine.for %i2 = 0 to 4 { affine.for %i3 = 0 to 6 { affine.for %i4 = 0 to 2 { affine.for %i5 = 0 to 8 { %v0 = affine.load %a[%i3, %i5] : memref<6x8xf32> %v1 = arith.addf %v0, %v0 : f32 affine.store %v1, %a[%i3, %i5] : memref<6x8xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_live_out_writer(%arg0 : memref<10xf32>) -> memref<10xf32> { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %arg0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %1 = affine.load %arg0[%i1] : memref<10xf32> affine.store %1, %arg0[%i1] : memref<10xf32> } return %arg0 : memref<10xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_live_out_writer(%arg0 : memref<10xf32>) -> memref<10xf32> { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.store %cst, %arg0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %1 = affine.load %arg0[%i1] : memref<10xf32> affine.store %1, %arg0[%i1] : memref<10xf32> } return %arg0 : memref<10xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @slice_tile(%arg0: memref<128x8xf32>, %arg1: memref<32x8xf32>, %0 : f32) -> memref<32x8xf32> { affine.for %i0 = 0 to 32 { affine.for %i1 = 0 to 8 { affine.store %0, %arg1[%i0, %i1] : memref<32x8xf32> } } affine.for %i = 0 to 2 { affine.for %j = 0 to 8 { affine.for %k = 0 to 8 { affine.for %kk = 0 to 16 { %v = affine.load %arg0[16 * %k + %kk, %j] : memref<128x8xf32> %r = ""foo""(%v) : (f32) -> f32 } affine.for %ii = 0 to 16 { %v = affine.load %arg1[16 * %i + %ii, %j] : memref<32x8xf32> %s = arith.addf %v, %v : f32 affine.store %s, %arg1[16 * %i + %ii, %j] : memref<32x8xf32> } } } } return %arg1 : memref<32x8xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @slice_tile(%arg0: memref<128x8xf32>, %arg1: memref<32x8xf32>, %0 : f32) -> memref<32x8xf32> { affine.for %i0 = 0 to 32 { affine.for %i1 = 0 to 8 { affine.store %0, %arg1[%i0, %i1] : memref<32x8xf32> } } affine.for %i = 0 to 2 { affine.for %j = 0 to 8 { affine.for %k = 0 to 8 { affine.for %kk = 0 to 16 { %v = affine.load %arg0[16 * %k + %kk, %j] : memref<128x8xf32> %r = ""foo""(%v) : (f32) -> f32 } affine.for %ii = 0 to 16 { %v = affine.load %arg1[16 * %i + %ii, %j] : memref<32x8xf32> %s = arith.addf %v, %v : f32 affine.store %s, %arg1[16 * %i + %ii, %j] : memref<32x8xf32> } } } } return %arg1 : memref<32x8xf32> }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @test_add_slice_bounds() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %c0 = arith.constant 0 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) %a1 = affine.apply affine_map<(d0) -> (d0)> (%i0) %a2 = affine.apply affine_map<(d0, d1) -> (d0 - d1)> (%a0, %a1) affine.store %cf7, %a[%a2] : memref<10xf32> } } } affine.for %i3 = 0 to 10 { affine.for %i4 = 0 to 10 { affine.for %i5 = 0 to 10 { %v0 = affine.load %a[%c0] : memref<10xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @test_add_slice_bounds() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %c0 = arith.constant 0 : index affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.for %i2 = 0 to 10 { %a0 = affine.apply affine_map<(d0) -> (d0)> (%i0) %a1 = affine.apply affine_map<(d0) -> (d0)> (%i0) %a2 = affine.apply affine_map<(d0, d1) -> (d0 - d1)> (%a0, %a1) affine.store %cf7, %a[%a2] : memref<10xf32> } } } affine.for %i3 = 0 to 10 { affine.for %i4 = 0 to 10 { affine.for %i5 = 0 to 10 { %v0 = affine.load %a[%c0] : memref<10xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_init_loops_siblings_then_shared_producer(%arg0: memref<10x10xf32>, %arg1: memref<10x10xf32>) { %0 = memref.alloc() : memref<10x10xf32> %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %cst_1 = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cst_1, %0[%i0, %i1] : memref<10x10xf32> } } affine.for %i2 = 0 to 3 { affine.for %i3 = 0 to 3 { affine.store %cst, %arg0[%i2, %i3] : memref<10x10xf32> } } affine.for %i4 = 0 to 3 { affine.for %i5 = 0 to 3 { %1 = affine.load %0[%i4, %i5] : memref<10x10xf32> %2 = affine.load %arg0[%i4, %i5] : memref<10x10xf32> %3 = arith.mulf %1, %2 : f32 affine.store %3, %arg0[%i4, %i5] : memref<10x10xf32> } } affine.for %i6 = 0 to 3 { affine.for %i7 = 0 to 3 { affine.store %cst_0, %arg1[%i6, %i7] : memref<10x10xf32> } } affine.for %i8 = 0 to 3 { affine.for %i9 = 0 to 3 { %4 = affine.load %0[%i8, %i9] : memref<10x10xf32> %5 = affine.load %arg1[%i8, %i9] : memref<10x10xf32> %6 = arith.addf %4, %5 : f32 affine.store %6, %arg1[%i8, %i9] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_init_loops_siblings_then_shared_producer(%arg0: memref<10x10xf32>, %arg1: memref<10x10xf32>) { %0 = memref.alloc() : memref<10x10xf32> %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 1.000000e+00 : f32 %cst_1 = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cst_1, %0[%i0, %i1] : memref<10x10xf32> } } affine.for %i2 = 0 to 3 { affine.for %i3 = 0 to 3 { affine.store %cst, %arg0[%i2, %i3] : memref<10x10xf32> } } affine.for %i4 = 0 to 3 { affine.for %i5 = 0 to 3 { %1 = affine.load %0[%i4, %i5] : memref<10x10xf32> %2 = affine.load %arg0[%i4, %i5] : memref<10x10xf32> %3 = arith.mulf %1, %2 : f32 affine.store %3, %arg0[%i4, %i5] : memref<10x10xf32> } } affine.for %i6 = 0 to 3 { affine.for %i7 = 0 to 3 { affine.store %cst_0, %arg1[%i6, %i7] : memref<10x10xf32> } } affine.for %i8 = 0 to 3 { affine.for %i9 = 0 to 3 { %4 = affine.load %0[%i8, %i9] : memref<10x10xf32> %5 = affine.load %arg1[%i8, %i9] : memref<10x10xf32> %6 = arith.addf %4, %5 : f32 affine.store %6, %arg1[%i8, %i9] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @two_matrix_vector_products() { %in_matrix = memref.alloc() : memref<10x10xf32> %in_vec0 = memref.alloc() : memref<10xf32> %in_vec1 = memref.alloc() : memref<10xf32> %out_vec0 = memref.alloc() : memref<10xf32> %out_vec1 = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cf7, %in_matrix[%i0, %i1] : memref<10x10xf32> } } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 10 { %v0 = affine.load %in_matrix[%i2, %i3] : memref<10x10xf32> %v1 = affine.load %in_vec0[%i3] : memref<10xf32> %v2 = arith.mulf %v0, %v1 : f32 %v3 = affine.load %out_vec0[%i3] : memref<10xf32> %v4 = arith.addf %v2, %v3 : f32 affine.store %v4, %out_vec0[%i3] : memref<10xf32> } } affine.for %i4 = 0 to 10 { affine.for %i5 = 0 to 10 { %v5 = affine.load %in_matrix[%i4, %i5] : memref<10x10xf32> %v6 = affine.load %in_vec1[%i5] : memref<10xf32> %v7 = arith.mulf %v5, %v6 : f32 %v8 = affine.load %out_vec1[%i5] : memref<10xf32> %v9 = arith.addf %v7, %v8 : f32 affine.store %v9, %out_vec1[%i5] : memref<10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @two_matrix_vector_products() { %in_matrix = memref.alloc() : memref<10x10xf32> %in_vec0 = memref.alloc() : memref<10xf32> %in_vec1 = memref.alloc() : memref<10xf32> %out_vec0 = memref.alloc() : memref<10xf32> %out_vec1 = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cf7, %in_matrix[%i0, %i1] : memref<10x10xf32> } } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 10 { %v0 = affine.load %in_matrix[%i2, %i3] : memref<10x10xf32> %v1 = affine.load %in_vec0[%i3] : memref<10xf32> %v2 = arith.mulf %v0, %v1 : f32 %v3 = affine.load %out_vec0[%i3] : memref<10xf32> %v4 = arith.addf %v2, %v3 : f32 affine.store %v4, %out_vec0[%i3] : memref<10xf32> } } affine.for %i4 = 0 to 10 { affine.for %i5 = 0 to 10 { %v5 = affine.load %in_matrix[%i4, %i5] : memref<10x10xf32> %v6 = affine.load %in_vec1[%i5] : memref<10xf32> %v7 = arith.mulf %v5, %v6 : f32 %v8 = affine.load %out_vec1[%i5] : memref<10xf32> %v9 = arith.addf %v7, %v8 : f32 affine.store %v9, %out_vec1[%i5] : memref<10xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_not_slice_past_slice_barrier() { %0 = memref.alloc() : memref<100x16xf32> affine.for %i0 = 0 to 100 { affine.for %i1 = 0 to 16 { %1 = ""op1""() : () -> f32 affine.store %1, %0[%i0, %i1] : memref<100x16xf32> } {slice_fusion_barrier = true} } affine.for %i2 = 0 to 100 { affine.for %i3 = 0 to 16 { %2 = affine.load %0[%i2, %i3] : memref<100x16xf32> ""op2""(%2) : (f32) -> () } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_not_slice_past_slice_barrier() { %0 = memref.alloc() : memref<100x16xf32> affine.for %i0 = 0 to 100 { affine.for %i1 = 0 to 16 { %1 = ""op1""() : () -> f32 affine.store %1, %0[%i0, %i1] : memref<100x16xf32> } {slice_fusion_barrier = true} } affine.for %i2 = 0 to 100 { affine.for %i3 = 0 to 16 { %2 = affine.load %0[%i2, %i3] : memref<100x16xf32> ""op2""(%2) : (f32) -> () } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "#map = affine_map<(d0, d1) -> (d0 * 16 + d1)> func.func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<9xf32>) { %1 = memref.alloc() : memref<144x4xf32> %2 = arith.constant 0.0 : f32 affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 4 { affine.for %i5 = 0 to 16 { %7 = affine.apply #map(%i2, %i5) affine.store %2, %1[%7, %i3] : memref<144x4xf32> } } } affine.for %i6 = 0 to 9 { affine.for %i7 = 0 to 9 { affine.for %i8 = 0 to 4 { affine.for %i10 = 0 to 16 { %10 = affine.apply #map(%i6, %i10) %11 = affine.load %1[%10, %i8] : memref<144x4xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "#map = affine_map<(d0, d1) -> (d0 * 16 + d1)> func.func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<9xf32>) { %1 = memref.alloc() : memref<144x4xf32> %2 = arith.constant 0.0 : f32 affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 4 { affine.for %i5 = 0 to 16 { %7 = affine.apply #map(%i2, %i5) affine.store %2, %1[%7, %i3] : memref<144x4xf32> } } } affine.for %i6 = 0 to 9 { affine.for %i7 = 0 to 9 { affine.for %i8 = 0 to 4 { affine.for %i10 = 0 to 16 { %10 = affine.apply #map(%i6, %i10) %11 = affine.load %1[%10, %i8] : memref<144x4xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "#map3 = affine_map<(d0, d1) -> ((d0 * 72 + d1) floordiv 2304)> #map4 = affine_map<(d0, d1) -> (((d0 * 72 + d1) mod 2304) floordiv 1152)> #map5 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) floordiv 9) floordiv 8)> #map6 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) floordiv 3)> #map7 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) mod 3)> #map10 = affine_map<(d0, d1) -> (d0 * 16 + d1)> #map11 = affine_map<(d0, d1) -> (d0 * 16 + d1)> #map12 = affine_map<(d0, d1) -> (d0 * 16 - d1 + 15)> func.func @fuse_across_varying_dims_complex(%arg0: f32) { %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<2x2x3x3x16x1xf32> %1 = memref.alloc() : memref<64x9xf32> %2 = memref.alloc() : memref<144x4xf32> affine.for %i0 = 0 to 64 { affine.for %i1 = 0 to 9 { %4 = affine.apply #map3(%i0, %i1) %5 = affine.apply #map4(%i0, %i1) %6 = affine.apply #map5(%i0, %i1) %7 = affine.apply #map6(%i0, %i1) %8 = affine.apply #map7(%i0, %i1) %9 = affine.load %0[%4, %5, %7, %8, %6, %c0] : memref<2x2x3x3x16x1xf32> affine.store %9, %1[%i0, %i1] : memref<64x9xf32> } } affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 4 { affine.for %i4 = 0 to 16 { %10 = affine.apply #map10(%i3, %i4) %11 = affine.load %1[%10, %i2] : memref<64x9xf32> } affine.for %i5 = 0 to 16 { %14 = affine.apply #map11(%i2, %i5) affine.store %arg0, %2[%14, %i3] : memref<144x4xf32> } } } affine.for %i6 = 0 to 9 { affine.for %i7 = 0 to 9 { affine.for %i8 = 0 to 4 { affine.for %i9 = 0 to 16 { %15 = affine.apply #map12(%i8, %i9) %16 = affine.load %1[%15, %i7] : memref<64x9xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "#map3 = affine_map<(d0, d1) -> ((d0 * 72 + d1) floordiv 2304)> #map4 = affine_map<(d0, d1) -> (((d0 * 72 + d1) mod 2304) floordiv 1152)> #map5 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) floordiv 9) floordiv 8)> #map6 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) floordiv 3)> #map7 = affine_map<(d0, d1) -> (((((d0 * 72 + d1) mod 2304) mod 1152) mod 9) mod 3)> #map10 = affine_map<(d0, d1) -> (d0 * 16 + d1)> #map11 = affine_map<(d0, d1) -> (d0 * 16 + d1)> #map12 = affine_map<(d0, d1) -> (d0 * 16 - d1 + 15)> func.func @fuse_across_varying_dims_complex(%arg0: f32) { %c0 = arith.constant 0 : index %0 = memref.alloc() : memref<2x2x3x3x16x1xf32> %1 = memref.alloc() : memref<64x9xf32> %2 = memref.alloc() : memref<144x4xf32> affine.for %i0 = 0 to 64 { affine.for %i1 = 0 to 9 { %4 = affine.apply #map3(%i0, %i1) %5 = affine.apply #map4(%i0, %i1) %6 = affine.apply #map5(%i0, %i1) %7 = affine.apply #map6(%i0, %i1) %8 = affine.apply #map7(%i0, %i1) %9 = affine.load %0[%4, %5, %7, %8, %6, %c0] : memref<2x2x3x3x16x1xf32> affine.store %9, %1[%i0, %i1] : memref<64x9xf32> } } affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 4 { affine.for %i4 = 0 to 16 { %10 = affine.apply #map10(%i3, %i4) %11 = affine.load %1[%10, %i2] : memref<64x9xf32> } affine.for %i5 = 0 to 16 { %14 = affine.apply #map11(%i2, %i5) affine.store %arg0, %2[%14, %i3] : memref<144x4xf32> } } } affine.for %i6 = 0 to 9 { affine.for %i7 = 0 to 9 { affine.for %i8 = 0 to 4 { affine.for %i9 = 0 to 16 { %15 = affine.apply #map12(%i8, %i9) %16 = affine.load %1[%15, %i7] : memref<64x9xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_with_slice_union() { %a = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 100 { affine.store %cf0, %a[%i0]: memref<100xf32> } affine.for %i1 = 10 to 20 { %v0 = affine.load %a[%i1]: memref<100xf32> affine.for %i2 = 15 to 25 { %v1 = affine.load %a[%i2]: memref<100xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_with_slice_union() { %a = memref.alloc() : memref<100xf32> %c0 = arith.constant 0 : index %cf0 = arith.constant 0.0 : f32 affine.for %i0 = 0 to 100 { affine.store %cf0, %a[%i0]: memref<100xf32> } affine.for %i1 = 10 to 20 { %v0 = affine.load %a[%i1]: memref<100xf32> affine.for %i2 = 15 to 25 { %v1 = affine.load %a[%i2]: memref<100xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @affine_add_mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>, %arg3: memref<1024x1024xf32>) { affine.for %i2 = 0 to 1024 { affine.for %i3 = 0 to 1024 { %0 = affine.load %arg3[%i2, %i3] : memref<1024x1024xf32> %1 = affine.load %arg2[%i2, %i3] : memref<1024x1024xf32> %2 = arith.addf %1, %0 : f32 affine.store %2, %arg2[%i2, %i3] : memref<1024x1024xf32> } } affine.for %i4 = 0 to 1024 { affine.for %i5 = 0 to 1024 { affine.for %i6 = 0 to 1024 { %3 = affine.load %arg1[%i6, %i5] : memref<1024x1024xf32> %4 = affine.load %arg0[%i4, %i6] : memref<1024x1024xf32> %5 = arith.mulf %4, %3 : f32 %6 = affine.load %arg2[%i4, %i5] : memref<1024x1024xf32> %7 = arith.addf %6, %5 : f32 affine.store %7, %arg2[%i4, %i5] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @affine_add_mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>, %arg3: memref<1024x1024xf32>) { affine.for %i2 = 0 to 1024 { affine.for %i3 = 0 to 1024 { %0 = affine.load %arg3[%i2, %i3] : memref<1024x1024xf32> %1 = affine.load %arg2[%i2, %i3] : memref<1024x1024xf32> %2 = arith.addf %1, %0 : f32 affine.store %2, %arg2[%i2, %i3] : memref<1024x1024xf32> } } affine.for %i4 = 0 to 1024 { affine.for %i5 = 0 to 1024 { affine.for %i6 = 0 to 1024 { %3 = affine.load %arg1[%i6, %i5] : memref<1024x1024xf32> %4 = affine.load %arg0[%i4, %i6] : memref<1024x1024xf32> %5 = arith.mulf %4, %3 : f32 %6 = affine.load %arg2[%i4, %i5] : memref<1024x1024xf32> %7 = arith.addf %6, %5 : f32 affine.store %7, %arg2[%i4, %i5] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @affine_2mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>, %arg3: memref<1024x1024xf32>, %arg4: memref<1024x1024xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 1024 { affine.for %i1 = 0 to 1024 { affine.store %cst, %arg2[%i0, %i1] : memref<1024x1024xf32> } } affine.for %i2 = 0 to 1024 { affine.for %i3 = 0 to 1024 { affine.store %cst, %arg4[%i2, %i3] : memref<1024x1024xf32> } } affine.for %i4 = 0 to 1024 { affine.for %i5 = 0 to 1024 { affine.for %i6 = 0 to 1024 { %0 = affine.load %arg1[%i6, %i5] : memref<1024x1024xf32> %1 = affine.load %arg0[%i4, %i6] : memref<1024x1024xf32> %2 = arith.mulf %1, %0 : f32 %3 = affine.load %arg2[%i4, %i5] : memref<1024x1024xf32> %4 = arith.addf %3, %2 : f32 affine.store %4, %arg2[%i4, %i5] : memref<1024x1024xf32> } } } affine.for %i7 = 0 to 1024 { affine.for %i8 = 0 to 1024 { affine.for %i9 = 0 to 1024 { %5 = affine.load %arg1[%i9, %i8] : memref<1024x1024xf32> %6 = affine.load %arg0[%i7, %i9] : memref<1024x1024xf32> %7 = arith.mulf %6, %5 : f32 %8 = affine.load %arg4[%i7, %i8] : memref<1024x1024xf32> %9 = arith.addf %8, %7 : f32 affine.store %9, %arg4[%i7, %i8] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @affine_2mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>, %arg3: memref<1024x1024xf32>, %arg4: memref<1024x1024xf32>) { %cst = arith.constant 0.000000e+00 : f32 affine.for %i0 = 0 to 1024 { affine.for %i1 = 0 to 1024 { affine.store %cst, %arg2[%i0, %i1] : memref<1024x1024xf32> } } affine.for %i2 = 0 to 1024 { affine.for %i3 = 0 to 1024 { affine.store %cst, %arg4[%i2, %i3] : memref<1024x1024xf32> } } affine.for %i4 = 0 to 1024 { affine.for %i5 = 0 to 1024 { affine.for %i6 = 0 to 1024 { %0 = affine.load %arg1[%i6, %i5] : memref<1024x1024xf32> %1 = affine.load %arg0[%i4, %i6] : memref<1024x1024xf32> %2 = arith.mulf %1, %0 : f32 %3 = affine.load %arg2[%i4, %i5] : memref<1024x1024xf32> %4 = arith.addf %3, %2 : f32 affine.store %4, %arg2[%i4, %i5] : memref<1024x1024xf32> } } } affine.for %i7 = 0 to 1024 { affine.for %i8 = 0 to 1024 { affine.for %i9 = 0 to 1024 { %5 = affine.load %arg1[%i9, %i8] : memref<1024x1024xf32> %6 = affine.load %arg0[%i7, %i9] : memref<1024x1024xf32> %7 = arith.mulf %6, %5 : f32 %8 = affine.load %arg4[%i7, %i8] : memref<1024x1024xf32> %9 = arith.addf %8, %7 : f32 affine.store %9, %arg4[%i7, %i8] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @affine_2_dependent_mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>, %arg3: memref<1024x1024xf32>, %arg4: memref<1024x1024xf32>) { affine.for %i0 = 0 to 1024 { affine.for %i1 = 0 to 1024 { affine.for %i2 = 0 to 1024 { %0 = affine.load %arg1[%i2, %i1] : memref<1024x1024xf32> %1 = affine.load %arg0[%i0, %i2] : memref<1024x1024xf32> %2 = arith.mulf %1, %0 : f32 %3 = affine.load %arg2[%i0, %i1] : memref<1024x1024xf32> %4 = arith.addf %3, %2 : f32 affine.store %4, %arg2[%i0, %i1] : memref<1024x1024xf32> } } } affine.for %i3 = 0 to 1024 { affine.for %i4 = 0 to 1024 { affine.for %i5 = 0 to 1024 { %5 = affine.load %arg3[%i5, %i4] : memref<1024x1024xf32> %6 = affine.load %arg2[%i3, %i5] : memref<1024x1024xf32> %7 = arith.mulf %6, %5 : f32 %8 = affine.load %arg4[%i3, %i4] : memref<1024x1024xf32> %9 = arith.addf %8, %7 : f32 affine.store %9, %arg4[%i3, %i4] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @affine_2_dependent_mm_fused(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1024xf32>, %arg2: memref<1024x1024xf32>, %arg3: memref<1024x1024xf32>, %arg4: memref<1024x1024xf32>) { affine.for %i0 = 0 to 1024 { affine.for %i1 = 0 to 1024 { affine.for %i2 = 0 to 1024 { %0 = affine.load %arg1[%i2, %i1] : memref<1024x1024xf32> %1 = affine.load %arg0[%i0, %i2] : memref<1024x1024xf32> %2 = arith.mulf %1, %0 : f32 %3 = affine.load %arg2[%i0, %i1] : memref<1024x1024xf32> %4 = arith.addf %3, %2 : f32 affine.store %4, %arg2[%i0, %i1] : memref<1024x1024xf32> } } } affine.for %i3 = 0 to 1024 { affine.for %i4 = 0 to 1024 { affine.for %i5 = 0 to 1024 { %5 = affine.load %arg3[%i5, %i4] : memref<1024x1024xf32> %6 = affine.load %arg2[%i3, %i5] : memref<1024x1024xf32> %7 = arith.mulf %6, %5 : f32 %8 = affine.load %arg4[%i3, %i4] : memref<1024x1024xf32> %9 = arith.addf %8, %7 : f32 affine.store %9, %arg4[%i3, %i4] : memref<1024x1024xf32> } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_self_dependence_multi_store_producer() { %m = memref.alloc() : memref<10xf32> %local_m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %local_m[%i0] : memref<10xf32> %v0 = affine.load %local_m[%i0] : memref<10xf32> affine.store %v0, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v1 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_self_dependence_multi_store_producer() { %m = memref.alloc() : memref<10xf32> %local_m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %local_m[%i0] : memref<10xf32> %v0 = affine.load %local_m[%i0] : memref<10xf32> affine.store %v0, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v1 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_dead_multi_store_producer() { %m = memref.alloc() : memref<10xf32> %dead_m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %dead_m[%i0] : memref<10xf32> affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_dead_multi_store_producer() { %m = memref.alloc() : memref<10xf32> %dead_m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %dead_m[%i0] : memref<10xf32> affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @should_fuse_function_live_out_multi_store_producer(%live_in_out_m : memref<10xf32>) { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %live_in_out_m[%i0] : memref<10xf32> affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' -split-input-file ,1 "func.func @should_fuse_function_live_out_multi_store_producer(%live_in_out_m : memref<10xf32>) { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %live_in_out_m[%i0] : memref<10xf32> affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal}))' -split-input-file ,1 "func.func @remove_all_ops(%arg0: i32) { %0 = ""test.illegal_op_a""() : () -> i32 %1 = ""test.illegal_op_b""() : () -> i32 %2 = ""test.illegal_op_c""() : () -> i32 %3 = ""test.illegal_op_d""() : () -> i32 %4 = ""test.illegal_op_e""() : () -> i32 return }", mlir-opt -test-legalize-unknown-root-patterns ,1 "func.func @verifyDirectPattern() -> i32 { %result = ""test.illegal_op_a""() : () -> (i32) return %result : i32 } func.func @verifyLargerBenefit() -> i32 { %result = ""test.illegal_op_c""() : () -> (i32) return %result : i32 } func.func private @remap_input_1_to_0(i16) func.func @remap_input_1_to_1(%arg0: i64) { ""test.invalid""(%arg0) : (i64) -> () } func.func @remap_call_1_to_1(%arg0: i64) { call @remap_input_1_to_1(%arg0) : (i64) -> () return } func.func @remap_input_1_to_N(%arg0: f32) -> f32 { ""test.return""(%arg0) : (f32) -> () } func.func @remap_input_1_to_N_remaining_use(%arg0: f32) { ""work""(%arg0) : (f32) -> () } func.func @remap_materialize_1_to_1(%arg0: i42) { ""test.return""(%arg0) : (i42) -> () } func.func @remap_input_to_self(%arg0: index) { ""work""(%arg0) : (index) -> () } func.func @remap_multi(%arg0: i64, %unused: i16, %arg1: i64) -> (i64, i64) { ""test.invalid""(%arg0, %arg1) : (i64, i64) -> () } func.func @no_remap_nested() { ""foo.region""() ({ ^bb0(%i0: i64, %unused: i16, %i1: i64): ""test.invalid""(%i0, %i1) : (i64, i64) -> () }) : () -> () return } func.func @remap_moved_region_args() { ""test.region""() ({ ^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32): ""test.invalid""(%i0, %i1, %2) : (i64, i64, f32) -> () }) : () -> () return } func.func @remap_cloned_region_args() { ""test.region""() ({ ^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32): ""test.invalid""(%i0, %i1, %2) : (i64, i64, f32) -> () }) {legalizer.should_clone} : () -> () return } func.func @remap_drop_region() { ""test.drop_region_op""() ({ ^bb1(%i0: i64, %unused: i16, %i1: i64, %2: f32): ""test.invalid""(%i0, %i1, %2) : (i64, i64, f32) -> () }) : () -> () return } func.func @dropped_input_in_use(%arg: i16, %arg2: i64) { ""work""(%arg) : (i16) -> () } func.func @up_to_date_replacement(%arg: i8) -> i8 { %repl_1 = ""test.rewrite""(%arg) : (i8) -> i8 %repl_2 = ""test.rewrite""(%repl_1) : (i8) -> i8 return %repl_2 : i8 } func.func @remove_foldable_op(%arg0 : i32) -> (i32) { %0 = ""test.op_with_region_fold""(%arg0) ({ ""foo.op_with_region_terminator""() : () -> () }) : (i32) -> (i32) return %0 : i32 } func.func @create_block() { ""test.create_block""() : () -> () return } func.func @bounded_recursion() { test.recursive_rewrite 3 return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "builtin.module { func.func @fail_to_convert_illegal_op() -> i32 { %result = ""test.illegal_op_f""() : () -> (i32) return %result : i32 } }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "builtin.module { func.func @fail_to_convert_illegal_op_in_region() { ""test.region_builder""() : () -> () return } }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "builtin.module { func.func @fail_to_convert_region() { ""test.region""() ({ ^bb1(%i0: i64): ""test.region_builder""() : () -> () ""test.valid""() : () -> () }) : () -> () return } }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "func.func @create_illegal_block() { ""test.create_illegal_block""() : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "func.func @undo_block_arg_replace() { ""test.undo_block_arg_replace""() ({ ^bb0(%arg0: i32): ""test.return""(%arg0) : (i32) -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "func.func @undo_block_erase() { ""test.undo_block_erase""() ({ ""unregistered.return""()[^bb1] : () -> () ^bb1: ""unregistered.return""() : () -> () }) : () -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "func.func @undo_child_created_before_parent() { ""test.illegal_op_with_region_anchor""() : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "func.func @blackhole() { %input = ""test.blackhole_producer""() : () -> (i32) ""test.blackhole""(%input) : (i32) -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "builtin.module { func.func @create_unregistered_op_in_pattern() -> i32 { %0 = ""test.illegal_op_g""() : () -> (i32) ""test.return""(%0) : (i32) -> () } }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "func.func @typemismatch(%arg: f32) -> i32 { %0 = ""test.passthrough_fold""(%arg) : (f32) -> (i32) ""test.return""(%0) : (i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "module { func.func private @callee(%0 : f32) -> f32 func.func @caller( %arg: f32) { %1 = func.call @callee(%arg) : (f32) -> f32 return } }", mlir-opt -allow-unregistered-dialect -split-input-file -test-legalize-patterns -verify-diagnostics ,1 "#set0 = affine_set<(d0) : (1 == 0)> func.func @inline_notation() -> i32 { %1 = ""foo""() : () -> i32 loc(""foo"") affine.for %i0 = 0 to 8 { } loc(fused[""foo"", ""mysource.cc"":10:8]) %2 = arith.constant 4 : index affine.if #set0(%2) { } loc(fused<""myPass"">[""foo"", ""foo2""]) ""foo.region""() ({ ^bb0(%a0: i32 loc(""argloc""), %z: i32 loc(""argloc2"")): %s = arith.addi %a0, %a0 : i32 ""foo.yield""(%s) : (i32) -> () }) : () -> () return %1 : i32 loc(""bar"") }", mlir-opt -allow-unregistered-dialect -mlir-print-debuginfo -mlir-print-local-scope -strip-debuginfo ,1 "module attributes {test.simple} { func.func private @dead_private_function() func.func nested @dead_nested_function() func.func private @live_private_function() func.func nested @live_nested_function() func.func @public_function() { ""foo.return""() {uses = [@live_private_function, @live_nested_function]} : () -> () } }", mlir-opt -allow-unregistered-dialect -symbol-dce -split-input-file -verify-diagnostics ,1 "module attributes {test.simple} { func.func private @dead_private_function() func.func nested @dead_nested_function() func.func private @live_private_function() func.func nested @live_nested_function() func.func @public_function() { ""foo.return""() {uses = [@live_private_function, @live_nested_function]} : () -> () } }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(symbol-dce))"" -split-input-file ",1 "module attributes {test.nested} { module @public_module { func.func nested @dead_nested_function() func.func private @private_function() func.func nested @nested_function() { ""foo.return""() {uses = [@private_function]} : () -> () } } ""live.user""() {uses = [@public_module::@nested_function]} : () -> () }", mlir-opt -allow-unregistered-dialect -symbol-dce -split-input-file -verify-diagnostics ,1 "module attributes {test.nested} { module @public_module { func.func nested @dead_nested_function() func.func private @private_function() func.func nested @nested_function() { ""foo.return""() {uses = [@private_function]} : () -> () } } ""live.user""() {uses = [@public_module::@nested_function]} : () -> () }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(symbol-dce))"" -split-input-file ",1 "module attributes {test.no_dce_non_hidden_parent} { module @public_module { func.func nested @nested_function() } module @nested_module attributes { sym_visibility = ""nested"" } { func.func nested @nested_function() } module @private_module attributes { sym_visibility = ""private"" } { func.func nested @nested_function() } ""live.user""() {uses = [@nested_module, @private_module]} : () -> () }", mlir-opt -allow-unregistered-dialect -symbol-dce -split-input-file -verify-diagnostics ,1 "module attributes {test.no_dce_non_hidden_parent} { module @public_module { func.func nested @nested_function() } module @nested_module attributes { sym_visibility = ""nested"" } { func.func nested @nested_function() } module @private_module attributes { sym_visibility = ""private"" } { func.func nested @nested_function() } ""live.user""() {uses = [@nested_module, @private_module]} : () -> () }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(symbol-dce))"" -split-input-file ",1 "module { func.func private @private_symbol() ""foo.possibly_unknown_symbol_table""() ({ }) : () -> () }", mlir-opt -allow-unregistered-dialect -symbol-dce -split-input-file -verify-diagnostics ,1 "module { func.func private @private_symbol() ""foo.possibly_unknown_symbol_table""() ({ }) : () -> () }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(symbol-dce))"" -split-input-file ",1 "module { func.func private @dead_private_function() func.func private @live_private_function() ""live.user""() {uses = [@live_private_function]} : () -> () ""live.user""() {uses = [@unknown_symbol]} : () -> () }", mlir-opt -allow-unregistered-dialect -symbol-dce -split-input-file -verify-diagnostics ,1 "module { func.func private @dead_private_function() func.func private @live_private_function() ""live.user""() {uses = [@live_private_function]} : () -> () ""live.user""() {uses = [@unknown_symbol]} : () -> () }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(builtin.module(symbol-dce))"" -split-input-file ",1 "#map_tiled = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2 floordiv 32, d3 floordiv 64, d2 mod 32, d3 mod 64)> func.func @test_norm_dynamic12(%arg0 : memref<1x?x?x14xf32, #map_tiled>) -> () { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_tiled> %1 = memref.dim %arg0, %c2 :memref<1x?x?x14xf32, #map_tiled> %2 = memref.alloc(%0, %1) : memref<1x?x?x14xf32, #map_tiled> ""test.op_norm""(%arg0, %2) : (memref<1x?x?x14xf32, #map_tiled>, memref<1x?x?x14xf32, #map_tiled>) -> () memref.dealloc %2 : memref<1x?x?x14xf32, #map_tiled> return }", mlir-opt -normalize-memrefs -split-input-file,1 "#map_tiled1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, (d2 floordiv 4) floordiv 32, (d3 mod 8) floordiv 64, (d2 floordiv 4) mod 32, (d3 mod 8) mod 64)> func.func @test_norm_dynamic1234(%arg0 : memref) -> () { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %0 = memref.dim %arg0, %c0 :memref %1 = memref.dim %arg0, %c1 :memref %2 = memref.dim %arg0, %c2 :memref %3 = memref.dim %arg0, %c3 :memref %4 = memref.alloc(%0, %1, %2, %3) : memref ""test.op_norm""(%arg0, %4) : (memref, memref) -> () memref.dealloc %4 : memref return }", mlir-opt -normalize-memrefs -split-input-file,1 "#map_not_tiled0 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2 - d1, d3 - d2)> func.func @test_norm_dynamic_not_tiled0(%arg0 : memref<1x?x?x14xf32, #map_not_tiled0>) -> () { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled0> %1 = memref.dim %arg0, %c2 :memref<1x?x?x14xf32, #map_not_tiled0> %2 = memref.alloc(%0, %1) : memref<1x?x?x14xf32, #map_not_tiled0> ""test.op_norm""(%arg0, %2) : (memref<1x?x?x14xf32, #map_not_tiled0>, memref<1x?x?x14xf32, #map_not_tiled0>) -> () memref.dealloc %2 : memref<1x?x?x14xf32, #map_not_tiled0> return }", mlir-opt -normalize-memrefs -split-input-file,1 "#map_not_tiled1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2 - d1, d3 - d2, d2 mod 32, d3 mod 64)> func.func @test_norm_dynamic_not_tiled1(%arg0 : memref<1x?x?x14xf32, #map_not_tiled1>) -> () { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled1> %1 = memref.dim %arg0, %c2 :memref<1x?x?x14xf32, #map_not_tiled1> %2 = memref.alloc(%0, %1) : memref<1x?x?x14xf32, #map_not_tiled1> ""test.op_norm""(%arg0, %2) : (memref<1x?x?x14xf32, #map_not_tiled1>, memref<1x?x?x14xf32, #map_not_tiled1>) -> () memref.dealloc %2 : memref<1x?x?x14xf32, #map_not_tiled1> return }", mlir-opt -normalize-memrefs -split-input-file,1 "#map_not_tiled2 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2 - d1, d3 floordiv 64, d2 mod 32, d3 mod 32)> func.func @test_norm_dynamic_not_tiled2(%arg0 : memref<1x?x?x14xf32, #map_not_tiled2>) -> () { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled2> %1 = memref.dim %arg0, %c2 :memref<1x?x?x14xf32, #map_not_tiled2> %2 = memref.alloc(%0, %1) : memref<1x?x?x14xf32, #map_not_tiled2> ""test.op_norm""(%arg0, %2) : (memref<1x?x?x14xf32, #map_not_tiled2>, memref<1x?x?x14xf32, #map_not_tiled2>) -> () memref.dealloc %2 : memref<1x?x?x14xf32, #map_not_tiled2> return }", mlir-opt -normalize-memrefs -split-input-file,1 "#map_not_tiled3 = affine_map<(d0, d1, d2, d3) -> (d0, d1 floordiv 32, d2, d3, d1 mod 32, d1 mod 32)> func.func @test_norm_dynamic_not_tiled3(%arg0 : memref<1x?x?x14xf32, #map_not_tiled3>) -> () { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled3> %1 = memref.dim %arg0, %c2 :memref<1x?x?x14xf32, #map_not_tiled3> %2 = memref.alloc(%0, %1) : memref<1x?x?x14xf32, #map_not_tiled3> ""test.op_norm""(%arg0, %2) : (memref<1x?x?x14xf32, #map_not_tiled3>, memref<1x?x?x14xf32, #map_not_tiled3>) -> () memref.dealloc %2 : memref<1x?x?x14xf32, #map_not_tiled3> return }", mlir-opt -normalize-memrefs -split-input-file,1 "#map_not_tiled4 = affine_map<(d0, d1, d2, d3) -> (d0 floordiv 32, d1 floordiv 32, d0, d3, d0 mod 32, d1 mod 32)> func.func @test_norm_dynamic_not_tiled4(%arg0 : memref<1x?x?x14xf32, #map_not_tiled4>) -> () { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c1 :memref<1x?x?x14xf32, #map_not_tiled4> %1 = memref.dim %arg0, %c2 :memref<1x?x?x14xf32, #map_not_tiled4> %2 = memref.alloc(%0, %1) : memref<1x?x?x14xf32, #map_not_tiled4> ""test.op_norm""(%arg0, %2) : (memref<1x?x?x14xf32, #map_not_tiled4>, memref<1x?x?x14xf32, #map_not_tiled4>) -> () memref.dealloc %2 : memref<1x?x?x14xf32, #map_not_tiled4> return }", mlir-opt -normalize-memrefs -split-input-file,1 "func.func private @dead_function() { return } func.func @dead_function_b() { return } func.func @live_function() { call @dead_function_b() : () -> () return } func.func @live_function_b() { return } func.func private @dead_function_c() { call @live_function_b() : () -> () return } func.func private @dead_function_d() { call @dead_function_c() : () -> () call @dead_function_c() : () -> () return } func.func @live_function_c() { call @dead_function_c() : () -> () call @dead_function_d() : () -> () return } func.func private @live_function_d() { return } ""live.user""() {use = @live_function_d} : () -> ()", mlir-opt -allow-unregistered-dialect -inline -split-input-file ,1 "func.func @live_function_e() { call @dead_function_e() : () -> () return } func.func private @dead_function_e() -> () { ""test.fold_to_call_op""() {callee=@dead_function_f} : () -> () return } func.func private @dead_function_f() { return }", mlir-opt -allow-unregistered-dialect -inline -split-input-file ,1 "func.func @slice_depth1_loop_nest() { %0 = memref.alloc() : memref<100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { affine.store %cst, %0[%i0] : memref<100xf32> } affine.for %i1 = 0 to 5 { %1 = affine.load %0[%i1] : memref<100xf32> } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @forward_slice_slice_depth1_loop_nest() { %0 = memref.alloc() : memref<100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 5 { affine.store %cst, %0[%i0] : memref<100xf32> } affine.for %i1 = 0 to 16 { %1 = affine.load %0[%i1] : memref<100xf32> } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @slice_depth1_loop_nest_with_offsets() { %0 = memref.alloc() : memref<100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { %a0 = affine.apply affine_map<(d0) -> (d0 + 2)>(%i0) affine.store %cst, %0[%a0] : memref<100xf32> } affine.for %i1 = 4 to 8 { %a1 = affine.apply affine_map<(d0) -> (d0 - 1)>(%i1) %1 = affine.load %0[%a1] : memref<100xf32> } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @slice_depth2_loop_nest() { %0 = memref.alloc() : memref<100x100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 16 { affine.store %cst, %0[%i0, %i1] : memref<100x100xf32> } } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 8 { %1 = affine.load %0[%i2, %i3] : memref<100x100xf32> } } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @slice_depth2_loop_nest_two_loads() { %0 = memref.alloc() : memref<100x100xf32> %c0 = arith.constant 0 : index %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 16 { affine.store %cst, %0[%i0, %i1] : memref<100x100xf32> } } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 8 { %1 = affine.load %0[%i2, %i3] : memref<100x100xf32> } %2 = affine.load %0[%i2, %c0] : memref<100x100xf32> } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @slice_depth2_loop_nest_two_stores() { %0 = memref.alloc() : memref<100x100xf32> %c0 = arith.constant 0 : index %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 16 { affine.store %cst, %0[%i0, %i1] : memref<100x100xf32> } affine.store %cst, %0[%i0, %c0] : memref<100x100xf32> } affine.for %i2 = 0 to 10 { affine.for %i3 = 0 to 8 { %1 = affine.load %0[%i2, %i3] : memref<100x100xf32> } } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @slice_loop_nest_with_smaller_outer_trip_count() { %0 = memref.alloc() : memref<100x100xf32> %c0 = arith.constant 0 : index %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { affine.for %i1 = 0 to 16 { affine.store %cst, %0[%i0, %i1] : memref<100x100xf32> } } affine.for %i2 = 0 to 8 { affine.for %i3 = 0 to 10 { %1 = affine.load %0[%i2, %i3] : memref<100x100xf32> } } return }", mlir-opt -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics ,1 "func.func @nested_loops_both_having_invariant_code() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 affine.for %arg1 = 0 to 10 { %v1 = arith.addf %v0, %cf8 : f32 affine.store %v0, %m[%arg0] : memref<10xf32> } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @nested_loops_code_invariant_to_both() { %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { %v0 = arith.addf %cf7, %cf8 : f32 } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @single_loop_nothing_invariant() { %m1 = memref.alloc() : memref<10xf32> %m2 = memref.alloc() : memref<10xf32> affine.for %arg0 = 0 to 10 { %v0 = affine.load %m1[%arg0] : memref<10xf32> %v1 = affine.load %m2[%arg0] : memref<10xf32> %v2 = arith.addf %v0, %v1 : f32 affine.store %v2, %m1[%arg0] : memref<10xf32> } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_code_inside_affine_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { %t0 = affine.apply affine_map<(d1) -> (d1 + 1)>(%arg0) affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %t0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_affine_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 20 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 } } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @hoist_affine_for_with_unknown_trip_count(%lb: index, %ub: index) { affine.for %arg0 = 0 to 10 { affine.for %arg1 = %lb to %ub { } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @hoist_affine_for_with_unknown_trip_count_non_unit_step(%lb: index, %ub: index) { affine.for %arg0 = 0 to 10 { affine.for %arg1 = %lb to %ub step 2 { } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @hoist_scf_for_with_unknown_trip_count_unit_step(%lb: index, %ub: index) { %c1 = arith.constant 1 : index scf.for %arg0 = %lb to %ub step %c1 { scf.for %arg1 = %lb to %ub step %c1 { } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @hoist_scf_for_with_unknown_trip_count_non_unit_constant_step(%lb: index, %ub: index) { %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index scf.for %arg0 = %lb to %ub step %c1 { scf.for %arg1 = %lb to %ub step %c2 { } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @hoist_scf_for_with_unknown_trip_count_unknown_step(%lb: index, %ub: index, %step: index) { %c1 = arith.constant 1 : index scf.for %arg0 = %lb to %ub step %c1 { scf.for %arg1 = %lb to %ub step %step { } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_affine_if2() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg1] : memref<10xf32> } } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_affine_nested_if() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf10 = arith.addf %cf9, %cf9 : f32 } } } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_affine_nested_if_else() { %m = memref.alloc() : memref<10xf32> %cf8 = arith.constant 8.0 : f32 affine.for %arg0 = 0 to 10 { affine.for %arg1 = 0 to 10 { affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf9 = arith.addf %cf8, %cf8 : f32 affine.store %cf9, %m[%arg0] : memref<10xf32> affine.if affine_set<(d0, d1) : (d1 - d0 >= 0)> (%arg0, %arg0) { %cf10 = arith.addf %cf9, %cf9 : f32 } else { affine.store %cf9, %m[%arg1] : memref<10xf32> } } } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_loop_dialect() { %ci0 = arith.constant 0 : index %ci10 = arith.constant 10 : index %ci1 = arith.constant 1 : index %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 %cf8 = arith.constant 8.0 : f32 scf.for %arg0 = %ci0 to %ci10 step %ci1 { scf.for %arg1 = %ci0 to %ci10 step %ci1 { %v0 = arith.addf %cf7, %cf8 : f32 } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @variant_loop_dialect() { %ci0 = arith.constant 0 : index %ci10 = arith.constant 10 : index %ci1 = arith.constant 1 : index %m = memref.alloc() : memref<10xf32> scf.for %arg0 = %ci0 to %ci10 step %ci1 { scf.for %arg1 = %ci0 to %ci10 step %ci1 { %v0 = arith.addi %arg0, %arg1 : index } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @parallel_loop_with_invariant() { %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index %c7 = arith.constant 7 : i32 %c8 = arith.constant 8 : i32 scf.parallel (%arg0, %arg1) = (%c0, %c0) to (%c10, %c10) step (%c1, %c1) { %v0 = arith.addi %c7, %c8 : i32 %v3 = arith.addi %arg0, %arg1 : index } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func private @make_val() -> (index) func.func @nested_uses_inside(%lb: index, %ub: index, %step: index) { %true = arith.constant true scf.for %i = %lb to %ub step %step { %val = func.call @make_val() : () -> (index) %val2 = func.call @make_val() : () -> (index) %r = scf.if %true -> (index) { scf.yield %val: index } else { scf.yield %val2: index } } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @invariant_subgraph(%lb: index, %ub: index, %step: index, %arg: i32) { scf.for %i = %lb to %ub step %step { %v0 = arith.addi %arg, %arg : i32 %v1 = arith.addi %arg, %v0 : i32 ""test.sink""(%v1) : (i32) -> () } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @test_invariant_nested_loop() { %0 = arith.constant 5 : i32 test.graph_loop { %1 = arith.addi %0, %0 : i32 %2 = arith.addi %1, %0 : i32 test.graph_loop { ^bb0(%arg0: i32): %3 = arith.subi %arg0, %arg0 : i32 test.region_yield %3 : i32 } : () -> () test.region_yield %2 : i32 } : () -> () return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @test_invariants_in_graph_region() { test.single_no_terminator_op : { test.graph_loop { %v0 = arith.addi %c0, %v1 : i32 %v1 = arith.addi %c0, %c0 : i32 %c0 = arith.constant 5 : i32 test.region_yield %v0 : i32 } : () -> () } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @test_invariant_backedge() { test.graph_loop { %v0 = arith.addi %c0, %v1 : i32 %v1 = arith.addi %c0, %c0 : i32 %c0 = arith.constant 5 : i32 test.region_yield %v0 : i32 } : () -> () return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @test_invariant_cycle_not_hoisted() { test.graph_loop { %a = ""test.a""(%b) : (i32) -> i32 %b = ""test.b""(%a) : (i32) -> i32 test.region_yield %a : i32 } : () -> () return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @test_always_speculatable_op(%lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = ""test.always_speculatable_op""() : () -> i32 } return } func.func @test_never_speculatable_op(%lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = ""test.never_speculatable_op""() : () -> i32 } return } func.func @test_conditionally_speculatable_op_success(%lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %const_val = arith.constant 5 : i32 %val = ""test.conditionally_speculatable_op""(%const_val) : (i32) -> i32 } return } func.func @test_conditionally_speculatable_op_failure(%lb: index, %ub: index, %step: index, %arg: i32) { %const_5 = arith.constant 5 : i32 %non_const = arith.addi %arg, %const_5 : i32 scf.for %i = %lb to %ub step %step { %val = ""test.conditionally_speculatable_op""(%non_const) : (i32) -> i32 } return } func.func @test_recursively_speculatable_op_success(%lb: index, %ub: index, %step: index, %arg: i32) { scf.for %i = %lb to %ub step %step { %val = ""test.recursively_speculatable_op""()({ %result = arith.addi %arg, %arg : i32 test.region_yield %result : i32 }) : () -> i32 } return } func.func @test_recursively_speculatable_op_failure(%lb: index, %ub: index, %step: index, %arg: i32) { scf.for %i = %lb to %ub step %step { %val = ""test.recursively_speculatable_op""()({ %result = ""test.never_speculatable_op""() : () -> i32 test.region_yield %result : i32 }) : () -> i32 } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @speculate_tensor_dim_unknown_rank_unknown_dim( %t: tensor<*xf32>, %dim_idx: index, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = tensor.dim %t, %dim_idx : tensor<*xf32> } return } func.func @speculate_tensor_dim_known_rank_unknown_dim( %t: tensor, %dim_idx: index, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = tensor.dim %t, %dim_idx : tensor } return } func.func @speculate_tensor_dim_unknown_rank_known_dim( %t: tensor<*xf32>, %dim_idx: index, %lb: index, %ub: index, %step: index) { %c0 = arith.constant 0 : index scf.for %i = %lb to %ub step %step { %val = tensor.dim %t, %c0 : tensor<*xf32> } return } func.func @speculate_tensor_dim_known_rank_known_dim_inbounds( %t: tensor, %dim_idx: index, %lb: index, %ub: index, %step: index) { %c1 = arith.constant 1 : index scf.for %i = %lb to %ub step %step { %val = tensor.dim %t, %c1 : tensor } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @speculate_memref_dim_unknown_rank_unknown_dim( %t: memref<*xf32>, %dim_idx: index, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = memref.dim %t, %dim_idx : memref<*xf32> } return } func.func @speculate_memref_dim_known_rank_unknown_dim( %t: memref, %dim_idx: index, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = memref.dim %t, %dim_idx : memref } return } func.func @speculate_memref_dim_unknown_rank_known_dim( %t: memref<*xf32>, %dim_idx: index, %lb: index, %ub: index, %step: index) { %c0 = arith.constant 0 : index scf.for %i = %lb to %ub step %step { %val = memref.dim %t, %c0 : memref<*xf32> } return } func.func @speculate_memref_dim_known_rank_known_dim_inbounds( %t: memref, %dim_idx: index, %lb: index, %ub: index, %step: index) { %c1 = arith.constant 1 : index scf.for %i = %lb to %ub step %step { %val = memref.dim %t, %c1 : memref } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @no_speculate_divui( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = arith.divui %num, %denom : i32 } return } func.func @no_speculate_divsi( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = arith.divsi %num, %denom : i32 } return } func.func @no_speculate_ceildivui( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = arith.ceildivui %num, %denom : i32 } return } func.func @no_speculate_ceildivsi( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %val = arith.ceildivsi %num, %denom : i32 } return } func.func @no_speculate_divui_const(%num: i32, %lb: index, %ub: index, %step: index) { %c0 = arith.constant 0 : i32 scf.for %i = %lb to %ub step %step { %val = arith.divui %num, %c0 : i32 } return } func.func @speculate_divui_const( %num: i32, %lb: index, %ub: index, %step: index) { %c5 = arith.constant 5 : i32 scf.for %i = %lb to %ub step %step { %val = arith.divui %num, %c5 : i32 } return } func.func @no_speculate_ceildivui_const(%num: i32, %lb: index, %ub: index, %step: index) { %c0 = arith.constant 0 : i32 scf.for %i = %lb to %ub step %step { %val = arith.ceildivui %num, %c0 : i32 } return } func.func @speculate_ceildivui_const( %num: i32, %lb: index, %ub: index, %step: index) { %c5 = arith.constant 5 : i32 scf.for %i = %lb to %ub step %step { %val = arith.ceildivui %num, %c5 : i32 } return } func.func @no_speculate_divsi_const0( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { %c0 = arith.constant 0 : i32 scf.for %i = %lb to %ub step %step { %val = arith.divsi %num, %c0 : i32 } return } func.func @no_speculate_divsi_const_minus1( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { %cm1 = arith.constant -1 : i32 scf.for %i = %lb to %ub step %step { %val = arith.divsi %num, %cm1 : i32 } return } func.func @speculate_divsi_const( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { %c5 = arith.constant 5 : i32 scf.for %i = %lb to %ub step %step { %val = arith.divsi %num, %c5 : i32 } return } func.func @no_speculate_ceildivsi_const0( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { %c0 = arith.constant 0 : i32 scf.for %i = %lb to %ub step %step { %val = arith.ceildivsi %num, %c0 : i32 } return } func.func @no_speculate_ceildivsi_const_minus1( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { %cm1 = arith.constant -1 : i32 scf.for %i = %lb to %ub step %step { %val = arith.ceildivsi %num, %cm1 : i32 } return } func.func @speculate_ceildivsi_const( %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) { %c5 = arith.constant 5 : i32 scf.for %i = %lb to %ub step %step { %val = arith.ceildivsi %num, %c5 : i32 } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @speculate_static_pack_and_unpack(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>, %lb: index, %ub: index, %step: index) { scf.for %i = %lb to %ub step %step { %packed = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32> } scf.for %i = %lb to %ub step %step { %unpacked = tensor.unpack %dest inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %source : tensor<4x16x32x16xf32> -> tensor<128x256xf32> } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @speculate_dynamic_pack_and_unpack(%source: tensor, %dest: tensor, %lb: index, %ub: index, %step: index, %tile_m: index, %tile_n: index, %pad: f32) { scf.for %i = %lb to %ub step %step { %packed = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [%tile_n, %tile_m] into %dest : tensor -> tensor } scf.for %i = %lb to %ub step %step { %unpacked = tensor.unpack %dest inner_dims_pos = [0, 1] inner_tiles = [%tile_n, %tile_m] into %source : tensor -> tensor } scf.for %i = %lb to %ub step %step { %packed = tensor.pack %source padding_value(%pad : f32) inner_dims_pos = [0, 1] inner_tiles = [%tile_n, %tile_m] into %dest : tensor -> tensor } return }", mlir-opt -split-input-file -loop-invariant-code-motion ,1 "func.func @function() -> i32 { %1 = ""foo""() : () -> i32 loc(""original"") return %1 : i32 loc(""original"") } loc(""original"")", mlir-opt -allow-unregistered-dialect -snapshot-op-locations='filename=%/t' -mlir-print-local-scope -mlir-print-debuginfo ,1 "func.func @function() -> i32 { %1 = ""foo""() : () -> i32 loc(""original"") return %1 : i32 loc(""original"") } loc(""original"")", mlir-opt -allow-unregistered-dialect -snapshot-op-locations='filename=%/t tag='tagged'' -mlir-print-local-scope -mlir-print-debuginfo ,1 "func.func @func_with_arg(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 return %b : i32 } func.func @inline_with_arg(%arg0 : i32) -> i32 { %0 = call @func_with_arg(%arg0) : (i32) -> i32 return %0 : i32 } func.func @func_with_multi_return(%a : i1) -> (i32) { cf.cond_br %a, ^bb1, ^bb2 ^bb1: %const_0 = arith.constant 0 : i32 return %const_0 : i32 ^bb2: %const_55 = arith.constant 55 : i32 return %const_55 : i32 } func.func @inline_with_multi_return() -> i32 { %false = arith.constant false %x = call @func_with_multi_return(%false) : (i1) -> i32 return %x : i32 } func.func @func_with_locations(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 loc(""mysource.cc"":10:8) return %b : i32 loc(""mysource.cc"":11:2) } func.func @inline_with_locations(%arg0 : i32) -> i32 { %0 = call @func_with_locations(%arg0) : (i32) -> i32 loc(""mysource.cc"":55:14) return %0 : i32 } func.func private @func_external() func.func @no_inline_external() { call @func_external() : () -> () return } func.func @multilevel_func_a() { return } func.func @multilevel_func_b() { call @multilevel_func_a() : () -> () return } func.func @inline_multilevel() { %fn = ""test.functional_region_op""() ({ call @multilevel_func_b() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @no_inline_recursive() { %fn = ""test.functional_region_op""() ({ call @no_inline_recursive() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) return } func.func @convert_callee_fn(%arg : i32) -> i32 { return %arg : i32 } func.func @convert_callee_fn_multi_arg(%a : i32, %b : i32) -> () { return } func.func @convert_callee_fn_multi_res() -> (i32, i32) { %res = arith.constant 0 : i32 return %res, %res : i32, i32 } func.func @inline_convert_call() -> i16 { %test_input = arith.constant 0 : i16 %res = ""test.conversion_call_op""(%test_input) { callee=@convert_callee_fn } : (i16) -> (i16) return %res : i16 } func.func @convert_callee_fn_multiblock() -> i32 { cf.br ^bb0 ^bb0: %0 = arith.constant 0 : i32 return %0 : i32 } func.func @inline_convert_result_multiblock() -> i16 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock } : () -> (i16) return %res : i16 } func.func @no_inline_convert_call() { %test_input_i16 = arith.constant 0 : i16 %test_input_i64 = arith.constant 0 : i64 ""test.conversion_call_op""(%test_input_i16, %test_input_i64) { callee=@convert_callee_fn_multi_arg } : (i16, i64) -> () %res_2:2 = ""test.conversion_call_op""() { callee=@convert_callee_fn_multi_res } : () -> (i16, i64) return } func.func @simplify_return_constant() -> i32 { %res = arith.constant 0 : i32 return %res : i32 } func.func @simplify_return_reference() -> (() -> i32) { %res = constant @simplify_return_constant : () -> i32 return %res : () -> i32 } func.func @inline_simplify() -> i32 { %fn = call @simplify_return_reference() : () -> (() -> i32) %res = call_indirect %fn() : () -> i32 return %res : i32 } func.func @no_inline_invalid_call() -> i32 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock, noinline } : () -> (i32) return %res : i32 } func.func @gpu_alloc() -> memref<1024xf32> { %m = gpu.alloc [] () : memref<1024xf32> return %m : memref<1024xf32> } func.func @inline_gpu_ops() -> memref<1024xf32> { %m = call @gpu_alloc() : () -> memref<1024xf32> return %m : memref<1024xf32> } func.func @func_with_block_args_location(%arg0 : i32) { cf.br ^bb1(%arg0 : i32) ^bb1(%x : i32 loc(""foo"")): ""test.foo"" (%x) : (i32) -> () loc(""bar"") return } func.func @func_with_block_args_location_callee1(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } func.func @func_with_block_args_location_callee2(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } test.conversion_func_op @handle_attr_callee_fn_multi_arg(%arg0 : i16, %arg1 : i16 {""test.handle_argument""}) -> (i16 {""test.handle_result""}, i16) { %0 = arith.addi %arg0, %arg1 : i16 %1 = arith.subi %arg0, %arg1 : i16 ""test.return""(%0, %1) : (i16, i16) -> () } test.conversion_func_op @handle_attr_callee_fn(%arg0 : i32 {""test.handle_argument""}) -> (i32 {""test.handle_result""}) { ""test.return""(%arg0) : (i32) -> () } func.func @inline_handle_attr_call(%arg0 : i16, %arg1 : i16) -> (i16, i16) { %res0, %res1 = ""test.conversion_call_op""(%arg0, %arg1) { callee=@handle_attr_callee_fn_multi_arg } : (i16, i16) -> (i16, i16) return %res0, %res1 : i16, i16 } func.func @inline_convert_and_handle_attr_call(%arg0 : i16) -> (i16) { %res = ""test.conversion_call_op""(%arg0) { callee=@handle_attr_callee_fn } : (i16) -> (i16) return %res : i16 }", mlir-opt -inline='default-pipeline=''' ,1 "func.func @func_with_arg(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 return %b : i32 } func.func @inline_with_arg(%arg0 : i32) -> i32 { %0 = call @func_with_arg(%arg0) : (i32) -> i32 return %0 : i32 } func.func @func_with_multi_return(%a : i1) -> (i32) { cf.cond_br %a, ^bb1, ^bb2 ^bb1: %const_0 = arith.constant 0 : i32 return %const_0 : i32 ^bb2: %const_55 = arith.constant 55 : i32 return %const_55 : i32 } func.func @inline_with_multi_return() -> i32 { %false = arith.constant false %x = call @func_with_multi_return(%false) : (i1) -> i32 return %x : i32 } func.func @func_with_locations(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 loc(""mysource.cc"":10:8) return %b : i32 loc(""mysource.cc"":11:2) } func.func @inline_with_locations(%arg0 : i32) -> i32 { %0 = call @func_with_locations(%arg0) : (i32) -> i32 loc(""mysource.cc"":55:14) return %0 : i32 } func.func private @func_external() func.func @no_inline_external() { call @func_external() : () -> () return } func.func @multilevel_func_a() { return } func.func @multilevel_func_b() { call @multilevel_func_a() : () -> () return } func.func @inline_multilevel() { %fn = ""test.functional_region_op""() ({ call @multilevel_func_b() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @no_inline_recursive() { %fn = ""test.functional_region_op""() ({ call @no_inline_recursive() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) return } func.func @convert_callee_fn(%arg : i32) -> i32 { return %arg : i32 } func.func @convert_callee_fn_multi_arg(%a : i32, %b : i32) -> () { return } func.func @convert_callee_fn_multi_res() -> (i32, i32) { %res = arith.constant 0 : i32 return %res, %res : i32, i32 } func.func @inline_convert_call() -> i16 { %test_input = arith.constant 0 : i16 %res = ""test.conversion_call_op""(%test_input) { callee=@convert_callee_fn } : (i16) -> (i16) return %res : i16 } func.func @convert_callee_fn_multiblock() -> i32 { cf.br ^bb0 ^bb0: %0 = arith.constant 0 : i32 return %0 : i32 } func.func @inline_convert_result_multiblock() -> i16 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock } : () -> (i16) return %res : i16 } func.func @no_inline_convert_call() { %test_input_i16 = arith.constant 0 : i16 %test_input_i64 = arith.constant 0 : i64 ""test.conversion_call_op""(%test_input_i16, %test_input_i64) { callee=@convert_callee_fn_multi_arg } : (i16, i64) -> () %res_2:2 = ""test.conversion_call_op""() { callee=@convert_callee_fn_multi_res } : () -> (i16, i64) return } func.func @simplify_return_constant() -> i32 { %res = arith.constant 0 : i32 return %res : i32 } func.func @simplify_return_reference() -> (() -> i32) { %res = constant @simplify_return_constant : () -> i32 return %res : () -> i32 } func.func @inline_simplify() -> i32 { %fn = call @simplify_return_reference() : () -> (() -> i32) %res = call_indirect %fn() : () -> i32 return %res : i32 } func.func @no_inline_invalid_call() -> i32 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock, noinline } : () -> (i32) return %res : i32 } func.func @gpu_alloc() -> memref<1024xf32> { %m = gpu.alloc [] () : memref<1024xf32> return %m : memref<1024xf32> } func.func @inline_gpu_ops() -> memref<1024xf32> { %m = call @gpu_alloc() : () -> memref<1024xf32> return %m : memref<1024xf32> } func.func @func_with_block_args_location(%arg0 : i32) { cf.br ^bb1(%arg0 : i32) ^bb1(%x : i32 loc(""foo"")): ""test.foo"" (%x) : (i32) -> () loc(""bar"") return } func.func @func_with_block_args_location_callee1(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } func.func @func_with_block_args_location_callee2(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } test.conversion_func_op @handle_attr_callee_fn_multi_arg(%arg0 : i16, %arg1 : i16 {""test.handle_argument""}) -> (i16 {""test.handle_result""}, i16) { %0 = arith.addi %arg0, %arg1 : i16 %1 = arith.subi %arg0, %arg1 : i16 ""test.return""(%0, %1) : (i16, i16) -> () } test.conversion_func_op @handle_attr_callee_fn(%arg0 : i32 {""test.handle_argument""}) -> (i32 {""test.handle_result""}) { ""test.return""(%arg0) : (i32) -> () } func.func @inline_handle_attr_call(%arg0 : i16, %arg1 : i16) -> (i16, i16) { %res0, %res1 = ""test.conversion_call_op""(%arg0, %arg1) { callee=@handle_attr_callee_fn_multi_arg } : (i16, i16) -> (i16, i16) return %res0, %res1 : i16, i16 } func.func @inline_convert_and_handle_attr_call(%arg0 : i16) -> (i16) { %res = ""test.conversion_call_op""(%arg0) { callee=@handle_attr_callee_fn } : (i16) -> (i16) return %res : i16 }", mlir-opt --mlir-disable-threading -inline='default-pipeline=''' ,1 "func.func @func_with_arg(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 return %b : i32 } func.func @inline_with_arg(%arg0 : i32) -> i32 { %0 = call @func_with_arg(%arg0) : (i32) -> i32 return %0 : i32 } func.func @func_with_multi_return(%a : i1) -> (i32) { cf.cond_br %a, ^bb1, ^bb2 ^bb1: %const_0 = arith.constant 0 : i32 return %const_0 : i32 ^bb2: %const_55 = arith.constant 55 : i32 return %const_55 : i32 } func.func @inline_with_multi_return() -> i32 { %false = arith.constant false %x = call @func_with_multi_return(%false) : (i1) -> i32 return %x : i32 } func.func @func_with_locations(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 loc(""mysource.cc"":10:8) return %b : i32 loc(""mysource.cc"":11:2) } func.func @inline_with_locations(%arg0 : i32) -> i32 { %0 = call @func_with_locations(%arg0) : (i32) -> i32 loc(""mysource.cc"":55:14) return %0 : i32 } func.func private @func_external() func.func @no_inline_external() { call @func_external() : () -> () return } func.func @multilevel_func_a() { return } func.func @multilevel_func_b() { call @multilevel_func_a() : () -> () return } func.func @inline_multilevel() { %fn = ""test.functional_region_op""() ({ call @multilevel_func_b() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @no_inline_recursive() { %fn = ""test.functional_region_op""() ({ call @no_inline_recursive() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) return } func.func @convert_callee_fn(%arg : i32) -> i32 { return %arg : i32 } func.func @convert_callee_fn_multi_arg(%a : i32, %b : i32) -> () { return } func.func @convert_callee_fn_multi_res() -> (i32, i32) { %res = arith.constant 0 : i32 return %res, %res : i32, i32 } func.func @inline_convert_call() -> i16 { %test_input = arith.constant 0 : i16 %res = ""test.conversion_call_op""(%test_input) { callee=@convert_callee_fn } : (i16) -> (i16) return %res : i16 } func.func @convert_callee_fn_multiblock() -> i32 { cf.br ^bb0 ^bb0: %0 = arith.constant 0 : i32 return %0 : i32 } func.func @inline_convert_result_multiblock() -> i16 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock } : () -> (i16) return %res : i16 } func.func @no_inline_convert_call() { %test_input_i16 = arith.constant 0 : i16 %test_input_i64 = arith.constant 0 : i64 ""test.conversion_call_op""(%test_input_i16, %test_input_i64) { callee=@convert_callee_fn_multi_arg } : (i16, i64) -> () %res_2:2 = ""test.conversion_call_op""() { callee=@convert_callee_fn_multi_res } : () -> (i16, i64) return } func.func @simplify_return_constant() -> i32 { %res = arith.constant 0 : i32 return %res : i32 } func.func @simplify_return_reference() -> (() -> i32) { %res = constant @simplify_return_constant : () -> i32 return %res : () -> i32 } func.func @inline_simplify() -> i32 { %fn = call @simplify_return_reference() : () -> (() -> i32) %res = call_indirect %fn() : () -> i32 return %res : i32 } func.func @no_inline_invalid_call() -> i32 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock, noinline } : () -> (i32) return %res : i32 } func.func @gpu_alloc() -> memref<1024xf32> { %m = gpu.alloc [] () : memref<1024xf32> return %m : memref<1024xf32> } func.func @inline_gpu_ops() -> memref<1024xf32> { %m = call @gpu_alloc() : () -> memref<1024xf32> return %m : memref<1024xf32> } func.func @func_with_block_args_location(%arg0 : i32) { cf.br ^bb1(%arg0 : i32) ^bb1(%x : i32 loc(""foo"")): ""test.foo"" (%x) : (i32) -> () loc(""bar"") return } func.func @func_with_block_args_location_callee1(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } func.func @func_with_block_args_location_callee2(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } test.conversion_func_op @handle_attr_callee_fn_multi_arg(%arg0 : i16, %arg1 : i16 {""test.handle_argument""}) -> (i16 {""test.handle_result""}, i16) { %0 = arith.addi %arg0, %arg1 : i16 %1 = arith.subi %arg0, %arg1 : i16 ""test.return""(%0, %1) : (i16, i16) -> () } test.conversion_func_op @handle_attr_callee_fn(%arg0 : i32 {""test.handle_argument""}) -> (i32 {""test.handle_result""}) { ""test.return""(%arg0) : (i32) -> () } func.func @inline_handle_attr_call(%arg0 : i16, %arg1 : i16) -> (i16, i16) { %res0, %res1 = ""test.conversion_call_op""(%arg0, %arg1) { callee=@handle_attr_callee_fn_multi_arg } : (i16, i16) -> (i16, i16) return %res0, %res1 : i16, i16 } func.func @inline_convert_and_handle_attr_call(%arg0 : i16) -> (i16) { %res = ""test.conversion_call_op""(%arg0) { callee=@handle_attr_callee_fn } : (i16) -> (i16) return %res : i16 }", mlir-opt -inline='default-pipeline=''' -mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func @func_with_arg(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 return %b : i32 } func.func @inline_with_arg(%arg0 : i32) -> i32 { %0 = call @func_with_arg(%arg0) : (i32) -> i32 return %0 : i32 } func.func @func_with_multi_return(%a : i1) -> (i32) { cf.cond_br %a, ^bb1, ^bb2 ^bb1: %const_0 = arith.constant 0 : i32 return %const_0 : i32 ^bb2: %const_55 = arith.constant 55 : i32 return %const_55 : i32 } func.func @inline_with_multi_return() -> i32 { %false = arith.constant false %x = call @func_with_multi_return(%false) : (i1) -> i32 return %x : i32 } func.func @func_with_locations(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 loc(""mysource.cc"":10:8) return %b : i32 loc(""mysource.cc"":11:2) } func.func @inline_with_locations(%arg0 : i32) -> i32 { %0 = call @func_with_locations(%arg0) : (i32) -> i32 loc(""mysource.cc"":55:14) return %0 : i32 } func.func private @func_external() func.func @no_inline_external() { call @func_external() : () -> () return } func.func @multilevel_func_a() { return } func.func @multilevel_func_b() { call @multilevel_func_a() : () -> () return } func.func @inline_multilevel() { %fn = ""test.functional_region_op""() ({ call @multilevel_func_b() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @no_inline_recursive() { %fn = ""test.functional_region_op""() ({ call @no_inline_recursive() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) return } func.func @convert_callee_fn(%arg : i32) -> i32 { return %arg : i32 } func.func @convert_callee_fn_multi_arg(%a : i32, %b : i32) -> () { return } func.func @convert_callee_fn_multi_res() -> (i32, i32) { %res = arith.constant 0 : i32 return %res, %res : i32, i32 } func.func @inline_convert_call() -> i16 { %test_input = arith.constant 0 : i16 %res = ""test.conversion_call_op""(%test_input) { callee=@convert_callee_fn } : (i16) -> (i16) return %res : i16 } func.func @convert_callee_fn_multiblock() -> i32 { cf.br ^bb0 ^bb0: %0 = arith.constant 0 : i32 return %0 : i32 } func.func @inline_convert_result_multiblock() -> i16 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock } : () -> (i16) return %res : i16 } func.func @no_inline_convert_call() { %test_input_i16 = arith.constant 0 : i16 %test_input_i64 = arith.constant 0 : i64 ""test.conversion_call_op""(%test_input_i16, %test_input_i64) { callee=@convert_callee_fn_multi_arg } : (i16, i64) -> () %res_2:2 = ""test.conversion_call_op""() { callee=@convert_callee_fn_multi_res } : () -> (i16, i64) return } func.func @simplify_return_constant() -> i32 { %res = arith.constant 0 : i32 return %res : i32 } func.func @simplify_return_reference() -> (() -> i32) { %res = constant @simplify_return_constant : () -> i32 return %res : () -> i32 } func.func @inline_simplify() -> i32 { %fn = call @simplify_return_reference() : () -> (() -> i32) %res = call_indirect %fn() : () -> i32 return %res : i32 } func.func @no_inline_invalid_call() -> i32 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock, noinline } : () -> (i32) return %res : i32 } func.func @gpu_alloc() -> memref<1024xf32> { %m = gpu.alloc [] () : memref<1024xf32> return %m : memref<1024xf32> } func.func @inline_gpu_ops() -> memref<1024xf32> { %m = call @gpu_alloc() : () -> memref<1024xf32> return %m : memref<1024xf32> } func.func @func_with_block_args_location(%arg0 : i32) { cf.br ^bb1(%arg0 : i32) ^bb1(%x : i32 loc(""foo"")): ""test.foo"" (%x) : (i32) -> () loc(""bar"") return } func.func @func_with_block_args_location_callee1(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } func.func @func_with_block_args_location_callee2(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } test.conversion_func_op @handle_attr_callee_fn_multi_arg(%arg0 : i16, %arg1 : i16 {""test.handle_argument""}) -> (i16 {""test.handle_result""}, i16) { %0 = arith.addi %arg0, %arg1 : i16 %1 = arith.subi %arg0, %arg1 : i16 ""test.return""(%0, %1) : (i16, i16) -> () } test.conversion_func_op @handle_attr_callee_fn(%arg0 : i32 {""test.handle_argument""}) -> (i32 {""test.handle_result""}) { ""test.return""(%arg0) : (i32) -> () } func.func @inline_handle_attr_call(%arg0 : i16, %arg1 : i16) -> (i16, i16) { %res0, %res1 = ""test.conversion_call_op""(%arg0, %arg1) { callee=@handle_attr_callee_fn_multi_arg } : (i16, i16) -> (i16, i16) return %res0, %res1 : i16, i16 } func.func @inline_convert_and_handle_attr_call(%arg0 : i16) -> (i16) { %res = ""test.conversion_call_op""(%arg0) { callee=@handle_attr_callee_fn } : (i16) -> (i16) return %res : i16 }", mlir-opt -inline ,1 "func.func @func_with_arg(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 return %b : i32 } func.func @inline_with_arg(%arg0 : i32) -> i32 { %0 = call @func_with_arg(%arg0) : (i32) -> i32 return %0 : i32 } func.func @func_with_multi_return(%a : i1) -> (i32) { cf.cond_br %a, ^bb1, ^bb2 ^bb1: %const_0 = arith.constant 0 : i32 return %const_0 : i32 ^bb2: %const_55 = arith.constant 55 : i32 return %const_55 : i32 } func.func @inline_with_multi_return() -> i32 { %false = arith.constant false %x = call @func_with_multi_return(%false) : (i1) -> i32 return %x : i32 } func.func @func_with_locations(%c : i32) -> i32 { %b = arith.addi %c, %c : i32 loc(""mysource.cc"":10:8) return %b : i32 loc(""mysource.cc"":11:2) } func.func @inline_with_locations(%arg0 : i32) -> i32 { %0 = call @func_with_locations(%arg0) : (i32) -> i32 loc(""mysource.cc"":55:14) return %0 : i32 } func.func private @func_external() func.func @no_inline_external() { call @func_external() : () -> () return } func.func @multilevel_func_a() { return } func.func @multilevel_func_b() { call @multilevel_func_a() : () -> () return } func.func @inline_multilevel() { %fn = ""test.functional_region_op""() ({ call @multilevel_func_b() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @no_inline_recursive() { %fn = ""test.functional_region_op""() ({ call @no_inline_recursive() : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) return } func.func @convert_callee_fn(%arg : i32) -> i32 { return %arg : i32 } func.func @convert_callee_fn_multi_arg(%a : i32, %b : i32) -> () { return } func.func @convert_callee_fn_multi_res() -> (i32, i32) { %res = arith.constant 0 : i32 return %res, %res : i32, i32 } func.func @inline_convert_call() -> i16 { %test_input = arith.constant 0 : i16 %res = ""test.conversion_call_op""(%test_input) { callee=@convert_callee_fn } : (i16) -> (i16) return %res : i16 } func.func @convert_callee_fn_multiblock() -> i32 { cf.br ^bb0 ^bb0: %0 = arith.constant 0 : i32 return %0 : i32 } func.func @inline_convert_result_multiblock() -> i16 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock } : () -> (i16) return %res : i16 } func.func @no_inline_convert_call() { %test_input_i16 = arith.constant 0 : i16 %test_input_i64 = arith.constant 0 : i64 ""test.conversion_call_op""(%test_input_i16, %test_input_i64) { callee=@convert_callee_fn_multi_arg } : (i16, i64) -> () %res_2:2 = ""test.conversion_call_op""() { callee=@convert_callee_fn_multi_res } : () -> (i16, i64) return } func.func @simplify_return_constant() -> i32 { %res = arith.constant 0 : i32 return %res : i32 } func.func @simplify_return_reference() -> (() -> i32) { %res = constant @simplify_return_constant : () -> i32 return %res : () -> i32 } func.func @inline_simplify() -> i32 { %fn = call @simplify_return_reference() : () -> (() -> i32) %res = call_indirect %fn() : () -> i32 return %res : i32 } func.func @no_inline_invalid_call() -> i32 { %res = ""test.conversion_call_op""() { callee=@convert_callee_fn_multiblock, noinline } : () -> (i32) return %res : i32 } func.func @gpu_alloc() -> memref<1024xf32> { %m = gpu.alloc [] () : memref<1024xf32> return %m : memref<1024xf32> } func.func @inline_gpu_ops() -> memref<1024xf32> { %m = call @gpu_alloc() : () -> memref<1024xf32> return %m : memref<1024xf32> } func.func @func_with_block_args_location(%arg0 : i32) { cf.br ^bb1(%arg0 : i32) ^bb1(%x : i32 loc(""foo"")): ""test.foo"" (%x) : (i32) -> () loc(""bar"") return } func.func @func_with_block_args_location_callee1(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } func.func @func_with_block_args_location_callee2(%arg0 : i32) { call @func_with_block_args_location(%arg0) : (i32) -> () return } test.conversion_func_op @handle_attr_callee_fn_multi_arg(%arg0 : i16, %arg1 : i16 {""test.handle_argument""}) -> (i16 {""test.handle_result""}, i16) { %0 = arith.addi %arg0, %arg1 : i16 %1 = arith.subi %arg0, %arg1 : i16 ""test.return""(%0, %1) : (i16, i16) -> () } test.conversion_func_op @handle_attr_callee_fn(%arg0 : i32 {""test.handle_argument""}) -> (i32 {""test.handle_result""}) { ""test.return""(%arg0) : (i32) -> () } func.func @inline_handle_attr_call(%arg0 : i16, %arg1 : i16) -> (i16, i16) { %res0, %res1 = ""test.conversion_call_op""(%arg0, %arg1) { callee=@handle_attr_callee_fn_multi_arg } : (i16, i16) -> (i16, i16) return %res0, %res1 : i16, i16 } func.func @inline_convert_and_handle_attr_call(%arg0 : i16) -> (i16) { %res = ""test.conversion_call_op""(%arg0) { callee=@handle_attr_callee_fn } : (i16) -> (i16) return %res : i16 }"," mlir-opt -inline='op-pipelines=func.func(canonicalize,cse)' ",1 "func.func @cannot_fuse_would_create_cycle() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %cf7, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %a[%i1] : memref<10xf32> %v1 = affine.load %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v2 = affine.load %b[%i2] : memref<10xf32> affine.store %cf7, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @can_fuse_rar_dependence() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %cf7, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v1 = affine.load %a[%i1] : memref<10xf32> %v2 = affine.load %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v3 = affine.load %b[%i2] : memref<10xf32> affine.store %cf7, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @can_fuse_different_memrefs() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %d = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %cf7, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %d[%i1] : memref<10xf32> %v1 = affine.load %c[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { %v2 = affine.load %b[%i2] : memref<10xf32> affine.store %cf7, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_intermediate_store() { %0 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %0[%i0] : memref<10xf32> ""op0""(%v0) : (f32) -> () } affine.store %cf7, %0[%c0] : memref<10xf32> affine.for %i1 = 0 to 10 { %v1 = affine.load %0[%i1] : memref<10xf32> ""op1""(%v1) : (f32) -> () } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_intermediate_load() { %0 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %0[%i0] : memref<10xf32> } %v0 = affine.load %0[%c0] : memref<10xf32> ""op0""(%v0) : (f32) -> () affine.for %i1 = 0 to 10 { affine.store %cf7, %0[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_ssa_value_def() { %0 = memref.alloc() : memref<10xf32> %1 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %0[%i0] : memref<10xf32> affine.store %v0, %1[%i0] : memref<10xf32> } %v1 = affine.load %1[%c0] : memref<10xf32> ""op0""(%v1) : (f32) -> () %c2 = arith.constant 2 : index affine.for %i1 = 0 to 10 { affine.store %cf7, %0[%c2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_store_before_load() { %0 = memref.alloc() : memref<10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %0[%i0] : memref<10xf32> %v0 = affine.load %0[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v1 = affine.load %0[%i1] : memref<10xf32> } affine.for %i2 = 0 to 10 { affine.store %cf7, %0[%i2] : memref<10xf32> %v2 = affine.load %0[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_load_at_depth1() { %0 = memref.alloc() : memref<10x10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cf7, %0[%i0, %i1] : memref<10x10xf32> } %v1 = affine.load %0[%i0, %c0] : memref<10x10xf32> affine.for %i3 = 0 to 10 { affine.store %cf7, %0[%i0, %i3] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_load_in_loop_at_depth1() { %0 = memref.alloc() : memref<10x10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { affine.store %cf7, %0[%i0, %i1] : memref<10x10xf32> } affine.for %i2 = 0 to 10 { %v1 = affine.load %0[%i0, %i2] : memref<10x10xf32> } affine.for %i3 = 0 to 10 { affine.store %cf7, %0[%i0, %i3] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_store_at_depth1() { %0 = memref.alloc() : memref<10x10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %v0 = affine.load %0[%i0, %i1] : memref<10x10xf32> } affine.store %cf7, %0[%i0, %c0] : memref<10x10xf32> affine.for %i3 = 0 to 10 { %v1 = affine.load %0[%i0, %i3] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_store_in_loop_at_depth1() { %0 = memref.alloc() : memref<10x10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %v0 = affine.load %0[%i0, %i1] : memref<10x10xf32> } affine.for %i2 = 0 to 10 { affine.store %cf7, %0[%i0, %i2] : memref<10x10xf32> } affine.for %i3 = 0 to 10 { %v1 = affine.load %0[%i0, %i3] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @should_not_fuse_across_ssa_value_def_at_depth1() { %0 = memref.alloc() : memref<10x10xf32> %1 = memref.alloc() : memref<10x10xf32> %c0 = arith.constant 0 : index %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %v0 = affine.load %0[%i0, %i1] : memref<10x10xf32> affine.store %v0, %1[%i0, %i1] : memref<10x10xf32> } %v1 = affine.load %1[%i0, %c0] : memref<10x10xf32> ""op0""(%v1) : (f32) -> () %c2 = arith.constant 2 : index affine.for %i2 = 0 to 10 { affine.store %cf7, %0[%i0, %c2] : memref<10x10xf32> } } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics ,1 "func.func @test_small_pattern_1(%arg0 : i32) -> i32 { %0 = arith.constant 45 : i32 %1 = ""test.addi""(%arg0, %arg0): (i32, i32) -> i32 %2 = arith.addi %arg0, %arg0 : i32 %3 = arith.muli %arg0, %arg0 : i32 %result = ""test.op_commutative""(%0, %1, %2, %3): (i32, i32, i32, i32) -> i32 return %result : i32 } func.func @test_small_pattern_2(%arg0 : i32) -> i32 { %0 = ""test.constant""() {value = 0 : i32} : () -> i32 %1 = arith.constant 0 : i32 %2 = arith.addi %arg0, %arg0 : i32 %result = ""test.op_commutative""(%0, %1, %2, %arg0): (i32, i32, i32, i32) -> i32 return %result : i32 } func.func @test_large_pattern(%arg0 : i32, %arg1 : i32) -> i32 { %0 = arith.divsi %arg0, %arg1 : i32 %1 = arith.divsi %0, %arg0 : i32 %2 = arith.divsi %1, %arg1 : i32 %3 = arith.addi %1, %arg1 : i32 %4 = arith.subi %2, %3 : i32 %5 = ""test.addi""(%arg0, %arg0): (i32, i32) -> i32 %6 = arith.divsi %4, %5 : i32 %7 = arith.divsi %1, %arg1 : i32 %8 = arith.muli %1, %arg1 : i32 %9 = arith.subi %7, %8 : i32 %10 = ""test.addi""(%arg0, %arg0): (i32, i32) -> i32 %11 = arith.divsi %9, %10 : i32 %12 = arith.divsi %6, %arg1 : i32 %13 = arith.subi %arg1, %arg0 : i32 %14 = ""test.op_commutative""(%12, %9, %12, %8): (i32, i32, i32, i32) -> i32 %15 = arith.divsi %13, %14 : i32 %16 = arith.addi %2, %15 : i32 %17 = arith.subi %16, %arg1 : i32 %18 = ""test.addi""(%arg0, %arg0): (i32, i32) -> i32 %19 = arith.divsi %17, %18 : i32 %20 = ""test.addi""(%arg0, %16): (i32, i32) -> i32 %21 = arith.divsi %17, %20 : i32 %result = ""test.op_large_commutative""(%16, %6, %11, %15, %19, %21, %19): (i32, i32, i32, i32, i32, i32, i32) -> i32 return %result : i32 }", mlir-opt -test-commutativity-utils ,1 "func.func @affine_for(%p : memref) { affine.for %arg1 = 0 to 128 { affine.for %arg2 = 0 to 8 { %0 = arith.constant 4.5 : f32 %1 = arith.constant 1.5 : f32 %2 = arith.addf %0, %1 : f32 memref.store %2, %p[] : memref } } return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_addf() -> f32 { %0 = arith.constant 4.5 : f32 %1 = arith.constant 1.5 : f32 %2 = arith.addf %0, %1 : f32 return %2 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @addf_splat_tensor() -> tensor<4xf32> { %0 = arith.constant dense<4.5> : tensor<4xf32> %1 = arith.constant dense<1.5> : tensor<4xf32> %2 = arith.addf %0, %1 : tensor<4xf32> return %2 : tensor<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @addf_dense_tensor() -> tensor<4xf32> { %0 = arith.constant dense<[1.5, 2.5, 3.5, 4.5]> : tensor<4xf32> %1 = arith.constant dense<[1.5, 2.5, 3.5, 4.5]> : tensor<4xf32> %2 = arith.addf %0, %1 : tensor<4xf32> return %2 : tensor<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @addf_dense_and_splat_tensors() -> tensor<4xf32> { %0 = arith.constant dense<[1.5, 2.5, 3.5, 4.5]> : tensor<4xf32> %1 = arith.constant dense<1.5> : tensor<4xf32> %2 = arith.addf %0, %1 : tensor<4xf32> return %2 : tensor<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_addi() -> i32 { %0 = arith.constant 1 : i32 %1 = arith.constant 5 : i32 %2 = arith.addi %0, %1 : i32 return %2 : i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_and(%arg0 : i1, %arg1 : i32) -> (i1, i32) { %c1 = arith.constant 1 : i1 %cAllOnes_32 = arith.constant 4294967295 : i32 %c31 = arith.constant 31 : i32 %1 = arith.andi %arg0, %c1 : i1 %2 = arith.andi %arg1, %cAllOnes_32 : i32 %3 = arith.andi %2, %c31 : i32 return %1, %3 : i1, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @and_index(%arg0 : index) -> (index) { %c31 = arith.constant 31 : index %c_AllOnes = arith.constant -1 : index %1 = arith.andi %arg0, %c31 : index %2 = arith.andi %1, %c_AllOnes : index return %2 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @tensor_and(%arg0 : tensor<2xi32>) -> tensor<2xi32> { %cAllOnes_32 = arith.constant dense<4294967295> : tensor<2xi32> %c31 = arith.constant dense<31> : tensor<2xi32> %c_mixed = arith.constant dense<[31, 4294967295]> : tensor<2xi32> %0 = arith.andi %arg0, %cAllOnes_32 : tensor<2xi32> %1 = arith.andi %0, %c31 : tensor<2xi32> %2 = arith.andi %1, %c_mixed : tensor<2xi32> return %2 : tensor<2xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @vector_and(%arg0 : vector<2xi32>) -> vector<2xi32> { %cAllOnes_32 = arith.constant dense<4294967295> : vector<2xi32> %c31 = arith.constant dense<31> : vector<2xi32> %c_mixed = arith.constant dense<[31, 4294967295]> : vector<2xi32> %0 = arith.andi %arg0, %cAllOnes_32 : vector<2xi32> %1 = arith.andi %0, %c31 : vector<2xi32> %2 = arith.andi %1, %c_mixed : vector<2xi32> return %2 : vector<2xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @addi_splat_vector() -> vector<8xi32> { %0 = arith.constant dense<1> : vector<8xi32> %1 = arith.constant dense<5> : vector<8xi32> %2 = arith.addi %0, %1 : vector<8xi32> return %2 : vector<8xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_subf() -> f32 { %0 = arith.constant 4.5 : f32 %1 = arith.constant 1.5 : f32 %2 = arith.subf %0, %1 : f32 return %2 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @subf_splat_vector() -> vector<4xf32> { %0 = arith.constant dense<4.5> : vector<4xf32> %1 = arith.constant dense<1.5> : vector<4xf32> %2 = arith.subf %0, %1 : vector<4xf32> return %2 : vector<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_subi(%arg0 : i32) -> (i32, i32) { %0 = arith.constant 4 : i32 %1 = arith.constant 1 : i32 %2 = arith.constant 0 : i32 %3 = arith.subi %0, %1 : i32 %4 = arith.subi %arg0, %2 : i32 return %3, %4 : i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @subi_splat_tensor() -> tensor<4xi32> { %0 = arith.constant dense<4> : tensor<4xi32> %1 = arith.constant dense<1> : tensor<4xi32> %2 = arith.subi %0, %1 : tensor<4xi32> return %2 : tensor<4xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @affine_apply(%variable : index) -> (index, index, index) { %c177 = arith.constant 177 : index %c211 = arith.constant 211 : index %N = arith.constant 1075 : index %x0 = affine.apply affine_map<(d0, d1)[S0] -> ( (d0 + 128 * S0) floordiv 128 + d1 mod 128)> (%c177, %c211)[%N] %x1 = affine.apply affine_map<(d0, d1)[S0] -> (128 * (S0 ceildiv 128))> (%c177, %c211)[%N] %y = affine.apply affine_map<(d0) -> (42)> (%variable) return %x0, %x1, %y : index, index, index }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_mulf() -> f32 { %0 = arith.constant 4.5 : f32 %1 = arith.constant 1.5 : f32 %2 = arith.mulf %0, %1 : f32 return %2 : f32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @mulf_splat_tensor() -> tensor<4xf32> { %0 = arith.constant dense<4.5> : tensor<4xf32> %1 = arith.constant dense<1.5> : tensor<4xf32> %2 = arith.mulf %0, %1 : tensor<4xf32> return %2 : tensor<4xf32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_divi_signed() -> (i32, i32, i32) { %z = arith.constant 0 : i32 %0 = arith.constant 6 : i32 %1 = arith.constant 2 : i32 %2 = arith.divsi %0, %1 : i32 %3 = arith.constant -2 : i32 %4 = arith.divsi %0, %3 : i32 %5 = arith.divsi %0, %z : i32 return %2, %4, %5 : i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @divi_signed_splat_tensor() -> (tensor<4xi32>, tensor<4xi32>, tensor<4xi32>) { %z = arith.constant dense<0> : tensor<4xi32> %0 = arith.constant dense<6> : tensor<4xi32> %1 = arith.constant dense<2> : tensor<4xi32> %2 = arith.divsi %0, %1 : tensor<4xi32> %3 = arith.constant dense<-2> : tensor<4xi32> %4 = arith.divsi %0, %3 : tensor<4xi32> %5 = arith.divsi %0, %z : tensor<4xi32> return %2, %4, %5 : tensor<4xi32>, tensor<4xi32>, tensor<4xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_divi_unsigned() -> (i32, i32, i32) { %z = arith.constant 0 : i32 %0 = arith.constant 6 : i32 %1 = arith.constant 2 : i32 %2 = arith.divui %0, %1 : i32 %3 = arith.constant -2 : i32 %4 = arith.divui %0, %3 : i32 %5 = arith.divui %0, %z : i32 return %2, %4, %5 : i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @divi_unsigned_splat_tensor() -> (tensor<4xi32>, tensor<4xi32>, tensor<4xi32>) { %z = arith.constant dense<0> : tensor<4xi32> %0 = arith.constant dense<6> : tensor<4xi32> %1 = arith.constant dense<2> : tensor<4xi32> %2 = arith.divui %0, %1 : tensor<4xi32> %3 = arith.constant dense<-2> : tensor<4xi32> %4 = arith.divui %0, %3 : tensor<4xi32> %5 = arith.divui %0, %z : tensor<4xi32> return %2, %4, %5 : tensor<4xi32>, tensor<4xi32>, tensor<4xi32> }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_arith.floordivsi() -> (i32, i32, i32, i32, i32) { %z = arith.constant 0 : i32 %0 = arith.constant 7 : i32 %1 = arith.constant 2 : i32 %2 = arith.floordivsi %0, %1 : i32 %3 = arith.constant -2 : i32 %4 = arith.floordivsi %0, %3 : i32 %5 = arith.constant -9 : i32 %6 = arith.floordivsi %5, %1 : i32 %7 = arith.constant -13 : i32 %8 = arith.floordivsi %7, %3 : i32 %9 = arith.floordivsi %0, %z : i32 return %2, %4, %6, %8, %9 : i32, i32, i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_arith.ceildivsi() -> (i32, i32, i32, i32, i32) { %z = arith.constant 0 : i32 %0 = arith.constant 7 : i32 %1 = arith.constant 2 : i32 %2 = arith.ceildivsi %0, %1 : i32 %3 = arith.constant -2 : i32 %4 = arith.ceildivsi %0, %3 : i32 %5 = arith.constant -9 : i32 %6 = arith.ceildivsi %5, %1 : i32 %7 = arith.constant -15 : i32 %8 = arith.ceildivsi %7, %3 : i32 %9 = arith.ceildivsi %0, %z : i32 return %2, %4, %6, %8, %9 : i32, i32, i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_arith.ceildivui() -> (i32, i32, i32, i32, i32) { %z = arith.constant 0 : i32 %0 = arith.constant 7 : i32 %1 = arith.constant 2 : i32 %2 = arith.ceildivui %0, %1 : i32 %3 = arith.constant -2 : i32 %4 = arith.ceildivui %0, %3 : i32 %5 = arith.constant -8 : i32 %6 = arith.ceildivui %5, %1 : i32 %7 = arith.constant -15 : i32 %8 = arith.ceildivui %7, %3 : i32 %9 = arith.ceildivui %0, %z : i32 return %2, %4, %6, %8, %9 : i32, i32, i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_arith.remsi(%a : i32) -> (i32, i32, i32) { %0 = arith.constant 5 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 1 : i32 %3 = arith.constant -2 : i32 %4 = arith.remsi %0, %1 : i32 %5 = arith.remsi %0, %3 : i32 %6 = arith.remsi %a, %2 : i32 return %4, %5, %6 : i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @simple_arith.remui(%a : i32) -> (i32, i32, i32) { %0 = arith.constant 5 : i32 %1 = arith.constant 2 : i32 %2 = arith.constant 1 : i32 %3 = arith.constant -2 : i32 %4 = arith.remui %0, %1 : i32 %5 = arith.remui %0, %3 : i32 %6 = arith.remui %a, %2 : i32 return %4, %5, %6 : i32, i32, i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @muli() -> i32 { %0 = arith.constant 4 : i32 %1 = arith.constant 2 : i32 %2 = arith.muli %0, %1 : i32 return %2 : i32 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @muli_splat_vector() -> vector<4xi32> { %0 = arith.constant dense<4> : vector<4xi32> %1 = arith.constant dense<2> : vector<4xi32> %2 = arith.muli %0, %1 : vector<4xi32> return %2 : vector<4xi32> } func.func @dim(%x : tensor<8x4xf32>) -> index { %c1 = arith.constant 1 : index %0 = tensor.dim %x, %c1 : tensor<8x4xf32> return %0 : index }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @cmpi() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) { %c42 = arith.constant 42 : i32 %cm1 = arith.constant -1 : i32 %0 = arith.cmpi eq, %c42, %cm1 : i32 %1 = arith.cmpi ne, %c42, %cm1 : i32 %2 = arith.cmpi slt, %c42, %cm1 : i32 %3 = arith.cmpi sle, %c42, %cm1 : i32 %4 = arith.cmpi sgt, %c42, %cm1 : i32 %5 = arith.cmpi sge, %c42, %cm1 : i32 %6 = arith.cmpi ult, %c42, %cm1 : i32 %7 = arith.cmpi ule, %c42, %cm1 : i32 %8 = arith.cmpi ugt, %c42, %cm1 : i32 %9 = arith.cmpi uge, %c42, %cm1 : i32 return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9 : i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @cmpf_normal_numbers() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) { %c42 = arith.constant 42. : f32 %cm1 = arith.constant -1. : f32 %0 = arith.cmpf false, %c42, %cm1 : f32 %1 = arith.cmpf oeq, %c42, %cm1 : f32 %2 = arith.cmpf ogt, %c42, %cm1 : f32 %3 = arith.cmpf oge, %c42, %cm1 : f32 %4 = arith.cmpf olt, %c42, %cm1 : f32 %5 = arith.cmpf ole, %c42, %cm1 : f32 %6 = arith.cmpf one, %c42, %cm1 : f32 %7 = arith.cmpf ord, %c42, %cm1 : f32 %8 = arith.cmpf ueq, %c42, %cm1 : f32 %9 = arith.cmpf ugt, %c42, %cm1 : f32 %10 = arith.cmpf uge, %c42, %cm1 : f32 %11 = arith.cmpf ult, %c42, %cm1 : f32 %12 = arith.cmpf ule, %c42, %cm1 : f32 %13 = arith.cmpf une, %c42, %cm1 : f32 %14 = arith.cmpf uno, %c42, %cm1 : f32 %15 = arith.cmpf true, %c42, %cm1 : f32 return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15 : i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @cmpf_nan() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) { %c42 = arith.constant 42. : f32 %cqnan = arith.constant 0xFFFFFFFF : f32 %0 = arith.cmpf false, %c42, %cqnan : f32 %1 = arith.cmpf oeq, %c42, %cqnan : f32 %2 = arith.cmpf ogt, %c42, %cqnan : f32 %3 = arith.cmpf oge, %c42, %cqnan : f32 %4 = arith.cmpf olt, %c42, %cqnan : f32 %5 = arith.cmpf ole, %c42, %cqnan : f32 %6 = arith.cmpf one, %c42, %cqnan : f32 %7 = arith.cmpf ord, %c42, %cqnan : f32 %8 = arith.cmpf ueq, %c42, %cqnan : f32 %9 = arith.cmpf ugt, %c42, %cqnan : f32 %10 = arith.cmpf uge, %c42, %cqnan : f32 %11 = arith.cmpf ult, %c42, %cqnan : f32 %12 = arith.cmpf ule, %c42, %cqnan : f32 %13 = arith.cmpf une, %c42, %cqnan : f32 %14 = arith.cmpf uno, %c42, %cqnan : f32 %15 = arith.cmpf true, %c42, %cqnan : f32 return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15 : i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @cmpf_inf() -> (i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) { %c42 = arith.constant 42. : f32 %cpinf = arith.constant 0x7F800000 : f32 %0 = arith.cmpf false, %c42, %cpinf: f32 %1 = arith.cmpf oeq, %c42, %cpinf: f32 %2 = arith.cmpf ogt, %c42, %cpinf: f32 %3 = arith.cmpf oge, %c42, %cpinf: f32 %4 = arith.cmpf olt, %c42, %cpinf: f32 %5 = arith.cmpf ole, %c42, %cpinf: f32 %6 = arith.cmpf one, %c42, %cpinf: f32 %7 = arith.cmpf ord, %c42, %cpinf: f32 %8 = arith.cmpf ueq, %c42, %cpinf: f32 %9 = arith.cmpf ugt, %c42, %cpinf: f32 %10 = arith.cmpf uge, %c42, %cpinf: f32 %11 = arith.cmpf ult, %c42, %cpinf: f32 %12 = arith.cmpf ule, %c42, %cpinf: f32 %13 = arith.cmpf une, %c42, %cpinf: f32 %14 = arith.cmpf uno, %c42, %cpinf: f32 %15 = arith.cmpf true, %c42, %cpinf: f32 return %0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15 : i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1 }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @nested_isolated_region() { func.func @isolated_op() { %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () } ""foo.unknown_region""() ({ %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @custom_insertion_position() { ""test.one_region_op""() ({ %0 = arith.constant 1 : i32 %2 = arith.addi %0, %0 : i32 ""foo.yield""(%2) : (i32) -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @subview_scalar_fold(%arg0: memref) -> memref { %c = memref.subview %arg0[] [] [] : memref to memref return %c : memref }", mlir-opt -allow-unregistered-dialect -split-input-file -test-constant-fold ,1 "func.func @multi_level_mapping() { %result = ""test.type_producer""() : () -> i32 ""test.type_consumer""(%result) : (i32) -> () ""test.return""() : () -> () } func.func @dropped_region_with_illegal_ops() { ""test.drop_region_op""() ({ %ignored = ""test.illegal_op_f""() : () -> (i32) ""test.return""() : () -> () }) : () -> () ""test.return""() : () -> () } func.func @replace_non_root_illegal_op() { %result = ""test.replace_non_root""() : () -> (i32) ""test.return""() : () -> () }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "func.func @recursively_legal_invalid_op() { builtin.module attributes {test.recursively_legal} { %ignored = ""test.illegal_op_f""() : () -> (i32) } func.func @dynamic_func(%arg: i64) attributes {test.recursively_legal} { %ignored = ""test.illegal_op_f""() : () -> (i32) ""test.return""() : () -> () } ""test.return""() : () -> () }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "builtin.module { func.func @test_undo_region_clone() { ""test.region""() ({ ^bb1(%i0: i64): ""test.invalid""(%i0) : (i64) -> () }) {legalizer.should_clone} : () -> () %ignored = ""test.illegal_op_f""() : () -> (i32) ""test.return""() : () -> () } }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "builtin.module { func.func @test_unknown_dynamically_legal() { ""foo.unknown_op""() {test.dynamically_legal} : () -> () ""foo.unknown_op""() {} : () -> () ""test.return""() : () -> () } }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "builtin.module { func.func @test_undo_region_inline() { ""test.region""() ({ ^bb1(%i0: i64): cf.br ^bb2(%i0 : i64) ^bb2(%i1: i64): ""test.invalid""(%i1) : (i64) -> () }) {} : () -> () ""test.return""() : () -> () } }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "builtin.module { func.func @test_undo_block_erase() { ""test.region""() ({ ^bb1(%i0: i64): cf.br ^bb2(%i0 : i64) ^bb2(%i1: i64): ""test.invalid""(%i1) : (i64) -> () }) {legalizer.should_clone, legalizer.erase_old_blocks} : () -> () ""test.return""() : () -> () } }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "builtin.module { func.func @create_unregistered_op_in_pattern() -> i32 { %0 = ""test.illegal_op_g""() : () -> (i32) ""test.return""(%0) : (i32) -> () } }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -test-legalize-mode=full -split-input-file -verify-diagnostics ,1 "func.func @doubleup(%lb: index, %ub: index, %step: index, %extra_arg: f32) -> f32 { %0 = scf.for %i = %lb to %ub step %step iter_args(%iter = %extra_arg) -> (f32) { %1 = arith.addf %iter, %iter : f32 scf.yield %1: f32 } return %0: f32 }", mlir-opt -allow-unregistered-dialect -test-scf-for-utils=test-replace-with-new-yields -mlir-disable-threading ,1 "func.func @foo() { %0 = ""test.type_producer""() : () -> i32 %1 = ""test.type_changer""(%0) : (i32) -> i16 %2 = ""test.type_changer""(%1) : (i16) -> i64 ""test.type_consumer""(%2) : (i64) -> () return }", mlir-opt -test-target-materialization-with-no-uses ,1 "func.func @return_blocks() { ""foo.cond_br""() [^bb1, ^bb2] : () -> () ^bb1: return ^bb2: return } func.func @matching_arguments() -> i32 { ""foo.cond_br""() [^bb1, ^bb2] : () -> () ^bb1(%arg0 : i32): return %arg0 : i32 ^bb2(%arg1 : i32): return %arg1 : i32 } func.func @mismatch_unknown_terminator(%arg0 : i32, %arg1 : i32) -> i32 { ""foo.cond_br""() [^bb1, ^bb2] : () -> () ^bb1: return %arg0 : i32 ^bb2: return %arg1 : i32 } func.func @mismatch_operands(%cond : i1, %arg0 : i32, %arg1 : i32) -> i32 { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: return %arg0 : i32 ^bb2: return %arg1 : i32 } func.func @mismatch_operands_matching_arguments(%cond : i1, %arg0 : i32, %arg1 : i32) -> (i32, i32) { cf.cond_br %cond, ^bb1(%arg1 : i32), ^bb2(%arg0 : i32) ^bb1(%arg2 : i32): return %arg0, %arg2 : i32, i32 ^bb2(%arg3 : i32): return %arg1, %arg3 : i32, i32 } func.func @mismatch_argument_uses(%cond : i1, %arg0 : i32, %arg1 : i32) -> (i32, i32) { cf.cond_br %cond, ^bb1(%arg1 : i32), ^bb2(%arg0 : i32) ^bb1(%arg2 : i32): return %arg0, %arg2 : i32, i32 ^bb2(%arg3 : i32): return %arg3, %arg1 : i32, i32 } func.func @mismatch_argument_types(%cond : i1, %arg0 : i32, %arg1 : i16) { cf.cond_br %cond, ^bb1(%arg0 : i32), ^bb2(%arg1 : i16) ^bb1(%arg2 : i32): ""foo.return""(%arg2) : (i32) -> () ^bb2(%arg3 : i16): ""foo.return""(%arg3) : (i16) -> () } func.func @mismatch_argument_count(%cond : i1, %arg0 : i32) { cf.cond_br %cond, ^bb1(%arg0 : i32), ^bb2 ^bb1(%arg2 : i32): ""foo.return""(%arg2) : (i32) -> () ^bb2: ""foo.return""() : () -> () } func.func @mismatch_operations(%cond : i1) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: ""foo.return""() : () -> () ^bb2: return } func.func @mismatch_operation_count(%cond : i1) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: ""foo.op""() : () -> () return ^bb2: return } func.func @contains_regions(%cond : i1) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: scf.if %cond { ""foo.op""() : () -> () } return ^bb2: scf.if %cond { ""foo.op""() : () -> () } return } func.func @mismatch_loop(%cond : i1, %cond2 : i1) { %cond3 = ""foo.op""() : () -> (i1) cf.cond_br %cond, ^bb2, ^bb3 ^bb1: cf.cond_br %cond3, ^bb1, ^bb3 ^bb2: cf.cond_br %cond2, ^bb1, ^bb3 ^bb3: return } func.func @mismatch_operand_types(%arg0 : i1, %arg1 : memref, %arg2 : memref) { %c0_i32 = arith.constant 0 : i32 %true = arith.constant true cf.br ^bb1 ^bb1: cf.cond_br %arg0, ^bb2, ^bb3 ^bb2: memref.store %c0_i32, %arg1[] : memref cf.br ^bb1 ^bb3: memref.store %true, %arg2[] : memref cf.br ^bb1 } func.func private @print(%arg0: i32, %arg1: i32) func.func @nomerge(%arg0: i32, %i: i32) { %c1_i32 = arith.constant 1 : i32 %icmp = arith.cmpi slt, %i, %arg0 : i32 cf.cond_br %icmp, ^bb2, ^bb3 ^bb2: %ip1 = arith.addi %i, %c1_i32 : i32 cf.br ^bb4(%ip1 : i32) ^bb7: %jp1 = arith.addi %j, %c1_i32 : i32 cf.br ^bb4(%jp1 : i32) ^bb4(%j: i32): %jcmp = arith.cmpi slt, %j, %arg0 : i32 call @print(%j, %ip1) : (i32, i32) -> () cf.cond_br %jcmp, ^bb7, ^bb3 ^bb3: return } func.func @mismatch_dominance() -> i32 { %0 = ""test.producing_br""()[^bb1, ^bb2] { operand_segment_sizes = array } : () -> i32 ^bb1: ""test.br""(%0)[^bb4] : (i32) -> () ^bb2: %1 = ""foo.def""() : () -> i32 ""test.br""()[^bb3] : () -> () ^bb3: ""test.br""(%1)[^bb4] : (i32) -> () ^bb4(%3: i32): return %3 : i32 }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(canonicalize))' -split-input-file ,1 "func.func @inline_with_arg(%arg0 : i32) -> i32 { %fn = ""test.functional_region_op""() ({ ^bb0(%a : i32): %b = arith.addi %a, %a : i32 ""test.return""(%b) : (i32) -> () }) : () -> ((i32) -> i32) %0 = call_indirect %fn(%arg0) : (i32) -> i32 return %0 : i32 } func.func @no_inline_invalid_nested_operation() { %fn = ""test.functional_region_op""() ({ ""test.region""() ({ ""foo.noinline_operation""() : () -> () }) : () -> () ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @inline_ignore_invalid_nested_operation() { %fn = ""test.functional_region_op""() ({ %internal_fn = ""test.functional_region_op""() ({ ""foo.noinline_operation""() : () -> () }) : () -> (() -> ()) ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () return } func.func @no_inline_invalid_dest_region() { ""foo.unknown_region""() ({ %fn = ""test.functional_region_op""() ({ ""test.return""() : () -> () }) : () -> (() -> ()) call_indirect %fn() : () -> () ""test.return""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -test-inline ,1 "func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @condBranch(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @condBranchDynamicType( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.br ^bb3(%1 : memref) ^bb3(%2: memref): test.copy(%2, %arg2) : (memref, memref) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @condBranchDynamicType( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.br ^bb3(%1 : memref) ^bb3(%2: memref): test.copy(%2, %arg2) : (memref, memref) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @condBranchDynamicType( %arg0: i1, %arg1: memref, %arg2: memref, %arg3: index) { cf.cond_br %arg0, ^bb1, ^bb2(%arg3: index) ^bb1: cf.br ^bb3(%arg1 : memref) ^bb2(%0: index): %1 = memref.alloc(%0) : memref test.buffer_based in(%arg1: memref) out(%1: memref) cf.br ^bb3(%1 : memref) ^bb3(%2: memref): test.copy(%2, %arg2) : (memref, memref) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @dynamicRanked(%memref: memref<*xf32>) { %0 = memref.rank %memref : memref<*xf32> %1 = memref.alloc(%0) : memref return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @dynamicRanked(%memref: memref<*xf32>) { %0 = memref.rank %memref : memref<*xf32> %1 = memref.alloc(%0) : memref return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @dynamicRanked(%memref: memref<*xf32>) { %0 = memref.rank %memref : memref<*xf32> %1 = memref.alloc(%0) : memref return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @dynamicRanked2D(%memref: memref<*xf32>) { %0 = memref.rank %memref : memref<*xf32> %1 = memref.alloc(%0, %0) : memref return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @dynamicRanked2D(%memref: memref<*xf32>) { %0 = memref.rank %memref : memref<*xf32> %1 = memref.alloc(%0, %0) : memref return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @dynamicRanked2D(%memref: memref<*xf32>) { %0 = memref.rank %memref : memref<*xf32> %1 = memref.alloc(%0, %0) : memref return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @dynamicNoRank(%arg0: index) { %0 = memref.alloc(%arg0) : memref return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @dynamicNoRank(%arg0: index) { %0 = memref.alloc(%arg0) : memref return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @dynamicNoRank(%arg0: index) { %0 = memref.alloc(%arg0) : memref return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @emptyUsesValue(%arg0: memref<4xf32>) { %0 = memref.alloc() : memref<4xf32> return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @emptyUsesValue(%arg0: memref<4xf32>) { %0 = memref.alloc() : memref<4xf32> return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @emptyUsesValue(%arg0: memref<4xf32>) { %0 = memref.alloc() : memref<4xf32> return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @criticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @invCriticalEdge(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1, ^bb2(%arg1 : memref<2xf32>) ^bb1: cf.br ^bb2(%0 : memref<2xf32>) ^bb2(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): %7 = memref.alloc() : memref<2xf32> test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>) test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): %7 = memref.alloc() : memref<2xf32> test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>) test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @ifElse(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): %7 = memref.alloc() : memref<2xf32> test.buffer_based in(%5: memref<2xf32>) out(%7: memref<2xf32>) test.copy(%7, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): test.copy(%arg1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): test.copy(%arg1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @ifElseNoUsers(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb3(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.br ^bb3(%3, %4 : memref<2xf32>, memref<2xf32>) ^bb3(%5: memref<2xf32>, %6: memref<2xf32>): test.copy(%arg1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @ifElseNested(%arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) cf.cond_br %arg0, ^bb1(%arg1, %0 : memref<2xf32>, memref<2xf32>), ^bb2(%0, %arg1 : memref<2xf32>, memref<2xf32>) ^bb1(%1: memref<2xf32>, %2: memref<2xf32>): cf.br ^bb5(%1, %2 : memref<2xf32>, memref<2xf32>) ^bb2(%3: memref<2xf32>, %4: memref<2xf32>): cf.cond_br %arg0, ^bb3(%3 : memref<2xf32>), ^bb4(%4 : memref<2xf32>) ^bb3(%5: memref<2xf32>): cf.br ^bb5(%5, %3 : memref<2xf32>, memref<2xf32>) ^bb4(%6: memref<2xf32>): cf.br ^bb5(%3, %6 : memref<2xf32>, memref<2xf32>) ^bb5(%7: memref<2xf32>, %8: memref<2xf32>): %9 = memref.alloc() : memref<2xf32> test.buffer_based in(%7: memref<2xf32>) out(%9: memref<2xf32>) test.copy(%9, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @redundantOperations(%arg0: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @redundantOperations(%arg0: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @redundantOperations(%arg0: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%0: memref<2xf32>) out(%1: memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @moving_alloc_and_inserting_missing_dealloc( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^exit(%0 : memref<2xf32>) ^bb2: %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @moving_alloc_and_inserting_missing_dealloc( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^exit(%0 : memref<2xf32>) ^bb2: %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @moving_alloc_and_inserting_missing_dealloc( %cond: i1, %arg0: memref<2xf32>, %arg1: memref<2xf32>) { cf.cond_br %cond, ^bb1, ^bb2 ^bb1: %0 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%0: memref<2xf32>) cf.br ^exit(%0 : memref<2xf32>) ^bb2: %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg0: memref<2xf32>) out(%1: memref<2xf32>) cf.br ^exit(%1 : memref<2xf32>) ^exit(%arg2: memref<2xf32>): test.copy(%arg2, %arg1) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @nested_regions_and_cond_branch( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @nested_regions_and_cond_branch( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @nested_regions_and_cond_branch( %arg0: i1, %arg1: memref<2xf32>, %arg2: memref<2xf32>) { cf.cond_br %arg0, ^bb1, ^bb2 ^bb1: cf.br ^bb3(%arg1 : memref<2xf32>) ^bb2: %0 = memref.alloc() : memref<2xf32> test.region_buffer_based in(%arg1: memref<2xf32>) out(%0: memref<2xf32>) { ^bb0(%gen1_arg0: f32, %gen1_arg1: f32): %1 = memref.alloc() : memref<2xf32> test.buffer_based in(%arg1: memref<2xf32>) out(%1: memref<2xf32>) %tmp1 = math.exp %gen1_arg0 : f32 test.region_yield %tmp1 : f32 } cf.br ^bb3(%0 : memref<2xf32>) ^bb3(%1: memref<2xf32>): test.copy(%1, %arg2) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @memref_in_function_results( %arg0: memref<5xf32>, %arg1: memref<10xf32>, %arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) { %x = memref.alloc() : memref<15xf32> %y = memref.alloc() : memref<5xf32> test.buffer_based in(%arg0: memref<5xf32>) out(%y: memref<5xf32>) test.copy(%y, %arg2) : (memref<5xf32>, memref<5xf32>) return %arg1, %x : memref<10xf32>, memref<15xf32> }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @memref_in_function_results( %arg0: memref<5xf32>, %arg1: memref<10xf32>, %arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) { %x = memref.alloc() : memref<15xf32> %y = memref.alloc() : memref<5xf32> test.buffer_based in(%arg0: memref<5xf32>) out(%y: memref<5xf32>) test.copy(%y, %arg2) : (memref<5xf32>, memref<5xf32>) return %arg1, %x : memref<10xf32>, memref<15xf32> }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @memref_in_function_results( %arg0: memref<5xf32>, %arg1: memref<10xf32>, %arg2: memref<5xf32>) -> (memref<10xf32>, memref<15xf32>) { %x = memref.alloc() : memref<15xf32> %y = memref.alloc() : memref<5xf32> test.buffer_based in(%arg0: memref<5xf32>) out(%y: memref<5xf32>) test.copy(%y, %arg2) : (memref<5xf32>, memref<5xf32>) return %arg1, %x : memref<10xf32>, memref<15xf32> }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @nested_region_control_flow( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @nested_region_control_flow( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @nested_region_control_flow( %arg0 : index, %arg1 : index) -> memref { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = memref.alloc(%arg0, %arg0) : memref %2 = scf.if %0 -> (memref) { scf.yield %1 : memref } else { %3 = memref.alloc(%arg0, %arg1) : memref scf.yield %1 : memref } return %2 : memref }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> { %0 = memref.alloc() : memref<2x2xf32> %1 = test.region_if %0 : memref<2x2xf32> -> (memref<2x2xf32>) then { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } else { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } join { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } return %1 : memref<2x2xf32> }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> { %0 = memref.alloc() : memref<2x2xf32> %1 = test.region_if %0 : memref<2x2xf32> -> (memref<2x2xf32>) then { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } else { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } join { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } return %1 : memref<2x2xf32> }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @inner_region_control_flow(%arg0 : index) -> memref<2x2xf32> { %0 = memref.alloc() : memref<2x2xf32> %1 = test.region_if %0 : memref<2x2xf32> -> (memref<2x2xf32>) then { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } else { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } join { ^bb0(%arg1 : memref<2x2xf32>): test.region_if_yield %arg1 : memref<2x2xf32> } return %1 : memref<2x2xf32> }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @loop_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @loop_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @loop_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = memref.alloc() : memref<2xf32> scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @loop_nested_if_no_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { scf.yield %0 : memref<2xf32> } else { scf.yield %iterBuf : memref<2xf32> } scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @loop_nested_if_no_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { scf.yield %0 : memref<2xf32> } else { scf.yield %iterBuf : memref<2xf32> } scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @loop_nested_if_no_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>, %res: memref<2xf32>) { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { scf.yield %0 : memref<2xf32> } else { scf.yield %iterBuf : memref<2xf32> } scf.yield %3 : memref<2xf32> } test.copy(%1, %res) : (memref<2xf32>, memref<2xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @loop_nested_if_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>) -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { %4 = memref.alloc() : memref<2xf32> scf.yield %4 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } scf.yield %3 : memref<2xf32> } return %1 : memref<2xf32> }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @loop_nested_if_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>) -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { %4 = memref.alloc() : memref<2xf32> scf.yield %4 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } scf.yield %3 : memref<2xf32> } return %1 : memref<2xf32> }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @loop_nested_if_alloc( %lb: index, %ub: index, %step: index, %buf: memref<2xf32>) -> memref<2xf32> { %0 = memref.alloc() : memref<2xf32> %1 = scf.for %i = %lb to %ub step %step iter_args(%iterBuf = %buf) -> memref<2xf32> { %2 = arith.cmpi eq, %i, %ub : index %3 = scf.if %2 -> (memref<2xf32>) { %4 = memref.alloc() : memref<2xf32> scf.yield %4 : memref<2xf32> } else { scf.yield %0 : memref<2xf32> } scf.yield %3 : memref<2xf32> } return %1 : memref<2xf32> }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @large_buffer_allocation(%arg0: memref<2048xf32>) { %0 = memref.alloc() : memref<2048xf32> test.copy(%0, %arg0) : (memref<2048xf32>, memref<2048xf32>) return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @large_buffer_allocation(%arg0: memref<2048xf32>) { %0 = memref.alloc() : memref<2048xf32> test.copy(%0, %arg0) : (memref<2048xf32>, memref<2048xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @large_buffer_allocation(%arg0: memref<2048xf32>) { %0 = memref.alloc() : memref<2048xf32> test.copy(%0, %arg0) : (memref<2048xf32>, memref<2048xf32>) return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @indexElementType() { %0 = memref.alloc() : memref<4xindex> return }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "func.func @indexElementType() { %0 = memref.alloc() : memref<4xindex> return }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "func.func @indexElementType() { %0 = memref.alloc() : memref<4xindex> return }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry>} { func.func @bigIndexElementType() { %0 = memref.alloc() {alignment = 64 : i64, custom_attr} : memref<4xindex> return } }", mlir-opt -promote-buffers-to-stack -split-input-file ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry>} { func.func @bigIndexElementType() { %0 = memref.alloc() {alignment = 64 : i64, custom_attr} : memref<4xindex> return } }"," mlir-opt -promote-buffers-to-stack=""max-alloc-size-in-bytes=64"" -split-input-file ",1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry>} { func.func @bigIndexElementType() { %0 = memref.alloc() {alignment = 64 : i64, custom_attr} : memref<4xindex> return } }"," mlir-opt -promote-buffers-to-stack=""max-rank-of-allocated-memref=2"" -split-input-file ",1 "func.func @make_isolated_from_above_single_block(%arg0 : index, %arg1 : index) { %c0 = arith.constant 0: index %c1 = arith.constant 1 : index %empty = tensor.empty(%arg0, %arg1) : tensor %d0 = tensor.dim %empty, %c0 : tensor %d1 = tensor.dim %empty, %c1 : tensor ""test.one_region_with_operands_op""() ({ ""foo.yield""(%c0, %c1, %d0, %d1) : (index, index, index, index) -> () }) : () -> () return }", mlir-opt -test-make-isolated-from-above=simple -allow-unregistered-dialect --split-input-file ,1 "func.func @make_isolated_from_above_single_block(%arg0 : index, %arg1 : index) { %c0 = arith.constant 0: index %c1 = arith.constant 1 : index %empty = tensor.empty(%arg0, %arg1) : tensor %d0 = tensor.dim %empty, %c0 : tensor %d1 = tensor.dim %empty, %c1 : tensor ""test.one_region_with_operands_op""() ({ ""foo.yield""(%c0, %c1, %d0, %d1) : (index, index, index, index) -> () }) : () -> () return }", mlir-opt -test-make-isolated-from-above=clone-ops-with-no-operands -allow-unregistered-dialect --split-input-file ,1 "func.func @make_isolated_from_above_single_block(%arg0 : index, %arg1 : index) { %c0 = arith.constant 0: index %c1 = arith.constant 1 : index %empty = tensor.empty(%arg0, %arg1) : tensor %d0 = tensor.dim %empty, %c0 : tensor %d1 = tensor.dim %empty, %c1 : tensor ""test.one_region_with_operands_op""() ({ ""foo.yield""(%c0, %c1, %d0, %d1) : (index, index, index, index) -> () }) : () -> () return }", mlir-opt -test-make-isolated-from-above=clone-ops-with-operands -allow-unregistered-dialect --split-input-file ,1 "func.func @make_isolated_from_above_multiple_blocks(%arg0 : index, %arg1 : index, %arg2 : index) { %c0 = arith.constant 0: index %c1 = arith.constant 1 : index %empty = tensor.empty(%arg0, %arg1) : tensor %d0 = tensor.dim %empty, %c0 : tensor %d1 = tensor.dim %empty, %c1 : tensor ""test.one_region_with_operands_op""(%arg2) ({ ^bb0(%b0 : index): cf.br ^bb1(%b0: index) ^bb1(%b1 : index): ""foo.yield""(%c0, %c1, %d0, %d1, %b1) : (index, index, index, index, index) -> () }) : (index) -> () return }", mlir-opt -test-make-isolated-from-above=simple -allow-unregistered-dialect --split-input-file ,1 "func.func @make_isolated_from_above_multiple_blocks(%arg0 : index, %arg1 : index, %arg2 : index) { %c0 = arith.constant 0: index %c1 = arith.constant 1 : index %empty = tensor.empty(%arg0, %arg1) : tensor %d0 = tensor.dim %empty, %c0 : tensor %d1 = tensor.dim %empty, %c1 : tensor ""test.one_region_with_operands_op""(%arg2) ({ ^bb0(%b0 : index): cf.br ^bb1(%b0: index) ^bb1(%b1 : index): ""foo.yield""(%c0, %c1, %d0, %d1, %b1) : (index, index, index, index, index) -> () }) : (index) -> () return }", mlir-opt -test-make-isolated-from-above=clone-ops-with-no-operands -allow-unregistered-dialect --split-input-file ,1 "func.func @make_isolated_from_above_multiple_blocks(%arg0 : index, %arg1 : index, %arg2 : index) { %c0 = arith.constant 0: index %c1 = arith.constant 1 : index %empty = tensor.empty(%arg0, %arg1) : tensor %d0 = tensor.dim %empty, %c0 : tensor %d1 = tensor.dim %empty, %c1 : tensor ""test.one_region_with_operands_op""(%arg2) ({ ^bb0(%b0 : index): cf.br ^bb1(%b0: index) ^bb1(%b1 : index): ""foo.yield""(%c0, %c1, %d0, %d1, %b1) : (index, index, index, index, index) -> () }) : (index) -> () return }", mlir-opt -test-make-isolated-from-above=clone-ops-with-operands -allow-unregistered-dialect --split-input-file ,1 "func.func @test(%arg0: f32) { %result = ""test.illegal_op_a""() : () -> (i32) ""foo.region""() ({ ""test.invalid""() : () -> () }) : () -> () return }", mlir-opt -allow-unregistered-dialect -test-legalize-patterns -verify-diagnostics -test-legalize-mode=analysis ,1 "func.func @unflatten4d(%arg1: memref<7x8x9x10xf32>) { %m = memref.alloc() : memref<5040xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to 8 { affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 10 { affine.store %cf7, %m[720 * %i0 + 90 * %i1 + 10 * %i2 + %i3] : memref<5040xf32> } } } } affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to 8 { affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 10 { %v0 = affine.load %m[720 * %i0 + 90 * %i1 + 10 * %i2 + %i3] : memref<5040xf32> affine.store %v0, %arg1[%i0, %i1, %i2, %i3] : memref<7x8x9x10xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{mode=producer}))' -split-input-file ,1 "func.func @unflatten4d(%arg1: memref<7x8x9x10xf32>) { %m = memref.alloc() : memref<5040xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to 8 { affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 10 { affine.store %cf7, %m[720 * %i0 + 90 * %i1 + 10 * %i2 + %i3] : memref<5040xf32> } } } } affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to 8 { affine.for %i2 = 0 to 9 { affine.for %i3 = 0 to 10 { %v0 = affine.load %m[720 * %i0 + 90 * %i1 + 10 * %i2 + %i3] : memref<5040xf32> affine.store %v0, %arg1[%i0, %i1, %i2, %i3] : memref<7x8x9x10xf32> } } } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal mode=sibling}))' -split-input-file ,1 "func.func @unflatten2d_with_transpose(%arg1: memref<8x7xf32>) { %m = memref.alloc() : memref<56xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to 8 { affine.store %cf7, %m[8 * %i0 + %i1] : memref<56xf32> } } affine.for %i0 = 0 to 8 { affine.for %i1 = 0 to 7 { %v0 = affine.load %m[%i0 + 8 * %i1] : memref<56xf32> affine.store %v0, %arg1[%i0, %i1] : memref<8x7xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{mode=producer}))' -split-input-file ,1 "func.func @unflatten2d_with_transpose(%arg1: memref<8x7xf32>) { %m = memref.alloc() : memref<56xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to 8 { affine.store %cf7, %m[8 * %i0 + %i1] : memref<56xf32> } } affine.for %i0 = 0 to 8 { affine.for %i1 = 0 to 7 { %v0 = affine.load %m[%i0 + 8 * %i1] : memref<56xf32> affine.store %v0, %arg1[%i0, %i1] : memref<8x7xf32> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal mode=sibling}))' -split-input-file ,1 "func.func @check_src_dst_step(%m : memref<100xf32>, %src: memref<100xf32>, %out: memref<100xf32>) { affine.for %i0 = 0 to 100 { %r1 = affine.load %src[%i0]: memref<100xf32> affine.store %r1, %m[%i0] : memref<100xf32> } affine.for %i2 = 0 to 100 step 2 { %r2 = affine.load %m[%i2] : memref<100xf32> affine.store %r2, %out[%i2] : memref<100xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{mode=producer}))' -split-input-file ,1 "func.func @check_src_dst_step(%m : memref<100xf32>, %src: memref<100xf32>, %out: memref<100xf32>) { affine.for %i0 = 0 to 100 { %r1 = affine.load %src[%i0]: memref<100xf32> affine.store %r1, %m[%i0] : memref<100xf32> } affine.for %i2 = 0 to 100 step 2 { %r2 = affine.load %m[%i2] : memref<100xf32> affine.store %r2, %out[%i2] : memref<100xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal mode=sibling}))' -split-input-file ,1 "func.func @reduce_add_non_maximal_f32_f32(%arg0: memref<64x64xf32, 1>, %arg1 : memref<1x64xf32, 1>, %arg2 : memref<1x64xf32, 1>) { %cst_0 = arith.constant 0.000000e+00 : f32 %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_0) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.addf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_dbl = arith.addf %accum, %accum : f32 affine.store %accum_dbl, %arg1[%arg3, %arg4] : memref<1x64xf32, 1> } } affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 32 iter_args (%prevAccum = %cst_1) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.mulf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_sqr = arith.mulf %accum, %accum : f32 affine.store %accum_sqr, %arg2[%arg3, %arg4] : memref<1x64xf32, 1> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{mode=producer}))' -split-input-file ,1 "func.func @reduce_add_non_maximal_f32_f32(%arg0: memref<64x64xf32, 1>, %arg1 : memref<1x64xf32, 1>, %arg2 : memref<1x64xf32, 1>) { %cst_0 = arith.constant 0.000000e+00 : f32 %cst_1 = arith.constant 1.000000e+00 : f32 affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 64 iter_args (%prevAccum = %cst_0) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.addf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_dbl = arith.addf %accum, %accum : f32 affine.store %accum_dbl, %arg1[%arg3, %arg4] : memref<1x64xf32, 1> } } affine.for %arg3 = 0 to 1 { affine.for %arg4 = 0 to 64 { %accum = affine.for %arg5 = 0 to 32 iter_args (%prevAccum = %cst_1) -> f32 { %4 = affine.load %arg0[%arg5, %arg4] : memref<64x64xf32, 1> %5 = arith.mulf %prevAccum, %4 : f32 affine.yield %5 : f32 } %accum_sqr = arith.mulf %accum, %accum : f32 affine.store %accum_sqr, %arg2[%arg3, %arg4] : memref<1x64xf32, 1> } } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal mode=sibling}))' -split-input-file ,1 "func.func @sibling_load_only(%arg0: memref<10xf32>) { affine.for %arg1 = 0 to 10 { %0 = affine.load %arg0[%arg1] : memref<10xf32> } affine.for %arg1 = 0 to 10 { %0 = affine.load %arg0[%arg1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{mode=producer}))' -split-input-file ,1 "func.func @sibling_load_only(%arg0: memref<10xf32>) { affine.for %arg1 = 0 to 10 { %0 = affine.load %arg0[%arg1] : memref<10xf32> } affine.for %arg1 = 0 to 10 { %0 = affine.load %arg0[%arg1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal mode=sibling}))' -split-input-file ,1 "func.func @fusion_for_multiple_blocks() { ^bb0: %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } cf.br ^bb1 ^bb1: affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{mode=producer}))' -split-input-file ,1 "func.func @fusion_for_multiple_blocks() { ^bb0: %m = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } cf.br ^bb1 ^bb1: affine.for %i0 = 0 to 10 { affine.store %cf7, %m[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { %v0 = affine.load %m[%i1] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(affine-loop-fusion{fusion-maximal mode=sibling}))' -split-input-file ,1 "func.func @slice_depth1_loop_nest() { %0 = memref.alloc() : memref<100xf32> %cst = arith.constant 7.000000e+00 : f32 affine.for %i0 = 0 to 16 { affine.store %cst, %0[%i0] : memref<100xf32> } affine.for %i1 = 0 to 5 { %1 = affine.load %0[%i1] : memref<100xf32> ""prevent.dce""(%1) : (f32) -> () } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-transformation -split-input-file -canonicalize ,1 "func.func @should_fuse_reduction_to_pointwise() { %a = memref.alloc() : memref<10x10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { affine.for %i1 = 0 to 10 { %v0 = affine.load %b[%i0] : memref<10xf32> %v1 = affine.load %a[%i0, %i1] : memref<10x10xf32> %v3 = arith.addf %v0, %v1 : f32 affine.store %v3, %b[%i0] : memref<10xf32> } } affine.for %i2 = 0 to 10 { %v4 = affine.load %b[%i2] : memref<10xf32> affine.store %v4, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-transformation -split-input-file -canonicalize ,1 "func.func @should_fuse_avoiding_dependence_cycle() { %a = memref.alloc() : memref<10xf32> %b = memref.alloc() : memref<10xf32> %c = memref.alloc() : memref<10xf32> %cf7 = arith.constant 7.0 : f32 affine.for %i0 = 0 to 10 { %v0 = affine.load %a[%i0] : memref<10xf32> affine.store %v0, %b[%i0] : memref<10xf32> } affine.for %i1 = 0 to 10 { affine.store %cf7, %a[%i1] : memref<10xf32> %v1 = affine.load %c[%i1] : memref<10xf32> ""prevent.dce""(%v1) : (f32) -> () } affine.for %i2 = 0 to 10 { %v2 = affine.load %b[%i2] : memref<10xf32> affine.store %v2, %c[%i2] : memref<10xf32> } return }", mlir-opt -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-transformation -split-input-file -canonicalize ,1 "func.func @test_invalid_arg_materialization( %arg0: i16) { ""foo.return""(%arg0) : (i16) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_valid_arg_materialization(%arg0: i64) { ""foo.return""(%arg0) : (i64) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_invalid_result_materialization() { %result = ""test.type_producer""() : () -> f16 ""foo.return""(%result) : (f16) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_invalid_result_materialization() { %result = ""test.type_producer""() : () -> f16 ""foo.return""(%result) : (f16) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_transitive_use_materialization() { %result = ""test.another_type_producer""() : () -> f32 ""foo.return""(%result) : (f32) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_transitive_use_invalid_materialization() { %result = ""test.another_type_producer""() : () -> f16 ""foo.return""(%result) : (f16) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_valid_result_legalization() { %result = ""test.type_producer""() : () -> f32 ""foo.return""(%result) : (f32) -> () }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_signature_conversion_undo() { ""test.signature_conversion_undo""() ({ ^bb0(%arg0: f32): ""test.type_consumer""(%arg0) : (f32) -> () ""test.return""(%arg0) : (f32) -> () }) : () -> () return }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_block_argument_not_converted() { ""test.unsupported_block_arg_type""() ({ ^bb0(%0 : index): ""test.return""(%0) : (index) -> () }) : () -> () return }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @test_signature_conversion_no_converter() { ""test.signature_conversion_no_converter""() ({ ^bb0(%arg0: f32): ""test.type_consumer""(%arg0) : (f32) -> () ""test.return""(%arg0) : (f32) -> () }) : () -> () return }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @recursive_type_conversion() { ""test.type_producer""() : () -> !test.test_rec> return }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "llvm.func @unsupported_func_op_interface() { llvm.return }", mlir-opt -test-legalize-type-conversion -allow-unregistered-dialect -split-input-file -verify-diagnostics ,1 "func.func @rewrite_dynamic_op(%arg0: i32) { %0:2 = ""test.dynamic_one_operand_two_results""(%arg0) : (i32) -> (i32, i32) return }", mlir-opt -test-rewrite-dynamic-op ,1 "func.func @remove_op_with_inner_ops_pattern() { ""test.op_with_region_pattern""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return } func.func @remove_op_with_inner_ops_fold_no_side_effect() { ""test.op_with_region_fold_no_side_effect""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return } func.func @remove_op_with_inner_ops_fold(%arg0 : i32) -> (i32) { %0 = ""test.op_with_region_fold""(%arg0) ({ ""test.op_with_region_terminator""() : () -> () }) : (i32) -> (i32) return %0 : i32 } func.func @remove_op_with_variadic_results_and_folder(%arg0 : i32, %arg1 : i32) -> (i32, i32) { %0, %1 = ""test.op_with_variadic_results_and_folder""(%arg0, %arg1) : (i32, i32) -> (i32, i32) return %0, %1 : i32, i32 } func.func @test_commutative_multi(%arg0: i32, %arg1: i32) -> (i32, i32) { %c42_i32 = arith.constant 42 : i32 %c43_i32 = arith.constant 43 : i32 %y = ""test.op_commutative""(%c42_i32, %arg0, %arg1, %c43_i32) : (i32, i32, i32, i32) -> i32 %z = ""test.op_commutative""(%arg0, %c42_i32, %c43_i32, %arg1): (i32, i32, i32, i32) -> i32 return %y, %z: i32, i32 } func.func @test_commutative_multi_cst(%arg0: i32, %arg1: i32) -> (i32, i32) { %c42_i32 = arith.constant 42 : i32 %c42_i32_2 = arith.constant 42 : i32 %y = ""test.op_commutative""(%c42_i32, %arg0, %arg1, %c42_i32_2) : (i32, i32, i32, i32) -> i32 %c42_i32_3 = arith.constant 42 : i32 %z = ""test.op_commutative""(%arg0, %c42_i32_3, %c42_i32_2, %arg1): (i32, i32, i32, i32) -> i32 return %y, %z: i32, i32 } func.func @typemismatch() -> i32 { %c42 = arith.constant 42.0 : f32 %0 = ""test.passthrough_fold""(%c42) : (f32) -> (i32) return %0 : i32 } func.func @test_dialect_canonicalizer() -> (i32) { %0 = ""test.dialect_canonicalizable""() : () -> (i32) return %0 : i32 } func.func @test_region_simplify() { return ^bb1: return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize))' ,1 "func.func @remove_op_with_inner_ops_pattern() { ""test.op_with_region_pattern""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return } func.func @remove_op_with_inner_ops_fold_no_side_effect() { ""test.op_with_region_fold_no_side_effect""() ({ ""test.op_with_region_terminator""() : () -> () }) : () -> () return } func.func @remove_op_with_inner_ops_fold(%arg0 : i32) -> (i32) { %0 = ""test.op_with_region_fold""(%arg0) ({ ""test.op_with_region_terminator""() : () -> () }) : (i32) -> (i32) return %0 : i32 } func.func @remove_op_with_variadic_results_and_folder(%arg0 : i32, %arg1 : i32) -> (i32, i32) { %0, %1 = ""test.op_with_variadic_results_and_folder""(%arg0, %arg1) : (i32, i32) -> (i32, i32) return %0, %1 : i32, i32 } func.func @test_commutative_multi(%arg0: i32, %arg1: i32) -> (i32, i32) { %c42_i32 = arith.constant 42 : i32 %c43_i32 = arith.constant 43 : i32 %y = ""test.op_commutative""(%c42_i32, %arg0, %arg1, %c43_i32) : (i32, i32, i32, i32) -> i32 %z = ""test.op_commutative""(%arg0, %c42_i32, %c43_i32, %arg1): (i32, i32, i32, i32) -> i32 return %y, %z: i32, i32 } func.func @test_commutative_multi_cst(%arg0: i32, %arg1: i32) -> (i32, i32) { %c42_i32 = arith.constant 42 : i32 %c42_i32_2 = arith.constant 42 : i32 %y = ""test.op_commutative""(%c42_i32, %arg0, %arg1, %c42_i32_2) : (i32, i32, i32, i32) -> i32 %c42_i32_3 = arith.constant 42 : i32 %z = ""test.op_commutative""(%arg0, %c42_i32_3, %c42_i32_2, %arg1): (i32, i32, i32, i32) -> i32 return %y, %z: i32, i32 } func.func @typemismatch() -> i32 { %c42 = arith.constant 42.0 : f32 %0 = ""test.passthrough_fold""(%c42) : (f32) -> (i32) return %0 : i32 } func.func @test_dialect_canonicalizer() -> (i32) { %0 = ""test.dialect_canonicalizable""() : () -> (i32) return %0 : i32 } func.func @test_region_simplify() { return ^bb1: return }", mlir-opt -pass-pipeline='builtin.module(func.func(canonicalize{region-simplify=false}))' ,1 "func.func @simple(%arg0 : i32) -> i32 { %cond = arith.constant true %res = scf.if %cond -> (i32) { %1 = arith.constant 1 : i32 scf.yield %1 : i32 } else { scf.yield %arg0 : i32 } return %res : i32 } func.func @simple_both_same(%cond : i1) -> i32 { %res = scf.if %cond -> (i32) { %1 = arith.constant 1 : i32 scf.yield %1 : i32 } else { %2 = arith.constant 1 : i32 scf.yield %2 : i32 } return %res : i32 } func.func @overdefined_unknown_condition(%cond : i1, %arg0 : i32) -> i32 { %res = scf.if %cond -> (i32) { %1 = arith.constant 1 : i32 scf.yield %1 : i32 } else { scf.yield %arg0 : i32 } return %res : i32 } func.func @overdefined_different_constants(%cond : i1) -> i32 { %res = scf.if %cond -> (i32) { %1 = arith.constant 1 : i32 scf.yield %1 : i32 } else { %2 = arith.constant 2 : i32 scf.yield %2 : i32 } return %res : i32 } func.func @simple_loop(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 { %s0 = arith.constant 0 : i32 %result = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0) -> (i32) { %sn = arith.addi %si, %si : i32 scf.yield %sn : i32 } return %result : i32 } func.func @loop_overdefined(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 { %s0 = arith.constant 1 : i32 %result = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0) -> (i32) { %sn = arith.addi %si, %si : i32 scf.yield %sn : i32 } return %result : i32 } func.func @loop_inner_control_flow(%arg0 : index, %arg1 : index, %arg2 : index) -> i32 { %cst_1 = arith.constant 1 : i32 %result = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %cst_1) -> (i32) { %cst_20 = arith.constant 20 : i32 %cond = arith.cmpi ult, %si, %cst_20 : i32 %inner_res = scf.if %cond -> (i32) { %1 = arith.constant 1 : i32 scf.yield %1 : i32 } else { %si_inc = arith.addi %si, %cst_1 : i32 scf.yield %si_inc : i32 } scf.yield %inner_res : i32 } return %result : i32 } func.func @loop_region_branch_terminator_op(%arg1 : i32) { %c2_i32 = arith.constant 2 : i32 %0 = scf.while (%arg2 = %c2_i32) : (i32) -> (i32) { %1 = arith.cmpi sgt, %arg1, %arg2 : i32 scf.condition(%1) %arg2 : i32 } do { ^bb0(%arg2: i32): scf.yield %arg2 : i32 } return } func.func @affine_loop_one_iter() -> i32 { %s0 = arith.constant 0 : i32 %s1 = arith.constant 1 : i32 %result = affine.for %i = 0 to 1 iter_args(%si = %s0) -> (i32) { %sn = arith.addi %si, %s1 : i32 affine.yield %sn : i32 } return %result : i32 } func.func @affine_loop_zero_iter() -> i32 { %s1 = arith.constant 1 : i32 %result = affine.for %i = 0 to 0 iter_args(%si = %s1) -> (i32) { %sn = arith.addi %si, %si : i32 affine.yield %sn : i32 } return %result : i32 } func.func @affine_loop_unknown_trip_count(%ub: index) -> i32 { %s0 = arith.constant 0 : i32 %result = affine.for %i = 0 to %ub iter_args(%si = %s0) -> (i32) { %sn = arith.addi %si, %si : i32 affine.yield %sn : i32 } return %result : i32 } func.func @while_loop_different_arg_count() -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = scf.while (%arg3 = %c0, %arg4 = %c1) : (index, index) -> index { %1 = arith.cmpi slt, %arg3, %c1 : index scf.condition(%1) %arg4 : index } do { ^bb0(%arg3: index): %1 = arith.muli %arg3, %c1 : index scf.yield %c0, %1 : index, index } return %0 : index } func.func @while_loop_false_condition(%arg0 : index) -> index { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = arith.muli %arg0, %c0 : index %1 = scf.while (%arg1 = %0) : (index) -> index { %2 = arith.cmpi slt, %arg1, %c0 : index scf.condition(%2) %arg1 : index } do { ^bb0(%arg2 : index): %3 = arith.addi %arg2, %c1 : index scf.yield %3 : index } func.return %1 : index }"," mlir-opt -allow-unregistered-dialect -pass-pipeline=""builtin.module(func.func(sccp))"" -split-input-file ",1 "func.func @foo0(%arg0 : i32) -> i32 { %0 = arith.constant 0 : i32 %1 = arith.cmpi eq, %arg0, %0 : i32 cf.cond_br %1, ^exit, ^tail ^exit: return %0 : i32 ^tail: %3 = call @foo1(%arg0) : (i32) -> i32 return %3 : i32 } func.func @foo1(%arg0 : i32) -> i32 { %0 = arith.constant 1 : i32 %1 = arith.subi %arg0, %0 : i32 %2 = call @foo0(%1) : (i32) -> i32 return %2 : i32 }", mlir-opt -inline='default-pipeline=''' ,1 "func.func @foo0(%arg0 : i32) -> i32 { %0 = arith.constant 0 : i32 %1 = arith.cmpi eq, %arg0, %0 : i32 cf.cond_br %1, ^exit, ^tail ^exit: return %0 : i32 ^tail: %3 = call @foo1(%arg0) : (i32) -> i32 return %3 : i32 } func.func @foo1(%arg0 : i32) -> i32 { %0 = arith.constant 1 : i32 %1 = arith.subi %arg0, %0 : i32 %2 = call @foo0(%1) : (i32) -> i32 return %2 : i32 }", mlir-opt --mlir-disable-threading -inline='default-pipeline=''' ,1 "func.func @identity(%arg0: tuple) -> tuple { return %arg0 : tuple }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func @identity(%arg0: tuple) -> tuple { return %arg0 : tuple }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @identity_1_to_1_no_materializations(%arg0: tuple) -> tuple { return %arg0 : tuple }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func @identity_1_to_1_no_materializations(%arg0: tuple) -> tuple { return %arg0 : tuple }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @recursive_decomposition(%arg0: tuple>>) -> tuple>> { return %arg0 : tuple>> }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func @recursive_decomposition(%arg0: tuple>>) -> tuple>> { return %arg0 : tuple>> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @mixed_recursive_decomposition(%arg0: tuple, tuple, tuple>>) -> tuple, tuple, tuple>> { return %arg0 : tuple, tuple, tuple>> }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func @mixed_recursive_decomposition(%arg0: tuple, tuple, tuple>>) -> tuple, tuple, tuple>> { return %arg0 : tuple, tuple, tuple>> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func private @callee(tuple) -> tuple func.func @caller(%arg0: tuple) -> tuple { %0 = call @callee(%arg0) : (tuple) -> tuple return %0 : tuple }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func private @callee(tuple) -> tuple func.func @caller(%arg0: tuple) -> tuple { %0 = call @callee(%arg0) : (tuple) -> tuple return %0 : tuple }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func private @callee(tuple<>) -> tuple<> func.func @caller(%arg0: tuple<>) -> tuple<> { %0 = call @callee(%arg0) : (tuple<>) -> (tuple<>) return %0 : tuple<> }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func private @callee(tuple<>) -> tuple<> func.func @caller(%arg0: tuple<>) -> tuple<> { %0 = call @callee(%arg0) : (tuple<>) -> (tuple<>) return %0 : tuple<> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @unconverted_op_result() -> tuple { %0 = ""test.source""() : () -> (tuple) return %0 : tuple }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func @unconverted_op_result() -> tuple { %0 = ""test.source""() : () -> (tuple) return %0 : tuple }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @nested_unconverted_op_result(%arg: tuple>) -> tuple> { %0 = ""test.op""(%arg) : (tuple>) -> (tuple>) return %0 : tuple> }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func @nested_unconverted_op_result(%arg: tuple>) -> tuple> { %0 = ""test.op""(%arg) : (tuple>) -> (tuple>) return %0 : tuple> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func private @callee(tuple<>, i1, tuple, i3, tuple, i6) -> (tuple<>, i1, tuple, i3, tuple, i6) func.func @caller(%arg0: tuple<>, %arg1: i1, %arg2: tuple, %arg3: i3, %arg4: tuple, %arg5: i6) -> (tuple<>, i1, tuple, i3, tuple, i6) { %0, %1, %2, %3, %4, %5 = call @callee(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) : (tuple<>, i1, tuple, i3, tuple, i6) -> (tuple<>, i1, tuple, i3, tuple, i6) return %0, %1, %2, %3, %4, %5 : tuple<>, i1, tuple, i3, tuple, i6 }", mlir-opt -split-input-file -test-decompose-call-graph-types ,1 "func.func private @callee(tuple<>, i1, tuple, i3, tuple, i6) -> (tuple<>, i1, tuple, i3, tuple, i6) func.func @caller(%arg0: tuple<>, %arg1: i1, %arg2: tuple, %arg3: i3, %arg4: tuple, %arg5: i6) -> (tuple<>, i1, tuple, i3, tuple, i6) { %0, %1, %2, %3, %4, %5 = call @callee(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) : (tuple<>, i1, tuple, i3, tuple, i6) -> (tuple<>, i1, tuple, i3, tuple, i6) return %0, %1, %2, %3, %4, %5 : tuple<>, i1, tuple, i3, tuple, i6 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @rectangular(%arg0: memref) { %c2 = arith.constant 2 : index %c44 = arith.constant 44 : index %c1 = arith.constant 1 : index scf.for %i = %c2 to %c44 step %c1 { scf.for %j = %c1 to %c44 step %c2 { memref.load %arg0[%i, %j]: memref } } return } func.func @triangular(%arg0: memref) { %c2 = arith.constant 2 : index %c44 = arith.constant 44 : index %c1 = arith.constant 1 : index scf.for %i = %c2 to %c44 step %c1 { scf.for %j = %c1 to %i step %c2 { memref.load %arg0[%i, %j]: memref } } return }", mlir-opt -test-extract-fixed-outer-loops='test-outer-loop-sizes=7' ,1 "func.func @rectangular(%arg0: memref) { %c2 = arith.constant 2 : index %c44 = arith.constant 44 : index %c1 = arith.constant 1 : index scf.for %i = %c2 to %c44 step %c1 { scf.for %j = %c1 to %c44 step %c2 { memref.load %arg0[%i, %j]: memref } } return } func.func @triangular(%arg0: memref) { %c2 = arith.constant 2 : index %c44 = arith.constant 44 : index %c1 = arith.constant 1 : index scf.for %i = %c2 to %c44 step %c1 { scf.for %j = %c1 to %i step %c2 { memref.load %arg0[%i, %j]: memref } } return }"," mlir-opt -test-extract-fixed-outer-loops='test-outer-loop-sizes=7,4' ",1 "func.func @parallel_many_dims() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %c3 = arith.constant 3 : index %c4 = arith.constant 4 : index %c5 = arith.constant 5 : index %c6 = arith.constant 6 : index %c7 = arith.constant 7 : index %c8 = arith.constant 8 : index %c9 = arith.constant 9 : index %c10 = arith.constant 10 : index %c11 = arith.constant 11 : index %c12 = arith.constant 12 : index %c13 = arith.constant 13 : index %c14 = arith.constant 14 : index %c15 = arith.constant 15 : index %c26 = arith.constant 26 : index scf.parallel (%i0, %i1, %i2, %i3, %i4) = (%c0, %c3, %c6, %c9, %c12) to (%c2, %c5, %c8, %c26, %c14) step (%c1, %c4, %c7, %c10, %c13) { %result = ""magic.op""(%i0, %i1, %i2, %i3, %i4) : (index, index, index, index, index) -> index } return }"," mlir-opt -allow-unregistered-dialect -pass-pipeline='builtin.module(func.func(test-scf-parallel-loop-collapsing{collapsed-indices-0=0,3 collapsed-indices-1=1,4 collapsed-indices-2=2}, canonicalize))' ",1 "func.func @basic() -> (memref) { %0 = ""test.source""() : () -> (memref) return %0 : memref } func.func @presence_of_existing_arguments(%arg0: memref<1xf32>) -> (memref<2xf32>) { %0 = ""test.source""() : () -> (memref<2xf32>) return %0 : memref<2xf32> } func.func @multiple_results() -> (memref<1xf32>, memref<2xf32>) { %0, %1 = ""test.source""() : () -> (memref<1xf32>, memref<2xf32>) return %0, %1 : memref<1xf32>, memref<2xf32> } func.func @non_memref_types() -> (i1, memref, i32) { %0, %1, %2 = ""test.source""() : () -> (i1, memref, i32) return %0, %1, %2 : i1, memref, i32 } func.func private @external_function() -> (memref) func.func private @result_attrs() -> (memref {test.some_attr}) func.func private @mixed_result_attrs() -> (memref<1xf32>, memref<2xf32> {test.some_attr}, memref<3xf32>)", mlir-opt -buffer-results-to-out-params -split-input-file -verify-diagnostics ,1 "func.func private @callee() -> memref<1xf32> func.func @call_basic() { %0 = call @callee() : () -> memref<1xf32> ""test.sink""(%0) : (memref<1xf32>) -> () return }", mlir-opt -buffer-results-to-out-params -split-input-file -verify-diagnostics ,1 "func.func private @callee() -> (memref<1xf32>, memref<2xf32>) func.func @call_multiple_result() { %0, %1 = call @callee() : () -> (memref<1xf32>, memref<2xf32>) ""test.sink""(%0, %1) : (memref<1xf32>, memref<2xf32>) -> () }", mlir-opt -buffer-results-to-out-params -split-input-file -verify-diagnostics ,1 "func.func private @callee() -> (i1, memref<1xf32>, i32) func.func @call_non_memref_result() { %0, %1, %2 = call @callee() : () -> (i1, memref<1xf32>, i32) ""test.sink""(%0, %1, %2) : (i1, memref<1xf32>, i32) -> () }", mlir-opt -buffer-results-to-out-params -split-input-file -verify-diagnostics ,1 "func.func private @callee() -> (memref) func.func @call_non_memref_result() { %0 = call @callee() : () -> (memref) ""test.sink""(%0) : (memref) -> () }", mlir-opt -buffer-results-to-out-params -split-input-file -verify-diagnostics ,1 "module attributes {test.simple} { func.func @aap() { return } func.func @kat() { return } }"," mlir-opt -symbol-privatize=exclude=""aap"" ",1 "func.func @test1(%arg0: i32, %arg1 : i32) -> () { %cast = ""test.cast""(%arg0, %arg1) : (i32, i32) -> (i32) %non_terminator = arith.addi %cast, %cast : i32 ""test.return""(%cast, %non_terminator) : (i32, i32) -> () }", mlir-opt -allow-unregistered-dialect -split-input-file -test-pattern-selective-replacement -verify-diagnostics ,1 "func.func @to_sdot(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul : vector<4xi32> into i32 return %red : i32 } func.func @to_sdot_acc(%arg0: vector<4xi8>, %arg1: vector<4xi8>, %acc: i32) -> i32 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul, %acc : vector<4xi32> into i32 return %red : i32 } func.func @to_sdot_i64(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i64 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi64> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi64> %mul = arith.muli %lhs, %rhs : vector<4xi64> %red = vector.reduction , %mul : vector<4xi64> into i64 return %red : i64 } func.func @to_sdot_acc_i64(%arg0: vector<4xi8>, %arg1: vector<4xi8>, %acc: i64) -> i64 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi64> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi64> %mul = arith.muli %lhs, %rhs : vector<4xi64> %red = vector.reduction , %mul, %acc : vector<4xi64> into i64 return %red : i64 } func.func @to_udot(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i32 { %lhs = arith.extui %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extui %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul : vector<4xi32> into i32 return %red : i32 } func.func @to_udot_acc(%arg0: vector<4xi8>, %arg1: vector<4xi8>, %acc: i32) -> i32 { %lhs = arith.extui %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extui %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul, %acc : vector<4xi32> into i32 return %red : i32 } func.func @to_signed_unsigned_dot(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extui %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul : vector<4xi32> into i32 return %red : i32 } func.func @to_signed_unsigned_dot_acc(%arg0: vector<4xi8>, %arg1: vector<4xi8>, %acc: i32) -> i32 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extui %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul, %acc : vector<4xi32> into i32 return %red : i32 } func.func @to_unsigned_signed_dot(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i32 { %lhs = arith.extui %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul : vector<4xi32> into i32 return %red : i32 } func.func @to_unsigned_signed_dot_acc(%arg0: vector<4xi8>, %arg1: vector<4xi8>, %acc: i32) -> i32 { %lhs = arith.extui %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul, %acc : vector<4xi32> into i32 return %red : i32 } func.func @to_sdot_vector3(%arg0: vector<3xi8>, %arg1: vector<3xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<3xi8> to vector<3xi32> %rhs = arith.extsi %arg1 : vector<3xi8> to vector<3xi32> %mul = arith.muli %lhs, %rhs : vector<3xi32> %red = vector.reduction , %mul : vector<3xi32> into i32 return %red : i32 }", mlir-opt --split-input-file --verify-diagnostics --test-vector-reduction-to-spirv-dot-prod -o - ,1 "func.func @too_short(%arg0: vector<2xi8>, %arg1: vector<2xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<2xi8> to vector<2xi32> %rhs = arith.extsi %arg1 : vector<2xi8> to vector<2xi32> %mul = arith.muli %lhs, %rhs : vector<2xi32> %red = vector.reduction , %mul : vector<2xi32> into i32 return %red : i32 } func.func @too_long(%arg0: vector<6xi8>, %arg1: vector<6xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<6xi8> to vector<6xi32> %rhs = arith.extsi %arg1 : vector<6xi8> to vector<6xi32> %mul = arith.muli %lhs, %rhs : vector<6xi32> %red = vector.reduction , %mul : vector<6xi32> into i32 return %red : i32 } func.func @wrong_reduction_kind(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi32> %mul = arith.muli %lhs, %rhs : vector<4xi32> %red = vector.reduction , %mul : vector<4xi32> into i32 return %red : i32 } func.func @wrong_arith_op(%arg0: vector<4xi8>, %arg1: vector<4xi8>) -> i32 { %lhs = arith.extsi %arg0 : vector<4xi8> to vector<4xi32> %rhs = arith.extsi %arg1 : vector<4xi8> to vector<4xi32> %add = arith.addi %lhs, %rhs : vector<4xi32> %red = vector.reduction , %add : vector<4xi32> into i32 return %red : i32 }", mlir-opt --split-input-file --verify-diagnostics --test-vector-reduction-to-spirv-dot-prod -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @bitcast(%arg0 : vector<2xf32>, %arg1: vector<2xf16>) -> (vector<4xf16>, vector<1xf32>) { %0 = vector.bitcast %arg0 : vector<2xf32> to vector<4xf16> %1 = vector.bitcast %arg1 : vector<2xf16> to vector<1xf32> return %0, %1: vector<4xf16>, vector<1xf32> } } ", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @bitcast(%arg0 : vector<2xf32>, %arg1: vector<2xf16>) -> (vector<4xf16>, vector<1xf32>) { %0 = vector.bitcast %arg0 : vector<2xf32> to vector<4xf16> %1 = vector.bitcast %arg1 : vector<2xf16> to vector<1xf32> return %0, %1: vector<4xf16>, vector<1xf32> } } ", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @cl_fma(%a: vector<4xf32>, %b: vector<4xf32>, %c: vector<4xf32>) -> vector<4xf32> { %0 = vector.fma %a, %b, %c: vector<4xf32> return %0 : vector<4xf32> } func.func @cl_fma_size1_vector(%a: vector<1xf32>, %b: vector<1xf32>, %c: vector<1xf32>) -> vector<1xf32> { %0 = vector.fma %a, %b, %c: vector<1xf32> return %0 : vector<1xf32> } func.func @cl_reduction_maxf(%v : vector<3xf32>, %s: f32) -> f32 { %reduce = vector.reduction , %v, %s : vector<3xf32> into f32 return %reduce : f32 } func.func @cl_reduction_minf(%v : vector<3xf32>, %s: f32) -> f32 { %reduce = vector.reduction , %v, %s : vector<3xf32> into f32 return %reduce : f32 } func.func @cl_reduction_maxsi(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 } func.func @cl_reduction_minsi(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 } func.func @cl_reduction_maxui(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 } func.func @cl_reduction_minui(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 } } ", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @broadcast(%arg0 : f32) -> (vector<4xf32>, vector<2xf32>) { %0 = vector.broadcast %arg0 : f32 to vector<4xf32> %1 = vector.broadcast %arg0 : f32 to vector<2xf32> return %0, %1: vector<4xf32>, vector<2xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract(%arg0 : vector<2xf32>) -> (vector<1xf32>, f32) { %0 = ""vector.extract""(%arg0) {position = [0]} : (vector<2xf32>) -> vector<1xf32> %1 = ""vector.extract""(%arg0) {position = [1]} : (vector<2xf32>) -> f32 return %0, %1: vector<1xf32>, f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_size1_vector(%arg0 : vector<1xf32>) -> f32 { %0 = vector.extract %arg0[0] : vector<1xf32> return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert(%arg0 : vector<4xf32>, %arg1: f32) -> vector<4xf32> { %1 = vector.insert %arg1, %arg0[2] : f32 into vector<4xf32> return %1: vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_index_vector(%arg0 : vector<4xindex>, %arg1: index) -> vector<4xindex> { %1 = vector.insert %arg1, %arg0[2] : index into vector<4xindex> return %1: vector<4xindex> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_size1_vector(%arg0 : vector<1xf32>, %arg1: f32) -> vector<1xf32> { %1 = vector.insert %arg1, %arg0[0] : f32 into vector<1xf32> return %1 : vector<1xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_element(%arg0 : vector<4xf32>, %id : i32) -> f32 { %0 = vector.extractelement %arg0[%id : i32] : vector<4xf32> return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_element_cst(%arg0 : vector<4xf32>) -> f32 { %idx = arith.constant 1 : i32 %0 = vector.extractelement %arg0[%idx : i32] : vector<4xf32> return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_element_index(%arg0 : vector<4xf32>, %id : index) -> f32 { %0 = vector.extractelement %arg0[%id : index] : vector<4xf32> return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_element_size5_vector(%arg0 : vector<5xf32>, %id : i32) -> f32 { %0 = vector.extractelement %arg0[%id : i32] : vector<5xf32> return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_element_size1_vector(%arg0 : f32, %i: index) -> f32 { %bcast = vector.broadcast %arg0 : f32 to vector<1xf32> %0 = vector.extractelement %bcast[%i : index] : vector<1xf32> return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_element_0d_vector(%arg0 : f32) -> f32 { %bcast = vector.broadcast %arg0 : f32 to vector %0 = vector.extractelement %bcast[] : vector return %0: f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @extract_strided_slice(%arg0: vector<4xf32>) -> (vector<2xf32>, vector<1xf32>) { %0 = vector.extract_strided_slice %arg0 {offsets = [1], sizes = [2], strides = [1]} : vector<4xf32> to vector<2xf32> %1 = vector.extract_strided_slice %arg0 {offsets = [1], sizes = [1], strides = [1]} : vector<4xf32> to vector<1xf32> return %0, %1 : vector<2xf32>, vector<1xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_element(%val: f32, %arg0 : vector<4xf32>, %id : i32) -> vector<4xf32> { %0 = vector.insertelement %val, %arg0[%id : i32] : vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_element_cst(%val: f32, %arg0 : vector<4xf32>) -> vector<4xf32> { %idx = arith.constant 2 : i32 %0 = vector.insertelement %val, %arg0[%idx : i32] : vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_element_index(%val: f32, %arg0 : vector<4xf32>, %id : index) -> vector<4xf32> { %0 = vector.insertelement %val, %arg0[%id : index] : vector<4xf32> return %0: vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_element_size5_vector(%val: f32, %arg0 : vector<5xf32>, %id : i32) -> vector<5xf32> { %0 = vector.insertelement %val, %arg0[%id : i32] : vector<5xf32> return %0 : vector<5xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_element_size1_vector(%scalar: f32, %vector : vector<1xf32>, %i: index) -> vector<1xf32> { %0 = vector.insertelement %scalar, %vector[%i : index] : vector<1xf32> return %0: vector<1xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_element_0d_vector(%scalar: f32, %vector : vector) -> vector { %0 = vector.insertelement %scalar, %vector[] : vector return %0: vector }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_strided_slice(%arg0: vector<2xf32>, %arg1: vector<4xf32>) -> vector<4xf32> { %0 = vector.insert_strided_slice %arg0, %arg1 {offsets = [1], strides = [1]} : vector<2xf32> into vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @insert_size1_vector(%arg0 : vector<1xf32>, %arg1: vector<3xf32>) -> vector<3xf32> { %1 = vector.insert_strided_slice %arg0, %arg1 {offsets = [2], strides = [1]} : vector<1xf32> into vector<3xf32> return %1 : vector<3xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @fma(%a: vector<4xf32>, %b: vector<4xf32>, %c: vector<4xf32>) -> vector<4xf32> { %0 = vector.fma %a, %b, %c: vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @fma_size1_vector(%a: vector<1xf32>, %b: vector<1xf32>, %c: vector<1xf32>) -> vector<1xf32> { %0 = vector.fma %a, %b, %c: vector<1xf32> return %0 : vector<1xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @splat(%f : f32) -> vector<4xf32> { %splat = vector.splat %f : vector<4xf32> return %splat : vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @splat_size1_vector(%f : f32) -> vector<1xf32> { %splat = vector.splat %f : vector<1xf32> return %splat : vector<1xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @shuffle(%v0 : vector<1xf32>, %v1: vector<1xf32>) -> vector<4xf32> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 1, 0] : vector<1xf32>, vector<1xf32> return %shuffle : vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @shuffle_index_vector(%v0 : vector<1xindex>, %v1: vector<1xindex>) -> vector<4xindex> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 1, 0] : vector<1xindex>, vector<1xindex> return %shuffle : vector<4xindex> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @shuffle(%v0 : vector<3xf32>, %v1: vector<3xf32>) -> vector<4xf32> { %shuffle = vector.shuffle %v0, %v1 [3, 2, 5, 1] : vector<3xf32>, vector<3xf32> return %shuffle : vector<4xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @shuffle(%v0 : vector<2x16xf32>, %v1: vector<1x16xf32>) -> vector<3x16xf32> { %shuffle = vector.shuffle %v0, %v1 [0, 1, 2] : vector<2x16xf32>, vector<1x16xf32> return %shuffle : vector<3x16xf32> }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_add(%v : vector<4xi32>) -> i32 { %reduce = vector.reduction , %v : vector<4xi32> into i32 return %reduce : i32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_mul(%v : vector<3xf32>, %s: f32) -> f32 { %reduce = vector.reduction , %v, %s : vector<3xf32> into f32 return %reduce : f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_maxf(%v : vector<3xf32>, %s: f32) -> f32 { %reduce = vector.reduction , %v, %s : vector<3xf32> into f32 return %reduce : f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_minf(%v : vector<3xf32>, %s: f32) -> f32 { %reduce = vector.reduction , %v, %s : vector<3xf32> into f32 return %reduce : f32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_maxsi(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_minsi(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_maxui(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @reduction_minui(%v : vector<3xi32>, %s: i32) -> i32 { %reduce = vector.reduction , %v, %s : vector<3xi32> into i32 return %reduce : i32 }", mlir-opt -split-input-file -convert-vector-to-spirv -verify-diagnostics -o - ,1 "func.func @parallel_loop_bidy_bidx(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %buf : memref, %res : memref) { %step = arith.constant 2 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) { %val = memref.load %buf[%i0, %i1] : memref memref.store %val, %res[%i1, %i0] : memref } { mapping = [#gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>] } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_loop_tiled(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %buf : memref, %res : memref) { %zero = arith.constant 0 : index %one = arith.constant 1 : index %four = arith.constant 4 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%four, %four) { scf.parallel (%si0, %si1) = (%zero, %zero) to (%four, %four) step (%one, %one) { %idx0 = arith.addi %i0, %si0 : index %idx1 = arith.addi %i1, %si1 : index %val = memref.load %buf[%idx0, %idx1] : memref memref.store %val, %res[%idx1, %idx0] : memref } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_loop_bidy_seq(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %buf : memref, %res : memref) { %step = arith.constant 2 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) { %val = memref.load %buf[%i0, %i1] : memref memref.store %val, %res[%i1, %i0] : memref } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_loop_tiled_seq(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %buf : memref, %res : memref) { %zero = arith.constant 0 : index %one = arith.constant 1 : index %four = arith.constant 4 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%four, %four) { scf.parallel (%si0, %si1) = (%zero, %zero) to (%four, %four) step (%one, %one) { %idx0 = arith.addi %i0, %si0 : index %idx1 = arith.addi %i1, %si1 : index %val = memref.load %buf[%idx0, %idx1] : memref memref.store %val, %res[%idx1, %idx0] : memref } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "#map1 = affine_map<(d0)[s0] -> (2, -d0 + s0)> #map2 = affine_map<(d0)[s0] -> (3, -d0 + s0)> module { func.func @sum(%arg0: memref>, %arg1: memref>, %arg2: memref>) { %c1 = arith.constant 1 : index %c0 = arith.constant 0 : index %c3 = arith.constant 3 : index %c2 = arith.constant 2 : index %0 = memref.dim %arg0, %c0 : memref> %1 = memref.dim %arg0, %c1 : memref> scf.parallel (%arg3, %arg4) = (%c0, %c0) to (%0, %1) step (%c2, %c3) { %2 = memref.dim %arg0, %c0 : memref> %3 = affine.min #map1(%arg3)[%2] %squared_min = arith.muli %3, %3 : index %4 = memref.dim %arg0, %c1 : memref> %d = arith.subi %4, %arg4 : index %5 = arith.minsi %c3, %d : index %6 = memref.subview %arg0[%arg3, %arg4][%squared_min, %5][%c1, %c1] : memref> to memref> %7 = memref.dim %arg1, %c0 : memref> %8 = affine.min #map1(%arg3)[%7] %9 = memref.dim %arg1, %c1 : memref> %10 = affine.min #map2(%arg4)[%9] %11 = memref.subview %arg1[%arg3, %arg4][%8, %10][%c1, %c1] : memref> to memref> %12 = memref.dim %arg2, %c0 : memref> %13 = affine.min #map1(%arg3)[%12] %14 = memref.dim %arg2, %c1 : memref> %15 = affine.min #map2(%arg4)[%14] %16 = memref.subview %arg2[%arg3, %arg4][%13, %15][%c1, %c1] : memref> to memref> scf.parallel (%arg5, %arg6) = (%c0, %c0) to (%squared_min, %5) step (%c1, %c1) { %17 = memref.load %6[%arg5, %arg6] : memref> %18 = memref.load %11[%arg5, %arg6] : memref> %19 = memref.load %16[%arg5, %arg6] : memref> %20 = arith.addf %17, %18 : f32 memref.store %20, %16[%arg5, %arg6] : memref> scf.yield } {mapping = [#gpu.loop_dim_map (d0), map = (d0) -> (d0), processor = thread_x>, #gpu.loop_dim_map (d0), map = (d0) -> (d0), processor = thread_y>]} scf.yield } {mapping = [#gpu.loop_dim_map (d0), map = (d0) -> (d0), processor = block_x>, #gpu.loop_dim_map (d0), map = (d0) -> (d0), processor = block_y>]} return } }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_loop_optional_attr() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index scf.parallel (%i0) = (%c0) to (%c1) step (%c1) { } { mapping = [#gpu.loop_dim_map (d0), bound = (d0) -> (d0)>], optional_attr = 1 } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_double_map(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %buf : memref, %res : memref) { %four = arith.constant 4 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%four, %four) { } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_loop_loop_variant_bound(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %buf : memref, %res : memref) { %zero = arith.constant 0 : index %one = arith.constant 1 : index %four = arith.constant 4 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%four, %four) { scf.parallel (%si0, %si1) = (%zero, %zero) to (%i0, %i1) step (%one, %one) { %idx0 = arith.addi %i0, %si0 : index %idx1 = arith.addi %i1, %si1 : index %val = memref.load %buf[%idx0, %idx1] : memref memref.store %val, %res[%idx1, %idx0] : memref } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } } { mapping = [ #gpu.loop_dim_map (d0), bound = (d0) -> (d0)>, #gpu.loop_dim_map (d0), bound = (d0) -> (d0)> ] } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @parallel_no_annotations(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %buf : memref, %res : memref) { %four = arith.constant 4 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%four, %four) { } return }", mlir-opt -convert-parallel-loops-to-gpu -split-input-file -verify-diagnostics ,1 "func.func @step_var(%A : memref, %B : memref) { affine.for %i = 5 to 15 step 4 { affine.for %j = 3 to 19 step 7 { %0 = memref.load %A[%i, %j] : memref memref.store %0, %B[%i, %j] : memref } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=1}))"" ",1 "func.func @one_d_loop(%A : memref, %B : memref) { affine.for %i = 0 to 42 { %0 = memref.load %A[%i] : memref memref.store %0, %B[%i] : memref } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=0 gpu-thread-dims=1}))"" ",1 "func.func @one_d_loop(%A : memref, %B : memref) { affine.for %i = 0 to 42 { %0 = memref.load %A[%i] : memref memref.store %0, %B[%i] : memref } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=0}))"" ",1 "func.func @step_1(%A : memref, %B : memref) { affine.for %i = 0 to 42 { affine.for %j = 0 to 10 { affine.for %ii = 2 to 16 { affine.for %jj = 5 to 17 { %0 = memref.load %A[%i, %j, %ii, %jj] : memref memref.store %0, %B[%i, %j, %ii, %jj] : memref } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=1 gpu-thread-dims=1}))"" ",1 "func.func @step_1(%A : memref, %B : memref) { affine.for %i = 0 to 42 { affine.for %j = 0 to 10 { affine.for %ii = 2 to 16 { affine.for %jj = 5 to 17 { %0 = memref.load %A[%i, %j, %ii, %jj] : memref memref.store %0, %B[%i, %j, %ii, %jj] : memref } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-affine-for-to-gpu{gpu-block-dims=2 gpu-thread-dims=2}))"" ",1 "func.func @ops(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32, %arg4: f64) { %0 = math.exp %arg0 : f32 %1 = math.exp2 %arg0 : f32 %2 = math.sqrt %arg0 : f32 %3 = math.sqrt %arg4 : f64 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @absi(%arg0: i32) -> i32 { %0 = math.absi %arg0 : i32 return %0 : i32 }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @log1p(%arg0 : f32) { %0 = math.log1p %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @log1p_fmf(%arg0 : f32) { %0 = math.log1p %arg0 fastmath : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @log1p_2dvector(%arg0 : vector<4x3xf32>) { %0 = math.log1p %arg0 : vector<4x3xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @log1p_2dvector_fmf(%arg0 : vector<4x3xf32>) { %0 = math.log1p %arg0 fastmath : vector<4x3xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @expm1(%arg0 : f32) { %0 = math.expm1 %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @expm1_fmf(%arg0 : f32) { %0 = math.expm1 %arg0 fastmath : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @expm1_vector(%arg0 : vector<4xf32>) { %0 = math.expm1 %arg0 : vector<4xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @expm1_vector_fmf(%arg0 : vector<4xf32>) { %0 = math.expm1 %arg0 fastmath : vector<4xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @rsqrt(%arg0 : f32) { %0 = math.rsqrt %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @sine(%arg0 : f32) { %0 = math.sin %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @ctlz(%arg0 : i32) { %0 = math.ctlz %arg0 : i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @cttz(%arg0 : i32) { %0 = math.cttz %arg0 : i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @cttz_vec(%arg0 : vector<4xi32>) { %0 = math.cttz %arg0 : vector<4xi32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @ctpop(%arg0 : i32) { %0 = math.ctpop %arg0 : i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @ctpop_vector(%arg0 : vector<3xi32>) { %0 = math.ctpop %arg0 : vector<3xi32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @rsqrt_double(%arg0 : f64) { %0 = math.rsqrt %arg0 : f64 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @rsqrt_double_fmf(%arg0 : f64) { %0 = math.rsqrt %arg0 fastmath : f64 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @rsqrt_vector(%arg0 : vector<4xf32>) { %0 = math.rsqrt %arg0 : vector<4xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @rsqrt_vector_fmf(%arg0 : vector<4xf32>) { %0 = math.rsqrt %arg0 fastmath : vector<4xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @rsqrt_multidim_vector(%arg0 : vector<4x3xf32>) { %0 = math.rsqrt %arg0 : vector<4x3xf32> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @fpowi(%arg0 : f64, %arg1 : i32) { %0 = math.fpowi %arg0, %arg1 : f64, i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @powf(%arg0 : f64) { %0 = math.powf %arg0, %arg0 : f64 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @round(%arg0 : f32) { %0 = math.round %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @roundeven(%arg0 : f32) { %0 = math.roundeven %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @trunc(%arg0 : f32) { %0 = math.trunc %arg0 : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "func.func @fastmath(%arg0 : f32, %arg1 : vector<4xf32>) { %0 = math.trunc %arg0 fastmath : f32 %1 = math.powf %arg0, %arg0 fastmath : f32 %2 = math.sqrt %arg0 fastmath : f32 %3 = math.fma %arg0, %arg0, %arg0 fastmath : f32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm))"" ",1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @simple_loop(%begin: i32, %end: i32, %step: i32) { cf.br ^bb1 ^bb1: cf.br ^bb2(%begin : i32) ^bb2(%0: i32): %1 = arith.cmpi slt, %0, %end : i32 cf.cond_br %1, ^bb3, ^bb4 ^bb3: %2 = arith.addi %0, %step : i32 cf.br ^bb2(%2 : i32) ^bb4: return } }", mlir-opt -split-input-file -convert-cf-to-spirv -verify-diagnostics ,1 "func.func @vector_scalable_memcopy(%src : memref, %dst : memref, %size : index) { %c0 = arith.constant 0 : index %c4 = arith.constant 4 : index %vs = vector.vscale %step = arith.muli %c4, %vs : index scf.for %i0 = %c0 to %size step %step { %0 = vector.load %src[%i0] : memref, vector<[4]xf32> vector.store %0, %dst[%i0] : memref, vector<[4]xf32> } return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' | mlir-opt ,1 "func.func @reduce_add_f32(%arg0: vector<16xf32>) -> f32 { %0 = vector.reduction , %arg0 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_add_f32(%arg0: vector<16xf32>) -> f32 { %0 = vector.reduction , %arg0 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_mul_f32(%arg0: vector<16xf32>) -> f32 { %0 = vector.reduction , %arg0 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_mul_f32(%arg0: vector<16xf32>) -> f32 { %0 = vector.reduction , %arg0 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_add_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_add_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_mul_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_mul_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_minf_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_minf_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_maxf_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_maxf_f32(%arg0: vector<16xf32>, %mask : vector<16xi1>) -> f32 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<16xf32> into f32 } : vector<16xi1> -> f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_add_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_add_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_mul_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_mul_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_minui_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_minui_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_maxui_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_maxui_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_minsi_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_minsi_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_maxsi_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_maxsi_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_or_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_or_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_and_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_and_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_xor_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_reduce_xor_i8(%arg0: vector<32xi8>, %mask : vector<32xi1>) -> i8 { %0 = vector.mask %mask { vector.reduction , %arg0 : vector<32xi8> into i8 } : vector<32xi1> -> i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file ,1 "func.func @bitcast_f32_to_i32_vector_0d(%input: vector) -> vector { %0 = vector.bitcast %input : vector to vector return %0 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @bitcast_f32_to_i32_vector(%input: vector<16xf32>) -> vector<16xi32> { %0 = vector.bitcast %input : vector<16xf32> to vector<16xi32> return %0 : vector<16xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @bitcast_i8_to_f32_vector(%input: vector<64xi8>) -> vector<16xf32> { %0 = vector.bitcast %input : vector<64xi8> to vector<16xf32> return %0 : vector<16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @bitcast_index_to_i8_vector(%input: vector<16xindex>) -> vector<128xi8> { %0 = vector.bitcast %input : vector<16xindex> to vector<128xi8> return %0 : vector<128xi8> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec0d_from_f32(%arg0: f32) -> vector { %0 = vector.broadcast %arg0 : f32 to vector return %0 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec0d_from_vec0d(%arg0: vector) -> vector { %0 = vector.broadcast %arg0 : vector to vector return %0 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec1d_from_f32(%arg0: f32) -> vector<2xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec1d_from_index(%arg0: index) -> vector<2xindex> { %0 = vector.broadcast %arg0 : index to vector<2xindex> return %0 : vector<2xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec2d_from_scalar(%arg0: f32) -> vector<2x3xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2x3xf32> return %0 : vector<2x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec3d_from_scalar(%arg0: f32) -> vector<2x3x4xf32> { %0 = vector.broadcast %arg0 : f32 to vector<2x3x4xf32> return %0 : vector<2x3x4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec1d_from_vec1d(%arg0: vector<2xf32>) -> vector<2xf32> { %0 = vector.broadcast %arg0 : vector<2xf32> to vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec2d_from_vec0d(%arg0: vector) -> vector<3x2xf32> { %0 = vector.broadcast %arg0 : vector to vector<3x2xf32> return %0 : vector<3x2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec2d_from_vec1d(%arg0: vector<2xf32>) -> vector<3x2xf32> { %0 = vector.broadcast %arg0 : vector<2xf32> to vector<3x2xf32> return %0 : vector<3x2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec2d_from_index_vec1d(%arg0: vector<2xindex>) -> vector<3x2xindex> { %0 = vector.broadcast %arg0 : vector<2xindex> to vector<3x2xindex> return %0 : vector<3x2xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec3d_from_vec1d(%arg0: vector<2xf32>) -> vector<4x3x2xf32> { %0 = vector.broadcast %arg0 : vector<2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_vec3d_from_vec2d(%arg0: vector<3x2xf32>) -> vector<4x3x2xf32> { %0 = vector.broadcast %arg0 : vector<3x2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_stretch(%arg0: vector<1xf32>) -> vector<4xf32> { %0 = vector.broadcast %arg0 : vector<1xf32> to vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_stretch_at_start(%arg0: vector<1x4xf32>) -> vector<3x4xf32> { %0 = vector.broadcast %arg0 : vector<1x4xf32> to vector<3x4xf32> return %0 : vector<3x4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_stretch_at_end(%arg0: vector<4x1xf32>) -> vector<4x3xf32> { %0 = vector.broadcast %arg0 : vector<4x1xf32> to vector<4x3xf32> return %0 : vector<4x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @broadcast_stretch_in_middle(%arg0: vector<4x1x2xf32>) -> vector<4x3x2xf32> { %0 = vector.broadcast %arg0 : vector<4x1x2xf32> to vector<4x3x2xf32> return %0 : vector<4x3x2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @outerproduct(%arg0: vector<2xf32>, %arg1: vector<3xf32>) -> vector<2x3xf32> { %2 = vector.outerproduct %arg0, %arg1 : vector<2xf32>, vector<3xf32> return %2 : vector<2x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @outerproduct_index(%arg0: vector<2xindex>, %arg1: vector<3xindex>) -> vector<2x3xindex> { %2 = vector.outerproduct %arg0, %arg1 : vector<2xindex>, vector<3xindex> return %2 : vector<2x3xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @outerproduct_add(%arg0: vector<2xf32>, %arg1: vector<3xf32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %2 = vector.outerproduct %arg0, %arg1, %arg2 : vector<2xf32>, vector<3xf32> return %2 : vector<2x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_float_add_outerprod(%arg0: vector<2xf32>, %arg1: f32, %arg2: vector<2xf32>, %m: vector<2xi1>) -> vector<2xf32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xf32>, f32 } : vector<2xi1> -> vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_float_mul_outerprod(%arg0: vector<2xf32>, %arg1: f32, %arg2: vector<2xf32>, %m: vector<2xi1>) -> vector<2xf32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xf32>, f32 } : vector<2xi1> -> vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_float_max_outerprod(%arg0: vector<2xf32>, %arg1: f32, %arg2: vector<2xf32>, %m: vector<2xi1>) -> vector<2xf32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xf32>, f32 } : vector<2xi1> -> vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_float_min_outerprod(%arg0: vector<2xf32>, %arg1: f32, %arg2: vector<2xf32>, %m: vector<2xi1>) -> vector<2xf32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xf32>, f32 } : vector<2xi1> -> vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_int_add_outerprod(%arg0: vector<2xi32>, %arg1: i32, %arg2: vector<2xi32>, %m: vector<2xi1>) -> vector<2xi32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xi32>, i32 } : vector<2xi1> -> vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_int_mul_outerprod(%arg0: vector<2xi32>, %arg1: i32, %arg2: vector<2xi32>, %m: vector<2xi1>) -> vector<2xi32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xi32>, i32 } : vector<2xi1> -> vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_int_max_outerprod(%arg0: vector<2xi32>, %arg1: i32, %arg2: vector<2xi32>, %m: vector<2xi1>) -> vector<2xi32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xi32>, i32 } : vector<2xi1> -> vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_int_min_outerprod(%arg0: vector<2xi32>, %arg1: i32, %arg2: vector<2xi32>, %m: vector<2xi1>) -> vector<2xi32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xi32>, i32 } : vector<2xi1> -> vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_int_and_outerprod(%arg0: vector<2xi32>, %arg1: i32, %arg2: vector<2xi32>, %m: vector<2xi1>) -> vector<2xi32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xi32>, i32 } : vector<2xi1> -> vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_int_or_outerprod(%arg0: vector<2xi32>, %arg1: i32, %arg2: vector<2xi32>, %m: vector<2xi1>) -> vector<2xi32> { %0 = vector.mask %m { vector.outerproduct %arg0, %arg1, %arg2 {kind = #vector.kind} : vector<2xi32>, i32 } : vector<2xi1> -> vector<2xi32> return %0 : vector<2xi32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @shuffle_0D_direct(%arg0: vector) -> vector<3xf32> { %1 = vector.shuffle %arg0, %arg0 [0, 1, 0] : vector, vector return %1 : vector<3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @shuffle_1D_direct(%arg0: vector<2xf32>, %arg1: vector<2xf32>) -> vector<2xf32> { %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2xf32>, vector<2xf32> return %1 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @shuffle_1D_index_direct(%arg0: vector<2xindex>, %arg1: vector<2xindex>) -> vector<2xindex> { %1 = vector.shuffle %arg0, %arg1 [0, 1] : vector<2xindex>, vector<2xindex> return %1 : vector<2xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @shuffle_1D(%arg0: vector<2xf32>, %arg1: vector<3xf32>) -> vector<5xf32> { %1 = vector.shuffle %arg0, %arg1 [4, 3, 2, 1, 0] : vector<2xf32>, vector<3xf32> return %1 : vector<5xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @shuffle_2D(%a: vector<1x4xf32>, %b: vector<2x4xf32>) -> vector<3x4xf32> { %1 = vector.shuffle %a, %b[1, 0, 2] : vector<1x4xf32>, vector<2x4xf32> return %1 : vector<3x4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_element_0d(%a: vector) -> f32 { %1 = vector.extractelement %a[] : vector return %1 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_element(%arg0: vector<16xf32>) -> f32 { %0 = arith.constant 15 : i32 %1 = vector.extractelement %arg0[%0 : i32]: vector<16xf32> return %1 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_element_index(%arg0: vector<16xf32>) -> f32 { %0 = arith.constant 15 : index %1 = vector.extractelement %arg0[%0 : index]: vector<16xf32> return %1 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_element_from_vec_1d(%arg0: vector<16xf32>) -> f32 { %0 = vector.extract %arg0[15]: vector<16xf32> return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_index_element_from_vec_1d(%arg0: vector<16xindex>) -> index { %0 = vector.extract %arg0[15]: vector<16xindex> return %0 : index }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_vec_2d_from_vec_3d(%arg0: vector<4x3x16xf32>) -> vector<3x16xf32> { %0 = vector.extract %arg0[0]: vector<4x3x16xf32> return %0 : vector<3x16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_vec_1d_from_vec_3d(%arg0: vector<4x3x16xf32>) -> vector<16xf32> { %0 = vector.extract %arg0[0, 0]: vector<4x3x16xf32> return %0 : vector<16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_element_from_vec_3d(%arg0: vector<4x3x16xf32>) -> f32 { %0 = vector.extract %arg0[0, 0, 0]: vector<4x3x16xf32> return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_element_0d(%a: f32, %b: vector) -> vector { %1 = vector.insertelement %a, %b[] : vector return %1 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_element(%arg0: f32, %arg1: vector<4xf32>) -> vector<4xf32> { %0 = arith.constant 3 : i32 %1 = vector.insertelement %arg0, %arg1[%0 : i32] : vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_element_index(%arg0: f32, %arg1: vector<4xf32>) -> vector<4xf32> { %0 = arith.constant 3 : index %1 = vector.insertelement %arg0, %arg1[%0 : index] : vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_element_into_vec_1d(%arg0: f32, %arg1: vector<4xf32>) -> vector<4xf32> { %0 = vector.insert %arg0, %arg1[3] : f32 into vector<4xf32> return %0 : vector<4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_index_element_into_vec_1d(%arg0: index, %arg1: vector<4xindex>) -> vector<4xindex> { %0 = vector.insert %arg0, %arg1[3] : index into vector<4xindex> return %0 : vector<4xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_vec_2d_into_vec_3d(%arg0: vector<8x16xf32>, %arg1: vector<4x8x16xf32>) -> vector<4x8x16xf32> { %0 = vector.insert %arg0, %arg1[3] : vector<8x16xf32> into vector<4x8x16xf32> return %0 : vector<4x8x16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_vec_1d_into_vec_3d(%arg0: vector<16xf32>, %arg1: vector<4x8x16xf32>) -> vector<4x8x16xf32> { %0 = vector.insert %arg0, %arg1[3, 7] : vector<16xf32> into vector<4x8x16xf32> return %0 : vector<4x8x16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_element_into_vec_3d(%arg0: f32, %arg1: vector<4x8x16xf32>) -> vector<4x8x16xf32> { %0 = vector.insert %arg0, %arg1[3, 7, 15] : f32 into vector<4x8x16xf32> return %0 : vector<4x8x16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_type_cast(%arg0: memref<8x8x8xf32>) -> memref> { %0 = vector.type_cast %arg0: memref<8x8x8xf32> to memref> return %0 : memref> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_index_type_cast(%arg0: memref<8x8x8xindex>) -> memref> { %0 = vector.type_cast %arg0: memref<8x8x8xindex> to memref> return %0 : memref> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_type_cast_non_zero_addrspace(%arg0: memref<8x8x8xf32, 3>) -> memref, 3> { %0 = vector.type_cast %arg0: memref<8x8x8xf32, 3> to memref, 3> return %0 : memref, 3> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_i1(%arg0: i1) { vector.print %arg0 : i1 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_i4(%arg0: i4) { vector.print %arg0 : i4 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_si4(%arg0: si4) { vector.print %arg0 : si4 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_ui4(%arg0: ui4) { vector.print %arg0 : ui4 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_i32(%arg0: i32) { vector.print %arg0 : i32 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_ui32(%arg0: ui32) { vector.print %arg0 : ui32 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_i40(%arg0: i40) { vector.print %arg0 : i40 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_si40(%arg0: si40) { vector.print %arg0 : si40 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_ui40(%arg0: ui40) { vector.print %arg0 : ui40 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_i64(%arg0: i64) { vector.print %arg0 : i64 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_ui64(%arg0: ui64) { vector.print %arg0 : ui64 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_index(%arg0: index) { vector.print %arg0 : index return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_f32(%arg0: f32) { vector.print %arg0 : f32 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_scalar_f64(%arg0: f64) { vector.print %arg0 : f64 return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_vector_0d(%arg0: vector) { vector.print %arg0 : vector return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_print_vector(%arg0: vector<2x2xf32>) { vector.print %arg0 : vector<2x2xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_strided_slice1(%arg0: vector<4xf32>) -> vector<2xf32> { %0 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4xf32> to vector<2xf32> return %0 : vector<2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_strided_index_slice1(%arg0: vector<4xindex>) -> vector<2xindex> { %0 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4xindex> to vector<2xindex> return %0 : vector<2xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_strided_slice2(%arg0: vector<4x8xf32>) -> vector<2x8xf32> { %0 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8xf32> to vector<2x8xf32> return %0 : vector<2x8xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_strided_slice3(%arg0: vector<4x8xf32>) -> vector<2x2xf32> { %0 = vector.extract_strided_slice %arg0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x8xf32> to vector<2x2xf32> return %0 : vector<2x2xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_strided_slice1(%b: vector<4x4xf32>, %c: vector<4x4x4xf32>) -> vector<4x4x4xf32> { %0 = vector.insert_strided_slice %b, %c {offsets = [2, 0, 0], strides = [1, 1]} : vector<4x4xf32> into vector<4x4x4xf32> return %0 : vector<4x4x4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_strided_index_slice1(%b: vector<4x4xindex>, %c: vector<4x4x4xindex>) -> vector<4x4x4xindex> { %0 = vector.insert_strided_slice %b, %c {offsets = [2, 0, 0], strides = [1, 1]} : vector<4x4xindex> into vector<4x4x4xindex> return %0 : vector<4x4x4xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_strided_slice2(%a: vector<2x2xf32>, %b: vector<4x4xf32>) -> vector<4x4xf32> { %0 = vector.insert_strided_slice %a, %b {offsets = [2, 2], strides = [1, 1]} : vector<2x2xf32> into vector<4x4xf32> return %0 : vector<4x4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @insert_strided_slice3(%arg0: vector<2x4xf32>, %arg1: vector<16x4x8xf32>) -> vector<16x4x8xf32> { %0 = vector.insert_strided_slice %arg0, %arg1 {offsets = [0, 0, 2], strides = [1, 1]}: vector<2x4xf32> into vector<16x4x8xf32> return %0 : vector<16x4x8xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_fma(%a: vector<8xf32>, %b: vector<2x4xf32>, %c: vector<1x1x1xf32>, %d: vector) -> (vector<8xf32>, vector<2x4xf32>, vector<1x1x1xf32>, vector) { %0 = vector.fma %a, %a, %a : vector<8xf32> %1 = vector.fma %b, %b, %b : vector<2x4xf32> %2 = vector.fma %c, %c, %c : vector<1x1x1xf32> %3 = vector.fma %d, %d, %d : vector return %0, %1, %2, %3: vector<8xf32>, vector<2x4xf32>, vector<1x1x1xf32>, vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_0d_f32(%arg0: vector) -> f32 { %0 = vector.reduction , %arg0 : vector into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_f16(%arg0: vector<16xf16>) -> f16 { %0 = vector.reduction , %arg0 : vector<16xf16> into f16 return %0 : f16 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_f32(%arg0: vector<16xf32>) -> f32 { %0 = vector.reduction , %arg0 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_f64(%arg0: vector<16xf64>) -> f64 { %0 = vector.reduction , %arg0 : vector<16xf64> into f64 return %0 : f64 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_i8(%arg0: vector<16xi8>) -> i8 { %0 = vector.reduction , %arg0 : vector<16xi8> into i8 return %0 : i8 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_mul_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_mul_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_fmax_f32(%arg0: vector<16xf32>, %arg1: f32) -> f32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_fmin_f32(%arg0: vector<16xf32>, %arg1: f32) -> f32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xf32> into f32 return %0 : f32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_minui_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_minui_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_maxui_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_maxui_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_minsi_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_minsi_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_maxsi_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_maxsi_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_and_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_and_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_or_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_or_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_xor_i32(%arg0: vector<16xi32>) -> i32 { %0 = vector.reduction , %arg0 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_xor_acc_i32(%arg0: vector<16xi32>, %arg1 : i32) -> i32 { %0 = vector.reduction , %arg0, %arg1 : vector<16xi32> into i32 return %0 : i32 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_i64(%arg0: vector<16xi64>) -> i64 { %0 = vector.reduction , %arg0 : vector<16xi64> into i64 return %0 : i64 }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduce_index(%arg0: vector<16xindex>) -> index { %0 = vector.reduction , %arg0 : vector<16xindex> into index return %0 : index }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @matrix_ops(%A: vector<64xf64>, %B: vector<48xf64>) -> vector<12xf64> { %C = vector.matrix_multiply %A, %B { lhs_rows = 4: i32, lhs_columns = 16: i32 , rhs_columns = 3: i32 } : (vector<64xf64>, vector<48xf64>) -> vector<12xf64> return %C: vector<12xf64> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @matrix_ops_index(%A: vector<64xindex>, %B: vector<48xindex>) -> vector<12xindex> { %C = vector.matrix_multiply %A, %B { lhs_rows = 4: i32, lhs_columns = 16: i32 , rhs_columns = 3: i32 } : (vector<64xindex>, vector<48xindex>) -> vector<12xindex> return %C: vector<12xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transfer_read_1d(%A : memref, %base: index) -> vector<17xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base], %f7 {permutation_map = affine_map<(d0) -> (d0)>} : memref, vector<17xf32> vector.transfer_write %f, %A[%base] {permutation_map = affine_map<(d0) -> (d0)>} : vector<17xf32>, memref return %f: vector<17xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transfer_read_index_1d(%A : memref, %base: index) -> vector<17xindex> { %f7 = arith.constant 7: index %f = vector.transfer_read %A[%base], %f7 {permutation_map = affine_map<(d0) -> (d0)>} : memref, vector<17xindex> vector.transfer_write %f, %A[%base] {permutation_map = affine_map<(d0) -> (d0)>} : vector<17xindex>, memref return %f: vector<17xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transfer_read_2d_to_1d(%A : memref, %base0: index, %base1: index) -> vector<17xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base0, %base1], %f7 {permutation_map = affine_map<(d0, d1) -> (d1)>} : memref, vector<17xf32> return %f: vector<17xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transfer_read_1d_non_zero_addrspace(%A : memref, %base: index) -> vector<17xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base], %f7 {permutation_map = affine_map<(d0) -> (d0)>} : memref, vector<17xf32> vector.transfer_write %f, %A[%base] {permutation_map = affine_map<(d0) -> (d0)>} : vector<17xf32>, memref return %f: vector<17xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transfer_read_1d_inbounds(%A : memref, %base: index) -> vector<17xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base], %f7 {in_bounds = [true]} : memref, vector<17xf32> return %f: vector<17xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transfer_read_1d_mask(%A : memref, %base : index) -> vector<5xf32> { %m = arith.constant dense<[0, 0, 1, 0, 1]> : vector<5xi1> %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base], %f7, %m : memref, vector<5xf32> return %f: vector<5xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @genbool_0d_f() -> vector { %0 = vector.constant_mask [0] : vector return %0 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @genbool_0d_t() -> vector { %0 = vector.constant_mask [1] : vector return %0 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @genbool_1d() -> vector<8xi1> { %0 = vector.constant_mask [4] : vector<8xi1> return %0 : vector<8xi1> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @genbool_1d_scalable() -> vector<[8]xi1> { %0 = vector.constant_mask [0] : vector<[8]xi1> return %0 : vector<[8]xi1> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @genbool_2d() -> vector<4x4xi1> { %v = vector.constant_mask [2, 2] : vector<4x4xi1> return %v: vector<4x4xi1> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @create_mask_0d(%a : index) -> vector { %v = vector.create_mask %a : vector return %v: vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @create_mask_1d(%a : index) -> vector<4xi1> { %v = vector.create_mask %a : vector<4xi1> return %v: vector<4xi1> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @create_mask_1d_scalable(%a : index) -> vector<[4]xi1> { %v = vector.create_mask %a : vector<[4]xi1> return %v: vector<[4]xi1> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transpose_0d(%arg0: vector) -> vector { %0 = vector.transpose %arg0, [] : vector to vector return %0 : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @flat_transpose(%arg0: vector<16xf32>) -> vector<16xf32> { %0 = vector.flat_transpose %arg0 { rows = 4: i32, columns = 4: i32 } : vector<16xf32> -> vector<16xf32> return %0 : vector<16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @flat_transpose_index(%arg0: vector<16xindex>) -> vector<16xindex> { %0 = vector.flat_transpose %arg0 { rows = 4: i32, columns = 4: i32 } : vector<16xindex> -> vector<16xindex> return %0 : vector<16xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_load_op(%memref : memref<200x100xf32>, %i : index, %j : index) -> vector<8xf32> { %0 = vector.load %memref[%i, %j] : memref<200x100xf32>, vector<8xf32> return %0 : vector<8xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_load_op_index(%memref : memref<200x100xindex>, %i : index, %j : index) -> vector<8xindex> { %0 = vector.load %memref[%i, %j] : memref<200x100xindex>, vector<8xindex> return %0 : vector<8xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_store_op(%memref : memref<200x100xf32>, %i : index, %j : index) { %val = arith.constant dense<11.0> : vector<4xf32> vector.store %val, %memref[%i, %j] : memref<200x100xf32>, vector<4xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_store_op_index(%memref : memref<200x100xindex>, %i : index, %j : index) { %val = arith.constant dense<11> : vector<4xindex> vector.store %val, %memref[%i, %j] : memref<200x100xindex>, vector<4xindex> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_load_op(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0: index %0 = vector.maskedload %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> return %0 : vector<16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_load_op_index(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xindex>) -> vector<16xindex> { %c0 = arith.constant 0: index %0 = vector.maskedload %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xindex> into vector<16xindex> return %0 : vector<16xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_store_op(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xf32>) { %c0 = arith.constant 0: index vector.maskedstore %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @masked_store_op_index(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xindex>) { %c0 = arith.constant 0: index vector.maskedstore %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xindex> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @gather_op(%arg0: memref, %arg1: vector<3xi32>, %arg2: vector<3xi1>, %arg3: vector<3xf32>) -> vector<3xf32> { %0 = arith.constant 0: index %1 = vector.gather %arg0[%0][%arg1], %arg2, %arg3 : memref, vector<3xi32>, vector<3xi1>, vector<3xf32> into vector<3xf32> return %1 : vector<3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @gather_op_index(%arg0: memref, %arg1: vector<3xindex>, %arg2: vector<3xi1>, %arg3: vector<3xindex>) -> vector<3xindex> { %0 = arith.constant 0: index %1 = vector.gather %arg0[%0][%arg1], %arg2, %arg3 : memref, vector<3xindex>, vector<3xi1>, vector<3xindex> into vector<3xindex> return %1 : vector<3xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @gather_op_multi_dims(%arg0: memref, %arg1: vector<2x3xi32>, %arg2: vector<2x3xi1>, %arg3: vector<2x3xf32>) -> vector<2x3xf32> { %0 = arith.constant 0: index %1 = vector.gather %arg0[%0][%arg1], %arg2, %arg3 : memref, vector<2x3xi32>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %1 : vector<2x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @gather_op_with_mask(%arg0: memref, %arg1: vector<2x3xi32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = arith.constant 0: index %1 = vector.constant_mask [1, 2] : vector<2x3xi1> %2 = vector.gather %arg0[%0][%arg1], %1, %arg2 : memref, vector<2x3xi32>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %2 : vector<2x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @gather_op_with_zero_mask(%arg0: memref, %arg1: vector<2x3xi32>, %arg2: vector<2x3xf32>) -> vector<2x3xf32> { %0 = arith.constant 0: index %1 = vector.constant_mask [0, 0] : vector<2x3xi1> %2 = vector.gather %arg0[%0][%arg1], %1, %arg2 : memref, vector<2x3xi32>, vector<2x3xi1>, vector<2x3xf32> into vector<2x3xf32> return %2 : vector<2x3xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @gather_2d_op(%arg0: memref<4x4xf32>, %arg1: vector<4xi32>, %arg2: vector<4xi1>, %arg3: vector<4xf32>) -> vector<4xf32> { %0 = arith.constant 3 : index %1 = vector.gather %arg0[%0, %0][%arg1], %arg2, %arg3 : memref<4x4xf32>, vector<4xi32>, vector<4xi1>, vector<4xf32> into vector<4xf32> return %1 : vector<4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @scatter_op(%arg0: memref, %arg1: vector<3xi32>, %arg2: vector<3xi1>, %arg3: vector<3xf32>) { %0 = arith.constant 0: index vector.scatter %arg0[%0][%arg1], %arg2, %arg3 : memref, vector<3xi32>, vector<3xi1>, vector<3xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @scatter_op_index(%arg0: memref, %arg1: vector<3xindex>, %arg2: vector<3xi1>, %arg3: vector<3xindex>) { %0 = arith.constant 0: index vector.scatter %arg0[%0][%arg1], %arg2, %arg3 : memref, vector<3xindex>, vector<3xi1>, vector<3xindex> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @scatter_2d_op(%arg0: memref<4x4xf32>, %arg1: vector<4xi32>, %arg2: vector<4xi1>, %arg3: vector<4xf32>) { %0 = arith.constant 3 : index vector.scatter %arg0[%0, %0][%arg1], %arg2, %arg3 : memref<4x4xf32>, vector<4xi32>, vector<4xi1>, vector<4xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @expand_load_op(%arg0: memref, %arg1: vector<11xi1>, %arg2: vector<11xf32>) -> vector<11xf32> { %c0 = arith.constant 0: index %0 = vector.expandload %arg0[%c0], %arg1, %arg2 : memref, vector<11xi1>, vector<11xf32> into vector<11xf32> return %0 : vector<11xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @expand_load_op_index(%arg0: memref, %arg1: vector<11xi1>, %arg2: vector<11xindex>) -> vector<11xindex> { %c0 = arith.constant 0: index %0 = vector.expandload %arg0[%c0], %arg1, %arg2 : memref, vector<11xi1>, vector<11xindex> into vector<11xindex> return %0 : vector<11xindex> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @compress_store_op(%arg0: memref, %arg1: vector<11xi1>, %arg2: vector<11xf32>) { %c0 = arith.constant 0: index vector.compressstore %arg0[%c0], %arg1, %arg2 : memref, vector<11xi1>, vector<11xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @compress_store_op_index(%arg0: memref, %arg1: vector<11xi1>, %arg2: vector<11xindex>) { %c0 = arith.constant 0: index vector.compressstore %arg0[%c0], %arg1, %arg2 : memref, vector<11xi1>, vector<11xindex> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @splat_0d(%a: f32) -> vector { %v = vector.splat %a : vector return %v : vector }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @splat(%a: vector<4xf32>, %b: f32) -> vector<4xf32> { %vb = vector.splat %b : vector<4xf32> %r = arith.mulf %a, %vb : vector<4xf32> return %r : vector<4xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_scalable_insert(%sub: vector<4xf32>, %dsv: vector<[4]xf32>) -> vector<[4]xf32> { %0 = vector.scalable.insert %sub, %dsv[0] : vector<4xf32> into vector<[4]xf32> %1 = vector.scalable.insert %sub, %0[4] : vector<4xf32> into vector<[4]xf32> return %1 : vector<[4]xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @vector_scalable_extract(%vec: vector<[4]xf32>) -> vector<8xf32> { %0 = vector.scalable.extract %vec[0] : vector<8xf32> from vector<[4]xf32> return %0 : vector<8xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @genbool_var_1d(%arg0: index) -> vector<11xi1> { %0 = vector.create_mask %arg0 : vector<11xi1> return %0 : vector<11xi1> } func.func @genbool_var_1d_scalable(%arg0: index) -> vector<[11]xi1> { %0 = vector.create_mask %arg0 : vector<[11]xi1> return %0 : vector<[11]xi1> } func.func @transfer_read_1d(%A : memref, %i: index) -> vector<16xf32> { %d = arith.constant -1.0: f32 %f = vector.transfer_read %A[%i], %d {permutation_map = affine_map<(d0) -> (d0)>} : memref, vector<16xf32> return %f : vector<16xf32> }", mlir-opt --convert-vector-to-llvm='force-32bit-vector-indices=1 use-opaque-pointers=1' ,1 "func.func @genbool_var_1d(%arg0: index) -> vector<11xi1> { %0 = vector.create_mask %arg0 : vector<11xi1> return %0 : vector<11xi1> } func.func @genbool_var_1d_scalable(%arg0: index) -> vector<[11]xi1> { %0 = vector.create_mask %arg0 : vector<[11]xi1> return %0 : vector<[11]xi1> } func.func @transfer_read_1d(%A : memref, %i: index) -> vector<16xf32> { %d = arith.constant -1.0: f32 %f = vector.transfer_read %A[%i], %d {permutation_map = affine_map<(d0) -> (d0)>} : memref, vector<16xf32> return %f : vector<16xf32> }", mlir-opt --convert-vector-to-llvm='force-32bit-vector-indices=0 use-opaque-pointers=1' ,1 "func.func @vector_type_cast(%arg0: memref<8x8x8xf32>) -> memref> { %0 = vector.type_cast %arg0: memref<8x8x8xf32> to memref> return %0 : memref> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @vector_type_cast_non_zero_addrspace(%arg0: memref<8x8x8xf32, 3>) -> memref, 3> { %0 = vector.type_cast %arg0: memref<8x8x8xf32, 3> to memref, 3> return %0 : memref, 3> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @transfer_read_1d(%A : memref, %base: index) -> vector<17xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base], %f7 {permutation_map = affine_map<(d0) -> (d0)>} : memref, vector<17xf32> vector.transfer_write %f, %A[%base] {permutation_map = affine_map<(d0) -> (d0)>} : vector<17xf32>, memref return %f: vector<17xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @vector_load_op(%memref : memref<200x100xf32>, %i : index, %j : index) -> vector<8xf32> { %0 = vector.load %memref[%i, %j] : memref<200x100xf32>, vector<8xf32> return %0 : vector<8xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @vector_store_op(%memref : memref<200x100xf32>, %i : index, %j : index) { %val = arith.constant dense<11.0> : vector<4xf32> vector.store %val, %memref[%i, %j] : memref<200x100xf32>, vector<4xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @masked_load_op(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xf32>) -> vector<16xf32> { %c0 = arith.constant 0: index %0 = vector.maskedload %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> return %0 : vector<16xf32> }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @masked_store_op(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xf32>) { %c0 = arith.constant 0: index vector.maskedstore %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xf32> return }", mlir-opt -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "module @external { pdl.pattern : benefit(1) { %input = operand %root = operation ""foo.op""(%input : !pdl.value) rewrite %root with ""rewriter""(%input : !pdl.value) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @erase { pdl.pattern : benefit(1) { %root = operation ""foo.op"" rewrite %root { erase %root } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @operation_attributes { pdl.pattern : benefit(1) { %attr = attribute %root = operation ""foo.op"" {""attr"" = %attr} rewrite %root { %attr1 = attribute = true %newOp = operation ""foo.op"" {""attr"" = %attr, ""attr1"" = %attr1} erase %root } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @operation_operands { pdl.pattern : benefit(1) { %operand = operand %root = operation ""foo.op""(%operand : !pdl.value) rewrite %root { %type = type : i32 %newOp = operation ""foo.op""(%operand : !pdl.value) -> (%type : !pdl.type) %result = result 0 of %newOp %newOp1 = operation ""foo.op2""(%result : !pdl.value) erase %root } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @operation_infer_types_from_replaceop { pdl.pattern : benefit(1) { %rootType = type %rootType1 = type %root = operation ""foo.op"" -> (%rootType, %rootType1 : !pdl.type, !pdl.type) rewrite %root { %newType1 = type %newOp = operation ""foo.op"" replace %root with %newOp } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @operation_infer_types_from_otherop_individual_results { pdl.pattern : benefit(1) { %rootType = type %rootTypes = types %root = operation ""foo.op"" -> (%rootType, %rootTypes : !pdl.type, !pdl.range) rewrite %root { %newOp = operation ""foo.op"" -> (%rootType, %rootTypes : !pdl.type, !pdl.range) } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @operation_infer_types_from_otherop_results { pdl.pattern : benefit(1) { %rootTypes = types %root = operation ""foo.op"" -> (%rootTypes : !pdl.range) rewrite %root { %newOp = operation ""foo.op"" -> (%rootTypes : !pdl.range) } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @operation_infer_types_from_interface { arith.constant true pdl.pattern : benefit(1) { %root = operation ""foo.op"" rewrite %root { %types = types %newOp = operation ""arith.constant"" -> (%types : !pdl.range) %newOp2 = operation ""foo.op"" -> (%types : !pdl.range) } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @replace_with_op { pdl.pattern : benefit(1) { %type = type : i32 %root = operation ""foo.op"" -> (%type : !pdl.type) rewrite %root { %newOp = operation ""foo.op"" -> (%type : !pdl.type) replace %root with %newOp } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @replace_with_values { pdl.pattern : benefit(1) { %types = types %root = operation ""foo.op"" -> (%types : !pdl.range) rewrite %root { %newOp = operation ""foo.op"" -> (%types : !pdl.range) %newResult = result 0 of %newOp %newResults = results 1 of %newOp -> !pdl.range %newResults2 = results 2 of %newOp -> !pdl.value replace %root with (%newResult, %newResults, %newResults2 : !pdl.value, !pdl.range, !pdl.value) } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @replace_with_no_results { pdl.pattern : benefit(1) { %root = operation ""foo.op"" rewrite %root { %newOp = operation ""foo.op"" replace %root with %newOp } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @apply_native_rewrite { pdl.pattern : benefit(1) { %type = type %root = operation ""foo.op"" -> (%type : !pdl.type) rewrite %root { %newType = apply_native_rewrite ""functor""(%root : !pdl.operation) : !pdl.type %newOp = operation ""foo.op"" -> (%newType : !pdl.type) } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @unbound_rewrite_op { pdl.pattern : benefit(1) { %root = operation ""foo.op"" rewrite %root { %unused = operation ""bar.op"" } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @range_op { pdl.pattern : benefit(1) { %operand = pdl.operand %root = operation ""foo.op""(%operand : !pdl.value) rewrite %root { %emptyRange = pdl.range : !pdl.range %range = pdl.range %operand, %emptyRange : !pdl.value, !pdl.range } } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @empty_module { }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @simple { pdl.pattern : benefit(1) { %root = operation ""foo.op"" rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @attributes { pdl.pattern : benefit(1) { %type = type : i64 %attr = attribute = 10 : i64 %attr1 = attribute : %type %root = operation {""attr"" = %attr, ""attr1"" = %attr1} rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @constraints { pdl.pattern : benefit(1) { %input0 = operand %input1 = operand %root = operation(%input0, %input1 : !pdl.value, !pdl.value) %result0 = result 0 of %root pdl.apply_native_constraint ""multi_constraint""(%input0, %input1, %result0 : !pdl.value, !pdl.value, !pdl.value) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @inputs { pdl.pattern : benefit(1) { %type = type : i64 %input = operand : %type %root = operation(%input, %input : !pdl.value, !pdl.value) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @variadic_inputs { pdl.pattern : benefit(1) { %types = types : [i64] %inputs = operands : %types %input = operand %root = operation(%input, %inputs, %input : !pdl.value, !pdl.range, !pdl.value) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @single_operand_range { pdl.pattern : benefit(1) { %types = types : [i64] %operands = operands : %types %root = operation(%operands : !pdl.range) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @results { pdl.pattern : benefit(1) { %type1 = type : i32 %type2 = type %root = operation -> (%type1, %type2 : !pdl.type, !pdl.type) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @variadic_results { pdl.pattern : benefit(1) { %types = types : [i64] %type = type %root = operation -> (%type, %types, %type : !pdl.type, !pdl.range, !pdl.type) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @single_result_range { pdl.pattern : benefit(1) { %types = types : [i64] %root = operation -> (%types : !pdl.range) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @results_as_operands { pdl.pattern : benefit(1) { %type1 = type : i32 %type2 = type %inputOp = operation -> (%type1, %type2 : !pdl.type, !pdl.type) %result1 = result 0 of %inputOp %result2 = result 1 of %inputOp %root = operation(%result1, %result2 : !pdl.value, !pdl.value) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @single_result_range_as_operands { pdl.pattern : benefit(1) { %types = types %inputOp = operation -> (%types : !pdl.range) %results = results of %inputOp %root = operation(%results : !pdl.range) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @switch_single_result_type { pdl.pattern : benefit(1) { %type = type : i32 %root = operation -> (%type : !pdl.type) rewrite %root with ""rewriter"" } pdl.pattern : benefit(1) { %type = type : i64 %root = operation -> (%type : !pdl.type) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @switch_result_types { pdl.pattern : benefit(1) { %types = types : [i32] %root = operation -> (%types : !pdl.range) rewrite %root with ""rewriter"" } pdl.pattern : benefit(1) { %types = types : [i64, i32] %root = operation -> (%types : !pdl.range) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @switch_operand_count_at_least { pdl.pattern : benefit(1) { %operand = operand %operands = operands %root = operation(%operand, %operands : !pdl.value, !pdl.range) rewrite %root with ""rewriter"" } pdl.pattern : benefit(1) { %operand = operand %operand2 = operand %operands = operands %root = operation(%operand, %operand2, %operands : !pdl.value, !pdl.value, !pdl.range) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @switch_result_count_at_least { pdl.pattern : benefit(1) { %type = type %types = types %root = operation -> (%type, %types : !pdl.type, !pdl.range) rewrite %root with ""rewriter"" } pdl.pattern : benefit(1) { %type = type %type2 = type %types = types %root = operation -> (%type, %type2, %types : !pdl.type, !pdl.type, !pdl.range) rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @predicate_ordering { pdl.pattern : benefit(1) { %resultType = type pdl.apply_native_constraint ""typeConstraint""(%resultType : !pdl.type) %root = operation -> (%resultType : !pdl.type) rewrite %root with ""rewriter"" } pdl.pattern : benefit(1) { %resultType = type %apply = operation -> (%resultType : !pdl.type) rewrite %apply with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @multi_root { pdl.pattern @rewrite_multi_root : benefit(1) { %input1 = operand %input2 = operand %type = type %op1 = operation(%input1 : !pdl.value) -> (%type : !pdl.type) %val1 = result 0 of %op1 %root1 = operation(%val1 : !pdl.value) %op2 = operation(%input2 : !pdl.value) -> (%type : !pdl.type) %val2 = result 0 of %op2 %root2 = operation(%val1, %val2 : !pdl.value, !pdl.value) rewrite %root1 with ""rewriter""(%root2 : !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @overlapping_roots { pdl.pattern @rewrite_overlapping_roots : benefit(1) { %input1 = operand %input2 = operand %type = type %op = operation(%input1, %input2 : !pdl.value, !pdl.value) -> (%type : !pdl.type) %val = result 0 of %op %root = operation(%val : !pdl.value) rewrite with ""rewriter""(%root : !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @force_overlapped_root { pdl.pattern @rewrite_forced_overlapped_root : benefit(1) { %input1 = operand %input2 = operand %type = type %root = operation(%input1, %input2 : !pdl.value, !pdl.value) -> (%type : !pdl.type) %val = result 0 of %root %op = operation(%val : !pdl.value) rewrite %root with ""rewriter""(%op : !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @variadic_results_all { pdl.pattern @variadic_results_all : benefit(1) { %types = types %root = operation -> (%types : !pdl.range) %vals = results of %root %op = operation(%vals : !pdl.range) rewrite %root with ""rewriter""(%op : !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @variadic_results_at { pdl.pattern @variadic_results_at : benefit(1) { %type = type %types = types %val = operand %op = operation -> (%types, %type : !pdl.range, !pdl.type) %vals = results 0 of %op -> !pdl.range %root1 = operation(%vals, %val : !pdl.range, !pdl.value) %root2 = operation(%val, %vals : !pdl.value, !pdl.range) rewrite with ""rewriter""(%root1, %root2 : !pdl.operation, !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @attribute_literal { pdl.pattern : benefit(1) { %attr = attribute = 10 pdl.apply_native_constraint ""constraint""(%attr: !pdl.attribute) %root = operation rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @type_literal { pdl.pattern : benefit(1) { %type = type : i32 %types = types : [i32, i64] pdl.apply_native_constraint ""constraint""(%type, %types: !pdl.type, !pdl.range) %root = operation rewrite %root with ""rewriter"" } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @common_connector { pdl.pattern @common_connector : benefit(1) { %type = type %op = operation -> (%type, %type : !pdl.type, !pdl.type) %val0 = result 0 of %op %val1 = result 1 of %op %rootA = operation (%val0 : !pdl.value) %rootB = operation (%val0 : !pdl.value) %inter = operation (%val1 : !pdl.value) -> (%type : !pdl.type) %val2 = result 0 of %inter %rootC = operation (%val2 : !pdl.value) rewrite with ""rewriter""(%rootA, %rootB, %rootC : !pdl.operation, !pdl.operation, !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "module @common_connector_range { pdl.pattern @common_connector_range : benefit(1) { %types = types %op = operation -> (%types, %types : !pdl.range, !pdl.range) %vals0 = results 0 of %op -> !pdl.range %vals1 = results 1 of %op -> !pdl.range %rootA = operation (%vals0 : !pdl.range) %rootB = operation (%vals0 : !pdl.range) %inter = operation (%vals1 : !pdl.range) -> (%types : !pdl.range) %vals2 = results of %inter %rootC = operation (%vals2 : !pdl.range) rewrite with ""rewriter""(%rootA, %rootB, %rootC : !pdl.operation, !pdl.operation, !pdl.operation) } }", mlir-opt -split-input-file -convert-pdl-to-pdl-interp ,1 "func.func @generalize_pad_tensor_static_shape(%arg0: tensor<1x28x28x1xf32>) -> tensor<1x32x32x1xf32> { %cst = arith.constant 0.000000e+00 : f32 %0 = tensor.pad %arg0 low[0, 2, 2, 0] high[0, 2, 2, 0] { ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index): tensor.yield %cst : f32 } : tensor<1x28x28x1xf32> to tensor<1x32x32x1xf32> return %0 : tensor<1x32x32x1xf32> } func.func @generalize_pad_tensor_dynamic_shape(%arg0: tensor<4x?x2x?xf32>, %arg1: index) -> tensor<4x?x?x?xf32> { %c0 = arith.constant 0 : index %cst = arith.constant 0.0 : f32 %out = tensor.pad %arg0 low[%c0, %c0, %arg1, %c0] high[%c0, %c0, %c0, %arg1] { ^bb0(%gen_arg1: index, %gen_arg2: index, %gen_arg3: index, %gen_arg4: index): tensor.yield %cst : f32 } : tensor<4x?x2x?xf32> to tensor<4x?x?x?xf32> return %out : tensor<4x?x?x?xf32> }", mlir-opt -split-input-file -convert-tensor-to-linalg -cse -verify-diagnostics ,1 "func.func @unary_resize_nearest_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x1x7xf32> { %resize = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<3x1x1x7xf32>) -> tensor<3x1x1x7xf32> return %resize : tensor<3x1x1x7xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @unary_resize_bilinear_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x1x7xf32> { %resize = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<3x1x1x7xf32>) -> tensor<3x1x1x7xf32> return %resize : tensor<3x1x1x7xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @unary_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi8> { %resize = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi8> return %resize : tensor<3x1x1x7xi8> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @broadcast_resize_nearest_f32(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x1x5x7xf32> { %resize = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<3x1x1x7xf32>) -> tensor<3x1x5x7xf32> return %resize : tensor<3x1x5x7xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @broadcast_resize_bilinear_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x4x5x7xi32> { %resize = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<3x1x1x7xi8>) -> tensor<3x4x5x7xi32> return %resize : tensor<3x4x5x7xi32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @unary_resize_bilinear_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi32> { %resize = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<3x1x1x7xi8>) -> tensor<3x1x1x7xi32> return %resize : tensor<3x1x1x7xi32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @resize_nearest_int(%arg0: tensor<1x15x13x1xi8>) -> () { %0 = ""tosa.resize""(%arg0) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<1x15x13x1xi8>) -> tensor<1x23x179x1xi8> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @resize_bilinear_int(%arg0: tensor<1x19x20x1xi8>) { %0 = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x19x20x1xi8>) -> tensor<1x304x320x1xi48> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @resize_nearest_fp(%input: tensor<1x50x48x1xf32>) -> () { %output = ""tosa.resize""(%input) {mode = ""NEAREST_NEIGHBOR"", scale = array, offset = array, border = array} : (tensor<1x50x48x1xf32>) -> tensor<1x1600x1536x1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @resize_bilinear_fp(%input: tensor<1x23x24x1xf32>) -> () { %output = ""tosa.resize""(%input) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x23x24x1xf32>) -> tensor<1x92x96x1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @resize_dyn(%input: tensor) -> () { %output = ""tosa.resize""(%input) { scale = array, offset = array, border = array, mode = ""BILINEAR"" } : (tensor) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @resize_bilinear_int48(%arg0: tensor<1x19x19x1xi16>) { %0 = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<1x19x19x1xi16>) -> tensor<1x289x289x1xi48> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @skip_interpolate_bilinear_i8(%arg0 : tensor<3x1x2x7xi8>) -> tensor<3x1x5x7xi32> { %resize = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<3x1x2x7xi8>) -> tensor<3x1x5x7xi32> return %resize : tensor<3x1x5x7xi32> } func.func @skip_interpolate_bilinear_f32(%arg0 : tensor<3x1x2x7xf32>) -> tensor<3x1x5x7xf32> { %resize = ""tosa.resize""(%arg0) {mode = ""BILINEAR"", scale = array, offset = array, border = array} : (tensor<3x1x2x7xf32>) -> tensor<3x1x5x7xf32> return %resize : tensor<3x1x5x7xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -o -",1 "func.func @matmul(%arg0: tensor<1x5x3xf32>, %arg1: tensor<1x3x6xf32>) -> (tensor<1x5x6xf32>) { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<1x5x3xf32>, tensor<1x3x6xf32>) -> (tensor<1x5x6xf32>) return %0 : tensor<1x5x6xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @matmul_quantized(%arg0: tensor<1x5x3xi8>, %arg1: tensor<1x3x6xi8>) -> (tensor<1x5x6xi32>) { %0 = ""tosa.matmul""(%arg0, %arg1) {quantization_info = #tosa.matmul_quant} : (tensor<1x5x3xi8>, tensor<1x3x6xi8>) -> (tensor<1x5x6xi32>) return %0 : tensor<1x5x6xi32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @matmul_dyn_batch(%arg0: tensor, %arg1: tensor) -> (tensor) { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor, tensor) -> (tensor) return %0 : tensor }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @matmul_dyn_independent_dim(%arg0: tensor<1x5x3xf32>, %arg1: tensor<1x3x?xf32>) -> (tensor<1x5x?xf32>) { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<1x5x3xf32>, tensor<1x3x?xf32>) -> (tensor<1x5x?xf32>) return %0 : tensor<1x5x?xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @matmul_dyn_independent_dim(%arg0: tensor<1x5x?xf32>, %arg1: tensor<1x?x6xf32>) -> (tensor<1x5x6xf32>) { %0 = ""tosa.matmul""(%arg0, %arg1) : (tensor<1x5x?xf32>, tensor<1x?x6xf32>) -> (tensor<1x5x6xf32>) return %0 : tensor<1x5x6xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @fully_connected(%arg0: tensor<5x3xf32>, %arg1: tensor<6x3xf32>, %arg2: tensor<6xf32>) -> (tensor<5x6xf32>) { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor<5x3xf32>, tensor<6x3xf32>, tensor<6xf32>) -> (tensor<5x6xf32>) return %0 : tensor<5x6xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @quantized_fully_connected(%arg0: tensor<5x3xi8>, %arg1: tensor<6x3xi8>, %arg2: tensor<6xi32>) -> (tensor<5x6xi32>) { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) {quantization_info = #tosa.conv_quant} : (tensor<5x3xi8>, tensor<6x3xi8>, tensor<6xi32>) -> (tensor<5x6xi32>) return %0 : tensor<5x6xi32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @fully_connected_dyn(%arg0: tensor, %arg1: tensor<6x3xf32>, %arg2: tensor<6xf32>) -> (tensor) { %0 = ""tosa.fully_connected""(%arg0, %arg1, %arg2) : (tensor, tensor<6x3xf32>, tensor<6xf32>) -> (tensor) return %0 : tensor }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @max_pool(%arg0: tensor<1x6x34x62xf32>) -> () { %0 = ""tosa.max_pool2d""(%arg0) {pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xf32>) -> (tensor<1x4x32x62xf32>) return } func.func @max_pool_padded(%arg0: tensor<1x6x34x62xf32>) -> () { %0 = ""tosa.max_pool2d""(%arg0) {pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xf32>) -> (tensor<1x4x33x62xf32>) return } func.func @max_pool_dyn(%arg0: tensor) -> () { %0 = ""tosa.max_pool2d""(%arg0) {pad = array, kernel = array, stride = array} : (tensor) -> (tensor) return } func.func @max_pool_i8(%arg0: tensor<1x6x34x62xi8>) -> () { %0 = ""tosa.max_pool2d""(%arg0) {pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xi8>) -> (tensor<1x4x32x62xi8>) return } func.func @max_pool_i16(%arg0: tensor<1x6x34x62xi16>) -> () { %0 = ""tosa.max_pool2d""(%arg0) {pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xi16>) -> (tensor<1x4x32x62xi16>) return } func.func @max_pool_i32(%arg0: tensor<1x6x34x62xi32>) -> () { %0 = ""tosa.max_pool2d""(%arg0) {pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xi32>) -> (tensor<1x4x32x62xi32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @avg_pool_f32(%arg0: tensor<1x6x34x62xf32>) -> (tensor<1x5x33x62xf32>) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xf32>) -> (tensor<1x5x33x62xf32>) return %0 : tensor<1x5x33x62xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @avg_pool_i8(%arg0: tensor<1x6x34x62xi8>) -> (tensor<1x5x33x62xi8>) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = i32, pad = array, kernel = array, stride = array} : (tensor<1x6x34x62xi8>) -> (tensor<1x5x33x62xi8>) return %0 : tensor<1x5x33x62xi8> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @avg_pool_dyn(%arg0: tensor) -> (tensor) { %0 = ""tosa.avg_pool2d""(%arg0) {acc_type = f32, pad = array, kernel = array, stride = array} : (tensor) -> (tensor) return %0 : tensor }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv2d_i8(%input: tensor<1x49x42x27xi8>, %weights: tensor<28x1x1x27xi8>, %bias: tensor<28xi8>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {dilation = array, pad = array, quantization_info = #tosa.conv_quant, stride = array} : (tensor<1x49x42x27xi8>, tensor<28x1x1x27xi8>, tensor<28xi8>) -> (tensor<1x45x40x28xi32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv2d_f32(%input: tensor<1x49x42x27xf32>, %weights: tensor<28x3x3x27xf32>, %bias: tensor<28xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<1x49x42x27xf32>, tensor<28x3x3x27xf32>, tensor<28xf32>) -> (tensor<1x45x40x28xf32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv2d_dyn(%input: tensor, %weights: tensor<28x3x3x27xf32>, %bias: tensor<28xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor, tensor<28x3x3x27xf32>, tensor<28xf32>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv2d_dyn_w_h(%input: tensor<1x?x?x27xf32>, %weights: tensor<28x3x3x27xf32>, %bias: tensor<28xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<1x?x?x27xf32>, tensor<28x3x3x27xf32>, tensor<28xf32>) -> (tensor<1x?x?x28xf32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv2d_padded_f32(%input: tensor<1x47x40x28xf32>, %weights: tensor<28x3x3x28xf32>, %bias: tensor<28xf32>) -> () { %0 = ""tosa.conv2d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<1x47x40x28xf32>, tensor<28x3x3x28xf32>, tensor<28xf32>) -> (tensor<1x45x40x28xf32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv2d_quant(%arg0 : tensor<1x12x12x1xi8>, %arg1 : tensor<1024x3x3x1xi8>, %arg2 : tensor<1024xi32>) -> () { %0 = ""tosa.conv2d""(%arg0, %arg1, %arg2) {dilation = array, pad = array, quantization_info = #tosa.conv_quant, stride = array} : (tensor<1x12x12x1xi8>, tensor<1024x3x3x1xi8>, tensor<1024xi32>) -> tensor<1x12x12x1024xi32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @depthwise_conv(%arg0 : tensor<1x7x5x3xf32>, %arg1 : tensor<3x1x3x11xf32>, %arg2 : tensor<33xf32>) -> () { %2 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) { pad = array, stride = array, dilation = array } : (tensor<1x7x5x3xf32>, tensor<3x1x3x11xf32>, tensor<33xf32>) -> (tensor<1x5x5x33xf32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @depthwise_conv_dyn(%arg0 : tensor, %arg1 : tensor<3x1x3x11xf32>, %arg2 : tensor<33xf32>) -> () { %2 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) { pad = array, stride = array, dilation = array } : (tensor, tensor<3x1x3x11xf32>, tensor<33xf32>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @depthwise_conv_strides(%arg0 : tensor<1x11x9x3xf32>, %arg1 : tensor<3x1x3x11xf32>, %arg2 : tensor<33xf32>) -> () { %2 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) { pad = array, stride = array, dilation = array } : (tensor<1x11x9x3xf32>, tensor<3x1x3x11xf32>, tensor<33xf32>) -> (tensor<1x5x5x33xf32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @depthwise_conv_quant(%arg0 : tensor<1x12x12x4xi8>, %arg1 : tensor<3x3x4x128xi8>, %arg2 : tensor<512xi32>) -> () { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, quantization_info = #tosa.conv_quant, stride = array, dilation = array } : (tensor<1x12x12x4xi8>, tensor<3x3x4x128xi8>, tensor<512xi32>) -> tensor<1x12x12x512xi32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @depthwise_conv_quant_dilations(%arg0 : tensor<1x14x14x4xi8>, %arg1 : tensor<3x3x4x128xi8>, %arg2 : tensor<512xi32>) -> () { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, quantization_info = #tosa.conv_quant, stride = array, dilation = array } : (tensor<1x14x14x4xi8>, tensor<3x3x4x128xi8>, tensor<512xi32>) -> tensor<1x10x10x512xi32> return } func.func @depthwise_conv2d_dyn_w_h(%arg0: tensor<2x?x?x3xf32>, %arg1: tensor<3x6x3x5xf32>, %arg2: tensor<15xf32>) { %0 = ""tosa.depthwise_conv2d""(%arg0, %arg1, %arg2) {pad = array, dilation = array, stride = array} : (tensor<2x?x?x3xf32>, tensor<3x6x3x5xf32>, tensor<15xf32>) -> tensor<2x?x?x15xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv3d_f32(%input: tensor<1x49x48x47x27xf32>, %weights: tensor<28x3x4x5x27xf32>, %bias: tensor<28xf32>) -> () { %0 = ""tosa.conv3d""(%input, %weights, %bias) {pad = array, stride = array, dilation = array} : (tensor<1x49x48x47x27xf32>, tensor<28x3x4x5x27xf32>, tensor<28xf32>) -> tensor<1x47x45x43x28xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @conv3d_i8(%input: tensor<1x49x48x47x27xi8>, %weights: tensor<28x3x4x5x27xi8>, %bias: tensor<28xi32>) -> () { %0 = ""tosa.conv3d""(%input, %weights, %bias) {pad = array, quantization_info = #tosa.conv_quant, stride = array, dilation = array} : (tensor<1x49x48x47x27xi8>, tensor<28x3x4x5x27xi8>, tensor<28xi32>) -> tensor<1x47x45x43x28xi32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg-named))"" -verify-diagnostics -o -",1 "func.func @test_abs(%arg0: tensor) -> tensor { %0 = ""tosa.abs""(%arg0) : (tensor) -> tensor return %0 : tensor }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_abs(%arg0: tensor<2xf32>) -> tensor<2xf32> { %0 = ""tosa.abs""(%arg0) : (tensor<2xf32>) -> tensor<2xf32> return %0 : tensor<2xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_abs(%arg0: tensor<2x3xf32>) -> tensor<2x3xf32> { %0 = ""tosa.abs""(%arg0) : (tensor<2x3xf32>) -> tensor<2x3xf32> return %0 : tensor<2x3xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_abs(%arg0: tensor) -> tensor { %0 = ""tosa.abs""(%arg0) : (tensor) -> tensor return %0 : tensor }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_abs_dyn(%arg0: tensor<2x?xf32>) -> tensor<2x?xf32> { %0 = ""tosa.abs""(%arg0) : (tensor<2x?xf32>) -> tensor<2x?xf32> return %0 : tensor<2x?xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_broadcast(%arg0: tensor<1xf32>, %arg1: tensor<2xf32>) -> tensor<2xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1xf32>, tensor<2xf32>) -> tensor<2xf32> return %0 : tensor<2xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_broadcast_swapped_args(%arg0: tensor<2xf32>, %arg1: tensor<1xf32>) -> tensor<2xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<2xf32>, tensor<1xf32>) -> tensor<2xf32> return %0 : tensor<2xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_multibroadcast(%arg0: tensor<1x3xf32>, %arg1: tensor<2x1xf32>) -> tensor<2x3xf32> { %0 = ""tosa.add""(%arg0, %arg1) : (tensor<1x3xf32>, tensor<2x1xf32>) -> tensor<2x3xf32> return %0 : tensor<2x3xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_simple_f32(%arg0: tensor<1xf32>) -> () { %0 = ""tosa.tanh""(%arg0) : (tensor<1xf32>) -> tensor<1xf32> %1 = ""tosa.abs""(%arg0) : (tensor<1xf32>) -> tensor<1xf32> %2 = ""tosa.add""(%0, %0) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %3 = ""tosa.sub""(%0, %1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %4 = ""tosa.mul""(%0, %1) {shift = 0 : i32} : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %5 = ""tosa.negate""(%0) : (tensor<1xf32>) -> tensor<1xf32> %6 = ""tosa.pow""(%1, %2) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %7 = ""tosa.rsqrt""(%1) : (tensor<1xf32>) -> tensor<1xf32> %8 = ""tosa.log""(%arg0) : (tensor<1xf32>) -> tensor<1xf32> %9 = ""tosa.exp""(%arg0) : (tensor<1xf32>) -> tensor<1xf32> %10 = ""tosa.greater""(%0, %1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi1> %11 = ""tosa.greater_equal""(%0, %1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi1> %12 = ""tosa.equal""(%0, %1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi1> %13 = ""tosa.select""(%10, %0, %1) : (tensor<1xi1>, tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %14 = ""tosa.maximum""(%0, %1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %15 = ""tosa.minimum""(%0, %1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32> %16 = ""tosa.ceil""(%0) : (tensor<1xf32>) -> tensor<1xf32> %17 = ""tosa.floor""(%0) : (tensor<1xf32>) -> tensor<1xf32> %18 = ""tosa.clamp""(%0) {min_int = 1 : i64, max_int = 5 : i64, min_fp = 1.0 : f32, max_fp = 5.0 : f32} : (tensor<1xf32>) -> tensor<1xf32> %19 = ""tosa.sigmoid""(%0) : (tensor<1xf32>) -> tensor<1xf32> %20 = ""tosa.cast""(%0) : (tensor<1xf32>) -> tensor<1xi32> %21 = ""tosa.cast""(%0) : (tensor<1xf32>) -> tensor<1xi1> %22 = ""tosa.cast""(%0) : (tensor<1xf32>) -> tensor<1xf16> %23 = ""tosa.reciprocal""(%0) : (tensor<1xf32>) -> tensor<1xf32> %24 = ""tosa.erf""(%0) : (tensor<1xf32>) -> tensor<1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_simple_f16(%arg0: tensor<1xf16>) -> () { %0 = ""tosa.cast""(%arg0) : (tensor<1xf16>) -> tensor<1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_simple_i16(%arg0: tensor<1xi16>) -> () { %0 = ""tosa.mul""(%arg0, %arg0) {shift = 0 : i32} : (tensor<1xi16>, tensor<1xi16>) -> tensor<1xi16> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_simple_ui8(%arg0: tensor<1xui8>) -> () { %0 = ""tosa.cast""(%arg0) : (tensor<1xui8>) -> tensor<1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_simple_i32(%arg0: tensor<1xi32>) -> () { %0 = ""tosa.add""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %1 = ""tosa.sub""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %2 = ""tosa.mul""(%arg0, %arg0) {shift = 0 : i32} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %3 = ""tosa.mul""(%arg0, %arg0) {shift = 2 : i32} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %4 = ""tosa.div""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %5 = ""tosa.negate""(%arg0) : (tensor<1xi32>) -> tensor<1xi32> %6 = ""tosa.bitwise_and""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %7 = ""tosa.bitwise_or""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %8 = ""tosa.bitwise_xor""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %9 = ""tosa.logical_left_shift""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %10 = ""tosa.logical_right_shift""(%arg0, %arg0) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %11 = ""tosa.arithmetic_right_shift""(%arg0, %arg0) {round = 0 : i1} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %12 = ""tosa.arithmetic_right_shift""(%arg0, %arg0) {round = 1 : i1} : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %13 = ""tosa.clz""(%arg0) : (tensor<1xi32>) -> tensor<1xi32> %14 = ""tosa.greater""(%0, %1) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi1> %15 = ""tosa.greater_equal""(%0, %1) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi1> %16 = ""tosa.select""(%14, %0, %1) : (tensor<1xi1>, tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %17 = ""tosa.maximum""(%0, %1) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %18 = ""tosa.minimum""(%0, %1) : (tensor<1xi32>, tensor<1xi32>) -> tensor<1xi32> %19 = ""tosa.clamp""(%0) {min_int = 1 : i64, max_int = 5 : i64, min_fp = 1.0 : f32, max_fp = 5.0 : f32} : (tensor<1xi32>) -> tensor<1xi32> %20 = ""tosa.cast""(%0) : (tensor<1xi32>) -> tensor<1xi16> %21 = ""tosa.cast""(%0) : (tensor<1xi32>) -> tensor<1xi64> %22 = ""tosa.cast""(%0) : (tensor<1xi32>) -> tensor<1xi1> %23 = ""tosa.cast""(%0) : (tensor<1xi32>) -> tensor<1xf32> %24 = ""tosa.abs""(%arg0) : (tensor<1xi32>) -> tensor<1xi32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_simple_ui8(%arg0: tensor<1xi8>) -> () { %0 = ""tosa.cast""(%arg0) : (tensor<1xi8>) -> tensor<1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_i8(%arg0: tensor<1xi8>) -> () { %0 = ""tosa.clamp""(%arg0) {min_int = -127 : i64, max_int = 126 : i64, min_fp = 0.0 : f32, max_fp = 0.0 : f32} : (tensor<1xi8>) -> tensor<1xi8> %1 = ""tosa.clamp""(%arg0) {min_int = -130 : i64, max_int = 130 : i64, min_fp = 0.0 : f32, max_fp = 0.0 : f32} : (tensor<1xi8>) -> tensor<1xi8> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_clamp_f16(%arg0: tensor<1xf16>) -> () { %0 = ""tosa.clamp""(%arg0) {min_int = 0 : i64, max_int = 0 : i64, min_fp = 0.0 : f32, max_fp = 6.0 : f32} : (tensor<1xf16>) -> tensor<1xf16> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_bool(%arg0: tensor<1xi1>, %arg1: tensor<1xi1>) -> () { %0 = ""tosa.logical_and""(%arg0, %arg1) : (tensor<1xi1>, tensor<1xi1>) -> tensor<1xi1> %1 = ""tosa.logical_or""(%arg0, %arg1) : (tensor<1xi1>, tensor<1xi1>) -> tensor<1xi1> %2 = ""tosa.logical_xor""(%arg0, %arg1) : (tensor<1xi1>, tensor<1xi1>) -> tensor<1xi1> %3 = ""tosa.logical_not""(%arg0) : (tensor<1xi1>) -> tensor<1xi1> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_negate_quantized(%arg0: tensor<1xi8>) -> () { %0 = ""tosa.negate""(%arg0) {quantization_info = #tosa.unary_quant} : (tensor<1xi8>) -> tensor<1xi8> %1 = ""tosa.negate""(%arg0) {quantization_info = #tosa.unary_quant} : (tensor<1xi8>) -> tensor<1xi8> %2 = ""tosa.negate""(%arg0) {quantization_info = #tosa.unary_quant} : (tensor<1xi8>) -> tensor<1xi8> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_identity(%arg0: tensor<1xf32>, %arg1: tensor<1xi32>) -> (tensor<1xf32>, tensor<1xi32>) { %0 = ""tosa.identity""(%arg0) : (tensor<1xf32>) -> tensor<1xf32> %1 = ""tosa.identity""(%arg1) : (tensor<1xi32>) -> tensor<1xi32> return %0, %1 : tensor<1xf32>, tensor<1xi32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_transpose(%arg0: tensor<1x2x3xi32>) -> () { %0 = arith.constant dense<[1, 2, 0]> : tensor<3xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<1x2x3xi32>, tensor<3xi32>) -> (tensor<2x3x1xi32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_transpose_dyn(%arg0: tensor<1x?x3x4xi32>) -> () { %0 = arith.constant dense<[1, 3, 0, 2]> : tensor<4xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor<1x?x3x4xi32>, tensor<4xi32>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_transpose_dyn_multiple(%arg0: tensor) -> () { %0 = arith.constant dense<[1, 0]> : tensor<2xi32> %1 = ""tosa.transpose""(%arg0, %0) : (tensor, tensor<2xi32>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_float(%arg0: tensor<5x4xf32>) -> () { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64} : (tensor<5x4xf32>) -> tensor<1x4xf32> %1 = ""tosa.reduce_sum""(%arg0) {axis = 1 : i64} : (tensor<5x4xf32>) -> tensor<5x1xf32> %2 = ""tosa.reduce_prod""(%arg0) {axis = 0 : i64} : (tensor<5x4xf32>) -> tensor<1x4xf32> %3 = ""tosa.reduce_min""(%arg0) {axis = 0 : i64} : (tensor<5x4xf32>) -> tensor<1x4xf32> %4 = ""tosa.reduce_max""(%arg0) {axis = 0 : i64} : (tensor<5x4xf32>) -> tensor<1x4xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_float_dyn(%arg0: tensor) -> () { %0 = ""tosa.reduce_sum""(%arg0) {axis = 1 : i64} : (tensor) -> tensor return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_float_dyn_rank_1(%arg0: tensor) -> () { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64} : (tensor) -> tensor<1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_float_dyn_nonzero_batch(%arg0: tensor<5x?x4xf32>) -> () { %0 = ""tosa.reduce_prod""(%arg0) {axis = 2 : i64} : (tensor<5x?x4xf32>) -> tensor<5x?x1xf32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_float_dyn_multiple(%arg0: tensor) -> () { %0 = ""tosa.reduce_max""(%arg0) {axis = 1 : i64} : (tensor) -> tensor return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_int(%arg0: tensor<5x4xi32>) -> () { %0 = ""tosa.reduce_sum""(%arg0) {axis = 0 : i64} : (tensor<5x4xi32>) -> tensor<1x4xi32> %1 = ""tosa.reduce_sum""(%arg0) {axis = 1 : i64} : (tensor<5x4xi32>) -> tensor<5x1xi32> %2 = ""tosa.reduce_prod""(%arg0) {axis = 0 : i64} : (tensor<5x4xi32>) -> tensor<1x4xi32> %3 = ""tosa.reduce_min""(%arg0) {axis = 0 : i64} : (tensor<5x4xi32>) -> tensor<1x4xi32> %4 = ""tosa.reduce_max""(%arg0) {axis = 0 : i64} : (tensor<5x4xi32>) -> tensor<1x4xi32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reduce_bool(%arg0: tensor<5x4xi1>) -> () { %0 = ""tosa.reduce_all""(%arg0) {axis = 0 : i64} : (tensor<5x4xi1>) -> tensor<1x4xi1> %1 = ""tosa.reduce_any""(%arg0) {axis = 0 : i64} : (tensor<5x4xi1>) -> tensor<1x4xi1> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @rescale_i8(%arg0 : tensor<2xi8>) -> () { %0 = ""tosa.rescale""(%arg0) {input_zp = 17 : i32, output_zp = 22 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor<2xi8>) -> (tensor<2xi8>) %1 = ""tosa.rescale""(%arg0) {input_zp = 17 : i32, output_zp = 22 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor<2xi8>) -> (tensor<2xui8>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @rescale_i8_dyn_batch(%arg0 : tensor) -> () { %0 = ""tosa.rescale""(%arg0) {input_zp = 17 : i32, output_zp = 22 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor) -> (tensor) %1 = ""tosa.rescale""(%arg0) {input_zp = 17 : i32, output_zp = 22 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @rescale_dyn(%arg0 : tensor<1x?x?x32xi32>) -> () { %0 = ""tosa.rescale""(%arg0) {double_round = true, input_zp = 0 : i32, multiplier = array, output_zp = 0 : i32, per_channel = false, scale32 = true, shift = array} : (tensor<1x?x?x32xi32>) -> tensor<1x?x?x32xi8> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @rescale_ui8(%arg0 : tensor<2xui8>) -> () { %0 = ""tosa.rescale""(%arg0) {input_zp = 17 : i32, output_zp = 22 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor<2xui8>) -> (tensor<2xi8>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @rescale_per_channel(%arg0 : tensor<3xi8>) -> (tensor<3xi8>) { %0 = ""tosa.rescale""(%arg0) {input_zp = 243 : i32, output_zp = 252 : i32, multiplier = array, shift = array, scale32 = false, double_round = false, per_channel = false} : (tensor<3xi8>) -> (tensor<3xi8>) return %0 : tensor<3xi8> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @rescaleDoubleRound(%arg0 : tensor<2xi8>) -> (tensor<2xi8>) { %0 = ""tosa.rescale""(%arg0) {input_zp = 243 : i32, output_zp = 252 : i32, multiplier = array, shift = array, scale32 = true, double_round = true, per_channel = false} : (tensor<2xi8>) -> (tensor<2xi8>) return %0 : tensor<2xi8> } func.func @rescaleUnnecessaryDoubleRound(%arg0 : tensor<2xi8>) -> (tensor<2xi8>) { %0 = ""tosa.rescale""(%arg0) {input_zp = 243 : i32, output_zp = 252 : i32, multiplier = array, shift = array, scale32 = true, double_round = true, per_channel = false} : (tensor<2xi8>) -> (tensor<2xi8>) return %0 : tensor<2xi8> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reverse(%arg0: tensor<5x4xi32>) -> () { %0 = ""tosa.reverse""(%arg0) {axis = 0 : i64} : (tensor<5x4xi32>) -> tensor<5x4xi32> %1 = ""tosa.reverse""(%arg0) {axis = 1 : i64} : (tensor<5x4xi32>) -> tensor<5x4xi32> return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @reverse_dyn(%arg0: tensor) -> () { %0 = ""tosa.reverse""(%arg0) {axis = 0 : i64} : (tensor) -> tensor return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @tile(%arg0 : tensor<2x3xi8>) -> () { %0 = ""tosa.tile""(%arg0) {multiples = array} : (tensor<2x3xi8>) -> (tensor<4x3xi8>) %1 = ""tosa.tile""(%arg0) {multiples = array} : (tensor<2x3xi8>) -> (tensor<2x6xi8>) %2 = ""tosa.tile""(%arg0) {multiples = array} : (tensor<2x3xi8>) -> (tensor<10x21xi8>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @tile_dyn_input(%arg0 : tensor) -> () { %0 = ""tosa.tile""(%arg0) {multiples = array} : (tensor) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @tile_dyn_multiples(%arg0 : tensor<2x3xi8>) -> () { %0 = ""tosa.tile""(%arg0) {multiples = array} : (tensor<2x3xi8>) -> (tensor<2x?xi8>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @argmax(%arg0 : tensor<3x2xi32>, %arg1 : tensor<6xf32>) -> () { %0 = ""tosa.argmax""(%arg0) { axis = 0 : i64} : (tensor<3x2xi32>) -> (tensor<2xi32>) %1 = ""tosa.argmax""(%arg0) { axis = 1 : i64} : (tensor<3x2xi32>) -> (tensor<3xi32>) %2 = ""tosa.argmax""(%arg1) { axis = 0 : i64} : (tensor<6xf32>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @argmax_dyn_non_axis(%arg0 : tensor<3x?xi32>) -> () { %0 = ""tosa.argmax""(%arg0) { axis = 0 : i64} : (tensor<3x?xi32>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @argmax_dyn_axis(%arg0 : tensor<3x?xi32>) -> () { %0 = ""tosa.argmax""(%arg0) { axis = 1 : i64} : (tensor<3x?xi32>) -> (tensor<3xi32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @gather_float(%arg0: tensor<2x3x2xf32>, %arg1: tensor<2x3xi32>) -> () { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<2x3x2xf32>, tensor<2x3xi32>) -> (tensor<2x3x2xf32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @gather_float_dyn(%arg0: tensor, %arg1: tensor) -> () { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor, tensor) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @gather_float_all_dynamic(%arg0: tensor, %arg1: tensor) -> () { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor, tensor) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @gather_int(%arg0: tensor<2x3x2xi32>, %arg1: tensor<2x3xi32>) -> () { %0 = ""tosa.gather""(%arg0, %arg1) : (tensor<2x3x2xi32>, tensor<2x3xi32>) -> (tensor<2x3x2xi32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @table8(%arg0: tensor<6xi8>, %arg1: tensor<512xi8>) -> () { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<6xi8>, tensor<512xi8>) -> (tensor<6xi8>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @table16(%arg0: tensor<6xi16>, %arg1: tensor<513xi16>) -> () { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<6xi16>, tensor<513xi16>) -> (tensor<6xi32>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @table8_dyn(%arg0: tensor, %arg1: tensor<512xi8>) -> () { %0 = ""tosa.table""(%arg0, %arg1) : (tensor, tensor<512xi8>) -> (tensor) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @table8_dyn_table(%arg0: tensor<6xi8>, %arg1: tensor) -> () { %0 = ""tosa.table""(%arg0, %arg1) : (tensor<6xi8>, tensor) -> (tensor<6xi8>) return }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @select_fp32(%arg0: tensor<1x1x5x5xi1>, %arg1: tensor<1x12x5x5xf32>, %arg2: tensor) -> tensor<1x12x5x5xf32> { %0 = ""tosa.select""(%arg0, %arg1, %arg2) : (tensor<1x1x5x5xi1>, tensor<1x12x5x5xf32>, tensor) -> tensor<1x12x5x5xf32> return %0 : tensor<1x12x5x5xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_static_rfft2d(%arg0: tensor<5x5x8xf32>) -> (tensor<5x5x5xf32>, tensor<5x5x5xf32>) { %output_real, %output_imag = ""tosa.rfft2d""(%arg0) {} : (tensor<5x5x8xf32>) -> (tensor<5x5x5xf32>, tensor<5x5x5xf32>) return %output_real, %output_imag : tensor<5x5x5xf32>, tensor<5x5x5xf32> }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @test_dynamic_rfft2d(%arg0: tensor) -> (tensor, tensor) { %output_real, %output_imag = ""tosa.rfft2d""(%arg0) {} : (tensor) -> (tensor, tensor) return %output_real, %output_imag : tensor, tensor }"," mlir-opt --split-input-file -pass-pipeline=""builtin.module(func.func(tosa-to-linalg))"" -verify-diagnostics -o -",1 "func.func @create_complex(%real: f32, %imag: f32) -> complex { %0 = complex.create %real, %imag : complex return %0 : complex }", mlir-opt -split-input-file -convert-complex-to-spirv ,1 "func.func @real_number(%arg: complex) -> f32 { %real = complex.re %arg : complex return %real : f32 }", mlir-opt -split-input-file -convert-complex-to-spirv ,1 "func.func @imaginary_number(%arg: complex) -> f32 { %imaginary = complex.im %arg : complex return %imaginary: f32 }", mlir-opt -split-input-file -convert-complex-to-spirv ,1 "func.func @complex_const() -> complex { %cst = complex.constant [0x7FC00000 : f32, 0.000000e+00 : f32] : complex return %cst : complex }", mlir-opt -split-input-file -convert-complex-to-spirv ,1 "func.func @conversion_static(%arg0 : memref<2xf32>) -> memref<2xf32> { %0 = bufferization.clone %arg0 : memref<2xf32> to memref<2xf32> memref.dealloc %arg0 : memref<2xf32> return %0 : memref<2xf32> }", mlir-opt -verify-diagnostics -convert-bufferization-to-memref -split-input-file ,1 "func.func @conversion_dynamic(%arg0 : memref) -> memref { %1 = bufferization.clone %arg0 : memref to memref memref.dealloc %arg0 : memref return %1 : memref }", mlir-opt -verify-diagnostics -convert-bufferization-to-memref -split-input-file ,1 "func.func @conversion_unknown(%arg0 : memref<*xf32>) -> memref<*xf32> { %1 = bufferization.clone %arg0 : memref<*xf32> to memref<*xf32> memref.dealloc %arg0 : memref<*xf32> return %1 : memref<*xf32> }", mlir-opt -verify-diagnostics -convert-bufferization-to-memref -split-input-file ,1 "func.func @conversion_with_layout_map(%arg0 : memref>) -> memref> { %1 = bufferization.clone %arg0 : memref> to memref> memref.dealloc %arg0 : memref> return %1 : memref> }", mlir-opt -verify-diagnostics -convert-bufferization-to-memref -split-input-file ,1 "func.func @conversion_with_invalid_layout_map(%arg0 : memref>) -> memref> { %1 = bufferization.clone %arg0 : memref> to memref> memref.dealloc %arg0 : memref> return %1 : memref> }", mlir-opt -verify-diagnostics -convert-bufferization-to-memref -split-input-file ,1 "func.func @trivial_ops(%a: index, %b: index) { %0 = index.add %a, %b %1 = index.sub %a, %b %2 = index.mul %a, %b %3 = index.divs %a, %b %4 = index.divu %a, %b %5 = index.rems %a, %b %6 = index.remu %a, %b %7 = index.maxs %a, %b %8 = index.maxu %a, %b %9 = index.mins %a, %b %10 = index.minu %a, %b %11 = index.shl %a, %b %12 = index.shrs %a, %b %13 = index.shru %a, %b %14 = index.add %a, %b %15 = index.or %a, %b %16 = index.xor %a, %b %17 = index.bool.constant true return } func.func @ceildivs(%n: index, %m: index) -> index { %result = index.ceildivs %n, %m return %result : index } func.func @ceildivu(%n: index, %m: index) -> index { %result = index.ceildivu %n, %m return %result : index } func.func @floordivs(%n: index, %m: index) -> index { %result = index.floordivs %n, %m return %result : index } func.func @index_cast_from(%a: index) -> (i64, i32, i64, i32) { %0 = index.casts %a : index to i64 %1 = index.casts %a : index to i32 %2 = index.castu %a : index to i64 %3 = index.castu %a : index to i32 return %0, %1, %2, %3 : i64, i32, i64, i32 } func.func @index_cast_to(%a: i32, %b: i64) -> (index, index, index, index) { %0 = index.casts %a : i32 to index %1 = index.casts %b : i64 to index %2 = index.castu %a : i32 to index %3 = index.castu %b : i64 to index return %0, %1, %2, %3 : index, index, index, index } func.func @index_sizeof() { %0 = index.sizeof return } func.func @index_constant() { %0 = index.constant -2100000000 %1 = index.constant 2100000000 %2 = index.constant -3000000000 %3 = index.constant 3000000000 return }", mlir-opt -convert-index-to-llvm ,1 "func.func @trivial_ops(%a: index, %b: index) { %0 = index.add %a, %b %1 = index.sub %a, %b %2 = index.mul %a, %b %3 = index.divs %a, %b %4 = index.divu %a, %b %5 = index.rems %a, %b %6 = index.remu %a, %b %7 = index.maxs %a, %b %8 = index.maxu %a, %b %9 = index.mins %a, %b %10 = index.minu %a, %b %11 = index.shl %a, %b %12 = index.shrs %a, %b %13 = index.shru %a, %b %14 = index.add %a, %b %15 = index.or %a, %b %16 = index.xor %a, %b %17 = index.bool.constant true return } func.func @ceildivs(%n: index, %m: index) -> index { %result = index.ceildivs %n, %m return %result : index } func.func @ceildivu(%n: index, %m: index) -> index { %result = index.ceildivu %n, %m return %result : index } func.func @floordivs(%n: index, %m: index) -> index { %result = index.floordivs %n, %m return %result : index } func.func @index_cast_from(%a: index) -> (i64, i32, i64, i32) { %0 = index.casts %a : index to i64 %1 = index.casts %a : index to i32 %2 = index.castu %a : index to i64 %3 = index.castu %a : index to i32 return %0, %1, %2, %3 : i64, i32, i64, i32 } func.func @index_cast_to(%a: i32, %b: i64) -> (index, index, index, index) { %0 = index.casts %a : i32 to index %1 = index.casts %b : i64 to index %2 = index.castu %a : i32 to index %3 = index.castu %b : i64 to index return %0, %1, %2, %3 : index, index, index, index } func.func @index_sizeof() { %0 = index.sizeof return } func.func @index_constant() { %0 = index.constant -2100000000 %1 = index.constant 2100000000 %2 = index.constant -3000000000 %3 = index.constant 3000000000 return }", mlir-opt -convert-index-to-llvm=index-bitwidth=32 ,1 "func.func @trivial_ops(%a: index, %b: index) { %0 = index.add %a, %b %1 = index.sub %a, %b %2 = index.mul %a, %b %3 = index.divs %a, %b %4 = index.divu %a, %b %5 = index.rems %a, %b %6 = index.remu %a, %b %7 = index.maxs %a, %b %8 = index.maxu %a, %b %9 = index.mins %a, %b %10 = index.minu %a, %b %11 = index.shl %a, %b %12 = index.shrs %a, %b %13 = index.shru %a, %b %14 = index.add %a, %b %15 = index.or %a, %b %16 = index.xor %a, %b %17 = index.bool.constant true return } func.func @ceildivs(%n: index, %m: index) -> index { %result = index.ceildivs %n, %m return %result : index } func.func @ceildivu(%n: index, %m: index) -> index { %result = index.ceildivu %n, %m return %result : index } func.func @floordivs(%n: index, %m: index) -> index { %result = index.floordivs %n, %m return %result : index } func.func @index_cast_from(%a: index) -> (i64, i32, i64, i32) { %0 = index.casts %a : index to i64 %1 = index.casts %a : index to i32 %2 = index.castu %a : index to i64 %3 = index.castu %a : index to i32 return %0, %1, %2, %3 : i64, i32, i64, i32 } func.func @index_cast_to(%a: i32, %b: i64) -> (index, index, index, index) { %0 = index.casts %a : i32 to index %1 = index.casts %b : i64 to index %2 = index.castu %a : i32 to index %3 = index.castu %b : i64 to index return %0, %1, %2, %3 : index, index, index, index } func.func @index_sizeof() { %0 = index.sizeof return } func.func @index_constant() { %0 = index.constant -2100000000 %1 = index.constant 2100000000 %2 = index.constant -3000000000 %3 = index.constant 3000000000 return }", mlir-opt -convert-index-to-llvm=index-bitwidth=64 ,1 "func.func @no_memref_op(%arg0: memref) { affine.load %arg0[] : memref return }", mlir-opt -lower-affine ,1 "func.func @empty() { return } func.func private @body(index) -> () func.func @simple_loop() { affine.for %i = 1 to 42 { func.call @body(%i) : (index) -> () } return } func.func @for_with_yield(%buffer: memref<1024xf32>) -> (f32) { %sum_0 = arith.constant 0.0 : f32 %sum = affine.for %i = 0 to 10 step 2 iter_args(%sum_iter = %sum_0) -> (f32) { %t = affine.load %buffer[%i] : memref<1024xf32> %sum_next = arith.addf %sum_iter, %t : f32 affine.yield %sum_next : f32 } return %sum : f32 } func.func private @pre(index) -> () func.func private @body2(index, index) -> () func.func private @post(index) -> () func.func @imperfectly_nested_loops() { affine.for %i = 0 to 42 { func.call @pre(%i) : (index) -> () affine.for %j = 7 to 56 step 2 { func.call @body2(%i, %j) : (index, index) -> () } func.call @post(%i) : (index) -> () } return } func.func private @mid(index) -> () func.func private @body3(index, index) -> () func.func @more_imperfectly_nested_loops() { affine.for %i = 0 to 42 { func.call @pre(%i) : (index) -> () affine.for %j = 7 to 56 step 2 { func.call @body2(%i, %j) : (index, index) -> () } func.call @mid(%i) : (index) -> () affine.for %k = 18 to 37 step 3 { func.call @body3(%i, %k) : (index, index) -> () } func.call @post(%i) : (index) -> () } return } func.func @affine_apply_loops_shorthand(%N : index) { affine.for %i = 0 to %N { affine.for %j = affine_map<(d0)[]->(d0)>(%i)[] to 42 { func.call @body2(%i, %j) : (index, index) -> () } } return } func.func private @get_idx() -> (index) #set1 = affine_set<(d0) : (20 - d0 >= 0)> #set2 = affine_set<(d0) : (d0 - 10 >= 0)> func.func @if_only() { %i = call @get_idx() : () -> (index) affine.if #set1(%i) { func.call @body(%i) : (index) -> () } return } func.func @if_else() { %i = call @get_idx() : () -> (index) affine.if #set1(%i) { func.call @body(%i) : (index) -> () } else { func.call @mid(%i) : (index) -> () } return } func.func @nested_ifs() { %i = call @get_idx() : () -> (index) affine.if #set1(%i) { affine.if #set2(%i) { func.call @body(%i) : (index) -> () } } else { affine.if #set2(%i) { func.call @mid(%i) : (index) -> () } } return } func.func @if_with_yield() -> (i64) { %cst0 = arith.constant 0 : i64 %cst1 = arith.constant 1 : i64 %i = call @get_idx() : () -> (index) %1 = affine.if #set2(%i) -> (i64) { affine.yield %cst0 : i64 } else { affine.yield %cst1 : i64 } return %1 : i64 } #setN = affine_set<(d0)[N,M,K,L] : (N - d0 + 1 >= 0, N - 1 >= 0, M - 1 >= 0, K - 1 >= 0, L - 42 == 0)> func.func @multi_cond(%N : index, %M : index, %K : index, %L : index) { %i = call @get_idx() : () -> (index) affine.if #setN(%i)[%N,%M,%K,%L] { func.call @body(%i) : (index) -> () } else { func.call @mid(%i) : (index) -> () } return } func.func @if_for() { %i = call @get_idx() : () -> (index) affine.if #set1(%i) { affine.for %j = 0 to 42 { affine.if #set2(%j) { func.call @body2(%i, %j) : (index, index) -> () } } } affine.for %k = 0 to 42 { affine.if #set2(%k) { affine.for %l = 0 to 42 { func.call @body3(%k, %l) : (index, index) -> () } } } return } #lbMultiMap = affine_map<(d0)[s0] -> (d0, s0 - d0)> #ubMultiMap = affine_map<(d0)[s0] -> (s0, d0 + 10)> func.func @loop_min_max(%N : index) { affine.for %i = 0 to 42 { affine.for %j = max #lbMultiMap(%i)[%N] to min #ubMultiMap(%i)[%N] { func.call @body2(%i, %j) : (index, index) -> () } } return } #map_7_values = affine_map<(d0, d1, d2, d3, d4, d5, d6) -> (d0, d1, d2, d3, d4, d5, d6)> func.func @min_reduction_tree(%v1 : index, %v2 : index, %v3 : index, %v4 : index, %v5 : index, %v6 : index, %v7 : index) { affine.for %i = 0 to min #map_7_values(%v1, %v2, %v3, %v4, %v5, %v6, %v7)[] { func.call @body(%i) : (index) -> () } return } #map0 = affine_map<() -> (0)> #map1 = affine_map<()[s0] -> (s0)> #map2 = affine_map<(d0) -> (d0)> #map3 = affine_map<(d0)[s0] -> (d0 + s0 + 1)> #map4 = affine_map<(d0,d1,d2,d3)[s0,s1,s2] -> (d0 + 2*d1 + 3*d2 + 4*d3 + 5*s0 + 6*s1 + 7*s2)> #map5 = affine_map<(d0,d1,d2) -> (d0,d1,d2)> #map6 = affine_map<(d0,d1,d2) -> (d0 + d1 + d2)> func.func @affine_applies(%arg0 : index) { %zero = affine.apply #map0() %101 = arith.constant 101 : index %symbZero = affine.apply #map1()[%zero] %102 = arith.constant 102 : index %copy = affine.apply #map2(%zero) %one = affine.apply #map3(%symbZero)[%zero] %four = affine.apply #map4(%arg0, %arg0, %arg0, %arg0)[%arg0, %arg0, %arg0] return } func.func @args_ret_affine_apply(index, index) -> (index, index) { ^bb0(%0 : index, %1 : index): %00 = affine.apply #map2 (%0) %11 = affine.apply #map1 ()[%1] return %00, %11 : index, index }", mlir-opt -lower-affine ,1 ---------------------------------------------------------------------, mlir-opt -lower-affine ,1 "--------------------------------------------------------------------- #map_mod = affine_map<(i) -> (i mod 42)> func.func @affine_apply_mod(%arg0 : index) -> (index) { %0 = affine.apply #map_mod (%arg0) return %0 : index } #map_mod_dynamic_divisor = affine_map<(i)[s] -> (i mod s)> func.func @affine_apply_mod_dynamic_divisor(%arg0 : index, %arg1 : index) -> (index) { %0 = affine.apply #map_mod_dynamic_divisor (%arg0)[%arg1] return %0 : index }", mlir-opt -lower-affine ,1 ---------------------------------------------------------------------, mlir-opt -lower-affine ,1 "--------------------------------------------------------------------- #map_floordiv = affine_map<(i) -> (i floordiv 42)> func.func @affine_apply_floordiv(%arg0 : index) -> (index) { %0 = affine.apply #map_floordiv (%arg0) return %0 : index } #map_floordiv_dynamic_divisor = affine_map<(i)[s] -> (i floordiv s)> func.func @affine_apply_floordiv_dynamic_divisor(%arg0 : index, %arg1 : index) -> (index) { %0 = affine.apply #map_floordiv_dynamic_divisor (%arg0)[%arg1] return %0 : index }", mlir-opt -lower-affine ,1 ---------------------------------------------------------------------, mlir-opt -lower-affine ,1 "--------------------------------------------------------------------- #map_ceildiv = affine_map<(i) -> (i ceildiv 42)> func.func @affine_apply_ceildiv(%arg0 : index) -> (index) { %0 = affine.apply #map_ceildiv (%arg0) return %0 : index } #map_ceildiv_dynamic_divisor = affine_map<(i)[s] -> (i ceildiv s)> func.func @affine_apply_ceildiv_dynamic_divisor(%arg0 : index, %arg1 : index) -> (index) { %0 = affine.apply #map_ceildiv_dynamic_divisor (%arg0)[%arg1] return %0 : index } func.func @affine_load(%arg0 : index) { %0 = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { %1 = affine.load %0[%i0 + symbol(%arg0) + 7] : memref<10xf32> } return } func.func @affine_store(%arg0 : index) { %0 = memref.alloc() : memref<10xf32> %1 = arith.constant 11.0 : f32 affine.for %i0 = 0 to 10 { affine.store %1, %0[%i0 - symbol(%arg0) + 7] : memref<10xf32> } return } func.func @affine_load_store_zero_dim(%arg0 : memref, %arg1 : memref) { %0 = affine.load %arg0[] : memref affine.store %0, %arg1[] : memref return } func.func @affine_prefetch(%arg0 : index) { %0 = memref.alloc() : memref<10xf32> affine.for %i0 = 0 to 10 { affine.prefetch %0[%i0 + symbol(%arg0) + 7], read, locality<3>, data : memref<10xf32> } return } func.func @affine_dma_start(%arg0 : index) { %0 = memref.alloc() : memref<100xf32> %1 = memref.alloc() : memref<100xf32, 2> %2 = memref.alloc() : memref<1xi32> %c0 = arith.constant 0 : index %c64 = arith.constant 64 : index affine.for %i0 = 0 to 10 { affine.dma_start %0[%i0 + 7], %1[%arg0 + 11], %2[%c0], %c64 : memref<100xf32>, memref<100xf32, 2>, memref<1xi32> } return } func.func @affine_dma_wait(%arg0 : index) { %2 = memref.alloc() : memref<1xi32> %c64 = arith.constant 64 : index affine.for %i0 = 0 to 10 { affine.dma_wait %2[%i0 + %arg0 + 17], %c64 : memref<1xi32> } return } func.func @affine_min(%arg0: index, %arg1: index) -> index{ %0 = affine.min affine_map<(d0,d1) -> (d0 - d1, d1 - d0)>(%arg0, %arg1) return %0 : index } func.func @affine_max(%arg0: index, %arg1: index) -> index{ %0 = affine.max affine_map<(d0,d1) -> (d0 - d1, d1 - d0)>(%arg0, %arg1) return %0 : index } func.func @affine_parallel(%o: memref<100x100xf32>, %a: memref<100x100xf32>) { affine.parallel (%i, %j) = (0, 0) to (100, 100) { } return } func.func @affine_parallel_tiled(%o: memref<100x100xf32>, %a: memref<100x100xf32>, %b: memref<100x100xf32>) { affine.parallel (%i0, %j0, %k0) = (0, 0, 0) to (100, 100, 100) step (10, 10, 10) { affine.parallel (%i1, %j1, %k1) = (%i0, %j0, %k0) to (%i0 + 10, %j0 + 10, %k0 + 10) { %0 = affine.load %a[%i1, %k1] : memref<100x100xf32> %1 = affine.load %b[%k1, %j1] : memref<100x100xf32> %2 = arith.mulf %0, %1 : f32 } } return } func.func @affine_parallel_simple(%arg0: memref<3x3xf32>, %arg1: memref<3x3xf32>) -> (memref<3x3xf32>) { %O = memref.alloc() : memref<3x3xf32> affine.parallel (%kx, %ky) = (0, 0) to (2, 2) { %1 = affine.load %arg0[%kx, %ky] : memref<3x3xf32> %2 = affine.load %arg1[%kx, %ky] : memref<3x3xf32> %3 = arith.mulf %1, %2 : f32 affine.store %3, %O[%kx, %ky] : memref<3x3xf32> } return %O : memref<3x3xf32> } func.func @affine_parallel_simple_dynamic_bounds(%arg0: memref, %arg1: memref, %arg2: memref) { %c_0 = arith.constant 0 : index %output_dim = memref.dim %arg0, %c_0 : memref affine.parallel (%kx, %ky) = (%c_0, %c_0) to (%output_dim, %output_dim) { %1 = affine.load %arg0[%kx, %ky] : memref %2 = affine.load %arg1[%kx, %ky] : memref %3 = arith.mulf %1, %2 : f32 affine.store %3, %arg2[%kx, %ky] : memref } return } func.func @affine_parallel_with_reductions(%arg0: memref<3x3xf32>, %arg1: memref<3x3xf32>) -> (f32, f32) { %0:2 = affine.parallel (%kx, %ky) = (0, 0) to (2, 2) reduce (""addf"", ""mulf"") -> (f32, f32) { %1 = affine.load %arg0[%kx, %ky] : memref<3x3xf32> %2 = affine.load %arg1[%kx, %ky] : memref<3x3xf32> %3 = arith.mulf %1, %2 : f32 %4 = arith.addf %1, %2 : f32 affine.yield %3, %4 : f32, f32 } return %0#0, %0#1 : f32, f32 } func.func @affine_parallel_with_reductions_f64(%arg0: memref<3x3xf64>, %arg1: memref<3x3xf64>) -> (f64, f64) { %0:2 = affine.parallel (%kx, %ky) = (0, 0) to (2, 2) reduce (""addf"", ""mulf"") -> (f64, f64) { %1 = affine.load %arg0[%kx, %ky] : memref<3x3xf64> %2 = affine.load %arg1[%kx, %ky] : memref<3x3xf64> %3 = arith.mulf %1, %2 : f64 %4 = arith.addf %1, %2 : f64 affine.yield %3, %4 : f64, f64 } return %0#0, %0#1 : f64, f64 } func.func @affine_parallel_with_reductions_i64(%arg0: memref<3x3xi64>, %arg1: memref<3x3xi64>) -> (i64, i64) { %0:2 = affine.parallel (%kx, %ky) = (0, 0) to (2, 2) reduce (""addi"", ""muli"") -> (i64, i64) { %1 = affine.load %arg0[%kx, %ky] : memref<3x3xi64> %2 = affine.load %arg1[%kx, %ky] : memref<3x3xi64> %3 = arith.muli %1, %2 : i64 %4 = arith.addi %1, %2 : i64 affine.yield %3, %4 : i64, i64 } return %0#0, %0#1 : i64, i64 }", mlir-opt -lower-affine ,1 "#map0gpufunc = affine_map<(d0) -> (d0)> gpu.module @kernels { gpu.func @foo(%arg0 : index, %arg1 : memref) -> f32 { %0 = affine.apply #map0gpufunc(%arg0) %1 = memref.load %arg1[%0] : memref gpu.return %1 : f32 } }"," mlir-opt -pass-pipeline=""builtin.module(gpu.module(lower-affine))"" ",1 "func.func @affine_vector_load(%arg0 : index) { %0 = memref.alloc() : memref<100xf32> affine.for %i0 = 0 to 16 { %1 = affine.vector_load %0[%i0 + symbol(%arg0) + 7] : memref<100xf32>, vector<8xf32> } return }", mlir-opt -lower-affine --split-input-file ,1 "func.func @affine_vector_store(%arg0 : index) { %0 = memref.alloc() : memref<100xf32> %1 = arith.constant dense<11.0> : vector<4xf32> affine.for %i0 = 0 to 16 { affine.vector_store %1, %0[%i0 - symbol(%arg0) + 7] : memref<100xf32>, vector<4xf32> } return }", mlir-opt -lower-affine --split-input-file ,1 "func.func @vector_load_2d() { %0 = memref.alloc() : memref<100x100xf32> affine.for %i0 = 0 to 16 step 2{ affine.for %i1 = 0 to 16 step 8 { %1 = affine.vector_load %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32> } } return }", mlir-opt -lower-affine --split-input-file ,1 "func.func @vector_store_2d() { %0 = memref.alloc() : memref<100x100xf32> %1 = arith.constant dense<11.0> : vector<2x8xf32> affine.for %i0 = 0 to 16 step 2{ affine.for %i1 = 0 to 16 step 8 { affine.vector_store %1, %0[%i0, %i1] : memref<100x100xf32>, vector<2x8xf32> } } return }", mlir-opt -lower-affine --split-input-file ,1 "func.func @vector_transfer_ops_0d(%M: memref) { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %M[], %f0 {permutation_map = affine_map<()->()>} : memref, vector vector.transfer_write %0, %M[] {permutation_map = affine_map<()->()>} : vector, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @vector_transfer_ops_0d(%M: memref) { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %M[], %f0 {permutation_map = affine_map<()->()>} : memref, vector vector.transfer_write %0, %M[] {permutation_map = affine_map<()->()>} : vector, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_read_1d() { %f0 = arith.constant 0.0: f32 %A = memref.alloc () : memref<7x42xf32> affine.for %i0 = 0 to 7 step 4 { affine.for %i1 = 0 to 42 step 4 { %f1 = vector.transfer_read %A[%i0, %i1], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> %ip1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i1) %f2 = vector.transfer_read %A[%i0, %ip1], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> %ip2 = affine.apply affine_map<(d0) -> (d0 + 2)> (%i1) %f3 = vector.transfer_read %A[%i0, %ip2], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> %ip3 = affine.apply affine_map<(d0) -> (d0 + 3)> (%i1) %f4 = vector.transfer_read %A[%i0, %ip3], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> ""dummy_use""(%f1, %f2, %f3, %f4) : (vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32>) -> () } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_read_1d() { %f0 = arith.constant 0.0: f32 %A = memref.alloc () : memref<7x42xf32> affine.for %i0 = 0 to 7 step 4 { affine.for %i1 = 0 to 42 step 4 { %f1 = vector.transfer_read %A[%i0, %i1], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> %ip1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i1) %f2 = vector.transfer_read %A[%i0, %ip1], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> %ip2 = affine.apply affine_map<(d0) -> (d0 + 2)> (%i1) %f3 = vector.transfer_read %A[%i0, %ip2], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> %ip3 = affine.apply affine_map<(d0) -> (d0 + 3)> (%i1) %f4 = vector.transfer_read %A[%i0, %ip3], %f0 {permutation_map = affine_map<(d0, d1) -> (d0)>} : memref<7x42xf32>, vector<4xf32> ""dummy_use""(%f1, %f2, %f3, %f4) : (vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32>) -> () } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %dyn4 : index) { %f0 = arith.constant 0.0: f32 %A = memref.alloc (%dyn1, %dyn2, %dyn4) : memref<7x?x?x42x?xf32> affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to %dyn1 { affine.for %i2 = 0 to %dyn2 { affine.for %i3 = 0 to 42 step 2 { affine.for %i4 = 0 to %dyn4 { %f1 = vector.transfer_read %A[%i0, %i1, %i2, %i3, %i4], %f0 {permutation_map = affine_map<(d0, d1, d2, d3, d4) -> (d3)>} : memref<7x?x?x42x?xf32>, vector<4xf32> %i3p1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i3) %f2 = vector.transfer_read %A[%i0, %i1, %i2, %i3p1, %i4], %f0 {permutation_map = affine_map<(d0, d1, d2, d3, d4) -> (d3)>} : memref<7x?x?x42x?xf32>, vector<4xf32> ""dummy_use""(%f1, %f2) : (vector<4xf32>, vector<4xf32>) -> () } } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_read_1d_partially_specialized(%dyn1 : index, %dyn2 : index, %dyn4 : index) { %f0 = arith.constant 0.0: f32 %A = memref.alloc (%dyn1, %dyn2, %dyn4) : memref<7x?x?x42x?xf32> affine.for %i0 = 0 to 7 { affine.for %i1 = 0 to %dyn1 { affine.for %i2 = 0 to %dyn2 { affine.for %i3 = 0 to 42 step 2 { affine.for %i4 = 0 to %dyn4 { %f1 = vector.transfer_read %A[%i0, %i1, %i2, %i3, %i4], %f0 {permutation_map = affine_map<(d0, d1, d2, d3, d4) -> (d3)>} : memref<7x?x?x42x?xf32>, vector<4xf32> %i3p1 = affine.apply affine_map<(d0) -> (d0 + 1)> (%i3) %f2 = vector.transfer_read %A[%i0, %i1, %i2, %i3p1, %i4], %f0 {permutation_map = affine_map<(d0, d1, d2, d3, d4) -> (d3)>} : memref<7x?x?x42x?xf32>, vector<4xf32> ""dummy_use""(%f1, %f2) : (vector<4xf32>, vector<4xf32>) -> () } } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_read(%M: index, %N: index, %O: index, %P: index) { %f0 = arith.constant 0.0: f32 %A = memref.alloc (%M, %N, %O, %P) : memref affine.for %i0 = 0 to %M step 3 { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %O { affine.for %i3 = 0 to %P step 5 { %f = vector.transfer_read %A[%i0, %i1, %i2, %i3], %f0 {permutation_map = affine_map<(d0, d1, d2, d3) -> (d3, 0, d0)>} : memref, vector<5x4x3xf32> ""dummy_use""(%f) : (vector<5x4x3xf32>) -> () } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_read(%M: index, %N: index, %O: index, %P: index) { %f0 = arith.constant 0.0: f32 %A = memref.alloc (%M, %N, %O, %P) : memref affine.for %i0 = 0 to %M step 3 { affine.for %i1 = 0 to %N { affine.for %i2 = 0 to %O { affine.for %i3 = 0 to %P step 5 { %f = vector.transfer_read %A[%i0, %i1, %i2, %i3], %f0 {permutation_map = affine_map<(d0, d1, d2, d3) -> (d3, 0, d0)>} : memref, vector<5x4x3xf32> ""dummy_use""(%f) : (vector<5x4x3xf32>) -> () } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_write(%M: index, %N: index, %O: index, %P: index) { %A = memref.alloc (%M, %N, %O, %P) : memref %f1 = arith.constant dense<1.000000e+00> : vector<5x4x3xf32> affine.for %i0 = 0 to %M step 3 { affine.for %i1 = 0 to %N step 4 { affine.for %i2 = 0 to %O { affine.for %i3 = 0 to %P step 5 { vector.transfer_write %f1, %A[%i0, %i1, %i2, %i3] {permutation_map = affine_map<(d0, d1, d2, d3) -> (d3, d1, d0)>} : vector<5x4x3xf32>, memref } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @materialize_write(%M: index, %N: index, %O: index, %P: index) { %A = memref.alloc (%M, %N, %O, %P) : memref %f1 = arith.constant dense<1.000000e+00> : vector<5x4x3xf32> affine.for %i0 = 0 to %M step 3 { affine.for %i1 = 0 to %N step 4 { affine.for %i2 = 0 to %O { affine.for %i3 = 0 to %P step 5 { vector.transfer_write %f1, %A[%i0, %i1, %i2, %i3] {permutation_map = affine_map<(d0, d1, d2, d3) -> (d3, d1, d0)>} : vector<5x4x3xf32>, memref } } } } return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_progressive(%A : memref, %base: index) -> vector<3x15xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base, %base], %f7 : memref, vector<3x15xf32> return %f: vector<3x15xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_progressive(%A : memref, %base: index) -> vector<3x15xf32> { %f7 = arith.constant 7.0: f32 %f = vector.transfer_read %A[%base, %base], %f7 : memref, vector<3x15xf32> return %f: vector<3x15xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_write_progressive(%A : memref, %base: index, %vec: vector<3x15xf32>) { vector.transfer_write %vec, %A[%base, %base] : vector<3x15xf32>, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_write_progressive(%A : memref, %base: index, %vec: vector<3x15xf32>) { vector.transfer_write %vec, %A[%base, %base] : vector<3x15xf32>, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_write_progressive_inbounds(%A : memref, %base: index, %vec: vector<3x15xf32>) { vector.transfer_write %vec, %A[%base, %base] {in_bounds = [true, true]} : vector<3x15xf32>, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_write_progressive_inbounds(%A : memref, %base: index, %vec: vector<3x15xf32>) { vector.transfer_write %vec, %A[%base, %base] {in_bounds = [true, true]} : vector<3x15xf32>, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_simple(%A : memref<2x2xf32>) -> vector<2x2xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<2x2xf32>, vector<2x2xf32> return %0 : vector<2x2xf32> } func.func @transfer_read_minor_identity(%A : memref) -> vector<3x3xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0, %c0, %c0, %c0], %f0 { permutation_map = affine_map<(d0, d1, d2, d3) -> (d2, d3)> } : memref, vector<3x3xf32> return %0 : vector<3x3xf32> } func.func @transfer_write_minor_identity(%A : vector<3x3xf32>, %B : memref) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 vector.transfer_write %A, %B[%c0, %c0, %c0, %c0] { permutation_map = affine_map<(d0, d1, d2, d3) -> (d2, d3)> } : vector<3x3xf32>, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_simple(%A : memref<2x2xf32>) -> vector<2x2xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<2x2xf32>, vector<2x2xf32> return %0 : vector<2x2xf32> } func.func @transfer_read_minor_identity(%A : memref) -> vector<3x3xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0, %c0, %c0, %c0], %f0 { permutation_map = affine_map<(d0, d1, d2, d3) -> (d2, d3)> } : memref, vector<3x3xf32> return %0 : vector<3x3xf32> } func.func @transfer_write_minor_identity(%A : vector<3x3xf32>, %B : memref) { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 vector.transfer_write %A, %B[%c0, %c0, %c0, %c0] { permutation_map = affine_map<(d0, d1, d2, d3) -> (d2, d3)> } : vector<3x3xf32>, memref return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_strided(%A : memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>>) -> vector<4xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>>, vector<4xf32> return %0 : vector<4xf32> } func.func @transfer_write_strided(%A : vector<4xf32>, %B : memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>>) { %c0 = arith.constant 0 : index vector.transfer_write %A, %B[%c0, %c0] : vector<4xf32>, memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_strided(%A : memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>>) -> vector<4xf32> { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>>, vector<4xf32> return %0 : vector<4xf32> } func.func @transfer_write_strided(%A : vector<4xf32>, %B : memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>>) { %c0 = arith.constant 0 : index vector.transfer_write %A, %B[%c0, %c0] : vector<4xf32>, memref<8x4xf32, affine_map<(d0, d1) -> (d0 + d1 * 8)>> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func private @fake_side_effecting_fun(%0: vector<2x2xf32>) -> () func.func @transfer_read_within_async_execute(%A : memref<2x2xf32>) -> !async.token { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %token = async.execute { %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<2x2xf32>, vector<2x2xf32> func.call @fake_side_effecting_fun(%0) : (vector<2x2xf32>) -> () async.yield } return %token : !async.token }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func private @fake_side_effecting_fun(%0: vector<2x2xf32>) -> () func.func @transfer_read_within_async_execute(%A : memref<2x2xf32>) -> !async.token { %c0 = arith.constant 0 : index %f0 = arith.constant 0.0 : f32 %token = async.execute { %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<2x2xf32>, vector<2x2xf32> func.call @fake_side_effecting_fun(%0) : (vector<2x2xf32>) -> () async.yield } return %token : !async.token }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_with_tensor(%arg: tensor) -> vector<1xf32> { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg[], %f0 {permutation_map = affine_map<()->(0)>} : tensor, vector<1xf32> return %0: vector<1xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_with_tensor(%arg: tensor) -> vector<1xf32> { %f0 = arith.constant 0.0 : f32 %0 = vector.transfer_read %arg[], %f0 {permutation_map = affine_map<()->(0)>} : tensor, vector<1xf32> return %0: vector<1xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_2d(%A : tensor, %base1 : index, %base2 : index) -> (vector<4x9xf32>){ %p = arith.constant -42.0: f32 %f = vector.transfer_read %A[%base1, %base2], %p {in_bounds = [true, true]} : tensor, vector<4x9xf32> return %f : vector<4x9xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{lower-tensors=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_write_2d(%A : tensor, %vec : vector<2x3xf32>, %base1 : index, %base2 : index) -> (tensor) { %t = vector.transfer_write %vec, %A[%base1, %base2] {in_bounds = [true, true]} : vector<2x3xf32>, tensor return %t : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{lower-tensors=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_inbounds(%A : memref) -> (vector<2x3x4xf32>) { %f0 = arith.constant 0.0: f32 %c0 = arith.constant 0: index %vec = vector.transfer_read %A[%c0, %c0, %c0], %f0 {in_bounds = [true, true, true]} : memref, vector<2x3x4xf32> return %vec : vector<2x3x4xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_out_of_bounds(%A : memref) -> (vector<2x3x4xf32>) { %f0 = arith.constant 0.0: f32 %c0 = arith.constant 0: index %vec = vector.transfer_read %A[%c0, %c0, %c0], %f0 : memref, vector<2x3x4xf32> return %vec : vector<2x3x4xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_mask(%A : memref, %mask : vector<2x3x4xi1>) -> (vector<2x3x4xf32>) { %f0 = arith.constant 0.0: f32 %c0 = arith.constant 0: index %vec = vector.transfer_read %A[%c0, %c0, %c0], %f0, %mask {in_bounds = [true, true, true]}: memref, vector<2x3x4xf32> return %vec : vector<2x3x4xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_2d(%A : tensor, %base1 : index, %base2 : index) -> (vector<4x9xf32>){ %p = arith.constant -42.0: f32 %f = vector.transfer_read %A[%base1, %base2], %p {in_bounds = [true, true]} : tensor, vector<4x9xf32> return %f : vector<4x9xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true lower-tensors=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_write_2d(%A : tensor, %vec : vector<2x3xf32>, %base1 : index, %base2 : index) -> (tensor) { %t = vector.transfer_write %vec, %A[%base1, %base2] {in_bounds = [true, true]} : vector<2x3xf32>, tensor return %t : tensor }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf{full-unroll=true lower-tensors=true}))"" -split-input-file -allow-unregistered-dialect ",1 "func.func @transfer_read_2d_mask_transposed( %A : memref, %base1: index, %base2: index) -> (vector<9x4xf32>) { %fm42 = arith.constant -42.0: f32 %mask = arith.constant dense<[[1, 0, 1, 0, 1, 1, 1, 0, 1], [0, 0, 1, 1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1], [0, 0, 1, 0, 1, 1, 1, 0, 1]]> : vector<4x9xi1> %f = vector.transfer_read %A[%base1, %base2], %fm42, %mask {permutation_map = affine_map<(d0, d1) -> (d1, d0)>} : memref, vector<9x4xf32> return %f : vector<9x4xf32> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-scf))"" -split-input-file ",1 "module attributes {spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { func.func @atomic_addi_storage_buffer(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""addi"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } func.func @atomic_maxs_workgroup(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""maxs"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } func.func @atomic_maxu_storage_buffer(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""maxu"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } func.func @atomic_mins_workgroup(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""mins"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } func.func @atomic_minu_storage_buffer(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""minu"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } func.func @atomic_ori_workgroup(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""ori"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } func.func @atomic_andi_storage_buffer(%value: i32, %memref: memref<2x3x4xi32, #spirv.storage_class>, %i0: index, %i1: index, %i2: index) -> i32 { %0 = memref.atomic_rmw ""andi"" %value, %memref[%i0, %i1, %i2] : (i32, memref<2x3x4xi32, #spirv.storage_class>) -> i32 return %0: i32 } }", mlir-opt -split-input-file -convert-memref-to-spirv -o - ,1 "func.func @operand_result() { %0 = ""dialect.memref_producer""() : () -> (memref) %1 = ""dialect.memref_producer""() : () -> (memref<4xi32, 1>) %2 = ""dialect.memref_producer""() : () -> (memref) %3 = ""dialect.memref_producer""() : () -> (memref<*xf16, 4>) ""dialect.memref_consumer""(%0) : (memref) -> () ""dialect.memref_consumer""(%1) : (memref<4xi32, 1>) -> () ""dialect.memref_consumer""(%2) : (memref) -> () ""dialect.memref_consumer""(%3) : (memref<*xf16, 4>) -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "func.func @operand_result() { %0 = ""dialect.memref_producer""() : () -> (memref) %1 = ""dialect.memref_producer""() : () -> (memref<4xi32, 1>) %2 = ""dialect.memref_producer""() : () -> (memref) %3 = ""dialect.memref_producer""() : () -> (memref<*xf16, 4>) ""dialect.memref_consumer""(%0) : (memref) -> () ""dialect.memref_consumer""(%1) : (memref<4xi32, 1>) -> () ""dialect.memref_consumer""(%2) : (memref) -> () ""dialect.memref_consumer""(%3) : (memref<*xf16, 4>) -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "func.func @type_attribute() { ""dialect.memref_producer""() { attr = memref } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "func.func @type_attribute() { ""dialect.memref_producer""() { attr = memref } : () -> () return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "func.func @function_io (%arg0: memref, %arg1: memref<4xi32, 3>) -> (memref, memref<4xi32, 3>) { return %arg0, %arg1: memref, memref<4xi32, 3> }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "func.func @function_io (%arg0: memref, %arg1: memref<4xi32, 3>) -> (memref, memref<4xi32, 3>) { return %arg0, %arg1: memref, memref<4xi32, 3> }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "gpu.module @kernel { gpu.func @function_io(%arg0 : memref<8xi32>) kernel { gpu.return } }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "gpu.module @kernel { gpu.func @function_io(%arg0 : memref<8xi32>) kernel { gpu.return } }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "func.func @region(%cond: i1, %arg0: memref) { scf.if %cond { %0 = ""dialect.memref_consumer""(%arg0) { attr = memref } : (memref) -> (memref) } return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "func.func @region(%cond: i1, %arg0: memref) { scf.if %cond { %0 = ""dialect.memref_consumer""(%arg0) { attr = memref } : (memref) -> (memref) } return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "func.func @non_memref_types(%arg: f32) -> f32 { %0 = ""dialect.op""(%arg) { attr = 16 } : (f32) -> (f32) return %0 : f32 }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "func.func @non_memref_types(%arg: f32) -> f32 { %0 = ""dialect.op""(%arg) { attr = 16 } : (f32) -> (f32) return %0 : f32 }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "func.func @missing_mapping() { %0 = ""dialect.memref_producer""() : () -> (memref) return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "func.func @missing_mapping() { %0 = ""dialect.memref_producer""() : () -> (memref) return }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @operand_result() { %0 = ""dialect.memref_producer""() : () -> (memref) %1 = ""dialect.memref_producer""() : () -> (memref<4xi32, 1>) %2 = ""dialect.memref_producer""() : () -> (memref) %3 = ""dialect.memref_producer""() : () -> (memref<*xf16, 4>) ""dialect.memref_consumer""(%0) : (memref) -> () ""dialect.memref_consumer""(%1) : (memref<4xi32, 1>) -> () ""dialect.memref_consumer""(%2) : (memref) -> () ""dialect.memref_consumer""(%3) : (memref<*xf16, 4>) -> () return } }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @operand_result() { %0 = ""dialect.memref_producer""() : () -> (memref) %1 = ""dialect.memref_producer""() : () -> (memref<4xi32, 1>) %2 = ""dialect.memref_producer""() : () -> (memref) %3 = ""dialect.memref_producer""() : () -> (memref<*xf16, 4>) ""dialect.memref_consumer""(%0) : (memref) -> () ""dialect.memref_consumer""(%1) : (memref<4xi32, 1>) -> () ""dialect.memref_consumer""(%2) : (memref) -> () ""dialect.memref_consumer""(%3) : (memref<*xf16, 4>) -> () return } }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @operand_result() { %0 = ""dialect.memref_producer""() : () -> (memref) %1 = ""dialect.memref_producer""() : () -> (memref<4xi32, 1>) %2 = ""dialect.memref_producer""() : () -> (memref) %3 = ""dialect.memref_producer""() : () -> (memref<*xf16, 4>) ""dialect.memref_consumer""(%0) : (memref) -> () ""dialect.memref_consumer""(%1) : (memref<4xi32, 1>) -> () ""dialect.memref_consumer""(%2) : (memref) -> () ""dialect.memref_consumer""(%3) : (memref<*xf16, 4>) -> () return } }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=vulkan' -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @operand_result() { %0 = ""dialect.memref_producer""() : () -> (memref) %1 = ""dialect.memref_producer""() : () -> (memref<4xi32, 1>) %2 = ""dialect.memref_producer""() : () -> (memref) %3 = ""dialect.memref_producer""() : () -> (memref<*xf16, 4>) ""dialect.memref_consumer""(%0) : (memref) -> () ""dialect.memref_consumer""(%1) : (memref<4xi32, 1>) -> () ""dialect.memref_consumer""(%2) : (memref) -> () ""dialect.memref_consumer""(%3) : (memref<*xf16, 4>) -> () return } }", mlir-opt -split-input-file -allow-unregistered-dialect -map-memref-spirv-storage-class='client-api=opencl' -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @alloc_dealloc_workgroup_mem(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<4x5xf32, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg1] : memref<4x5xf32, #spirv.storage_class> memref.store %1, %0[%arg0, %arg1] : memref<4x5xf32, #spirv.storage_class> memref.dealloc %0 : memref<4x5xf32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @alloc_dealloc_workgroup_mem(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<4x5xi16, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg1] : memref<4x5xi16, #spirv.storage_class> memref.store %1, %0[%arg0, %arg1] : memref<4x5xi16, #spirv.storage_class> memref.dealloc %0 : memref<4x5xi16, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @two_allocs() { %0 = memref.alloc() : memref<4x5xf32, #spirv.storage_class> %1 = memref.alloc() : memref<2x3xi32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @two_allocs_vector() { %0 = memref.alloc() : memref<4xvector<4xf32>, #spirv.storage_class> %1 = memref.alloc() : memref<2xvector<2xi32>, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @alloc_dynamic_size(%arg0 : index) -> f32 { %0 = memref.alloc(%arg0) : memref<4x?xf32, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg0] : memref<4x?xf32, #spirv.storage_class> return %1: f32 } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @alloc_unsupported_memory_space(%arg0: index) -> f32 { %0 = memref.alloc() : memref<4x5xf32, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg0] : memref<4x5xf32, #spirv.storage_class> return %1: f32 } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @dealloc_dynamic_size(%arg0 : memref<4x?xf32, #spirv.storage_class>) { memref.dealloc %arg0 : memref<4x?xf32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @dealloc_unsupported_memory_space(%arg0 : memref<4x5xf32, #spirv.storage_class>) { memref.dealloc %arg0 : memref<4x5xf32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @alloc_dealloc_workgroup_mem(%arg0 : index, %arg1 : index) { %0 = memref.alloc() : memref<4x5xf32, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg1] : memref<4x5xf32, #spirv.storage_class> memref.store %1, %0[%arg0, %arg1] : memref<4x5xf32, #spirv.storage_class> memref.dealloc %0 : memref<4x5xf32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes {spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { func.func @alloc_function_variable(%arg0 : index, %arg1 : index) { %0 = memref.alloca() : memref<4x5xf32, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg1] : memref<4x5xf32, #spirv.storage_class> memref.store %1, %0[%arg0, %arg1] : memref<4x5xf32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes {spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { func.func @two_allocs() { %0 = memref.alloca() : memref<4x5xf32, #spirv.storage_class> %1 = memref.alloca() : memref<2x3xi32, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes {spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { func.func @two_allocs_vector() { %0 = memref.alloca() : memref<4xvector<4xf32>, #spirv.storage_class> %1 = memref.alloca() : memref<2xvector<2xi32>, #spirv.storage_class> return } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes {spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { func.func @alloc_dynamic_size(%arg0 : index) -> f32 { %0 = memref.alloca(%arg0) : memref<4x?xf32, #spirv.storage_class> %1 = memref.load %0[%arg0, %arg0] : memref<4x?xf32, #spirv.storage_class> return %1: f32 } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes {spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { func.func @alloc_unsupported_memory_space(%arg0: index) -> f32 { %0 = memref.alloca() : memref<4x5xf32> %1 = memref.load %0[%arg0, %arg0] : memref<4x5xf32> return %1: f32 } }", mlir-opt -split-input-file -convert-memref-to-spirv -canonicalize -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @load_store_zero_rank_float(%arg0: memref>, %arg1: memref>) { %0 = memref.load %arg0[] : memref> memref.store %0, %arg1[] : memref> return } func.func @load_store_zero_rank_int(%arg0: memref>, %arg1: memref>) { %0 = memref.load %arg0[] : memref> memref.store %0, %arg1[] : memref> return } func.func @load_store_unknown_dim(%i: index, %source: memref>, %dest: memref>) { %0 = memref.load %source[%i] : memref> memref.store %0, %dest[%i]: memref> return } func.func @load_i1(%src: memref<4xi1, #spirv.storage_class>, %i : index) -> i1 { %0 = memref.load %src[%i] : memref<4xi1, #spirv.storage_class> return %0: i1 } func.func @store_i1(%dst: memref<4xi1, #spirv.storage_class>, %i: index) { %true = arith.constant true memref.store %true, %dst[%i]: memref<4xi1, #spirv.storage_class> return } func.func @load_i16(%arg0: memref>) { %0 = memref.load %arg0[] : memref> return } func.func @store_i16(%arg0: memref<10xi16, #spirv.storage_class>, %index: index, %value: i16) { memref.store %value, %arg0[%index] : memref<10xi16, #spirv.storage_class> return } } "," mlir-opt -split-input-file -convert-memref-to-spirv=""bool-num-bits=8"" -cse -o - ",1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @load_store_zero_rank_float(%arg0: memref>, %arg1: memref>) { %0 = memref.load %arg0[] : memref> memref.store %0, %arg1[] : memref> return } func.func @load_store_zero_rank_int(%arg0: memref>, %arg1: memref>) { %0 = memref.load %arg0[] : memref> memref.store %0, %arg1[] : memref> return } func.func @load_store_unknown_dim(%i: index, %source: memref>, %dest: memref>) { %0 = memref.load %source[%i] : memref> memref.store %0, %dest[%i]: memref> return } func.func @load_i1(%src: memref<4xi1, #spirv.storage_class>, %i : index) -> i1 { %0 = memref.load %src[%i] : memref<4xi1, #spirv.storage_class> return %0: i1 } func.func @store_i1(%dst: memref<4xi1, #spirv.storage_class>, %i: index) { %true = arith.constant true memref.store %true, %dst[%i]: memref<4xi1, #spirv.storage_class> return } } "," mlir-opt -split-input-file -convert-memref-to-spirv=""bool-num-bits=8"" -cse -o - ",1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memory_space_cast(%arg: memref<4xf32, #spirv.storage_class>) -> memref<4xf32, #spirv.storage_class> { %ret = memref.memory_space_cast %arg : memref<4xf32, #spirv.storage_class> to memref<4xf32, #spirv.storage_class> return %ret : memref<4xf32, #spirv.storage_class> } } "," mlir-opt -split-input-file -convert-memref-to-spirv=""bool-num-bits=8"" -cse -o - ",1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @load_i1(%arg0: memref>) -> i1 { %0 = memref.load %arg0[] : memref> return %0 : i1 } func.func @load_i8(%arg0: memref>) -> i8 { %0 = memref.load %arg0[] : memref> return %0 : i8 } func.func @load_i16(%arg0: memref<10xi16, #spirv.storage_class>, %index : index) -> i16 { %0 = memref.load %arg0[%index] : memref<10xi16, #spirv.storage_class> return %0: i16 } func.func @load_f32(%arg0: memref>) { %0 = memref.load %arg0[] : memref> return } func.func @store_i1(%arg0: memref>, %value: i1) { memref.store %value, %arg0[] : memref> return } func.func @store_i8(%arg0: memref>, %value: i8) { memref.store %value, %arg0[] : memref> return } func.func @store_i16(%arg0: memref<10xi16, #spirv.storage_class>, %index: index, %value: i16) { memref.store %value, %arg0[%index] : memref<10xi16, #spirv.storage_class> return } func.func @store_f32(%arg0: memref>, %value: f32) { memref.store %value, %arg0[] : memref> return } } "," mlir-opt -split-input-file -convert-memref-to-spirv=""bool-num-bits=8"" -cse -o - ",1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @load_i4(%arg0: memref>, %i: index) -> i4 { %0 = memref.load %arg0[%i] : memref> return %0 : i4 } func.func @store_i4(%arg0: memref>, %value: i4, %i: index) { memref.store %value, %arg0[%i] : memref> return } } "," mlir-opt -split-input-file -convert-memref-to-spirv=""bool-num-bits=8"" -cse -o - ",1 "gpu.module @foo { llvm.func @kernel(%arg0 : f32, %arg1 : !llvm.ptr) attributes { gpu.kernel } { llvm.return } } gpu.module @bar { llvm.func @kernel_a() attributes { gpu.kernel } { llvm.return } llvm.func @kernel_b() attributes { gpu.kernel } { llvm.return } }", mlir-opt --test-gpu-to-cubin ,1 "func.func @create_token() { %0 = async.runtime.create : !async.token return } func.func @create_value() { %0 = async.runtime.create : !async.value return } func.func @create_group() { %c = arith.constant 1 : index %0 = async.runtime.create_group %c: !async.group return } func.func @set_token_available() { %0 = async.runtime.create : !async.token async.runtime.set_available %0 : !async.token return } func.func @set_value_available() { %0 = async.runtime.create : !async.value async.runtime.set_available %0 : !async.value return } func.func @is_token_error() -> i1 { %0 = async.runtime.create : !async.token %1 = async.runtime.is_error %0 : !async.token return %1 : i1 } func.func @is_value_error() -> i1 { %0 = async.runtime.create : !async.value %1 = async.runtime.is_error %0 : !async.value return %1 : i1 } func.func @await_token() { %0 = async.runtime.create : !async.token async.runtime.await %0 : !async.token return } func.func @await_value() { %0 = async.runtime.create : !async.value async.runtime.await %0 : !async.value return } func.func @await_group() { %c = arith.constant 1 : index %0 = async.runtime.create_group %c: !async.group async.runtime.await %0 : !async.group return } func.func @await_and_resume_token() { %0 = async.coro.id %1 = async.coro.begin %0 %2 = async.runtime.create : !async.token async.runtime.await_and_resume %2, %1 : !async.token return } func.func @await_and_resume_value() { %0 = async.coro.id %1 = async.coro.begin %0 %2 = async.runtime.create : !async.value async.runtime.await_and_resume %2, %1 : !async.value return } func.func @await_and_resume_group() { %c = arith.constant 1 : index %0 = async.coro.id %1 = async.coro.begin %0 %2 = async.runtime.create_group %c : !async.group async.runtime.await_and_resume %2, %1 : !async.group return } func.func @resume() { %0 = async.coro.id %1 = async.coro.begin %0 async.runtime.resume %1 return } func.func @store() { %0 = arith.constant 1.0 : f32 %1 = async.runtime.create : !async.value async.runtime.store %0, %1 : !async.value return } func.func @load() -> f32 { %0 = async.runtime.create : !async.value %1 = async.runtime.load %0 : !async.value return %1 : f32 } func.func @add_token_to_group() { %c = arith.constant 1 : index %0 = async.runtime.create : !async.token %1 = async.runtime.create_group %c : !async.group async.runtime.add_to_group %0, %1 : !async.token return }", mlir-opt -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @coro_id() { %0 = async.coro.id return } func.func @coro_begin() { %0 = async.coro.id %1 = async.coro.begin %0 return } func.func @coro_free() { %0 = async.coro.id %1 = async.coro.begin %0 async.coro.free %0, %1 return } func.func @coro_end() { %0 = async.coro.id %1 = async.coro.begin %0 async.coro.end %1 return } func.func @coro_save() { %0 = async.coro.id %1 = async.coro.begin %0 %2 = async.coro.save %1 return } func.func @coro_suspend() { %0 = async.coro.id %1 = async.coro.begin %0 %2 = async.coro.save %1 async.coro.suspend %2, ^suspend, ^resume, ^cleanup ^resume: return { coro.resume } ^cleanup: return { coro.cleanup } ^suspend: return { coro.suspend } }", mlir-opt -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @reference_counting(%arg0: !async.token) { async.runtime.add_ref %arg0 {count = 2 : i64} : !async.token async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) { %token = async.execute { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } async.await %token : !async.token return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @nested_async_execute(%arg0: f32, %arg1: f32, %arg2: memref<1xf32>) { %token0 = async.execute { %c0 = arith.constant 0 : index %token1 = async.execute { %c1 = arith.constant 1: index memref.store %arg0, %arg2[%c0] : memref<1xf32> async.yield } async.await %token1 : !async.token memref.store %arg1, %arg2[%c0] : memref<1xf32> async.yield } async.await %token0 : !async.token return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @async_execute_token_dependency(%arg0: f32, %arg1: memref<1xf32>) { %token = async.execute { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } %token_0 = async.execute [%token] { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @async_group_await_all(%arg0: f32, %arg1: memref<1xf32>) { %c = arith.constant 1 : index %0 = async.create_group %c : !async.group %token = async.execute { async.yield } async.add_to_group %token, %0 : !async.token async.execute { async.await_all %0 async.yield } async.await_all %0 return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @execute_and_return_f32() -> f32 { %token, %result = async.execute -> !async.value { %c0 = arith.constant 123.0 : f32 async.yield %c0 : f32 } %0 = async.await %result : !async.value return %0 : f32 }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @async_value_operands() { %token, %result = async.execute -> !async.value { %c0 = arith.constant 123.0 : f32 async.yield %c0 : f32 } %token0 = async.execute(%result as %value: !async.value) { %0 = arith.addf %value, %value : f32 async.yield } async.await %token0 : !async.token return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=1' ,1 "func.func @store() { %0 = arith.constant 1.0 : f32 %1 = async.runtime.create : !async.value async.runtime.store %0, %1 : !async.value return } func.func @load() -> f32 { %0 = async.runtime.create : !async.value %1 = async.runtime.load %0 : !async.value return %1 : f32 }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=0' ,1 "func.func @execute_no_async_args(%arg0: f32, %arg1: memref<1xf32>) { %token = async.execute { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32> async.yield } async.await %token : !async.token return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=0' ,1 "func.func @execute_and_return_f32() -> f32 { %token, %result = async.execute -> !async.value { %c0 = arith.constant 123.0 : f32 async.yield %c0 : f32 } %0 = async.await %result : !async.value return %0 : f32 }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=0' ,1 "func.func @await_and_resume_group() { %c = arith.constant 1 : index %0 = async.coro.id %1 = async.coro.begin %0 %2 = async.runtime.create_group %c : !async.group async.runtime.await_and_resume %2, %1 : !async.group return }", mlir-opt -split-input-file -async-to-async-runtime -convert-async-to-llvm='use-opaque-pointers=0' ,1 "func.func @test_reshape_downrank(%arg0: tensor<2x3xf32>) -> tensor<6xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<2x3xf32>) -> tensor<6xf32> return %0 : tensor<6xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_downrank_dyn(%arg0: tensor<2x?xf32>) -> tensor { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<2x?xf32>) -> tensor return %0 : tensor }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_uprank(%arg0: tensor<6xf32>) -> tensor<2x3xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<6xf32>) -> tensor<2x3xf32> return %0 : tensor<2x3xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_uprank_dyn(%arg0: tensor) -> tensor<2x?xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor) -> tensor<2x?xf32> return %0 : tensor<2x?xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_samerank(%arg0: tensor<3x2xf32>) -> tensor<2x3xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<3x2xf32>) -> tensor<2x3xf32> return %0 : tensor<2x3xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_samerank_dyn(%arg0: tensor) -> tensor<2x?xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor) -> tensor<2x?xf32> return %0 : tensor<2x?xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_downrank_6D(%arg0: tensor<1x2x3x5x7x11xf32>) -> tensor<6x5x77xf32> { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<1x2x3x5x7x11xf32>) -> tensor<6x5x77xf32> return %0 : tensor<6x5x77xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @test_reshape_downrank_6D_dyn(%arg0: tensor<1x2x?x5x7x11xf32>) -> tensor { %0 = ""tosa.reshape""(%arg0) {new_shape = array} : (tensor<1x2x?x5x7x11xf32>) -> tensor return %0 : tensor }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @slice(%arg0: tensor<6xf32>) ->() { %0 = ""tosa.slice""(%arg0) {start = array, size = array} : (tensor<6xf32>) -> (tensor<1xf32>) return }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @slice_dyn(%arg0: tensor) -> (tensor) { %0 = ""tosa.slice""(%arg0) {start = array, size = array} : (tensor) -> (tensor) return %0 : tensor }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @pad_float(%arg0 : tensor<1x2xf32>) -> (tensor<4x9xf32>) { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor<1x2xf32>, tensor<2x2xi32>) -> (tensor<4x9xf32>) return %1 : tensor<4x9xf32> } func.func @pad_int(%arg0 : tensor<1x2xi32>) -> (tensor<4x9xi32>) { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor<1x2xi32>, tensor<2x2xi32>) -> (tensor<4x9xi32>) return %1 : tensor<4x9xi32> } func.func @pad_quant(%arg0 : tensor<1x2xi32>) -> (tensor<4x9xi32>) { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) {quantization_info = #tosa.pad_quant} : (tensor<1x2xi32>, tensor<2x2xi32>) -> (tensor<4x9xi32>) return %1 : tensor<4x9xi32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @pad_float_explicit(%arg0 : tensor<1x2xf32>) -> (tensor<4x9xf32>) { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = arith.constant dense<42.0> : tensor %2 = ""tosa.pad""(%arg0, %0, %1) : (tensor<1x2xf32>, tensor<2x2xi32>, tensor) -> (tensor<4x9xf32>) return %2 : tensor<4x9xf32> }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @pad_dyn_input(%arg0 : tensor) -> (tensor) { %0 = arith.constant dense<[[1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor, tensor<2x2xi32>) -> (tensor) return %1 : tensor } func.func @pad_dyn_padding(%arg0 : tensor<1x2xf32>) -> (tensor) { %0 = arith.constant dense<[[-1, 2], [3, 4]]> : tensor<2x2xi32> %1 = ""tosa.pad""(%arg0, %0) : (tensor<1x2xf32>, tensor<2x2xi32>) -> (tensor) return %1 : tensor }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @concat(%arg0: tensor<5x1xf32>, %arg1: tensor<6x1xf32>) -> () { %0 = ""tosa.concat""(%arg0, %arg1) { axis = 0 : i64} : (tensor<5x1xf32>, tensor<6x1xf32>) -> (tensor<11x1xf32>) %1 = ""tosa.concat""(%arg0, %arg0) { axis = 1 : i64} : (tensor<5x1xf32>, tensor<5x1xf32>) -> (tensor<5x2xf32>) return }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @concat_non_axis_dyn(%arg0: tensor<5x?xf32>, %arg1: tensor<6x?xf32>) -> () { %0 = ""tosa.concat""(%arg0, %arg1) { axis = 0 : i64} : (tensor<5x?xf32>, tensor<6x?xf32>) -> (tensor<11x?xf32>) return }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "func.func @concat_axis_dyn(%arg0: tensor, %arg1: tensor) -> () { %0 = ""tosa.concat""(%arg0, %arg1) { axis = 0 : i64} : (tensor, tensor) -> (tensor) return }", mlir-opt --split-input-file --tosa-to-tensor -o -,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @integer8(%arg0: i8, %arg1: si8, %arg2: ui8) { return } func.func @integer16(%arg0: i16, %arg1: si16, %arg2: ui16) { return } func.func @integer64(%arg0: i64, %arg1: si64, %arg2: ui64) { return } func.func @integer128(%arg0: i128) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @integer8(%arg0: i8, %arg1: si8, %arg2: ui8) { return } func.func @integer16(%arg0: i16, %arg1: si16, %arg2: ui16) { return } func.func @integer64(%arg0: i64, %arg1: si64, %arg2: ui64) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @integer2(%arg0: i8) { return } func.func @integer4(%arg0: i4) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @integer3(%arg0: i3) { return } func.func @integer4(%arg0: i13) { return } func.func @integer128(%arg0: i128) { return } func.func @integer42(%arg0: i42) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @index_type(%arg0: index) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @float16(%arg0: f16) { return } func.func @float64(%arg0: f64) { return } func.func @float80(%arg0: f80) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @float16(%arg0: f16) { return } func.func @float64(%arg0: f64) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @bf16_type(%arg0: bf16) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @complex_types( %arg0: complex, %arg2: complex ) { return } func.func @memref_complex_types_with_cap( %arg0: memref<4xcomplex, #spirv.storage_class>, %arg1: memref<2x8xcomplex, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @memref_complex_types_no_cap( %arg0: memref<4xcomplex, #spirv.storage_class>, %arg1: memref<2x8xcomplex, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @int_vector( %arg0: vector<2xi8>, %arg1: vector<3xsi16> ) { return } func.func @float_vector( %arg0: vector<2xf16> ) { return } func.func @one_element_vector(%arg0: vector<1xi8>) { return } func.func @index_vector(%arg0: vector<4xindex>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @int_vector( %arg0: vector<2xi8>, %arg1: vector<3xsi16>, %arg2: vector<4xui64> ) { return } func.func @float_vector( %arg0: vector<2xf16>, %arg1: vector<3xf64> ) { return } func.func @one_element_vector(%arg0: vector<1xi32>) { return } func.func @zerod_vector(%arg0: vector) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @large_vector(%arg0: vector<1024xi32>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memref_mem_space( %arg0: memref<4xf32, #spirv.storage_class>, %arg1: memref<4xf32, #spirv.storage_class>, %arg2: memref<4xf32, #spirv.storage_class>, %arg3: memref<4xf32, #spirv.storage_class>, %arg4: memref<4xf32, #spirv.storage_class>, %arg5: memref<4xf32, #spirv.storage_class> ) { return } func.func @memref_1bit_type( %arg0: memref<4x8xi1, #spirv.storage_class>, %arg1: memref<4x8xi1, #spirv.storage_class> ) { return } func.func @memref_index_type( %arg0: memref<4xindex, #spirv.storage_class>, %arg1: memref<4xindex, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @numeric_memref_mem_space1(%arg0: memref<4xf32>) { return } func.func @numeric_memref_mem_space2(%arg0: memref<4xf32, 3>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @memref_1bit_type(%arg0: memref<5xi1, #spirv.storage_class>) { return } func.func @memref_2bit_type(%arg0: memref<33xi2, #spirv.storage_class>) { return } func.func @memref_4bit_type(%arg0: memref<16xi4, #spirv.storage_class>) { return } func.func @memref_8bit_StorageBuffer(%arg0: memref<16xi8, #spirv.storage_class>) { return } func.func @memref_8bit_Uniform(%arg0: memref<16xsi8, #spirv.storage_class>) { return } func.func @memref_8bit_PushConstant(%arg0: memref<16xui8, #spirv.storage_class>) { return } func.func @memref_16bit_StorageBuffer(%arg0: memref<16xi16, #spirv.storage_class>) { return } func.func @memref_16bit_Uniform(%arg0: memref<16xsi16, #spirv.storage_class>) { return } func.func @memref_16bit_PushConstant(%arg0: memref<16xui16, #spirv.storage_class>) { return } func.func @memref_16bit_Input(%arg3: memref<16xf16, #spirv.storage_class>) { return } func.func @memref_16bit_Output(%arg4: memref<16xf16, #spirv.storage_class>) { return } func.func @memref_64bit_StorageBuffer(%arg0: memref<16xi64, #spirv.storage_class>) { return } func.func @memref_64bit_Uniform(%arg0: memref<16xsi64, #spirv.storage_class>) { return } func.func @memref_64bit_PushConstant(%arg0: memref<16xui64, #spirv.storage_class>) { return } func.func @memref_64bit_Input(%arg3: memref<16xf64, #spirv.storage_class>) { return } func.func @memref_64bit_Output(%arg4: memref<16xf64, #spirv.storage_class>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memref_8bit_PushConstant(%arg0: memref<16xi8, #spirv.storage_class>) { return } func.func @memref_16bit_PushConstant( %arg0: memref<16xi16, #spirv.storage_class>, %arg1: memref<16xf16, #spirv.storage_class> ) { return } func.func @memref_64bit_PushConstant( %arg0: memref<16xi64, #spirv.storage_class>, %arg1: memref<16xf64, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memref_8bit_StorageBuffer(%arg0: memref<16xi8, #spirv.storage_class>) { return } func.func @memref_16bit_StorageBuffer( %arg0: memref<16xi16, #spirv.storage_class>, %arg1: memref<16xf16, #spirv.storage_class> ) { return } func.func @memref_64bit_StorageBuffer( %arg0: memref<16xi64, #spirv.storage_class>, %arg1: memref<16xf64, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memref_8bit_Uniform(%arg0: memref<16xi8, #spirv.storage_class>) { return } func.func @memref_16bit_Uniform( %arg0: memref<16xi16, #spirv.storage_class>, %arg1: memref<16xf16, #spirv.storage_class> ) { return } func.func @memref_64bit_Uniform( %arg0: memref<16xi64, #spirv.storage_class>, %arg1: memref<16xf64, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memref_16bit_Input(%arg3: memref<16xf16, #spirv.storage_class>) { return } func.func @memref_16bit_Output(%arg4: memref<16xi16, #spirv.storage_class>) { return } func.func @memref_64bit_Input( %arg0: memref<16xi64, #spirv.storage_class>, %arg1: memref<16xf64, #spirv.storage_class> ) { return } func.func @memref_64bit_Output( %arg0: memref<16xi64, #spirv.storage_class>, %arg1: memref<16xf64, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @memref_offset_strides( %arg0: memref<16x4xf32, strided<[4, 1], offset: 0>, #spirv.storage_class>, %arg1: memref<16x4xf32, strided<[4, 1], offset: 8>, #spirv.storage_class>, %arg2: memref<16x4xf32, strided<[16, 1], offset: 0>, #spirv.storage_class>, %arg3: memref<16x4xf32, strided<[1, 16], offset: 0>, #spirv.storage_class>, %arg4: memref<16x4xf32, strided<[1, 22], offset: 0>, #spirv.storage_class>, %arg5: memref<16x4xf16, strided<[4, 1], offset: 0>, #spirv.storage_class>, %arg6: memref<16x4xf16, strided<[4, 1], offset: 8>, #spirv.storage_class>, %arg7: memref<16x4xf16, strided<[16, 1], offset: 0>, #spirv.storage_class>, %arg8: memref<16x4xf16, strided<[1, 16], offset: 0>, #spirv.storage_class>, %arg9: memref<16x4xf16, strided<[1, 22], offset: 0>, #spirv.storage_class> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @unranked_memref(%arg0: memref<*xi32>) { return } func.func @memref_1bit_type(%arg0: memref>) { return } func.func @memref_2bit_type(%arg0: memref>) { return } func.func @memref_4bit_type(%arg0: memref>) { return } func.func @dynamic_dim_memref( %arg0: memref<8x?xi32, #spirv.storage_class>, %arg1: memref>) { return } func.func @memref_8bit_StorageBuffer(%arg0: memref>) { return } func.func @memref_8bit_Uniform(%arg0: memref>) { return } func.func @memref_8bit_PushConstant(%arg0: memref>) { return } func.func @memref_16bit_StorageBuffer(%arg0: memref>) { return } func.func @memref_16bit_Uniform(%arg0: memref>) { return } func.func @memref_16bit_PushConstant(%arg0: memref>) { return } func.func @memref_16bit_Input(%arg3: memref>) { return } func.func @memref_16bit_Output(%arg4: memref>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @memref_vector( %arg0: memref<4xvector<2xf32>, #spirv.storage_class>, %arg1: memref<4xvector<4xf32>, #spirv.storage_class>) { return } func.func @dynamic_dim_memref_vector( %arg0: memref<8x?xvector<4xi32>, #spirv.storage_class>, %arg1: memref, #spirv.storage_class>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @memref_vector_wrong_size( %arg0: memref<4xvector<5xf32>, #spirv.storage_class>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @int_tensor_types( %arg0: tensor<8x4xi64>, %arg1: tensor<8x4xi32>, %arg2: tensor<8x4xi16>, %arg3: tensor<8x4xi8> ) { return } func.func @float_tensor_types( %arg0: tensor<8x4xf64>, %arg1: tensor<8x4xf32>, %arg2: tensor<8x4xf16> ) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @int_tensor_types( %arg1: tensor<8x4xi32>, %arg2: tensor<8x4xi16>, %arg3: tensor<8x4xi8> ) { return } func.func @float_tensor_types( %arg1: tensor<8x4xf32>, %arg2: tensor<8x4xf16> ) { return } func.func @index_tensor_type(%arg0: tensor<4x5xindex>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @unranked_tensor(%arg0: tensor<*xi32>) { return } func.func @dynamic_dim_tensor(%arg0: tensor<8x?xi32>) { return } } ", mlir-opt -split-input-file -convert-func-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @return_none_val() { return } func.func @return_one_val(%arg0: f32) -> f32 { return %arg0: f32 } func.func @return_multi_val(%arg0: f32) -> (f32, f32) { return %arg0, %arg0: f32, f32 } func.func @return_one_index(%arg0: index) -> index { return %arg0: index } func.func @call_functions(%arg0: index) -> index { call @return_none_val(): () -> () %0 = call @return_one_index(%arg0): (index) -> index return %0: index } }", mlir-opt -split-input-file -convert-func-to-spirv -verify-diagnostics ,1 "func.func @binary_ops(%lhs : index, %rhs : index) { %sum = shape.add %lhs, %rhs : index, index -> index %product = shape.mul %lhs, %rhs : index, index -> index return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @binary_ops_on_size(%lhs : !shape.size, %rhs : !shape.size) { %sum = shape.add %lhs, %rhs : !shape.size, !shape.size -> !shape.size %prod = shape.mul %lhs, %rhs : !shape.size, !shape.size -> !shape.size return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @rank(%shape : tensor) -> index { %rank = shape.rank %shape : tensor -> index return %rank : index }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @get_extent(%shape : tensor, %idx : !shape.size) -> !shape.size { %result = shape.get_extent %shape, %idx : tensor, !shape.size -> !shape.size return %result : !shape.size }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @rank(%shape : !shape.shape) { %rank = shape.rank %shape : !shape.shape -> !shape.size return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @dim(%arg : tensor<2x3xf32>, %idx : index) -> index { %result = shape.dim %arg, %idx : tensor<2x3xf32>, index -> index return %result : index }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @get_extent_shape_of(%arg : tensor<2x3xf32>, %idx : index) -> index { %shape = shape.shape_of %arg : tensor<2x3xf32> -> tensor %result = shape.get_extent %shape, %idx : tensor, index -> index return %result : index }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @get_extent_from_extent_tensor(%extents : tensor, %idx : index) -> index { %result = shape.get_extent %extents, %idx : tensor, index -> index return %result : index }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @const_shape() -> tensor<3xindex> { %shape = shape.const_shape [1, 2, 3] : tensor<3xindex> return %shape : tensor<3xindex> }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @const_shape_zero_elements() -> tensor<0xindex> { %shape = shape.const_shape [] : tensor<0xindex> return %shape : tensor<0xindex> }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @any_of_three(%a : tensor, %b : tensor, %c : tensor) -> tensor { %result = ""shape.any""(%a, %b, %c) : (tensor, tensor, tensor) -> tensor return %result : tensor }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @any_of_one(%a : tensor) -> tensor { %result = ""shape.any""(%a) : (tensor) -> tensor return %result : tensor }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @const_size() -> index { %size = shape.const_size 42 %result = shape.size_to_index %size : !shape.size return %result : index }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @to_extent_tensor(%arg: tensor) -> tensor<3xindex> { %casted = shape.to_extent_tensor %arg : tensor -> tensor<3xindex> return %casted : tensor<3xindex> } func.func @shape_reduce(%shape : tensor) -> index { %init = arith.constant 1 : index %num_elements = shape.reduce(%shape, %init) : tensor -> index { ^bb0(%index : index, %extent : index, %acc: index): %new_acc = arith.muli %acc, %extent : index shape.yield %new_acc : index } return %num_elements : index }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_of(%arg : tensor<*xf32>) { %shape = shape.shape_of %arg : tensor<*xf32> -> !shape.shape return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_of_unranked(%arg : tensor<*xf32>) { %shape = shape.shape_of %arg : tensor<*xf32> -> tensor return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_of_stat(%arg : tensor<1x2x3xf32>) { %shape = shape.shape_of %arg : tensor<1x2x3xf32> -> !shape.shape return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_of_stat(%arg : tensor<1x2x3xf32>) { %shape = shape.shape_of %arg : tensor<1x2x3xf32> -> tensor return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_of_zero_d(%arg : tensor) { %shape = shape.shape_of %arg : tensor -> tensor return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_of_dyn(%arg : tensor<1x5x?xf32>) { %shape = shape.shape_of %arg : tensor<1x5x?xf32> -> tensor return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_eq(%a : tensor, %b : tensor) -> i1 { %result = shape.shape_eq %a, %b : tensor, tensor return %result : i1 }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @shape_eq(%a : tensor, %b : tensor, %c : tensor) -> i1 { %result = shape.shape_eq %a, %b, %c : tensor, tensor, tensor return %result : i1 }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @broadcast(%a : tensor, %b : !shape.shape) -> !shape.shape { %c = shape.broadcast %a, %b : tensor, !shape.shape -> !shape.shape return %c : !shape.shape }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @try_is_broadcastable (%a : tensor<2xindex>, %b : tensor<3xindex>, %c : tensor<2xindex>) -> i1 { %0 = shape.is_broadcastable %a, %b, %c : tensor<2xindex>, tensor<3xindex>, tensor<2xindex> return %0 : i1 }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @broadcast(%a : tensor<2xindex>, %b : tensor<3xindex>, %c : tensor<2xindex>) -> !shape.witness { %0 = shape.cstr_broadcastable %a, %b, %c : tensor<2xindex>, tensor<3xindex>, tensor<2xindex> return %0 : !shape.witness }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @broadcast_3_shapes_different_extents(%a : tensor<2xindex>, %b : tensor<3xindex>, %c : tensor<2xindex>) { %0 = shape.broadcast %a, %b, %c : tensor<2xindex>, tensor<3xindex>, tensor<2xindex> -> tensor return }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @broadcast_to_known_rank(%a : tensor<1xindex>, %b : tensor<3xindex>) -> tensor<3xindex> { %0 = shape.broadcast %a, %b : tensor<1xindex>, tensor<3xindex> -> tensor<3xindex> return %0 : tensor<3xindex> }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @split_at(%shape: tensor, %index: index) -> (tensor, tensor) { %head, %tail = ""shape.split_at""(%shape, %index) : (tensor, index) -> (tensor, tensor) return %head, %tail : tensor, tensor }", mlir-opt --split-input-file --convert-shape-to-std --verify-diagnostics ,1 "func.func @cstr_broadcastable(%arg0: tensor, %arg1: tensor) -> !shape.witness { %witness = shape.cstr_broadcastable %arg0, %arg1 : tensor, tensor return %witness : !shape.witness } func.func @cstr_eq(%arg0: tensor, %arg1: tensor) -> !shape.witness { %witness = shape.cstr_eq %arg0, %arg1 : tensor, tensor return %witness : !shape.witness } func.func @cstr_require(%arg0: i1) -> !shape.witness { %witness = shape.cstr_require %arg0, ""msg"" return %witness : !shape.witness }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-shape-constraints))"" < ",1 "func.func @atan_caller(%float: f32, %double: f64, %half: f16, %bfloat: bf16) -> (f32, f64, f16, bf16) { %float_result = math.atan %float : f32 %double_result = math.atan %double : f64 %half_result = math.atan %half : f16 %bfloat_result = math.atan %bfloat : bf16 return %float_result, %double_result, %half_result, %bfloat_result : f32, f64, f16, bf16 } func.func @atan_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.atan %float : vector<2xf32> %double_result = math.atan %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @tanh_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.tanh %float : f32 %double_result = math.tanh %double : f64 return %float_result, %double_result : f32, f64 } func.func @atan2_caller(%float: f32, %double: f64, %half: f16, %bfloat: bf16) -> (f32, f64, f16, bf16) { %float_result = math.atan2 %float, %float : f32 %double_result = math.atan2 %double, %double : f64 %half_result = math.atan2 %half, %half : f16 %bfloat_result = math.atan2 %bfloat, %bfloat : bf16 return %float_result, %double_result, %half_result, %bfloat_result : f32, f64, f16, bf16 } func.func @erf_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.erf %float : f32 %double_result = math.erf %double : f64 return %float_result, %double_result : f32, f64 } func.func @erf_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.erf %float : vector<2xf32> %double_result = math.erf %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @expm1_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.expm1 %float : f32 %double_result = math.expm1 %double : f64 return %float_result, %double_result : f32, f64 } func.func @expm1_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.expm1 %float : vector<2xf32> %double_result = math.expm1 %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @expm1_multidim_vec_caller(%float: vector<2x2xf32>) -> (vector<2x2xf32>) { %result = math.expm1 %float : vector<2x2xf32> return %result : vector<2x2xf32> } func.func @round_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.round %float : f32 %double_result = math.round %double : f64 return %float_result, %double_result : f32, f64 } func.func @roundeven_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.roundeven %float : f32 %double_result = math.roundeven %double : f64 return %float_result, %double_result : f32, f64 } func.func @trunc_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.trunc %float : f32 %double_result = math.trunc %double : f64 return %float_result, %double_result : f32, f64 } func.func @cbrt_caller(%float: f32, %double: f64, %half: f16, %bfloat: bf16, %float_vec: vector<2xf32>) -> (f32, f64, f16, bf16, vector<2xf32>) { %float_result = math.cbrt %float : f32 %double_result = math.cbrt %double : f64 %half_result = math.cbrt %half : f16 %bfloat_result = math.cbrt %bfloat : bf16 %vec_result = math.cbrt %float_vec : vector<2xf32> return %float_result, %double_result, %half_result, %bfloat_result, %vec_result : f32, f64, f16, bf16, vector<2xf32> } func.func @cos_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.cos %float : f32 %double_result = math.cos %double : f64 return %float_result, %double_result : f32, f64 } func.func @sin_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.sin %float : f32 %double_result = math.sin %double : f64 return %float_result, %double_result : f32, f64 } func.func @round_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.round %float : vector<2xf32> %double_result = math.round %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @roundeven_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.roundeven %float : vector<2xf32> %double_result = math.roundeven %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @trunc_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.trunc %float : vector<2xf32> %double_result = math.trunc %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @tan_caller(%float: f32, %double: f64, %half: f16, %bfloat: bf16) -> (f32, f64, f16, bf16) { %float_result = math.tan %float : f32 %double_result = math.tan %double : f64 %half_result = math.tan %half : f16 %bfloat_result = math.tan %bfloat : bf16 return %float_result, %double_result, %half_result, %bfloat_result : f32, f64, f16, bf16 } func.func @tan_vec_caller(%float: vector<2xf32>, %double: vector<2xf64>) -> (vector<2xf32>, vector<2xf64>) { %float_result = math.tan %float : vector<2xf32> %double_result = math.tan %double : vector<2xf64> return %float_result, %double_result : vector<2xf32>, vector<2xf64> } func.func @log1p_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.log1p %float : f32 %double_result = math.log1p %double : f64 return %float_result, %double_result : f32, f64 } func.func @floor_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.floor %float : f32 %double_result = math.floor %double : f64 return %float_result, %double_result : f32, f64 } func.func @ceil_caller(%float: f32, %double: f64) -> (f32, f64) { %float_result = math.ceil %float : f32 %double_result = math.ceil %double : f64 return %float_result, %double_result : f32, f64 }", mlir-opt -convert-math-to-libm -canonicalize ,1 "gpu.module @foo { llvm.func @kernel(%arg0 : f32, %arg1 : !llvm.ptr) attributes { gpu.kernel } { llvm.return } } gpu.module @bar { llvm.func @kernel_a() attributes { gpu.kernel } { llvm.return } llvm.func @kernel_b() attributes { gpu.kernel } { llvm.return } }", mlir-opt --test-gpu-to-hsaco ,1 "func.func @cpow_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.pow %float, %float : complex %double_result = complex.pow %double, %double : complex return %float_result, %double_result : complex, complex } func.func @csqrt_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.sqrt %float : complex %double_result = complex.sqrt %double : complex return %float_result, %double_result : complex, complex } func.func @ctanh_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.tanh %float : complex %double_result = complex.tanh %double : complex return %float_result, %double_result : complex, complex } func.func @ccos_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.cos %float : complex %double_result = complex.cos %double : complex return %float_result, %double_result : complex, complex } func.func @csin_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.sin %float : complex %double_result = complex.sin %double : complex return %float_result, %double_result : complex, complex } func.func @conj_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.conj %float : complex %double_result = complex.conj %double : complex return %float_result, %double_result : complex, complex } func.func @cabs_caller(%float: complex, %double: complex) -> (f32, f64) { %float_result = complex.abs %float : complex %double_result = complex.abs %double : complex return %float_result, %double_result : f32, f64 } func.func @carg_caller(%float: complex, %double: complex) -> (f32, f64) { %float_result = complex.angle %float : complex %double_result = complex.angle %double : complex return %float_result, %double_result : f32, f64 } func.func @clog_caller(%float: complex, %double: complex) -> (complex, complex) { %float_result = complex.log %float : complex %double_result = complex.log %double : complex return %float_result, %double_result : complex, complex }", mlir-opt -convert-complex-to-libm -canonicalize ,1 "func.func @m16n8k16_fp16(%arg0: vector<4x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf16>) -> vector<2x2xf16> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 16]} : (vector<4x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m16n8k16_fp16_fp32(%arg0: vector<4x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 16]} : (vector<4x2xf16>, vector<2x2xf16>, vector<2x2xf32>) -> vector<2x2xf32> return %d : vector<2x2xf32> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m16n8k8_fp16(%arg0: vector<2x2xf16>, %arg1: vector<1x2xf16>, %arg2: vector<2x2xf16>) -> vector<2x2xf16> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 8]} : (vector<2x2xf16>, vector<1x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m16n8k32_int8(%arg0: vector<4x4xi8>, %arg1: vector<2x4xi8>, %arg2: vector<2x2xi32>) -> vector<2x2xi32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 32]} : (vector<4x4xi8>, vector<2x4xi8>, vector<2x2xi32>) -> vector<2x2xi32> return %d : vector<2x2xi32> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m16n8k32_i4(%arg0: vector<2x8xi4>, %arg1: vector<1x8xi4>, %arg2: vector<2x2xi32>) -> vector<2x2xi32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 32]} : (vector<2x8xi4>, vector<1x8xi4>, vector<2x2xi32>) -> vector<2x2xi32> return %d : vector<2x2xi32> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m16n8k64_i4(%arg0: vector<4x8xi4>, %arg1: vector<2x8xi4>, %arg2: vector<2x2xi32>) -> vector<2x2xi32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 64]} : (vector<4x8xi4>, vector<2x8xi4>, vector<2x2xi32>) -> vector<2x2xi32> return %d : vector<2x2xi32> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m8n8k4_f64(%arg0: vector<1x1xf64>, %arg1: vector<1x1xf64>, %arg2: vector<1x2xf64>) -> vector<1x2xf64> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [8, 8, 4]} : (vector<1x1xf64>, vector<1x1xf64>, vector<1x2xf64>) -> vector<1x2xf64> return %d : vector<1x2xf64> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @ldmatrix_x4(%arg0: memref<128x128xf16, 3>) -> vector<4x2xf16> { %c0 = arith.constant 0 : index %a = nvgpu.ldmatrix %arg0[%c0, %c0] {transpose = false, numTiles = 4 : i32} : memref<128x128xf16, 3> -> vector<4x2xf16> return %a : vector<4x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @ldmatrix_x1(%arg0: memref<128x128xf16, 3>) -> vector<1x2xf16> { %c0 = arith.constant 0 : index %a = nvgpu.ldmatrix %arg0[%c0, %c0] {transpose = false, numTiles = 1 : i32} : memref<128x128xf16, 3> -> vector<1x2xf16> return %a : vector<1x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @m16n8k4_tf32(%arg0: vector<2x1xf32>, %arg1: vector<1x1xf32>, %arg2: vector<2x2xf32>) -> vector<2x2xf32> { %d = nvgpu.mma.sync (%arg0, %arg1, %arg2) {mmaShape = [16, 8, 4], tf32Enabled} : (vector<2x1xf32>, vector<1x1xf32>, vector<2x2xf32>) -> vector<2x2xf32> return %d : vector<2x2xf32> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @async_cp( %src: memref<128x128xf32>, %dst: memref<3x16x128xf32, 3>, %i : index) { %0 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i, %i], 4 : memref<128x128xf32> to memref<3x16x128xf32, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32 } %2 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i, %i], 4 {bypassL1}: memref<128x128xf32> to memref<3x16x128xf32, 3> return }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @async_cp_i4( %src: memref<128x64xi4>, %dst: memref<128x128xi4, 3>, %i : index) -> !nvgpu.device.async.token { %0 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i], 32 : memref<128x64xi4> to memref<128x128xi4, 3> return %0 : !nvgpu.device.async.token }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @async_cp_zfill_f32_align4( %src: memref<128x128xf32>, %dst: memref<3x16x128xf32, 3>, %i : index, %srcElements : index) { %0 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i, %i], 4, %srcElements {bypassL1}: memref<128x128xf32> to memref<3x16x128xf32, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32 } return }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @async_cp_zfill_f32_align1( %src: memref<128x128xf32>, %dst: memref<3x16x128xf32, 3>, %i : index, %srcElements : index) { %0 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i, %i], 1, %srcElements {bypassL1}: memref<128x128xf32> to memref<3x16x128xf32, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32 } return }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @mma_sp_sync_f16_16832(%arg0: vector<4x2xf16>, %arg1: vector<4x2xf16>, %arg2: vector<2x2xf16>, %arg3: vector<2xi16>) -> vector<2x2xf16> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 32]} : (vector<4x2xf16>, vector<4x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @mma_sp_sync_f16_16816(%arg0: vector<2x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf16>, %arg3: vector<2xi16>) -> vector<2x2xf16> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 16]} : (vector<2x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @mma_sp_sync_f16_16816_01(%arg0: vector<2x2xf16>, %arg1: vector<2x2xf16>, %arg2: vector<2x2xf16>, %arg3: vector<2xi16>) -> vector<2x2xf16> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 16], sparsitySelector = 1 : i32} : (vector<2x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16> return %d : vector<2x2xf16> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @mma_sp_sync_i8_16864(%arg0: vector<4x4xi8>, %arg1: vector<4x4xi8>, %arg2: vector<2x2xi32>, %arg3: vector<2xi16>) -> vector<2x2xi32> { %d = nvgpu.mma.sp.sync(%arg0, %arg1, %arg2) metadata(%arg3) {mmaShape = [16, 8, 64]} : (vector<4x4xi8>, vector<4x4xi8>, vector<2x2xi32>) -> vector<2x2xi32> return %d : vector<2x2xi32> }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "func.func @async_cp( %src: memref<128x128xf32>, %dst: memref<3x16x128xf32, 3>, %i : index) { %0 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i, %i], 4 : memref<128x128xf32> to memref<3x16x128xf32, 3> %1 = nvgpu.device_async_create_group %0 nvgpu.device_async_wait %1 { numGroups = 1 : i32 } %2 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i, %i], 4 {bypassL1}: memref<128x128xf32> to memref<3x16x128xf32, 3> return }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=0' --split-input-file ,1 "func.func @async_cp_i4( %src: memref<128x64xi4>, %dst: memref<128x128xi4, 3>, %i : index) -> !nvgpu.device.async.token { %0 = nvgpu.device_async_copy %src[%i, %i], %dst[%i, %i], 32 : memref<128x64xi4> to memref<128x128xi4, 3> return %0 : !nvgpu.device.async.token }", mlir-opt --convert-nvgpu-to-nvvm='use-opaque-pointers=0' --split-input-file ,1 "func.func @const_test() -> (tensor) { %result = ""tosa.const""() {value = dense<3> : tensor} : () -> tensor return %result : tensor }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=true use-32-bit=true"" -verify-diagnostics -o -",1 "func.func @const_test() -> (tensor) { %result = ""tosa.const""() {value = dense<3> : tensor} : () -> tensor return %result : tensor }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=false"" -verify-diagnostics -o -",1 "func.func @apply_scale_test_i32(%arg0 : i32, %arg1 : i32, %arg2 : i8) -> (i32) { %res = ""tosa.apply_scale""(%arg0, %arg1, %arg2) {double_round = true} : (i32, i32, i8) -> i32 return %res : i32 }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=true use-32-bit=true"" -verify-diagnostics -o -",1 "func.func @apply_scale_test_i32(%arg0 : i32, %arg1 : i32, %arg2 : i8) -> (i32) { %res = ""tosa.apply_scale""(%arg0, %arg1, %arg2) {double_round = true} : (i32, i32, i8) -> i32 return %res : i32 }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=false"" -verify-diagnostics -o -",1 "func.func @apply_scale_test_vector(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>, %arg2 : vector<4xi8>) -> (vector<4xi32>) { %res = ""tosa.apply_scale""(%arg0, %arg1, %arg2) {double_round = true} : (vector<4xi32>, vector<4xi32>, vector<4xi8>) -> vector<4xi32> return %res : vector<4xi32> }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=true use-32-bit=true"" -verify-diagnostics -o -",1 "func.func @apply_scale_test_vector(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>, %arg2 : vector<4xi8>) -> (vector<4xi32>) { %res = ""tosa.apply_scale""(%arg0, %arg1, %arg2) {double_round = true} : (vector<4xi32>, vector<4xi32>, vector<4xi8>) -> vector<4xi32> return %res : vector<4xi32> }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=false"" -verify-diagnostics -o -",1 "func.func @apply_scale_test_i48(%arg0 : i48, %arg1 : i32, %arg2 : i8) -> (i32) { %res = ""tosa.apply_scale""(%arg0, %arg1, %arg2) {double_round = true} : (i48, i32, i8) -> i32 return %res : i32 }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=true use-32-bit=true"" -verify-diagnostics -o -",1 "func.func @apply_scale_test_i48(%arg0 : i48, %arg1 : i32, %arg2 : i8) -> (i32) { %res = ""tosa.apply_scale""(%arg0, %arg1, %arg2) {double_round = true} : (i48, i32, i8) -> i32 return %res : i32 }"," mlir-opt --split-input-file --tosa-to-arith=""include-apply-rescale=false"" -verify-diagnostics -o -",1 "func.func @complex_div(%lhs: complex, %rhs: complex) -> complex { %div = complex.div %lhs, %rhs : complex return %div : complex } func.func @complex_mul(%lhs: complex, %rhs: complex) -> complex { %mul = complex.mul %lhs, %rhs : complex return %mul : complex } func.func @complex_abs(%arg: complex) -> f32 { %abs = complex.abs %arg: complex return %abs : f32 }", mlir-opt -convert-complex-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts ,1 "func.func @complex_create(%real: f32, %imag: f32) -> complex { %cplx2 = complex.create %real, %imag : complex return %cplx2 : complex } func.func @complex_constant() -> complex { %cplx2 = complex.constant [1.000000e+00, 2.000000e+00] : complex return %cplx2 : complex } func.func @complex_extract(%cplx: complex) { %real1 = complex.re %cplx : complex %imag1 = complex.im %cplx : complex return } func.func @complex_addition() { %a_re = arith.constant 1.2 : f64 %a_im = arith.constant 3.4 : f64 %a = complex.create %a_re, %a_im : complex %b_re = arith.constant 5.6 : f64 %b_im = arith.constant 7.8 : f64 %b = complex.create %b_re, %b_im : complex %c = complex.add %a, %b : complex return } func.func @complex_substraction() { %a_re = arith.constant 1.2 : f64 %a_im = arith.constant 3.4 : f64 %a = complex.create %a_re, %a_im : complex %b_re = arith.constant 5.6 : f64 %b_im = arith.constant 7.8 : f64 %b = complex.create %b_re, %b_im : complex %c = complex.sub %a, %b : complex return } func.func @complex_div(%lhs: complex, %rhs: complex) -> complex { %div = complex.div %lhs, %rhs : complex return %div : complex } func.func @complex_mul(%lhs: complex, %rhs: complex) -> complex { %mul = complex.mul %lhs, %rhs : complex return %mul : complex } func.func @complex_abs(%arg: complex) -> f32 { %abs = complex.abs %arg: complex return %abs : f32 }", mlir-opt -convert-complex-to-llvm ,1 "func.func @complex_abs(%arg: complex) -> f32 { %abs = complex.abs %arg: complex return %abs : f32 } func.func @complex_eq(%lhs: complex, %rhs: complex) -> i1 { %eq = complex.eq %lhs, %rhs: complex return %eq : i1 } func.func @complex_neq(%lhs: complex, %rhs: complex) -> i1 { %neq = complex.neq %lhs, %rhs: complex return %neq : i1 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-complex-to-standard),convert-complex-to-llvm,func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" ",1 "func.func @bad_address_space(%a: memref<2xindex, ""foo"">) { %c0 = arith.constant 0 : index memref.store %c0, %a[%c0] : memref<2xindex, ""foo""> return }", mlir-opt -finalize-memref-to-llvm -split-input-file 2>&1 ,1 "func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) -> memref> { %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref> return %1 : memref> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_non_zero_addrspace(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>, 3>, %arg0 : index, %arg1 : index, %arg2 : index) -> memref, 3> { %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>, 3> to memref, 3> return %1 : memref, 3> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_const_size(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) -> memref<4x2xf32, strided<[?, ?], offset: ?>> { %1 = memref.subview %0[%arg0, %arg1][4, 2][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref<4x2xf32, strided<[?, ?], offset: ?>> return %1 : memref<4x2xf32, strided<[?, ?], offset: ?>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_const_stride(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) -> memref> { %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][1, 2] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref> return %1 : memref> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_const_stride_and_offset(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>) -> memref<62x3xf32, strided<[4, 1], offset: 8>> { %1 = memref.subview %0[0, 8][62, 3][1, 1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref<62x3xf32, strided<[4, 1], offset: 8>> return %1 : memref<62x3xf32, strided<[4, 1], offset: 8>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_mixed_static_dynamic(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) -> memref<62x?xf32, strided<[?, 1], offset: ?>> { %1 = memref.subview %0[%arg1, 8][62, %arg2][%arg0, 1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref<62x?xf32, strided<[?, 1], offset: ?>> return %1 : memref<62x?xf32, strided<[?, 1], offset: ?>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_leading_operands(%0 : memref<5x3xf32>, %1: memref<5x?xf32>) -> memref<3x3xf32, strided<[3, 1], offset: 6>> { %2 = memref.subview %0[2, 0][3, 3][1, 1]: memref<5x3xf32> to memref<3x3xf32, strided<[3, 1], offset: 6>> return %2 : memref<3x3xf32, strided<[3, 1], offset: 6>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_leading_operands_dynamic(%0 : memref<5x?xf32>) -> memref<3x?xf32, strided<[?, 1], offset: ?>> { %c0 = arith.constant 1 : index %d0 = memref.dim %0, %c0 : memref<5x?xf32> %1 = memref.subview %0[2, 0][3, %d0][1, 1]: memref<5x?xf32> to memref<3x?xf32, strided<[?, 1], offset: ?>> return %1 : memref<3x?xf32, strided<[?, 1], offset: ?>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_rank_reducing_leading_operands(%0 : memref<5x3xf32>) -> memref<3xf32, strided<[1], offset: 3>> { %1 = memref.subview %0[1, 0][1, 3][1, 1]: memref<5x3xf32> to memref<3xf32, strided<[1], offset: 3>> return %1 : memref<3xf32, strided<[1], offset: 3>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @subview_negative_stride(%arg0 : memref<7xf32>) -> memref<7xf32, strided<[-1], offset: 6>> { %0 = memref.subview %arg0[6] [7] [-1] : memref<7xf32> to memref<7xf32, strided<[-1], offset: 6>> return %0 : memref<7xf32, strided<[-1], offset: 6>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @collapse_shape_static(%arg0: memref<1x3x4x1x5xf32>) -> memref<3x4x5xf32> { %0 = memref.collapse_shape %arg0 [[0, 1], [2], [3, 4]] : memref<1x3x4x1x5xf32> into memref<3x4x5xf32> return %0 : memref<3x4x5xf32> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @collapse_shape_dynamic_with_non_identity_layout( %arg0 : memref<4x?x?xf32, strided<[?, 4, 1], offset: ?>>) -> memref<4x?xf32, strided<[?, ?], offset: ?>> { %0 = memref.collapse_shape %arg0 [[0], [1, 2]]: memref<4x?x?xf32, strided<[?, 4, 1], offset: ?>> into memref<4x?xf32, strided<[?, ?], offset: ?>> return %0 : memref<4x?xf32, strided<[?, ?], offset: ?>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @expand_shape_static(%arg0: memref<3x4x5xf32>) -> memref<1x3x4x1x5xf32> { %0 = memref.expand_shape %arg0 [[0, 1], [2], [3, 4]] : memref<3x4x5xf32> into memref<1x3x4x1x5xf32> return %0 : memref<1x3x4x1x5xf32> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @collapse_shape_fold_zero_dim(%arg0 : memref<1x1xf32>) -> memref { %0 = memref.collapse_shape %arg0 [] : memref<1x1xf32> into memref return %0 : memref }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @expand_shape_zero_dim(%arg0 : memref) -> memref<1x1xf32> { %0 = memref.expand_shape %arg0 [] : memref into memref<1x1xf32> return %0 : memref<1x1xf32> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @collapse_shape_dynamic(%arg0 : memref<1x2x?xf32>) -> memref<1x?xf32> { %0 = memref.collapse_shape %arg0 [[0], [1, 2]]: memref<1x2x?xf32> into memref<1x?xf32> return %0 : memref<1x?xf32> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @expand_shape_dynamic(%arg0 : memref<1x?xf32>) -> memref<1x2x?xf32> { %0 = memref.expand_shape %arg0 [[0], [1, 2]]: memref<1x?xf32> into memref<1x2x?xf32> return %0 : memref<1x2x?xf32> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @expand_shape_dynamic_with_non_identity_layout( %arg0 : memref<1x?xf32, strided<[?, ?], offset: ?>>) -> memref<1x2x?xf32, strided<[?, ?, ?], offset: ?>> { %0 = memref.expand_shape %arg0 [[0], [1, 2]]: memref<1x?xf32, strided<[?, ?], offset: ?>> into memref<1x2x?xf32, strided<[?, ?, ?], offset: ?>> return %0 : memref<1x2x?xf32, strided<[?, ?, ?], offset: ?>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @collapse_static_shape_with_non_identity_layout(%arg: memref<1x1x8x8xf32, strided<[64, 64, 8, 1], offset: ?>>) -> memref<64xf32, strided<[1], offset: ?>> { %1 = memref.collapse_shape %arg [[0, 1, 2, 3]] : memref<1x1x8x8xf32, strided<[64, 64, 8, 1], offset: ?>> into memref<64xf32, strided<[1], offset: ?>> return %1 : memref<64xf32, strided<[1], offset: ?>> }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @load_and_assume( %arg0: memref>, %i0: index, %i1: index) -> f32 { memref.assume_alignment %arg0, 16 : memref> %2 = memref.load %arg0[%i0, %i1] : memref> func.return %2 : f32 }", mlir-opt -expand-strided-metadata -finalize-memref-to-llvm='use-opaque-pointers=1' -lower-affine -convert-arith-to-llvm -cse -split-input-file ,1 "func.func @empty() { memref.alloca_scope { memref.alloca_scope.return } return } func.func @returns_nothing(%b: f32) { %a = arith.constant 10.0 : f32 memref.alloca_scope { %c = arith.addf %a, %b : f32 memref.alloca_scope.return } return } func.func @returns_one_value(%b: f32) -> f32 { %a = arith.constant 10.0 : f32 %result = memref.alloca_scope -> f32 { %c = arith.addf %a, %b : f32 memref.alloca_scope.return %c: f32 } return %result : f32 } func.func @returns_multiple_values(%b: f32) -> f32 { %a = arith.constant 10.0 : f32 %result1, %result2 = memref.alloca_scope -> (f32, f32) { %c = arith.addf %a, %b : f32 %d = arith.subf %a, %b : f32 memref.alloca_scope.return %c, %d: f32, f32 } %result = arith.addf %result1, %result2 : f32 return %result : f32 }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @zero_d_alloc() -> memref { %0 = memref.alloc() : memref return %0 : memref }"," mlir-opt -pass-pipeline=""builtin.module(finalize-memref-to-llvm{use-generic-functions=1 use-opaque-pointers=1})"" -split-input-file ",1 "func.func @zero_d_alloc() -> memref { %0 = memref.alloc() : memref return %0 : memref }"," mlir-opt -pass-pipeline=""builtin.module(finalize-memref-to-llvm{use-generic-functions=1 use-aligned-alloc=1 use-opaque-pointers=1})"" -split-input-file ",1 "func.func @dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }"," mlir-opt -pass-pipeline=""builtin.module(finalize-memref-to-llvm{use-generic-functions=1 use-opaque-pointers=1})"" -split-input-file ",1 "func.func @dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }"," mlir-opt -pass-pipeline=""builtin.module(finalize-memref-to-llvm{use-generic-functions=1 use-aligned-alloc=1 use-opaque-pointers=1})"" -split-input-file ",1 "func.func @zero_d_alloc() -> memref { %0 = memref.alloc() : memref return %0 : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @zero_d_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @aligned_1d_alloc() -> memref<42xf32> { %0 = memref.alloc() {alignment = 8} : memref<42xf32> return %0 : memref<42xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_alloc() -> memref<32x18xf32> { %0 = memref.alloc() : memref<32x18xf32> return %0 : memref<32x18xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_alloca() -> memref<32x18xf32> { %0 = memref.alloca() : memref<32x18xf32> memref.alloca() {alignment = 32} : memref<32x18xf32> return %0 : memref<32x18xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_dealloc(%static: memref<10x8xf32>) { memref.dealloc %static : memref<10x8xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @zero_d_load(%arg0: memref) -> f32 { %0 = memref.load %arg0[] : memref return %0 : f32 }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_load(%static : memref<10x42xf32>, %i : index, %j : index) { %0 = memref.load %static[%i, %j] : memref<10x42xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @zero_d_store(%arg0: memref, %arg1: f32) { memref.store %arg1, %arg0[] : memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_store(%static : memref<10x42xf32>, %i : index, %j : index, %val : f32) { memref.store %val, %static[%i, %j] : memref<10x42xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_memref_dim(%static : memref<42x32x15x13x27xf32>) { %c0 = arith.constant 0 : index %0 = memref.dim %static, %c0 : memref<42x32x15x13x27xf32> %c1 = arith.constant 1 : index %1 = memref.dim %static, %c1 : memref<42x32x15x13x27xf32> %c2 = arith.constant 2 : index %2 = memref.dim %static, %c2 : memref<42x32x15x13x27xf32> %c3 = arith.constant 3 : index %3 = memref.dim %static, %c3 : memref<42x32x15x13x27xf32> %c4 = arith.constant 4 : index %4 = memref.dim %static, %c4 : memref<42x32x15x13x27xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @static_out_of_bound_memref_dim(%static : memref<42x32x15x13x27xf32>) -> index { %c-7 = arith.constant -7 : index %1 = memref.dim %static, %c-7 : memref<42x32x15x13x27xf32> return %1 : index }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry> } { func.func @address() { %c1 = arith.constant 1 : index %0 = memref.alloc(%c1) : memref> return } }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "memref.global ""private"" constant @__constant_3xi64 : memref<3xi64> = dense<[2, 6, 20]> func.func @memref.reshape(%arg0: memref<4x5x6xf32>) -> memref<2x6x20xf32> { %0 = memref.get_global @__constant_3xi64 : memref<3xi64> %1 = memref.reshape %arg0(%0) : (memref<4x5x6xf32>, memref<3xi64>) -> memref<2x6x20xf32> return %1 : memref<2x6x20xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref.reshape.dynamic.dim(%arg: memref, %shape: memref<4xi64>) -> memref { %0 = memref.reshape %arg(%shape) : (memref, memref<4xi64>) -> memref return %0 : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref.reshape_index(%arg0: memref, %shape: memref<1xindex>) -> memref { %1 = memref.reshape %arg0(%shape) : (memref, memref<1xindex>) -> memref return %1 : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @realloc_static(%in: memref<2xi32>) -> memref<4xi32>{ %out = memref.realloc %in : memref<2xi32> to memref<4xi32> return %out : memref<4xi32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @realloc_static_alignment(%in: memref<2xf32>) -> memref<4xf32>{ %out = memref.realloc %in {alignment = 8} : memref<2xf32> to memref<4xf32> return %out : memref<4xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_memory_space_cast(%input : memref) -> memref { %cast = memref.memory_space_cast %input : memref to memref return %cast : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @mixed_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @mixed_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @mixed_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @unranked_dealloc(%arg0: memref<*xf32>) { memref.dealloc %arg0 : memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @unranked_dealloc(%arg0: memref<*xf32>) { memref.dealloc %arg0 : memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @unranked_dealloc(%arg0: memref<*xf32>) { memref.dealloc %arg0 : memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @dynamic_alloca(%arg0: index, %arg1: index) -> memref { %0 = memref.alloca(%arg0, %arg1) : memref memref.alloca(%arg0, %arg1) {alignment = 32} : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @dynamic_alloca(%arg0: index, %arg1: index) -> memref { %0 = memref.alloca(%arg0, %arg1) : memref memref.alloca(%arg0, %arg1) {alignment = 32} : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @dynamic_alloca(%arg0: index, %arg1: index) -> memref { %0 = memref.alloca(%arg0, %arg1) : memref memref.alloca(%arg0, %arg1) {alignment = 32} : memref return %0 : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @dynamic_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @dynamic_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @dynamic_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> { %0 = memref.alloc() {alignment = 32} : memref<32x18xf32> %1 = memref.alloc() {alignment = 64} : memref<4096xf32> %2 = memref.alloc() : memref<4096xvector<8xf32>> %3 = memref.alloc() : memref<4096xvector<2xf32>> %4 = memref.alloc() {alignment = 8} : memref<1024xvector<4xf32>> %5 = memref.alloc() {alignment = 32} : memref<100xf32> %6 = memref.alloc(%N) : memref> return %0 : memref<32x18xf32> }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> { %0 = memref.alloc() {alignment = 32} : memref<32x18xf32> %1 = memref.alloc() {alignment = 64} : memref<4096xf32> %2 = memref.alloc() : memref<4096xvector<8xf32>> %3 = memref.alloc() : memref<4096xvector<2xf32>> %4 = memref.alloc() {alignment = 8} : memref<1024xvector<4xf32>> %5 = memref.alloc() {alignment = 32} : memref<100xf32> %6 = memref.alloc(%N) : memref> return %0 : memref<32x18xf32> }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> { %0 = memref.alloc() {alignment = 32} : memref<32x18xf32> %1 = memref.alloc() {alignment = 64} : memref<4096xf32> %2 = memref.alloc() : memref<4096xvector<8xf32>> %3 = memref.alloc() : memref<4096xvector<2xf32>> %4 = memref.alloc() {alignment = 8} : memref<1024xvector<4xf32>> %5 = memref.alloc() {alignment = 32} : memref<100xf32> %6 = memref.alloc(%N) : memref> return %0 : memref<32x18xf32> }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @mixed_load(%mixed : memref<42x?xf32>, %i : index, %j : index) { %0 = memref.load %mixed[%i, %j] : memref<42x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @mixed_load(%mixed : memref<42x?xf32>, %i : index, %j : index) { %0 = memref.load %mixed[%i, %j] : memref<42x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @mixed_load(%mixed : memref<42x?xf32>, %i : index, %j : index) { %0 = memref.load %mixed[%i, %j] : memref<42x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @dynamic_load(%dynamic : memref, %i : index, %j : index) { %0 = memref.load %dynamic[%i, %j] : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @dynamic_load(%dynamic : memref, %i : index, %j : index) { %0 = memref.load %dynamic[%i, %j] : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @dynamic_load(%dynamic : memref, %i : index, %j : index) { %0 = memref.load %dynamic[%i, %j] : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @prefetch(%A : memref, %i : index, %j : index) { memref.prefetch %A[%i, %j], write, locality<3>, data : memref memref.prefetch %A[%i, %j], read, locality<0>, data : memref memref.prefetch %A[%i, %j], read, locality<2>, instr : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @prefetch(%A : memref, %i : index, %j : index) { memref.prefetch %A[%i, %j], write, locality<3>, data : memref memref.prefetch %A[%i, %j], read, locality<0>, data : memref memref.prefetch %A[%i, %j], read, locality<2>, instr : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @prefetch(%A : memref, %i : index, %j : index) { memref.prefetch %A[%i, %j], write, locality<3>, data : memref memref.prefetch %A[%i, %j], read, locality<0>, data : memref memref.prefetch %A[%i, %j], read, locality<2>, instr : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @dynamic_store(%dynamic : memref, %i : index, %j : index, %val : f32) { memref.store %val, %dynamic[%i, %j] : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @dynamic_store(%dynamic : memref, %i : index, %j : index, %val : f32) { memref.store %val, %dynamic[%i, %j] : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @dynamic_store(%dynamic : memref, %i : index, %j : index, %val : f32) { memref.store %val, %dynamic[%i, %j] : memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @mixed_store(%mixed : memref<42x?xf32>, %i : index, %j : index, %val : f32) { memref.store %val, %mixed[%i, %j] : memref<42x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @mixed_store(%mixed : memref<42x?xf32>, %i : index, %j : index, %val : f32) { memref.store %val, %mixed[%i, %j] : memref<42x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @mixed_store(%mixed : memref<42x?xf32>, %i : index, %j : index, %val : f32) { memref.store %val, %mixed[%i, %j] : memref<42x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xi32>>, #dlti.dl_entry, dense<[32, 32, 32]> : vector<3xi32>>> } { func.func @memref_memory_space_cast(%input : memref<*xf32>) -> memref<*xf32, 1> { %cast = memref.memory_space_cast %input : memref<*xf32> to memref<*xf32, 1> return %cast : memref<*xf32, 1> } }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xi32>>, #dlti.dl_entry, dense<[32, 32, 32]> : vector<3xi32>>> } { func.func @memref_memory_space_cast(%input : memref<*xf32>) -> memref<*xf32, 1> { %cast = memref.memory_space_cast %input : memref<*xf32> to memref<*xf32, 1> return %cast : memref<*xf32, 1> } }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xi32>>, #dlti.dl_entry, dense<[32, 32, 32]> : vector<3xi32>>> } { func.func @memref_memory_space_cast(%input : memref<*xf32>) -> memref<*xf32, 1> { %cast = memref.memory_space_cast %input : memref<*xf32> to memref<*xf32, 1> return %cast : memref<*xf32, 1> } }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_dynamic_to_static(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref<10x12xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_dynamic_to_static(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref<10x12xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_dynamic_to_static(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref<10x12xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_dynamic_to_mixed(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_dynamic_to_mixed(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_dynamic_to_mixed(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_static(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref<42x1xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_static(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref<42x1xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_static(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref<42x1xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) { %0 = memref.cast %arg : memref<42x2x?xf32> to memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) { %0 = memref.cast %arg : memref<42x2x?xf32> to memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) { %0 = memref.cast %arg : memref<42x2x?xf32> to memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) { %0 = memref.cast %arg : memref<*xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) { %0 = memref.cast %arg : memref<*xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) { %0 = memref.cast %arg : memref<*xf32> to memref return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) { %c0 = arith.constant 0 : index %0 = memref.dim %mixed, %c0 : memref<42x?x?x13x?xf32> %c1 = arith.constant 1 : index %1 = memref.dim %mixed, %c1 : memref<42x?x?x13x?xf32> %c2 = arith.constant 2 : index %2 = memref.dim %mixed, %c2 : memref<42x?x?x13x?xf32> %c3 = arith.constant 3 : index %3 = memref.dim %mixed, %c3 : memref<42x?x?x13x?xf32> %c4 = arith.constant 4 : index %4 = memref.dim %mixed, %c4 : memref<42x?x?x13x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) { %c0 = arith.constant 0 : index %0 = memref.dim %mixed, %c0 : memref<42x?x?x13x?xf32> %c1 = arith.constant 1 : index %1 = memref.dim %mixed, %c1 : memref<42x?x?x13x?xf32> %c2 = arith.constant 2 : index %2 = memref.dim %mixed, %c2 : memref<42x?x?x13x?xf32> %c3 = arith.constant 3 : index %3 = memref.dim %mixed, %c3 : memref<42x?x?x13x?xf32> %c4 = arith.constant 4 : index %4 = memref.dim %mixed, %c4 : memref<42x?x?x13x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) { %c0 = arith.constant 0 : index %0 = memref.dim %mixed, %c0 : memref<42x?x?x13x?xf32> %c1 = arith.constant 1 : index %1 = memref.dim %mixed, %c1 : memref<42x?x?x13x?xf32> %c2 = arith.constant 2 : index %2 = memref.dim %mixed, %c2 : memref<42x?x?x13x?xf32> %c3 = arith.constant 3 : index %3 = memref.dim %mixed, %c3 : memref<42x?x?x13x?xf32> %c4 = arith.constant 4 : index %4 = memref.dim %mixed, %c4 : memref<42x?x?x13x?xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_dim_with_dyn_index(%arg : memref<3x?xf32>, %idx : index) -> index { %result = memref.dim %arg, %idx : memref<3x?xf32> return %result : index }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_dim_with_dyn_index(%arg : memref<3x?xf32>, %idx : index) -> index { %result = memref.dim %arg, %idx : memref<3x?xf32> return %result : index }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_dim_with_dyn_index(%arg : memref<3x?xf32>, %idx : index) -> index { %result = memref.dim %arg, %idx : memref<3x?xf32> return %result : index }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_reinterpret_cast_ranked_to_static_shape(%input : memref<2x3xf32>) { %output = memref.reinterpret_cast %input to offset: [0], sizes: [6, 1], strides: [1, 1] : memref<2x3xf32> to memref<6x1xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_reinterpret_cast_ranked_to_static_shape(%input : memref<2x3xf32>) { %output = memref.reinterpret_cast %input to offset: [0], sizes: [6, 1], strides: [1, 1] : memref<2x3xf32> to memref<6x1xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_reinterpret_cast_ranked_to_static_shape(%input : memref<2x3xf32>) { %output = memref.reinterpret_cast %input to offset: [0], sizes: [6, 1], strides: [1, 1] : memref<2x3xf32> to memref<6x1xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_reinterpret_cast_unranked_to_dynamic_shape(%offset: index, %size_0 : index, %size_1 : index, %stride_0 : index, %stride_1 : index, %input : memref<*xf32>) { %output = memref.reinterpret_cast %input to offset: [%offset], sizes: [%size_0, %size_1], strides: [%stride_0, %stride_1] : memref<*xf32> to memref> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_reinterpret_cast_unranked_to_dynamic_shape(%offset: index, %size_0 : index, %size_1 : index, %stride_0 : index, %stride_1 : index, %input : memref<*xf32>) { %output = memref.reinterpret_cast %input to offset: [%offset], sizes: [%size_0, %size_1], strides: [%stride_0, %stride_1] : memref<*xf32> to memref> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_reinterpret_cast_unranked_to_dynamic_shape(%offset: index, %size_0 : index, %size_1 : index, %stride_0 : index, %stride_1 : index, %input : memref<*xf32>) { %output = memref.reinterpret_cast %input to offset: [%offset], sizes: [%size_0, %size_1], strides: [%stride_0, %stride_1] : memref<*xf32> to memref> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref) { %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref) -> memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref) { %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref) -> memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref) { %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref) -> memref<*xf32> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_of_memref() { %0 = memref.alloc() : memref<1xmemref<1xf32>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_of_memref() { %0 = memref.alloc() : memref<1xmemref<1xf32>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_of_memref() { %0 = memref.alloc() : memref<1xmemref<1xf32>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry> } { func.func @memref_of_memref_32() { %0 = memref.alloc() : memref<1xmemref<1xf32>> return } }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry> } { func.func @memref_of_memref_32() { %0 = memref.alloc() : memref<1xmemref<1xf32>> return } }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry> } { func.func @memref_of_memref_32() { %0 = memref.alloc() : memref<1xmemref<1xf32>> return } }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @memref_of_memref_of_memref() { %0 = memref.alloc() : memref<1 x memref<2 x memref<3 x f32>>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @memref_of_memref_of_memref() { %0 = memref.alloc() : memref<1 x memref<2 x memref<3 x f32>>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @memref_of_memref_of_memref() { %0 = memref.alloc() : memref<1 x memref<2 x memref<3 x f32>>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @ranked_unranked() { %0 = memref.alloc() : memref<1 x memref<* x f32>> memref.cast %0 : memref<1 x memref<* x f32>> to memref<* x memref<* x f32>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @ranked_unranked() { %0 = memref.alloc() : memref<1 x memref<* x f32>> memref.cast %0 : memref<1 x memref<* x f32>> to memref<* x memref<* x f32>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @ranked_unranked() { %0 = memref.alloc() : memref<1 x memref<* x f32>> memref.cast %0 : memref<1 x memref<* x f32>> to memref<* x memref<* x f32>> return }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @realloc_dynamic(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) : memref to memref return %out : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @realloc_dynamic(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) : memref to memref return %out : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @realloc_dynamic(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) : memref to memref return %out : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @realloc_dynamic_alignment(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) {alignment = 8} : memref to memref return %out : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-opaque-pointers=1' ,1 "func.func @realloc_dynamic_alignment(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) {alignment = 8} : memref to memref return %out : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='use-aligned-alloc=1 use-opaque-pointers=1' ,1 "func.func @realloc_dynamic_alignment(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) {alignment = 8} : memref to memref return %out : memref }", mlir-opt -split-input-file -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' ,1 "func.func @view(%arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @view(%arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "memref.global @gv0 : memref<2xf32> = uninitialized func.func @get_gv0_memref() { %0 = memref.get_global @gv0 : memref<2xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "memref.global @gv0 : memref<2xf32> = uninitialized func.func @get_gv0_memref() { %0 = memref.get_global @gv0 : memref<2xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_copy_unranked() { %0 = memref.alloc() : memref<2xi1> %1 = memref.cast %0 : memref<2xi1> to memref<*xi1> %2 = memref.alloc() : memref<2xi1> %3 = memref.cast %2 : memref<2xi1> to memref<*xi1> memref.copy %1, %3 : memref<*xi1> to memref<*xi1> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_copy_unranked() { %0 = memref.alloc() : memref<2xi1> %1 = memref.cast %0 : memref<2xi1> to memref<*xi1> %2 = memref.alloc() : memref<2xi1> %3 = memref.cast %2 : memref<2xi1> to memref<*xi1> memref.copy %1, %3 : memref<*xi1> to memref<*xi1> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @mixed_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @mixed_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref { %0 = memref.alloc(%arg0, %arg1) : memref return %0 : memref }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @dynamic_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @dynamic_dealloc(%arg0: memref) { memref.dealloc %arg0 : memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) { %0 = memref.cast %static : memref<10x42xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_dynamic_to_static(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref<10x12xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_dynamic_to_static(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref<10x12xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_dynamic_to_mixed(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_dynamic_to_mixed(%dynamic : memref) { %0 = memref.cast %dynamic : memref to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_mixed_to_static(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref<42x1xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_mixed_to_static(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref<42x1xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) { %0 = memref.cast %mixed : memref<42x?xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) { %0 = memref.cast %arg : memref<42x2x?xf32> to memref<*xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) { %0 = memref.cast %arg : memref<42x2x?xf32> to memref<*xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) { %0 = memref.cast %arg : memref<*xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) { %0 = memref.cast %arg : memref<*xf32> to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_reinterpret_cast_unranked_to_dynamic_shape(%offset: index, %size_0 : index, %size_1 : index, %stride_0 : index, %stride_1 : index, %input : memref<*xf32>) { %output = memref.reinterpret_cast %input to offset: [%offset], sizes: [%size_0, %size_1], strides: [%stride_0, %stride_1] : memref<*xf32> to memref> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_reinterpret_cast_unranked_to_dynamic_shape(%offset: index, %size_0 : index, %size_1 : index, %stride_0 : index, %stride_1 : index, %input : memref<*xf32>) { %output = memref.reinterpret_cast %input to offset: [%offset], sizes: [%size_0, %size_1], strides: [%stride_0, %stride_1] : memref<*xf32> to memref> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref) { %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref) -> memref<*xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref) { %output = memref.reshape %input(%shape) : (memref<2x3xf32>, memref) -> memref<*xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @realloc_dynamic(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) : memref to memref return %out : memref }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @realloc_dynamic(%in: memref, %d: index) -> memref{ %out = memref.realloc %in(%d) : memref to memref return %out : memref }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=0' -split-input-file ,1 "func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> %5 = memref.view %0[%arg2][] : memref<2048xi8> to memref<64x4xf32> %6 = memref.alloc() : memref<2048xi8, 4> %7 = memref.view %6[%arg2][] : memref<2048xi8, 4> to memref<64x4xf32, 4> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) { %0 = memref.alloc() : memref<2048xi8> %1 = memref.view %0[%arg2][%arg0, %arg1] : memref<2048xi8> to memref %3 = memref.view %0[%arg2][%arg1] : memref<2048xi8> to memref<4x?xf32> %5 = memref.view %0[%arg2][] : memref<2048xi8> to memref<64x4xf32> %6 = memref.alloc() : memref<2048xi8, 4> %7 = memref.view %6[%arg2][] : memref<2048xi8, 4> to memref<64x4xf32, 4> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @view_empty_memref(%offset: index, %mem: memref<0xi8>) { %0 = memref.view %mem[%offset][] : memref<0xi8> to memref<0x4xf32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @view_empty_memref(%offset: index, %mem: memref<0xi8>) { %0 = memref.view %mem[%offset][] : memref<0xi8> to memref<0x4xf32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) { %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : index, %arg1 : index, %arg2 : index) { %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][%arg0, %arg1] : memref<64x4xf32, strided<[4, 1], offset: 0>> to memref> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @assume_alignment(%0 : memref<4x4xf16>) { memref.assume_alignment %0, 16 : memref<4x4xf16> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @assume_alignment(%0 : memref<4x4xf16>) { memref.assume_alignment %0, 16 : memref<4x4xf16> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @assume_alignment_w_offset(%0 : memref<4x4xf16, strided<[?, ?], offset: ?>>) { memref.assume_alignment %0, 16 : memref<4x4xf16, strided<[?, ?], offset: ?>> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @assume_alignment_w_offset(%0 : memref<4x4xf16, strided<[?, ?], offset: ?>>) { memref.assume_alignment %0, 16 : memref<4x4xf16, strided<[?, ?], offset: ?>> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @dim_of_unranked(%unranked: memref<*xi32>) -> index { %c0 = arith.constant 0 : index %dim = memref.dim %unranked, %c0 : memref<*xi32> return %dim : index }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @dim_of_unranked(%unranked: memref<*xi32>) -> index { %c0 = arith.constant 0 : index %dim = memref.dim %unranked, %c0 : memref<*xi32> return %dim : index }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @address_space(%arg0 : memref<32xf32, affine_map<(d0) -> (d0)>, 7>) { %0 = memref.alloc() : memref<32xf32, affine_map<(d0) -> (d0)>, 5> %1 = arith.constant 7 : index %2 = memref.load %0[%1] : memref<32xf32, affine_map<(d0) -> (d0)>, 5> func.return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @address_space(%arg0 : memref<32xf32, affine_map<(d0) -> (d0)>, 7>) { %0 = memref.alloc() : memref<32xf32, affine_map<(d0) -> (d0)>, 5> %1 = arith.constant 7 : index %2 = memref.load %0[%1] : memref<32xf32, affine_map<(d0) -> (d0)>, 5> func.return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @transpose(%arg0: memref>) { %0 = memref.transpose %arg0 (i, j, k) -> (k, i, j) : memref> to memref> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @transpose(%arg0: memref>) { %0 = memref.transpose %arg0 (i, j, k) -> (k, i, j) : memref> to memref> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "memref.global @gv0 : memref<2xf32> = uninitialized memref.global ""private"" @gv1 : memref<2xf32> memref.global @gv2 : memref<2x3xf32> = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> func.func @get_gv0_memref() { %0 = memref.get_global @gv0 : memref<2xf32> return } func.func @get_gv2_memref() { %0 = memref.get_global @gv2 : memref<2x3xf32> return } memref.global @gv3 : memref = dense<1.0> func.func @get_gv3_memref() { %0 = memref.get_global @gv3 : memref return } memref.global ""private"" @gv4 : memref = dense<1.0> {alignment = 64}", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "memref.global @gv0 : memref<2xf32> = uninitialized memref.global ""private"" @gv1 : memref<2xf32> memref.global @gv2 : memref<2x3xf32> = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]> func.func @get_gv0_memref() { %0 = memref.get_global @gv0 : memref<2xf32> return } func.func @get_gv2_memref() { %0 = memref.get_global @gv2 : memref<2x3xf32> return } memref.global @gv3 : memref = dense<1.0> func.func @get_gv3_memref() { %0 = memref.get_global @gv3 : memref return } memref.global ""private"" @gv4 : memref = dense<1.0> {alignment = 64}", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @expand_shape_static(%arg0: memref<3x4x5xf32>) -> memref<1x3x4x1x5xf32> { %0 = memref.expand_shape %arg0 [[0, 1], [2], [3, 4]] : memref<3x4x5xf32> into memref<1x3x4x1x5xf32> return %0 : memref<1x3x4x1x5xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @expand_shape_static(%arg0: memref<3x4x5xf32>) -> memref<1x3x4x1x5xf32> { %0 = memref.expand_shape %arg0 [[0, 1], [2], [3, 4]] : memref<3x4x5xf32> into memref<1x3x4x1x5xf32> return %0 : memref<1x3x4x1x5xf32> }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @collapse_shape_static(%arg0: memref<1x3x4x1x5xf32>) -> memref<3x4x5xf32> { %0 = memref.collapse_shape %arg0 [[0, 1], [2], [3, 4]] : memref<1x3x4x1x5xf32> into memref<3x4x5xf32> return %0 : memref<3x4x5xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @collapse_shape_static(%arg0: memref<1x3x4x1x5xf32>) -> memref<3x4x5xf32> { %0 = memref.collapse_shape %arg0 [[0, 1], [2], [3, 4]] : memref<1x3x4x1x5xf32> into memref<3x4x5xf32> return %0 : memref<3x4x5xf32> }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @rank_of_unranked(%unranked: memref<*xi32>) { %rank = memref.rank %unranked : memref<*xi32> return } func.func @rank_of_ranked(%ranked: memref) { %rank = memref.rank %ranked : memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @rank_of_unranked(%unranked: memref<*xi32>) { %rank = memref.rank %unranked : memref<*xi32> return } func.func @rank_of_ranked(%ranked: memref) { %rank = memref.rank %ranked : memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @atomic_rmw(%I : memref<10xi32>, %ival : i32, %F : memref<10xf32>, %fval : f32, %i : index) { memref.atomic_rmw assign %fval, %F[%i] : (f32, memref<10xf32>) -> f32 memref.atomic_rmw addi %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw maxs %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw mins %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw maxu %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw minu %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw addf %fval, %F[%i] : (f32, memref<10xf32>) -> f32 memref.atomic_rmw ori %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw andi %ival, %I[%i] : (i32, memref<10xi32>) -> i32 return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @atomic_rmw(%I : memref<10xi32>, %ival : i32, %F : memref<10xf32>, %fval : f32, %i : index) { memref.atomic_rmw assign %fval, %F[%i] : (f32, memref<10xf32>) -> f32 memref.atomic_rmw addi %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw maxs %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw mins %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw maxu %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw minu %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw addf %fval, %F[%i] : (f32, memref<10xf32>) -> f32 memref.atomic_rmw ori %ival, %I[%i] : (i32, memref<10xi32>) -> i32 memref.atomic_rmw andi %ival, %I[%i] : (i32, memref<10xi32>) -> i32 return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @generic_atomic_rmw(%I : memref<10xi32>, %i : index) { %x = memref.generic_atomic_rmw %I[%i] : memref<10xi32> { ^bb0(%old_value : i32): memref.atomic_yield %old_value : i32 } llvm.return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @generic_atomic_rmw(%I : memref<10xi32>, %i : index) { %x = memref.generic_atomic_rmw %I[%i] : memref<10xi32> { ^bb0(%old_value : i32): memref.atomic_yield %old_value : i32 } llvm.return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @generic_atomic_rmw_in_alloca_scope(){ %c1 = arith.constant 1 : index %alloc = memref.alloc() : memref<2x3xi32> memref.alloca_scope { %0 = memref.generic_atomic_rmw %alloc[%c1, %c1] : memref<2x3xi32> { ^bb0(%arg0: i32): memref.atomic_yield %arg0 : i32 } } return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @generic_atomic_rmw_in_alloca_scope(){ %c1 = arith.constant 1 : index %alloc = memref.alloc() : memref<2x3xi32> memref.alloca_scope { %0 = memref.generic_atomic_rmw %alloc[%c1, %c1] : memref<2x3xi32> { ^bb0(%arg0: i32): memref.atomic_yield %arg0 : i32 } } return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_ranked() { %0 = memref.alloc() : memref<2xf32> %1 = memref.cast %0 : memref<2xf32> to memref %2 = memref.alloc() : memref<2xf32> %3 = memref.cast %2 : memref<2xf32> to memref memref.copy %1, %3 : memref to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_ranked() { %0 = memref.alloc() : memref<2xf32> %1 = memref.cast %0 : memref<2xf32> to memref %2 = memref.alloc() : memref<2xf32> %3 = memref.cast %2 : memref<2xf32> to memref memref.copy %1, %3 : memref to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_contiguous(%in: memref<16x4xi32>, %offset: index) { %buf = memref.alloc() : memref<1x2xi32> %sub = memref.subview %in[%offset, 0] [1, 2] [1, 1] : memref<16x4xi32> to memref<1x2xi32, strided<[4, 1], offset: ?>> memref.copy %sub, %buf : memref<1x2xi32, strided<[4, 1], offset: ?>> to memref<1x2xi32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_contiguous(%in: memref<16x4xi32>, %offset: index) { %buf = memref.alloc() : memref<1x2xi32> %sub = memref.subview %in[%offset, 0] [1, 2] [1, 1] : memref<16x4xi32> to memref<1x2xi32, strided<[4, 1], offset: ?>> memref.copy %sub, %buf : memref<1x2xi32, strided<[4, 1], offset: ?>> to memref<1x2xi32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_0d_offset(%in: memref<2xi32>) { %buf = memref.alloc() : memref %sub = memref.subview %in[1] [1] [1] : memref<2xi32> to memref<1xi32, strided<[1], offset: 1>> %scalar = memref.collapse_shape %sub [] : memref<1xi32, strided<[1], offset: 1>> into memref> memref.copy %scalar, %buf : memref> to memref return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_0d_offset(%in: memref<2xi32>) { %buf = memref.alloc() : memref %sub = memref.subview %in[1] [1] [1] : memref<2xi32> to memref<1xi32, strided<[1], offset: 1>> %scalar = memref.collapse_shape %sub [] : memref<1xi32, strided<[1], offset: 1>> into memref> memref.copy %scalar, %buf : memref> to memref return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_noncontiguous(%in: memref<16x2xi32>, %offset: index) { %buf = memref.alloc() : memref<2x1xi32> %sub = memref.subview %in[%offset, 0] [2, 1] [1, 1] : memref<16x2xi32> to memref<2x1xi32, strided<[2, 1], offset: ?>> memref.copy %sub, %buf : memref<2x1xi32, strided<[2, 1], offset: ?>> to memref<2x1xi32> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_noncontiguous(%in: memref<16x2xi32>, %offset: index) { %buf = memref.alloc() : memref<2x1xi32> %sub = memref.subview %in[%offset, 0] [2, 1] [1, 1] : memref<16x2xi32> to memref<2x1xi32, strided<[2, 1], offset: ?>> memref.copy %sub, %buf : memref<2x1xi32, strided<[2, 1], offset: ?>> to memref<2x1xi32> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_unranked() { %0 = memref.alloc() : memref<2xi1> %1 = memref.cast %0 : memref<2xi1> to memref<*xi1> %2 = memref.alloc() : memref<2xi1> %3 = memref.cast %2 : memref<2xi1> to memref<*xi1> memref.copy %1, %3 : memref<*xi1> to memref<*xi1> return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @memref_copy_unranked() { %0 = memref.alloc() : memref<2xi1> %1 = memref.cast %0 : memref<2xi1> to memref<*xi1> %2 = memref.alloc() : memref<2xi1> %3 = memref.cast %2 : memref<2xi1> to memref<*xi1> memref.copy %1, %3 : memref<*xi1> to memref<*xi1> return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_aligned_pointer_as_index(%m: memref) -> index { %0 = memref.extract_aligned_pointer_as_index %m: memref -> index return %0: index }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_aligned_pointer_as_index(%m: memref) -> index { %0 = memref.extract_aligned_pointer_as_index %m: memref -> index return %0: index }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_strided_metadata( %ref: memref>) { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %ref : memref> -> memref, index, index, index, index, index return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @extract_strided_metadata( %ref: memref>) { %base, %offset, %sizes:2, %strides:2 = memref.extract_strided_metadata %ref : memref> -> memref, index, index, index, index, index return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @load_non_temporal(%arg0 : memref<32xf32, affine_map<(d0) -> (d0)>>) { %1 = arith.constant 7 : index %2 = memref.load %arg0[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> func.return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @load_non_temporal(%arg0 : memref<32xf32, affine_map<(d0) -> (d0)>>) { %1 = arith.constant 7 : index %2 = memref.load %arg0[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> func.return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "func.func @store_non_temporal(%input : memref<32xf32, affine_map<(d0) -> (d0)>>, %output : memref<32xf32, affine_map<(d0) -> (d0)>>) { %1 = arith.constant 7 : index %2 = memref.load %input[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> memref.store %2, %output[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> func.return }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "func.func @store_non_temporal(%input : memref<32xf32, affine_map<(d0) -> (d0)>>, %output : memref<32xf32, affine_map<(d0) -> (d0)>>) { %1 = arith.constant 7 : index %2 = memref.load %input[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> memref.store %2, %output[%1] {nontemporal = true} : memref<32xf32, affine_map<(d0) -> (d0)>> func.return }", mlir-opt -finalize-memref-to-llvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_ops() -> (index, index, index, index, index, index, index, index, index, index, index, index) { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z func.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ, %bIdX, %bIdY, %bIdZ, %gDimX, %gDimY, %gDimZ : index, index, index, index, index, index, index, index, index, index, index, index } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_ops() -> (index, index, index, index, index, index, index, index, index, index, index, index) { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z func.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ, %bIdX, %bIdY, %bIdZ, %gDimX, %gDimY, %gDimZ : index, index, index, index, index, index, index, index, index, index, index, index } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_ops_range() -> (index, index, index, index, index, index) attributes {gpu.known_block_size = array, gpu.known_grid_size = array} { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z func.return %tIdX, %tIdY, %tIdZ, %bIdX, %bIdY, %bIdZ : index, index, index, index, index, index } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_ops_range() -> (index, index, index, index, index, index) attributes {gpu.known_block_size = array, gpu.known_grid_size = array} { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z func.return %tIdX, %tIdY, %tIdZ, %bIdX, %bIdY, %bIdZ : index, index, index, index, index, index } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_comp(%idx : index) -> index { %0 = arith.addi %idx, %idx : index func.return %0 : index } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_comp(%idx : index) -> index { %0 = arith.addi %idx, %idx : index func.return %0 : index } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sync() { gpu.barrier func.return } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sync() { gpu.barrier func.return } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_fabs(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.absf %arg_f32 : f32 %result64 = math.absf %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_fabs(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.absf %arg_f32 : f32 %result64 = math.absf %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cbrt(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cbrt %arg_f32 : f32 %result64 = math.cbrt %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cbrt(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cbrt %arg_f32 : f32 %result64 = math.cbrt %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_ceil(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.ceil %arg_f32 : f32 %result64 = math.ceil %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_ceil(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.ceil %arg_f32 : f32 %result64 = math.ceil %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_floor(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.floor %arg_f32 : f32 %result64 = math.floor %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_floor(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.floor %arg_f32 : f32 %result64 = math.floor %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cos(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cos %arg_f32 : f32 %result64 = math.cos %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cos(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cos %arg_f32 : f32 %result64 = math.cos %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %exp_f32 = math.exp %arg_f32 : f32 %result32 = math.exp %exp_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %exp_f32 = math.exp %arg_f32 : f32 %result32 = math.exp %exp_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %exp2_f32 = math.exp2 %arg_f32 : f32 %result32 = math.exp2 %exp2_f32 : f32 %result64 = math.exp2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %exp2_f32 = math.exp2 %arg_f32 : f32 %result32 = math.exp2 %exp2_f32 : f32 %result64 = math.exp2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { ""test.symbol_scope""() ({ func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %exp_f32 = math.exp %arg_f32 : f32 %result32 = math.exp %exp_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } ""test.finish"" () : () -> () }) : () -> () }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { ""test.symbol_scope""() ({ func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %exp_f32 = math.exp %arg_f32 : f32 %result32 = math.exp %exp_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } ""test.finish"" () : () -> () }) : () -> () }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_expm1(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %expm1_f32 = math.expm1 %arg_f32 : f32 %result32 = math.expm1 %expm1_f32 : f32 %result64 = math.expm1 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_expm1(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %expm1_f32 = math.expm1 %arg_f32 : f32 %result32 = math.expm1 %expm1_f32 : f32 %result64 = math.expm1 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log %arg_f32 : f32 %result64 = math.log %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log %arg_f32 : f32 %result64 = math.log %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log1p(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log1p %arg_f32 : f32 %result64 = math.log1p %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log1p(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log1p %arg_f32 : f32 %result64 = math.log1p %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log10(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log10 %arg_f32 : f32 %result64 = math.log10 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log10(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log10 %arg_f32 : f32 %result64 = math.log10 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log2 %arg_f32 : f32 %result64 = math.log2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log2 %arg_f32 : f32 %result64 = math.log2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_rsqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.rsqrt %arg_f16 : f16 %result32 = math.rsqrt %arg_f32 : f32 %result64 = math.rsqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_rsqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.rsqrt %arg_f16 : f16 %result32 = math.rsqrt %arg_f32 : f32 %result64 = math.rsqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.sqrt %arg_f16 : f16 %result32 = math.sqrt %arg_f32 : f32 %result64 = math.sqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.sqrt %arg_f16 : f16 %result32 = math.sqrt %arg_f32 : f32 %result64 = math.sqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tan(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.tan %arg_f32 : f32 %result64 = math.tan %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tan(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.tan %arg_f32 : f32 %result64 = math.tan %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tanh(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.tanh %arg_f32 : f32 %result64 = math.tanh %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tanh(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.tanh %arg_f32 : f32 %result64 = math.tanh %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.atan %arg_f32 : f32 %result64 = math.atan %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.atan %arg_f32 : f32 %result64 = math.atan %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.atan2 %arg_f32, %arg_f32 : f32 %result64 = math.atan2 %arg_f64, %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.atan2 %arg_f32, %arg_f32 : f32 %result64 = math.atan2 %arg_f64, %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_pow(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.powf %arg_f32, %arg_f32 : f32 %result64 = math.powf %arg_f64, %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_pow(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.powf %arg_f32, %arg_f32 : f32 %result64 = math.powf %arg_f64, %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_erf(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.erf %arg_f32 : f32 %result64 = math.erf %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_erf(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.erf %arg_f32 : f32 %result64 = math.erf %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_unroll(%arg0 : vector<4xf32>) -> vector<4xf32> { %result = math.exp %arg0 : vector<4xf32> func.return %result : vector<4xf32> } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_unroll(%arg0 : vector<4xf32>) -> vector<4xf32> { %result = math.exp %arg0 : vector<4xf32> func.return %result : vector<4xf32> } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @kernel_func() kernel { gpu.return } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @kernel_func() kernel { gpu.return } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @module { spirv.func @spirv_exp(%arg0: vector<4xf32>) -> vector<4xf32> ""None"" { %0 = math.exp %arg0 : vector<4xf32> spirv.ReturnValue %0 : vector<4xf32> } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @module { spirv.func @spirv_exp(%arg0: vector<4xf32>) -> vector<4xf32> ""None"" { %0 = math.exp %arg0 : vector<4xf32> spirv.ReturnValue %0 : vector<4xf32> } }", mlir-opt -convert-gpu-to-rocdl='index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @test_const_printf() { gpu.printf ""Hello, world\n"" gpu.return } gpu.func @test_printf(%arg0: i32) { gpu.printf ""Hello: %d\n"" %arg0 : i32 gpu.return } }", mlir-opt -convert-gpu-to-rocdl='runtime=HIP use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @test_printf(%arg0: i32) { gpu.printf ""Hello: %d\n"" %arg0 : i32 gpu.return } }", mlir-opt -convert-gpu-to-rocdl='runtime=OpenCL use-opaque-pointers=1' ,1 "gpu.module @memref_conversions { gpu.func @kern(%arg0: memref<8xf32>) kernel { gpu.return } }", mlir-opt -convert-gpu-to-rocdl='use-opaque-pointers=1' -split-input-file ,1 "gpu.module @memref_conversions { gpu.func @kern(%arg0: memref<8xf32>) kernel { gpu.return } }", mlir-opt -convert-gpu-to-rocdl='use-bare-ptr-memref-call-conv=true use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @test_printf(%arg0: i32) { gpu.printf ""Hello: %d\n"" %arg0 : i32 gpu.return } }"," mlir-opt -convert-gpu-to-rocdl=""runtime=HIP use-opaque-pointers=0"" -split-input-file ",1 "gpu.module @test_module { gpu.func @test_printf(%arg0: i32) { gpu.printf ""Hello: %d\n"" %arg0 : i32 gpu.return } }"," mlir-opt -convert-gpu-to-rocdl=""runtime=OpenCL use-opaque-pointers=0"" ",1 "func.func @vec_bin(%arg0: vector<2x2x2xf32>) -> vector<2x2x2xf32> { %0 = arith.addf %arg0, %arg0 : vector<2x2x2xf32> return %0 : vector<2x2x2xf32> } func.func @sexti_vector(%arg0 : vector<1x2x3xi32>, %arg1 : vector<1x2x3xi64>) { %0 = arith.extsi %arg0: vector<1x2x3xi32> to vector<1x2x3xi64> return } func.func @zexti_vector(%arg0 : vector<1x2x3xi32>, %arg1 : vector<1x2x3xi64>) { %0 = arith.extui %arg0: vector<1x2x3xi32> to vector<1x2x3xi64> return } func.func @sitofp_vector(%arg0 : vector<1x2x3xi32>) -> vector<1x2x3xf32> { %0 = arith.sitofp %arg0: vector<1x2x3xi32> to vector<1x2x3xf32> return %0 : vector<1x2x3xf32> } func.func @uitofp_vector(%arg0 : vector<1x2x3xi32>) -> vector<1x2x3xf32> { %0 = arith.uitofp %arg0: vector<1x2x3xi32> to vector<1x2x3xf32> return %0 : vector<1x2x3xf32> } func.func @fptosi_vector(%arg0 : vector<1x2x3xf32>) -> vector<1x2x3xi32> { %0 = arith.fptosi %arg0: vector<1x2x3xf32> to vector<1x2x3xi32> return %0 : vector<1x2x3xi32> } func.func @fptoui_vector(%arg0 : vector<1x2x3xf32>) -> vector<1x2x3xi32> { %0 = arith.fptoui %arg0: vector<1x2x3xf32> to vector<1x2x3xi32> return %0 : vector<1x2x3xi32> } func.func @fpext_vector(%arg0 : vector<1x2x3xf16>) -> vector<1x2x3xf64> { %0 = arith.extf %arg0: vector<1x2x3xf16> to vector<1x2x3xf64> return %0 : vector<1x2x3xf64> } func.func @fptrunc_vector(%arg0 : vector<1x2x3xf64>) -> vector<1x2x3xf16> { %0 = arith.truncf %arg0: vector<1x2x3xf64> to vector<1x2x3xf16> return %0 : vector<1x2x3xf16> } func.func @trunci_vector(%arg0 : vector<1x2x3xi64>) -> vector<1x2x3xi16> { %0 = arith.trunci %arg0: vector<1x2x3xi64> to vector<1x2x3xi16> return %0 : vector<1x2x3xi16> } func.func @shl_vector(%arg0 : vector<1x2x3xi64>) -> vector<1x2x3xi64> { %c1 = arith.constant dense<1> : vector<1x2x3xi64> %0 = arith.shli %arg0, %c1 : vector<1x2x3xi64> return %0 : vector<1x2x3xi64> } func.func @shrs_vector(%arg0 : vector<1x2x3xi64>) -> vector<1x2x3xi64> { %c1 = arith.constant dense<1> : vector<1x2x3xi64> %0 = arith.shrsi %arg0, %c1 : vector<1x2x3xi64> return %0 : vector<1x2x3xi64> } func.func @shru_vector(%arg0 : vector<1x2x3xi64>) -> vector<1x2x3xi64> { %c1 = arith.constant dense<1> : vector<1x2x3xi64> %0 = arith.shrui %arg0, %c1 : vector<1x2x3xi64> return %0 : vector<1x2x3xi64> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @bitcast_2d(%arg0: vector<2x4xf32>) { arith.bitcast %arg0 : vector<2x4xf32> to vector<2x4xi32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @select_2d(%arg0 : vector<4x3xi1>, %arg1 : vector<4x3xi32>, %arg2 : vector<4x3xi32>) { %0 = arith.select %arg0, %arg1, %arg2 : vector<4x3xi1>, vector<4x3xi32> func.return } func.func @index_cast_2d(%arg0: vector<1x2x3xi1>) { %0 = arith.index_cast %arg0: vector<1x2x3xi1> to vector<1x2x3xindex> %1 = arith.index_cast %0: vector<1x2x3xindex> to vector<1x2x3xi1> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @vector_ops(%arg0: vector<4xf32>, %arg1: vector<4xi1>, %arg2: vector<4xi64>, %arg3: vector<4xi64>) -> vector<4xf32> { %0 = arith.constant dense<42.> : vector<4xf32> %1 = arith.addf %arg0, %0 : vector<4xf32> %3 = arith.divsi %arg2, %arg2 : vector<4xi64> %4 = arith.divui %arg2, %arg2 : vector<4xi64> %5 = arith.remsi %arg2, %arg2 : vector<4xi64> %6 = arith.remui %arg2, %arg2 : vector<4xi64> %7 = arith.divf %arg0, %0 : vector<4xf32> %8 = arith.remf %arg0, %0 : vector<4xf32> %9 = arith.andi %arg2, %arg3 : vector<4xi64> %10 = arith.ori %arg2, %arg3 : vector<4xi64> %11 = arith.xori %arg2, %arg3 : vector<4xi64> %12 = arith.shli %arg2, %arg2 : vector<4xi64> %13 = arith.shrsi %arg2, %arg2 : vector<4xi64> %14 = arith.shrui %arg2, %arg2 : vector<4xi64> return %1 : vector<4xf32> } func.func @ops(f32, f32, i32, i32, f64) -> (f32, i32) { ^bb0(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32, %arg4: f64): %0 = arith.subf %arg0, %arg1: f32 %1 = arith.subi %arg2, %arg3: i32 %2 = arith.cmpi slt, %arg2, %1 : i32 %3 = arith.divsi %arg2, %arg3 : i32 %4 = arith.divui %arg2, %arg3 : i32 %5 = arith.remsi %arg2, %arg3 : i32 %6 = arith.remui %arg2, %arg3 : i32 %8 = arith.divf %arg0, %arg1 : f32 %9 = arith.remf %arg0, %arg1 : f32 %10 = arith.andi %arg2, %arg3 : i32 %11 = arith.ori %arg2, %arg3 : i32 %12 = arith.xori %arg2, %arg3 : i32 %15 = arith.constant 7.9e-01 : f64 %16 = arith.shli %arg2, %arg3 : i32 %17 = arith.shrsi %arg2, %arg3 : i32 %18 = arith.shrui %arg2, %arg3 : i32 return %0, %4 : f32, i32 } func.func @index_cast(%arg0: index, %arg1: i1) { %0 = arith.index_cast %arg0: index to i1 %1 = arith.index_cast %arg1: i1 to index return } func.func @vector_index_cast(%arg0: vector<2xindex>, %arg1: vector<2xi1>) { %0 = arith.index_cast %arg0: vector<2xindex> to vector<2xi1> %1 = arith.index_cast %arg1: vector<2xi1> to vector<2xindex> return } func.func @index_castui(%arg0: index, %arg1: i1) { %0 = arith.index_castui %arg0: index to i1 %1 = arith.index_castui %arg1: i1 to index return } func.func @vector_index_castui(%arg0: vector<2xindex>, %arg1: vector<2xi1>) { %0 = arith.index_castui %arg0: vector<2xindex> to vector<2xi1> %1 = arith.index_castui %arg1: vector<2xi1> to vector<2xindex> return } func.func @sitofp(%arg0 : i32, %arg1 : i64) { %0 = arith.sitofp %arg0: i32 to f32 %1 = arith.sitofp %arg0: i32 to f64 %2 = arith.sitofp %arg1: i64 to f32 %3 = arith.sitofp %arg1: i64 to f64 return } func.func @sitofp_vector(%arg0 : vector<2xi16>, %arg1 : vector<2xi32>, %arg2 : vector<2xi64>) { %0 = arith.sitofp %arg0: vector<2xi16> to vector<2xf32> %1 = arith.sitofp %arg0: vector<2xi16> to vector<2xf64> %2 = arith.sitofp %arg1: vector<2xi32> to vector<2xf32> %3 = arith.sitofp %arg1: vector<2xi32> to vector<2xf64> %4 = arith.sitofp %arg2: vector<2xi64> to vector<2xf32> %5 = arith.sitofp %arg2: vector<2xi64> to vector<2xf64> return } func.func @uitofp(%arg0 : i32, %arg1 : i64) { %0 = arith.uitofp %arg0: i32 to f32 %1 = arith.uitofp %arg0: i32 to f64 %2 = arith.uitofp %arg1: i64 to f32 %3 = arith.uitofp %arg1: i64 to f64 return } func.func @fpext(%arg0 : f16, %arg1 : f32) { %0 = arith.extf %arg0: f16 to f32 %1 = arith.extf %arg0: f16 to f64 %2 = arith.extf %arg1: f32 to f64 return } func.func @fpext_vector(%arg0 : vector<2xf16>, %arg1 : vector<2xf32>) { %0 = arith.extf %arg0: vector<2xf16> to vector<2xf32> %1 = arith.extf %arg0: vector<2xf16> to vector<2xf64> %2 = arith.extf %arg1: vector<2xf32> to vector<2xf64> return } func.func @fptosi(%arg0 : f32, %arg1 : f64) { %0 = arith.fptosi %arg0: f32 to i32 %1 = arith.fptosi %arg0: f32 to i64 %2 = arith.fptosi %arg1: f64 to i32 %3 = arith.fptosi %arg1: f64 to i64 return } func.func @fptosi_vector(%arg0 : vector<2xf16>, %arg1 : vector<2xf32>, %arg2 : vector<2xf64>) { %0 = arith.fptosi %arg0: vector<2xf16> to vector<2xi32> %1 = arith.fptosi %arg0: vector<2xf16> to vector<2xi64> %2 = arith.fptosi %arg1: vector<2xf32> to vector<2xi32> %3 = arith.fptosi %arg1: vector<2xf32> to vector<2xi64> %4 = arith.fptosi %arg2: vector<2xf64> to vector<2xi32> %5 = arith.fptosi %arg2: vector<2xf64> to vector<2xi64> return } func.func @fptoui(%arg0 : f32, %arg1 : f64) { %0 = arith.fptoui %arg0: f32 to i32 %1 = arith.fptoui %arg0: f32 to i64 %2 = arith.fptoui %arg1: f64 to i32 %3 = arith.fptoui %arg1: f64 to i64 return } func.func @fptoui_vector(%arg0 : vector<2xf16>, %arg1 : vector<2xf32>, %arg2 : vector<2xf64>) { %0 = arith.fptoui %arg0: vector<2xf16> to vector<2xi32> %1 = arith.fptoui %arg0: vector<2xf16> to vector<2xi64> %2 = arith.fptoui %arg1: vector<2xf32> to vector<2xi32> %3 = arith.fptoui %arg1: vector<2xf32> to vector<2xi64> %4 = arith.fptoui %arg2: vector<2xf64> to vector<2xi32> %5 = arith.fptoui %arg2: vector<2xf64> to vector<2xi64> return } func.func @uitofp_vector(%arg0 : vector<2xi16>, %arg1 : vector<2xi32>, %arg2 : vector<2xi64>) { %0 = arith.uitofp %arg0: vector<2xi16> to vector<2xf32> %1 = arith.uitofp %arg0: vector<2xi16> to vector<2xf64> %2 = arith.uitofp %arg1: vector<2xi32> to vector<2xf32> %3 = arith.uitofp %arg1: vector<2xi32> to vector<2xf64> %4 = arith.uitofp %arg2: vector<2xi64> to vector<2xf32> %5 = arith.uitofp %arg2: vector<2xi64> to vector<2xf64> return } func.func @fptrunc(%arg0 : f32, %arg1 : f64) { %0 = arith.truncf %arg0: f32 to f16 %1 = arith.truncf %arg1: f64 to f16 %2 = arith.truncf %arg1: f64 to f32 return } func.func @fptrunc_vector(%arg0 : vector<2xf32>, %arg1 : vector<2xf64>) { %0 = arith.truncf %arg0: vector<2xf32> to vector<2xf16> %1 = arith.truncf %arg1: vector<2xf64> to vector<2xf16> %2 = arith.truncf %arg1: vector<2xf64> to vector<2xf32> return } func.func @integer_extension_and_truncation(%arg0 : i3) { %0 = arith.extsi %arg0 : i3 to i6 %1 = arith.extui %arg0 : i3 to i6 %2 = arith.trunci %arg0 : i3 to i2 return } func.func @integer_cast_0d_vector(%arg0 : vector) { %0 = arith.extsi %arg0 : vector to vector %1 = arith.extui %arg0 : vector to vector %2 = arith.trunci %arg0 : vector to vector return } func.func @fcmp(f32, f32) -> () { ^bb0(%arg0: f32, %arg1: f32): %1 = arith.cmpf oeq, %arg0, %arg1 : f32 %2 = arith.cmpf ogt, %arg0, %arg1 : f32 %3 = arith.cmpf oge, %arg0, %arg1 : f32 %4 = arith.cmpf olt, %arg0, %arg1 : f32 %5 = arith.cmpf ole, %arg0, %arg1 : f32 %6 = arith.cmpf one, %arg0, %arg1 : f32 %7 = arith.cmpf ord, %arg0, %arg1 : f32 %8 = arith.cmpf ueq, %arg0, %arg1 : f32 %9 = arith.cmpf ugt, %arg0, %arg1 : f32 %10 = arith.cmpf uge, %arg0, %arg1 : f32 %11 = arith.cmpf ult, %arg0, %arg1 : f32 %12 = arith.cmpf ule, %arg0, %arg1 : f32 %13 = arith.cmpf une, %arg0, %arg1 : f32 %14 = arith.cmpf uno, %arg0, %arg1 : f32 return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @index_vector(%arg0: vector<4xindex>) { %0 = arith.constant dense<[0, 1, 2, 3]> : vector<4xindex> %1 = arith.addi %arg0, %0 : vector<4xindex> func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @bitcast_1d(%arg0: vector<2xf32>) { arith.bitcast %arg0 : vector<2xf32> to vector<2xi32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @addui_extended_scalar(%arg0: i32, %arg1: i32) -> (i32, i1) { %sum, %carry = arith.addui_extended %arg0, %arg1 : i32, i1 return %sum, %carry : i32, i1 } func.func @addui_extended_vector1d(%arg0: vector<3xi16>, %arg1: vector<3xi16>) -> (vector<3xi16>, vector<3xi1>) { %sum, %carry = arith.addui_extended %arg0, %arg1 : vector<3xi16>, vector<3xi1> return %sum, %carry : vector<3xi16>, vector<3xi1> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @mulsi_extended_scalar(%arg0: i32, %arg1: i32) -> (i32, i32) { %low, %high = arith.mulsi_extended %arg0, %arg1 : i32 return %low, %high : i32, i32 } func.func @mulsi_extended_vector1d(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> (vector<3xi64>, vector<3xi64>) { %low, %high = arith.mulsi_extended %arg0, %arg1 : vector<3xi64> return %low, %high : vector<3xi64>, vector<3xi64> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @mului_extended_scalar(%arg0: i32, %arg1: i32) -> (i32, i32) { %low, %high = arith.mului_extended %arg0, %arg1 : i32 return %low, %high : i32, i32 } func.func @mului_extended_vector1d(%arg0: vector<3xi64>, %arg1: vector<3xi64>) -> (vector<3xi64>, vector<3xi64>) { %low, %high = arith.mului_extended %arg0, %arg1 : vector<3xi64> return %low, %high : vector<3xi64>, vector<3xi64> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @cmpf_2dvector(%arg0 : vector<4x3xf32>, %arg1 : vector<4x3xf32>) { %0 = arith.cmpf olt, %arg0, %arg1 : vector<4x3xf32> func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @cmpi_0dvector(%arg0 : vector, %arg1 : vector) { %0 = arith.cmpi ult, %arg0, %arg1 : vector func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @cmpi_2dvector(%arg0 : vector<4x3xi32>, %arg1 : vector<4x3xi32>) { %0 = arith.cmpi ult, %arg0, %arg1 : vector<4x3xi32> func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @select(%arg0 : i1, %arg1 : i32, %arg2 : i32) -> i32 { %0 = arith.select %arg0, %arg1, %arg2 : i32 return %0 : i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @minmaxi(%arg0 : i32, %arg1 : i32) -> i32 { %0 = arith.minsi %arg0, %arg1 : i32 %1 = arith.maxsi %arg0, %arg1 : i32 %2 = arith.minui %arg0, %arg1 : i32 %3 = arith.maxui %arg0, %arg1 : i32 return %0 : i32 } func.func @minmaxf(%arg0 : f32, %arg1 : f32) -> f32 { %0 = arith.minf %arg0, %arg1 : f32 %1 = arith.maxf %arg0, %arg1 : f32 return %0 : f32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @fastmath(%arg0: f32, %arg1: f32, %arg2: i32) { %0 = arith.addf %arg0, %arg1 fastmath : f32 %1 = arith.mulf %arg0, %arg1 fastmath : f32 %2 = arith.negf %arg0 fastmath : f32 %3 = arith.addf %arg0, %arg1 fastmath : f32 %4 = arith.addf %arg0, %arg1 fastmath : f32 return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "func.func @ops_supporting_fastmath(%arg0: f32, %arg1: f32, %arg2: i32) { %0 = arith.addf %arg0, %arg1 fastmath : f32 %1 = arith.divf %arg0, %arg1 fastmath : f32 %2 = arith.maxf %arg0, %arg1 fastmath : f32 %3 = arith.minf %arg0, %arg1 fastmath : f32 %4 = arith.mulf %arg0, %arg1 fastmath : f32 %5 = arith.negf %arg0 fastmath : f32 %6 = arith.remf %arg0, %arg1 fastmath : f32 %7 = arith.subf %arg0, %arg1 fastmath : f32 return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm))"" -split-input-file ",1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @cmpf_ordered(%arg0 : f32, %arg1 : f32) -> i1 { %0 = arith.cmpf ord, %arg0, %arg1 : f32 return %0: i1 } func.func @cmpf_unordered(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) -> vector<4xi1> { %0 = arith.cmpf uno, %arg0, %arg1 : vector<4xf32> return %0: vector<4xi1> } } ", mlir-opt -split-input-file -convert-arith-to-spirv=enable-fast-math -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @minf(%arg0 : f32, %arg1 : f32) -> f32 { %0 = arith.minf %arg0, %arg1 : f32 return %0: f32 } func.func @maxf(%arg0 : vector<4xf32>, %arg1 : vector<4xf32>) -> vector<4xf32> { %0 = arith.maxf %arg0, %arg1 : vector<4xf32> return %0: vector<4xf32> } } ", mlir-opt -split-input-file -convert-arith-to-spirv=enable-fast-math -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @int32_scalar(%lhs: i32, %rhs: i32) { %0 = arith.addi %lhs, %rhs: i32 %1 = arith.subi %lhs, %rhs: i32 %2 = arith.muli %lhs, %rhs: i32 %3 = arith.divsi %lhs, %rhs: i32 %4 = arith.divui %lhs, %rhs: i32 %5 = arith.remui %lhs, %rhs: i32 return } func.func @int32_scalar_srem(%lhs: i32, %rhs: i32) { %0 = arith.remsi %lhs, %rhs: i32 return } func.func @index_scalar(%lhs: index, %rhs: index) { %0 = arith.addi %lhs, %rhs: index %1 = arith.subi %lhs, %rhs: index %2 = arith.muli %lhs, %rhs: index %3 = arith.divsi %lhs, %rhs: index %4 = arith.divui %lhs, %rhs: index %5 = arith.remui %lhs, %rhs: index return } func.func @index_scalar_srem(%lhs: index, %rhs: index) { %0 = arith.remsi %lhs, %rhs: index return } func.func @int32_scalar_addui_extended(%lhs: i32, %rhs: i32) -> (i32, i1) { %sum, %overflow = arith.addui_extended %lhs, %rhs: i32, i1 return %sum, %overflow : i32, i1 } func.func @int32_vector_addui_extended(%lhs: vector<4xi32>, %rhs: vector<4xi32>) -> (vector<4xi32>, vector<4xi1>) { %sum, %overflow = arith.addui_extended %lhs, %rhs: vector<4xi32>, vector<4xi1> return %sum, %overflow : vector<4xi32>, vector<4xi1> } func.func @int32_scalar_mulsi_extended(%lhs: i32, %rhs: i32) -> (i32, i32) { %low, %high = arith.mulsi_extended %lhs, %rhs: i32 return %low, %high : i32, i32 } func.func @int32_vector_mulsi_extended(%lhs: vector<4xi32>, %rhs: vector<4xi32>) -> (vector<4xi32>, vector<4xi32>) { %low, %high = arith.mulsi_extended %lhs, %rhs: vector<4xi32> return %low, %high : vector<4xi32>, vector<4xi32> } func.func @int32_scalar_mului_extended(%lhs: i32, %rhs: i32) -> (i32, i32) { %low, %high = arith.mului_extended %lhs, %rhs: i32 return %low, %high : i32, i32 } func.func @int32_vector_mului_extended(%lhs: vector<4xi32>, %rhs: vector<4xi32>) -> (vector<4xi32>, vector<4xi32>) { %low, %high = arith.mului_extended %lhs, %rhs: vector<4xi32> return %low, %high : vector<4xi32>, vector<4xi32> } func.func @float32_unary_scalar(%arg0: f32) { %0 = arith.negf %arg0 : f32 return } func.func @float32_binary_scalar(%lhs: f32, %rhs: f32) { %0 = arith.addf %lhs, %rhs: f32 %1 = arith.subf %lhs, %rhs: f32 %2 = arith.mulf %lhs, %rhs: f32 %3 = arith.divf %lhs, %rhs: f32 %4 = arith.remf %lhs, %rhs: f32 return } func.func @int_vector234(%arg0: vector<2xi8>, %arg1: vector<4xi64>) { %0 = arith.divsi %arg0, %arg0: vector<2xi8> %1 = arith.divui %arg1, %arg1: vector<4xi64> return } func.func @index_vector(%arg0: vector<4xindex>) { %0 = arith.remui %arg0, %arg0: vector<4xindex> return } func.func @vector_srem(%arg0: vector<3xi16>, %arg1: vector<3xi16>) { %0 = arith.remsi %arg0, %arg1: vector<3xi16> return } func.func @float_vector234(%arg0: vector<2xf16>, %arg1: vector<3xf64>) { %0 = arith.addf %arg0, %arg0: vector<2xf16> %1 = arith.mulf %arg1, %arg1: vector<3xf64> return } func.func @one_elem_vector(%arg0: vector<1xi32>) { %0 = arith.addi %arg0, %arg0: vector<1xi32> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @bitwise_scalar(%arg0 : i32, %arg1 : i32) { %0 = arith.andi %arg0, %arg1 : i32 %1 = arith.ori %arg0, %arg1 : i32 %2 = arith.xori %arg0, %arg1 : i32 return } func.func @bitwise_vector(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) { %0 = arith.andi %arg0, %arg1 : vector<4xi32> %1 = arith.ori %arg0, %arg1 : vector<4xi32> %2 = arith.xori %arg0, %arg1 : vector<4xi32> return } func.func @logical_scalar(%arg0 : i1, %arg1 : i1) { %0 = arith.andi %arg0, %arg1 : i1 %1 = arith.ori %arg0, %arg1 : i1 %2 = arith.xori %arg0, %arg1 : i1 return } func.func @logical_vector(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>) { %0 = arith.andi %arg0, %arg1 : vector<4xi1> %1 = arith.ori %arg0, %arg1 : vector<4xi1> %2 = arith.xori %arg0, %arg1 : vector<4xi1> return } func.func @shift_scalar(%arg0 : i32, %arg1 : i32) { %0 = arith.shli %arg0, %arg1 : i32 %1 = arith.shrsi %arg0, %arg1 : i32 %2 = arith.shrui %arg0, %arg1 : i32 return } func.func @shift_vector(%arg0 : vector<4xi32>, %arg1 : vector<4xi32>) { %0 = arith.shli %arg0, %arg1 : vector<4xi32> %1 = arith.shrsi %arg0, %arg1 : vector<4xi32> %2 = arith.shrui %arg0, %arg1 : vector<4xi32> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @cmpf(%arg0 : f32, %arg1 : f32) { %1 = arith.cmpf oeq, %arg0, %arg1 : f32 %2 = arith.cmpf ogt, %arg0, %arg1 : f32 %3 = arith.cmpf oge, %arg0, %arg1 : f32 %4 = arith.cmpf olt, %arg0, %arg1 : f32 %5 = arith.cmpf ole, %arg0, %arg1 : f32 %6 = arith.cmpf one, %arg0, %arg1 : f32 %7 = arith.cmpf ueq, %arg0, %arg1 : f32 %8 = arith.cmpf ugt, %arg0, %arg1 : f32 %9 = arith.cmpf uge, %arg0, %arg1 : f32 %10 = arith.cmpf ult, %arg0, %arg1 : f32 %11 = arith.cmpf ule, %arg0, %arg1 : f32 %12 = arith.cmpf une, %arg0, %arg1 : f32 return } func.func @vec1cmpf(%arg0 : vector<1xf32>, %arg1 : vector<1xf32>) { %0 = arith.cmpf ogt, %arg0, %arg1 : vector<1xf32> %1 = arith.cmpf ult, %arg0, %arg1 : vector<1xf32> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @cmpf(%arg0 : f32, %arg1 : f32) { %0 = arith.cmpf ord, %arg0, %arg1 : f32 %1 = arith.cmpf uno, %arg0, %arg1 : f32 return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @cmpf(%arg0 : f32, %arg1 : f32) { %0 = arith.cmpf ord, %arg0, %arg1 : f32 %1 = arith.cmpf uno, %arg0, %arg1 : f32 return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @cmpi(%arg0 : i32, %arg1 : i32) { %0 = arith.cmpi eq, %arg0, %arg1 : i32 %1 = arith.cmpi ne, %arg0, %arg1 : i32 %2 = arith.cmpi slt, %arg0, %arg1 : i32 %3 = arith.cmpi sle, %arg0, %arg1 : i32 %4 = arith.cmpi sgt, %arg0, %arg1 : i32 %5 = arith.cmpi sge, %arg0, %arg1 : i32 %6 = arith.cmpi ult, %arg0, %arg1 : i32 %7 = arith.cmpi ule, %arg0, %arg1 : i32 %8 = arith.cmpi ugt, %arg0, %arg1 : i32 %9 = arith.cmpi uge, %arg0, %arg1 : i32 return } func.func @indexcmpi(%arg0 : index, %arg1 : index) { %0 = arith.cmpi eq, %arg0, %arg1 : index %1 = arith.cmpi ne, %arg0, %arg1 : index %2 = arith.cmpi slt, %arg0, %arg1 : index %3 = arith.cmpi sle, %arg0, %arg1 : index %4 = arith.cmpi sgt, %arg0, %arg1 : index %5 = arith.cmpi sge, %arg0, %arg1 : index %6 = arith.cmpi ult, %arg0, %arg1 : index %7 = arith.cmpi ule, %arg0, %arg1 : index %8 = arith.cmpi ugt, %arg0, %arg1 : index %9 = arith.cmpi uge, %arg0, %arg1 : index return } func.func @vec1cmpi(%arg0 : vector<1xi32>, %arg1 : vector<1xi32>) { %0 = arith.cmpi ult, %arg0, %arg1 : vector<1xi32> %1 = arith.cmpi sgt, %arg0, %arg1 : vector<1xi32> return } func.func @boolcmpi_equality(%arg0 : i1, %arg1 : i1) { %0 = arith.cmpi eq, %arg0, %arg1 : i1 %1 = arith.cmpi ne, %arg0, %arg1 : i1 return } func.func @boolcmpi_unsigned(%arg0 : i1, %arg1 : i1) { %0 = arith.cmpi uge, %arg0, %arg1 : i1 %1 = arith.cmpi ult, %arg0, %arg1 : i1 return } func.func @vec1boolcmpi_equality(%arg0 : vector<1xi1>, %arg1 : vector<1xi1>) { %0 = arith.cmpi eq, %arg0, %arg1 : vector<1xi1> %1 = arith.cmpi ne, %arg0, %arg1 : vector<1xi1> return } func.func @vec1boolcmpi_unsigned(%arg0 : vector<1xi1>, %arg1 : vector<1xi1>) { %0 = arith.cmpi uge, %arg0, %arg1 : vector<1xi1> %1 = arith.cmpi ult, %arg0, %arg1 : vector<1xi1> return } func.func @vecboolcmpi_equality(%arg0 : vector<4xi1>, %arg1 : vector<4xi1>) { %0 = arith.cmpi eq, %arg0, %arg1 : vector<4xi1> %1 = arith.cmpi ne, %arg0, %arg1 : vector<4xi1> return } func.func @vecboolcmpi_unsigned(%arg0 : vector<3xi1>, %arg1 : vector<3xi1>) { %0 = arith.cmpi uge, %arg0, %arg1 : vector<3xi1> %1 = arith.cmpi ult, %arg0, %arg1 : vector<3xi1> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @constant() { %0 = arith.constant true %1 = arith.constant 42 : i32 %2 = arith.constant 0.5 : f32 %3 = arith.constant dense<[2, 3]> : vector<2xi32> %4 = arith.constant 1 : index %5 = arith.constant dense<1> : tensor<2x3xi32> %6 = arith.constant dense<1.0> : tensor<2x3xf32> %7 = arith.constant dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> : tensor<2x3xf32> %8 = arith.constant dense<[[1, 2, 3], [4, 5, 6]]> : tensor<2x3xi32> %9 = arith.constant dense<[[1, 2], [3, 4], [5, 6]]> : tensor<3x2xi32> %10 = arith.constant dense<[1, 2, 3, 4, 5, 6]> : tensor<6xi32> return } func.func @constant_16bit() { %0 = arith.constant 4 : i16 %1 = arith.constant 5.0 : f16 %2 = arith.constant dense<[2, 3]> : vector<2xi16> %3 = arith.constant dense<4.0> : tensor<5xf16> return } func.func @constant_64bit() { %0 = arith.constant 4 : i64 %1 = arith.constant 5.0 : f64 %2 = arith.constant dense<[2, 3]> : vector<2xi64> %3 = arith.constant dense<4.0> : tensor<5xf64> return } func.func @constant_size1() { %0 = arith.constant dense : tensor<1xi1> %1 = arith.constant dense<4> : vector<1xi64> %2 = arith.constant dense<5.0> : tensor<1xf64> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @constant_16bit() { %0 = arith.constant 4 : i16 %1 = arith.constant 5.0 : f16 %2 = arith.constant dense<[2, 3]> : vector<2xi16> %3 = arith.constant dense<4.0> : tensor<5xf16> %4 = arith.constant dense<[[1.0, 2.0], [3.0, 4.0]]> : tensor<2x2xf16> return } func.func @constant_size1() { %0 = arith.constant dense<4> : vector<1xi16> %1 = arith.constant dense<5.0> : tensor<1xf16> return } func.func @corner_cases() { %5 = arith.constant -1 : i16 %6 = arith.constant -2 : i16 %7 = arith.constant -1 : index %8 = arith.constant -2 : index %9 = arith.constant false %10 = arith.constant true return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @index_cast1(%arg0: i16) { %0 = arith.index_cast %arg0 : i16 to index return } func.func @index_cast2(%arg0: index) { %0 = arith.index_cast %arg0 : index to i16 return } func.func @index_cast3(%arg0: i32) { %0 = arith.index_cast %arg0 : i32 to index return } func.func @index_cast4(%arg0: index) { %0 = arith.index_cast %arg0 : index to i32 return } func.func @index_castui1(%arg0: i16) { %0 = arith.index_castui %arg0 : i16 to index return } func.func @index_castui2(%arg0: index) { %0 = arith.index_castui %arg0 : index to i16 return } func.func @index_castui3(%arg0: i32) { %0 = arith.index_castui %arg0 : i32 to index return } func.func @index_castui4(%arg0: index) { %0 = arith.index_cast %arg0 : index to i32 return } func.func @bit_cast(%arg0: vector<2xf32>, %arg1: i64) { %0 = arith.bitcast %arg0 : vector<2xf32> to vector<2xi32> %1 = arith.bitcast %arg1 : i64 to f64 return } func.func @fpext1(%arg0: f16) -> f64 { %0 = arith.extf %arg0 : f16 to f64 return %0 : f64 } func.func @fpext2(%arg0 : f32) -> f64 { %0 = arith.extf %arg0 : f32 to f64 return %0 : f64 } func.func @fptrunc1(%arg0 : f64) -> f16 { %0 = arith.truncf %arg0 : f64 to f16 return %0 : f16 } func.func @fptrunc2(%arg0: f32) -> f16 { %0 = arith.truncf %arg0 : f32 to f16 return %0 : f16 } func.func @sitofp1(%arg0 : i32) -> f32 { %0 = arith.sitofp %arg0 : i32 to f32 return %0 : f32 } func.func @sitofp2(%arg0 : i64) -> f64 { %0 = arith.sitofp %arg0 : i64 to f64 return %0 : f64 } func.func @uitofp_i16_f32(%arg0: i16) -> f32 { %0 = arith.uitofp %arg0 : i16 to f32 return %0 : f32 } func.func @uitofp_i32_f32(%arg0 : i32) -> f32 { %0 = arith.uitofp %arg0 : i32 to f32 return %0 : f32 } func.func @uitofp_i1_f32(%arg0 : i1) -> f32 { %0 = arith.uitofp %arg0 : i1 to f32 return %0 : f32 } func.func @uitofp_i1_f64(%arg0 : i1) -> f64 { %0 = arith.uitofp %arg0 : i1 to f64 return %0 : f64 } func.func @uitofp_vec_i1_f32(%arg0 : vector<4xi1>) -> vector<4xf32> { %0 = arith.uitofp %arg0 : vector<4xi1> to vector<4xf32> return %0 : vector<4xf32> } spirv.func @uitofp_vec_i1_f64(%arg0: vector<4xi1>) -> vector<4xf64> ""None"" { %0 = spirv.Constant dense<0.000000e+00> : vector<4xf64> %1 = spirv.Constant dense<1.000000e+00> : vector<4xf64> %2 = spirv.Select %arg0, %1, %0 : vector<4xi1>, vector<4xf64> spirv.ReturnValue %2 : vector<4xf64> } func.func @sexti1(%arg0: i16) -> i64 { %0 = arith.extsi %arg0 : i16 to i64 return %0 : i64 } func.func @sexti2(%arg0 : i32) -> i64 { %0 = arith.extsi %arg0 : i32 to i64 return %0 : i64 } func.func @sext_bool_scalar(%arg0 : i1) -> i32 { %0 = arith.extsi %arg0 : i1 to i32 return %0 : i32 } func.func @sext_bool_vector(%arg0 : vector<3xi1>) -> vector<3xi32> { %0 = arith.extsi %arg0 : vector<3xi1> to vector<3xi32> return %0 : vector<3xi32> } func.func @zexti1(%arg0: i16) -> i64 { %0 = arith.extui %arg0 : i16 to i64 return %0 : i64 } func.func @zexti2(%arg0 : i32) -> i64 { %0 = arith.extui %arg0 : i32 to i64 return %0 : i64 } func.func @zexti3(%arg0 : i1) -> i32 { %0 = arith.extui %arg0 : i1 to i32 return %0 : i32 } func.func @zexti4(%arg0 : vector<4xi1>) -> vector<4xi32> { %0 = arith.extui %arg0 : vector<4xi1> to vector<4xi32> return %0 : vector<4xi32> } func.func @zexti5(%arg0 : vector<4xi1>) -> vector<4xi64> { %0 = arith.extui %arg0 : vector<4xi1> to vector<4xi64> return %0 : vector<4xi64> } func.func @trunci1(%arg0 : i64) -> i16 { %0 = arith.trunci %arg0 : i64 to i16 return %0 : i16 } func.func @trunci2(%arg0: i32) -> i16 { %0 = arith.trunci %arg0 : i32 to i16 return %0 : i16 } func.func @trunc_to_i1(%arg0: i32) -> i1 { %0 = arith.trunci %arg0 : i32 to i1 return %0 : i1 } func.func @trunc_to_veci1(%arg0: vector<4xi32>) -> vector<4xi1> { %0 = arith.trunci %arg0 : vector<4xi32> to vector<4xi1> return %0 : vector<4xi1> } func.func @fptoui1(%arg0 : f32) -> i32 { %0 = arith.fptoui %arg0 : f32 to i32 return %0 : i32 } func.func @fptoui2(%arg0 : f16) -> i16 { %0 = arith.fptoui %arg0 : f16 to i16 return %0 : i16 } func.func @fptosi1(%arg0 : f32) -> i32 { %0 = arith.fptosi %arg0 : f32 to i32 return %0 : i32 } func.func @fptosi2(%arg0 : f16) -> i16 { %0 = arith.fptosi %arg0 : f16 to i16 return %0 : i16 } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @fpext1(%arg0: f16) -> f64 { %0 = arith.extf %arg0 : f16 to f64 return %0: f64 } func.func @fpext2(%arg0 : f32) -> f64 { %0 = arith.extf %arg0 : f32 to f64 return %0: f64 } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @fptrunc1(%arg0: f32) -> f16 { %0 = arith.truncf %arg0 : f32 to f16 return %0: f16 } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @int32_scalar(%lhs: i32, %rhs: i32) { %0 = arith.addi %lhs, %rhs: i32 %1 = arith.subi %lhs, %rhs: i32 %2 = arith.muli %lhs, %rhs: i32 %3 = arith.divsi %lhs, %rhs: i32 %4 = arith.divui %lhs, %rhs: i32 %5 = arith.remui %lhs, %rhs: i32 %6 = arith.maxsi %lhs, %rhs : i32 %7 = arith.maxui %lhs, %rhs : i32 %8 = arith.minsi %lhs, %rhs : i32 %9 = arith.minui %lhs, %rhs : i32 return } func.func @float32_binary_scalar(%lhs: f32, %rhs: f32) { %0 = arith.addf %lhs, %rhs: f32 %1 = arith.subf %lhs, %rhs: f32 %2 = arith.mulf %lhs, %rhs: f32 %3 = arith.divf %lhs, %rhs: f32 %4 = arith.remf %lhs, %rhs: f32 return } func.func @float32_minf_scalar(%arg0 : f32, %arg1 : f32) -> f32 { %0 = arith.minf %arg0, %arg1 : f32 return %0: f32 } func.func @float32_maxf_scalar(%arg0 : vector<2xf32>, %arg1 : vector<2xf32>) -> vector<2xf32> { %0 = arith.maxf %arg0, %arg1 : vector<2xf32> return %0: vector<2xf32> } func.func @scalar_srem(%lhs: i32, %rhs: i32) { %0 = arith.remsi %lhs, %rhs: i32 return } func.func @vector_srem(%arg0: vector<3xi16>, %arg1: vector<3xi16>) { %0 = arith.remsi %arg0, %arg1: vector<3xi16> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @select(%arg0 : i32, %arg1 : i32) { %0 = arith.cmpi sle, %arg0, %arg1 : i32 %1 = arith.select %0, %arg0, %arg1 : i32 return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @int32_scalar(%lhs: i32, %rhs: i32) { %0 = arith.addi %lhs, %rhs: i32 %1 = arith.subi %lhs, %rhs: i32 %2 = arith.muli %lhs, %rhs: i32 %3 = arith.divsi %lhs, %rhs: i32 %4 = arith.divui %lhs, %rhs: i32 %5 = arith.remui %lhs, %rhs: i32 %6 = arith.maxsi %lhs, %rhs : i32 %7 = arith.maxui %lhs, %rhs : i32 %8 = arith.minsi %lhs, %rhs : i32 %9 = arith.minui %lhs, %rhs : i32 return } func.func @scalar_srem(%lhs: i32, %rhs: i32) { %0 = arith.remsi %lhs, %rhs: i32 return } func.func @float32_unary_scalar(%arg0: f32) { %5 = arith.negf %arg0 : f32 return } func.func @float32_binary_scalar(%lhs: f32, %rhs: f32) { %0 = arith.addf %lhs, %rhs: f32 %1 = arith.subf %lhs, %rhs: f32 %2 = arith.mulf %lhs, %rhs: f32 %3 = arith.divf %lhs, %rhs: f32 %4 = arith.remf %lhs, %rhs: f32 return } func.func @float32_minf_scalar(%arg0 : f32, %arg1 : f32) -> f32 { %0 = arith.minf %arg0, %arg1 : f32 return %0: f32 } func.func @float32_maxf_scalar(%arg0 : vector<2xf32>, %arg1 : vector<2xf32>) -> vector<2xf32> { %0 = arith.maxf %arg0, %arg1 : vector<2xf32> return %0: vector<2xf32> } func.func @int_vector234(%arg0: vector<2xi8>, %arg1: vector<4xi64>) { %0 = arith.divsi %arg0, %arg0: vector<2xi8> %1 = arith.divui %arg1, %arg1: vector<4xi64> return } func.func @vector_srem(%arg0: vector<3xi16>, %arg1: vector<3xi16>) { %0 = arith.remsi %arg0, %arg1: vector<3xi16> return } func.func @float_vector234(%arg0: vector<2xf16>, %arg1: vector<3xf64>) { %0 = arith.addf %arg0, %arg0: vector<2xf16> %1 = arith.mulf %arg1, %arg1: vector<3xf64> return } func.func @one_elem_vector(%arg0: vector<1xi32>) { %0 = arith.addi %arg0, %arg0: vector<1xi32> return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @int_vector23(%arg0: vector<2xi8>, %arg1: vector<3xi16>) { %0 = arith.divsi %arg0, %arg0: vector<2xi8> %1 = arith.divsi %arg1, %arg1: vector<3xi16> return } func.func @float_scalar(%arg0: f16) { %0 = arith.addf %arg0, %arg0: f16 return } } ", mlir-opt -split-input-file -convert-arith-to-spirv -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index %c256 = arith.constant 256 : i32 gpu.launch_func @kernels::@builtin_workgroup_id_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) dynamic_shared_memory_size %c256 return } gpu.module @kernels { gpu.func @builtin_workgroup_id_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index %c256 = arith.constant 256 : i32 gpu.launch_func @kernels::@builtin_workgroup_id_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) dynamic_shared_memory_size %c256 return } gpu.module @kernels { gpu.func @builtin_workgroup_id_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_id_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_id_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_id_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_id_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_dim x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_dim x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_dim y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_dim y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_dim z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_dim z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_local_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_local_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.thread_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_local_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_local_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.thread_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_num_workgroups_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_num_workgroups_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.grid_dim x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_num_workgroups_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_num_workgroups_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.grid_dim x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_subgroup_id() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.subgroup_id : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_subgroup_id() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.subgroup_id : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_num_subgroups() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.num_subgroups : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_num_subgroups() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.num_subgroups : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi<>} { %0 = gpu.block_dim x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi<>} { %0 = gpu.block_dim x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi<>} { %0 = gpu.block_dim y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi<>} { %0 = gpu.block_dim y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi<>} { %0 = gpu.block_dim z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_size_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_size_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi<>} { %0 = gpu.block_dim z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_global_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_global_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.global_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_global_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_global_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.global_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_global_id_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_global_id_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.global_id y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_global_id_y blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_global_id_y() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.global_id y gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_global_id_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_global_id_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.global_id z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_global_id_z blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_global_id_z() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.global_id z gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_subgroup_size() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.subgroup_size : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_subgroup_size() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.subgroup_size : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @basic_module_structure(%arg0 : f32, %arg1 : memref<12xf32, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } func.func @main() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref<12xf32, #spirv.storage_class>) %cst = arith.constant 1 : index gpu.launch_func @kernels::@basic_module_structure blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref<12xf32, #spirv.storage_class>) return } }", mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @basic_module_structure_preset_ABI( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(1, 2), StorageBuffer>}, %arg1 : memref<12xf32, #spirv.storage_class> {spirv.interface_var_abi = #spirv.interface_var_abi<(3, 0)>}) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } }", mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @missing_entry_point_abi(%arg0 : f32, %arg1 : memref<12xf32, #spirv.storage_class>) kernel { gpu.return } } func.func @main() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref<12xf32, #spirv.storage_class>) %cst = arith.constant 1 : index gpu.launch_func @kernels::@missing_entry_point_abi blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref<12xf32, #spirv.storage_class>) return } }", mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @missing_entry_point_abi( %arg0 : f32 {spirv.interface_var_abi = #spirv.interface_var_abi<(1, 2), StorageBuffer>}, %arg1 : memref<12xf32, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } }", mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @missing_entry_point_abi( %arg0 : f32, %arg1 : memref<12xf32, #spirv.storage_class> {spirv.interface_var_abi = #spirv.interface_var_abi<(3, 0)>}) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } }", mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes {gpu.container_module} { gpu.module @kernels { gpu.func @barrier(%arg0 : f32, %arg1 : memref<12xf32, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.barrier gpu.return } } func.func @main() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref<12xf32, #spirv.storage_class>) %cst = arith.constant 1 : index gpu.launch_func @kernels::@barrier blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref<12xf32, #spirv.storage_class>) return } }", mlir-opt -allow-unregistered-dialect -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "gpu.module @kernels { gpu.func @foo() kernel { gpu.return } }", mlir-opt -test-spirv-entry-point-abi ,1 "gpu.module @kernels { gpu.func @foo() kernel { gpu.return } }"," mlir-opt -test-spirv-entry-point-abi=""workgroup-size=32"" ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @basic_module_structure(%arg0 : f32, %arg1 : memref<12xf32, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } func.func @main() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref<12xf32, #spirv.storage_class>) %cst = arith.constant 1 : index gpu.launch_func @kernels::@basic_module_structure blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref<12xf32, #spirv.storage_class>) return } }"," mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv=""use-64bit-index=true"" -verify-diagnostics -split-input-file -o - ",1 "module attributes { gpu.container_module } { gpu.module @kernels attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.func @basic_module_structure(%arg0 : f32, %arg1 : memref<12xf32, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } func.func @main() { %0 = ""op""() : () -> (f32) %1 = ""op""() : () -> (memref<12xf32, #spirv.storage_class>) %cst = arith.constant 1 : index gpu.launch_func @kernels::@basic_module_structure blocks in (%cst, %cst, %cst) threads in (%cst, %cst, %cst) args(%0 : f32, %1 : memref<12xf32, #spirv.storage_class>) return } }"," mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv=""use-64bit-index=true"" -verify-diagnostics -split-input-file -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce add %arg uniform {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce add %arg {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce add %arg uniform {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce add %arg {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce add %arg uniform : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce add %arg : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce add %arg uniform : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce add %arg : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce mul %arg uniform {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce mul %arg {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce mul %arg uniform {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce mul %arg {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce mul %arg uniform : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce mul %arg : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce mul %arg uniform : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce mul %arg : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce min %arg uniform {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce min %arg {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce min %arg uniform {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce min %arg {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce min %arg uniform : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce min %arg : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce min %arg uniform : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce min %arg : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce max %arg uniform {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce max %arg {} : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce max %arg uniform {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.all_reduce max %arg {} : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce max %arg uniform : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : f32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce max %arg : (f32) -> (f32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce max %arg uniform : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @test(%arg : i32) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %reduced = gpu.subgroup_reduce max %arg : (i32) -> (i32) gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_load_op(%arg0 : memref<32x32xf16, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %arg0[%i, %j] {leadDimension = 32 : index} : memref<32x32xf16, #spirv.storage_class> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_load_op_transpose(%arg0 : memref<32x32xf16, #spirv.storage_class>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %arg0[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xf16, #spirv.storage_class> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_store_op(%arg0 : memref<32x32xf16, #spirv.storage_class>, %arg1 : !gpu.mma_matrix<16x16xf16, ""COp"">) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %i = arith.constant 16 : index %j = arith.constant 16 : index gpu.subgroup_mma_store_matrix %arg1, %arg0[%i,%j] {leadDimension= 32 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x32xf16, #spirv.storage_class> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_store_op_transpose(%arg0 : memref<32x32xf16, #spirv.storage_class>, %arg1 : !gpu.mma_matrix<16x16xf16, ""COp"">) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %i = arith.constant 16 : index %j = arith.constant 16 : index gpu.subgroup_mma_store_matrix %arg1, %arg0[%i,%j] {leadDimension= 32 : index, transpose} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x32xf16, #spirv.storage_class> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_mma_op(%A : !gpu.mma_matrix<16x16xf16, ""AOp"">, %B : !gpu.mma_matrix<16x16xf16, ""BOp"">, %C : !gpu.mma_matrix<16x16xf16, ""COp"">) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %D = gpu.subgroup_mma_compute %A, %B, %C : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_constant_op() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %cst = arith.constant 1.0 : f16 %C = gpu.subgroup_mma_constant_matrix %cst : !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_elementwise_op_default(%A : !gpu.mma_matrix<16x16xf16, ""COp"">, %B : !gpu.mma_matrix<16x16xf16, ""COp"">) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %C = gpu.subgroup_mma_elementwise addf %A, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> %D = gpu.subgroup_mma_elementwise negatef %C : (!gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> %E = gpu.subgroup_mma_elementwise divf %D, %A : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_elementwise_op_matrix_times_scalar(%A : !gpu.mma_matrix<16x16xf16, ""COp"">, %scalar : f16) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %B = gpu.subgroup_mma_constant_matrix %scalar : !gpu.mma_matrix<16x16xf16, ""COp""> %C = gpu.subgroup_mma_elementwise mulf %A, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> %D = gpu.subgroup_mma_elementwise mulf %B, %A : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>>} { gpu.module @kernels { gpu.func @gpu_wmma_elementwise_op_matrix_plus_scalar(%A : !gpu.mma_matrix<16x16xf16, ""COp"">, %scalar : f16) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %B = gpu.subgroup_mma_constant_matrix %scalar : !gpu.mma_matrix<16x16xf16, ""COp""> %C = gpu.subgroup_mma_elementwise addf %A, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> gpu.return } } }", mlir-opt -allow-unregistered-dialect -convert-gpu-to-spirv -split-input-file -verify-diagnostics ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits> } { gpu.module @kernels { gpu.func @shuffle_xor() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %mask = arith.constant 8 : i32 %width = arith.constant 16 : i32 %val = arith.constant 42.0 : f32 %result, %valid = gpu.shuffle xor %val, %mask, %width : f32 gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits> } { gpu.module @kernels { gpu.func @shuffle_xor() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %mask = arith.constant 8 : i32 %width = arith.constant 16 : i32 %val = arith.constant 42.0 : f32 %result, %valid = gpu.shuffle xor %val, %mask, %width : f32 gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits> } { gpu.module @kernels { gpu.func @shuffle_idx() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %mask = arith.constant 8 : i32 %width = arith.constant 16 : i32 %val = arith.constant 42.0 : f32 %result, %valid = gpu.shuffle idx %val, %mask, %width : f32 gpu.return } } }", mlir-opt -split-input-file -convert-gpu-to-spirv -verify-diagnostics -o - ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @builtin() { %c0 = arith.constant 1 : index gpu.launch_func @kernels::@builtin_workgroup_id_x blocks in (%c0, %c0, %c0) threads in (%c0, %c0, %c0) return } gpu.module @kernels { gpu.func @builtin_workgroup_id_x() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_subgroup_size() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.subgroup_size : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=false"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { gpu.module @kernels { gpu.func @builtin_subgroup_size() kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.subgroup_size : index gpu.return } } }"," mlir-opt -split-input-file -convert-gpu-to-spirv=""use-64bit-index=true"" -o - ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @load_store(%arg0: memref<12x4xf32, #spirv.storage_class>, %arg1: memref<12x4xf32, #spirv.storage_class>, %arg2: memref<12x4xf32, #spirv.storage_class>) { %c0 = arith.constant 0 : index %c12 = arith.constant 12 : index %0 = arith.subi %c12, %c0 : index %c1 = arith.constant 1 : index %c0_0 = arith.constant 0 : index %c4 = arith.constant 4 : index %1 = arith.subi %c4, %c0_0 : index %c1_1 = arith.constant 1 : index %c1_2 = arith.constant 1 : index gpu.launch_func @kernels::@load_store_kernel blocks in (%0, %c1_2, %c1_2) threads in (%1, %c1_2, %c1_2) args(%arg0 : memref<12x4xf32, #spirv.storage_class>, %arg1 : memref<12x4xf32, #spirv.storage_class>, %arg2 : memref<12x4xf32, #spirv.storage_class>, %c0 : index, %c0_0 : index, %c1 : index, %c1_1 : index) return } gpu.module @kernels { gpu.func @load_store_kernel(%arg0: memref<12x4xf32, #spirv.storage_class>, %arg1: memref<12x4xf32, #spirv.storage_class>, %arg2: memref<12x4xf32, #spirv.storage_class>, %arg3: index, %arg4: index, %arg5: index, %arg6: index) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { %0 = gpu.block_id x %1 = gpu.block_id y %2 = gpu.block_id z %3 = gpu.thread_id x %4 = gpu.thread_id y %5 = gpu.thread_id z %6 = gpu.grid_dim x %7 = gpu.grid_dim y %8 = gpu.grid_dim z %9 = gpu.block_dim x %10 = gpu.block_dim y %11 = gpu.block_dim z %12 = arith.addi %arg3, %0 : index %13 = arith.addi %arg4, %3 : index %14 = memref.load %arg0[%12, %13] : memref<12x4xf32, #spirv.storage_class> %15 = memref.load %arg1[%12, %13] : memref<12x4xf32, #spirv.storage_class> %16 = arith.addf %14, %15 : f32 memref.store %16, %arg2[%12, %13] : memref<12x4xf32, #spirv.storage_class> gpu.return } } }", mlir-opt -convert-gpu-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @loop_kernel(%arg2 : memref<10xf32, #spirv.storage_class>, %arg3 : memref<10xf32, #spirv.storage_class>) { %lb = arith.constant 4 : index %ub = arith.constant 42 : index %step = arith.constant 2 : index scf.for %arg4 = %lb to %ub step %step { %1 = memref.load %arg2[%arg4] : memref<10xf32, #spirv.storage_class> memref.store %1, %arg3[%arg4] : memref<10xf32, #spirv.storage_class> } return } func.func @loop_yield(%arg2 : memref<10xf32, #spirv.storage_class>, %arg3 : memref<10xf32, #spirv.storage_class>) { %lb = arith.constant 4 : index %ub = arith.constant 42 : index %step = arith.constant 2 : index %s0 = arith.constant 0.0 : f32 %s1 = arith.constant 1.0 : f32 %result:2 = scf.for %i0 = %lb to %ub step %step iter_args(%si = %s0, %sj = %s1) -> (f32, f32) { %sn = arith.addf %si, %si : f32 scf.yield %sn, %sn : f32, f32 } memref.store %result#0, %arg3[%lb] : memref<10xf32, #spirv.storage_class> memref.store %result#1, %arg3[%ub] : memref<10xf32, #spirv.storage_class> return } } ", mlir-opt -convert-scf-to-spirv -o - ,1 "func.func @func(%arg0: i64) { %0 = arith.index_cast %arg0 : i64 to index %alloc = memref.alloc() : memref<16xf32> scf.parallel (%arg1) = (%0) to (%0) step (%0) { %cst = arith.constant 1.000000e+00 : f32 memref.store %cst, %alloc[%arg1] : memref<16xf32> scf.yield } return }", mlir-opt -convert-scf-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @kernel_simple_selection(%arg2 : memref<10xf32, #spirv.storage_class>, %arg3 : i1) { %value = arith.constant 0.0 : f32 %i = arith.constant 0 : index scf.if %arg3 { memref.store %value, %arg2[%i] : memref<10xf32, #spirv.storage_class> } return } func.func @kernel_nested_selection(%arg3 : memref<10xf32, #spirv.storage_class>, %arg4 : memref<10xf32, #spirv.storage_class>, %arg5 : i1, %arg6 : i1) { %i = arith.constant 0 : index %j = arith.constant 9 : index scf.if %arg5 { scf.if %arg6 { %value = memref.load %arg3[%i] : memref<10xf32, #spirv.storage_class> memref.store %value, %arg4[%i] : memref<10xf32, #spirv.storage_class> } else { %value = memref.load %arg4[%i] : memref<10xf32, #spirv.storage_class> memref.store %value, %arg3[%i] : memref<10xf32, #spirv.storage_class> } } else { scf.if %arg6 { %value = memref.load %arg3[%j] : memref<10xf32, #spirv.storage_class> memref.store %value, %arg4[%j] : memref<10xf32, #spirv.storage_class> } else { %value = memref.load %arg4[%j] : memref<10xf32, #spirv.storage_class> memref.store %value, %arg3[%j] : memref<10xf32, #spirv.storage_class> } } return } func.func @simple_if_yield(%arg2 : memref<10xf32, #spirv.storage_class>, %arg3 : i1) { %0:2 = scf.if %arg3 -> (f32, f32) { %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1.0 : f32 scf.yield %c0, %c1 : f32, f32 } else { %c0 = arith.constant 2.0 : f32 %c1 = arith.constant 3.0 : f32 scf.yield %c1, %c0 : f32, f32 } %i = arith.constant 0 : index %j = arith.constant 1 : index memref.store %0#0, %arg2[%i] : memref<10xf32, #spirv.storage_class> memref.store %0#1, %arg2[%j] : memref<10xf32, #spirv.storage_class> return } func.func @simple_if_yield_type_change(%arg2 : memref<10xf32, #spirv.storage_class>, %arg3 : memref<10xf32, #spirv.storage_class>, %arg4 : i1) { %i = arith.constant 0 : index %value = arith.constant 0.0 : f32 %0 = scf.if %arg4 -> (memref<10xf32, #spirv.storage_class>) { scf.yield %arg2 : memref<10xf32, #spirv.storage_class> } else { scf.yield %arg3 : memref<10xf32, #spirv.storage_class> } memref.store %value, %0[%i] : memref<10xf32, #spirv.storage_class> return } func.func @unsupported_yield_type(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %c : i1) { %r = scf.if %c -> (memref<8xi32>) { scf.yield %arg0 : memref<8xi32> } else { scf.yield %arg1 : memref<8xi32> } return } } ", mlir-opt -convert-scf-to-spirv -o - ,1 "module attributes { spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits<>> } { func.func @while_loop1(%arg0: i32, %arg1: i32) -> i32 { %c2_i32 = arith.constant 2 : i32 %0 = scf.while (%arg3 = %arg0) : (i32) -> (i32) { %1 = arith.cmpi slt, %arg3, %arg1 : i32 scf.condition(%1) %arg3 : i32 } do { ^bb0(%arg5: i32): %1 = arith.muli %arg5, %c2_i32 : i32 scf.yield %1 : i32 } return %0 : i32 }", mlir-opt -allow-unregistered-dialect -convert-scf-to-spirv -o - ,1 "func.func @while_loop2(%arg0: f32) -> i64 { %res = scf.while (%arg1 = %arg0) : (f32) -> i64 { %shared = ""foo.shared_compute""(%arg1) : (f32) -> i64 %condition = ""foo.evaluate_condition""(%arg1, %shared) : (f32, i64) -> i1 scf.condition(%condition) %shared : i64 } do { ^bb0(%arg2: i64): %res = ""foo.payload""(%arg2) : (i64) -> f32 scf.yield %res : f32 } return %res : i64 } } ", mlir-opt -allow-unregistered-dialect -convert-scf-to-spirv -o - ,1 "spirv.func @bitcount_scalar(%arg0: i16) ""None"" { %0 = spirv.BitCount %arg0: i16 spirv.Return } spirv.func @bitcount_vector(%arg0: vector<3xi32>) ""None"" { %0 = spirv.BitCount %arg0: vector<3xi32> spirv.Return } spirv.func @bitreverse_scalar(%arg0: i64) ""None"" { %0 = spirv.BitReverse %arg0: i64 spirv.Return } spirv.func @bitreverse_vector(%arg0: vector<4xi32>) ""None"" { %0 = spirv.BitReverse %arg0: vector<4xi32> spirv.Return } spirv.func @bitfield_insert_scalar_same_bit_width(%base: i32, %insert: i32, %offset: i32, %count: i32) ""None"" { %0 = spirv.BitFieldInsert %base, %insert, %offset, %count : i32, i32, i32 spirv.Return } spirv.func @bitfield_insert_scalar_smaller_bit_width(%base: i64, %insert: i64, %offset: i8, %count: i8) ""None"" { %0 = spirv.BitFieldInsert %base, %insert, %offset, %count : i64, i8, i8 spirv.Return } spirv.func @bitfield_insert_scalar_greater_bit_width(%base: i16, %insert: i16, %offset: i32, %count: i64) ""None"" { %0 = spirv.BitFieldInsert %base, %insert, %offset, %count : i16, i32, i64 spirv.Return } spirv.func @bitfield_insert_vector(%base: vector<2xi32>, %insert: vector<2xi32>, %offset: i32, %count: i32) ""None"" { %0 = spirv.BitFieldInsert %base, %insert, %offset, %count : vector<2xi32>, i32, i32 spirv.Return } spirv.func @bitfield_sextract_scalar_same_bit_width(%base: i64, %offset: i64, %count: i64) ""None"" { %0 = spirv.BitFieldSExtract %base, %offset, %count : i64, i64, i64 spirv.Return } spirv.func @bitfield_sextract_scalar_smaller_bit_width(%base: i32, %offset: i8, %count: i8) ""None"" { %0 = spirv.BitFieldSExtract %base, %offset, %count : i32, i8, i8 spirv.Return } spirv.func @bitfield_sextract_scalar_greater_bit_width(%base: i32, %offset: i64, %count: i64) ""None"" { %0 = spirv.BitFieldSExtract %base, %offset, %count : i32, i64, i64 spirv.Return } spirv.func @bitfield_sextract_vector(%base: vector<2xi32>, %offset: i32, %count: i32) ""None"" { %0 = spirv.BitFieldSExtract %base, %offset, %count : vector<2xi32>, i32, i32 spirv.Return } spirv.func @bitfield_uextract_scalar_same_bit_width(%base: i32, %offset: i32, %count: i32) ""None"" { %0 = spirv.BitFieldUExtract %base, %offset, %count : i32, i32, i32 spirv.Return } spirv.func @bitfield_uextract_scalar_smaller_bit_width(%base: i32, %offset: i16, %count: i8) ""None"" { %0 = spirv.BitFieldUExtract %base, %offset, %count : i32, i16, i8 spirv.Return } spirv.func @bitfield_uextract_scalar_greater_bit_width(%base: i8, %offset: i16, %count: i8) ""None"" { %0 = spirv.BitFieldUExtract %base, %offset, %count : i8, i16, i8 spirv.Return } spirv.func @bitfield_uextract_vector(%base: vector<2xi32>, %offset: i32, %count: i32) ""None"" { %0 = spirv.BitFieldUExtract %base, %offset, %count : vector<2xi32>, i32, i32 spirv.Return } spirv.func @bitwise_and_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.BitwiseAnd %arg0, %arg1 : i32 spirv.Return } spirv.func @bitwise_and_vector(%arg0: vector<4xi64>, %arg1: vector<4xi64>) ""None"" { %0 = spirv.BitwiseAnd %arg0, %arg1 : vector<4xi64> spirv.Return } spirv.func @bitwise_or_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.BitwiseOr %arg0, %arg1 : i64 spirv.Return } spirv.func @bitwise_or_vector(%arg0: vector<3xi8>, %arg1: vector<3xi8>) ""None"" { %0 = spirv.BitwiseOr %arg0, %arg1 : vector<3xi8> spirv.Return } spirv.func @bitwise_xor_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.BitwiseXor %arg0, %arg1 : i32 spirv.Return } spirv.func @bitwise_xor_vector(%arg0: vector<2xi16>, %arg1: vector<2xi16>) ""None"" { %0 = spirv.BitwiseXor %arg0, %arg1 : vector<2xi16> spirv.Return } spirv.func @not_scalar(%arg0: i32) ""None"" { %0 = spirv.Not %arg0 : i32 spirv.Return } spirv.func @not_vector(%arg0: vector<2xi16>) ""None"" { %0 = spirv.Not %arg0 : vector<2xi16> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @i_equal_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.IEqual %arg0, %arg1 : i32 spirv.Return } spirv.func @i_equal_vector(%arg0: vector<4xi64>, %arg1: vector<4xi64>) ""None"" { %0 = spirv.IEqual %arg0, %arg1 : vector<4xi64> spirv.Return } spirv.func @i_not_equal_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.INotEqual %arg0, %arg1 : i64 spirv.Return } spirv.func @i_not_equal_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.INotEqual %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @s_greater_than_equal_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.SGreaterThanEqual %arg0, %arg1 : i64 spirv.Return } spirv.func @s_greater_than_equal_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.SGreaterThanEqual %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @s_greater_than_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.SGreaterThan %arg0, %arg1 : i64 spirv.Return } spirv.func @s_greater_than_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.SGreaterThan %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @s_less_than_equal_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.SLessThanEqual %arg0, %arg1 : i64 spirv.Return } spirv.func @s_less_than_equal_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.SLessThanEqual %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @s_less_than_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.SLessThan %arg0, %arg1 : i64 spirv.Return } spirv.func @s_less_than_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.SLessThan %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @u_greater_than_equal_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.UGreaterThanEqual %arg0, %arg1 : i64 spirv.Return } spirv.func @u_greater_than_equal_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.UGreaterThanEqual %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @u_greater_than_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.UGreaterThan %arg0, %arg1 : i64 spirv.Return } spirv.func @u_greater_than_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.UGreaterThan %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @u_less_than_equal_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.ULessThanEqual %arg0, %arg1 : i64 spirv.Return } spirv.func @u_less_than_equal_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.ULessThanEqual %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @u_less_than_scalar(%arg0: i64, %arg1: i64) ""None"" { %0 = spirv.ULessThan %arg0, %arg1 : i64 spirv.Return } spirv.func @u_less_than_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.ULessThan %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @f_ord_equal_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FOrdEqual %arg0, %arg1 : f32 spirv.Return } spirv.func @f_ord_equal_vector(%arg0: vector<4xf64>, %arg1: vector<4xf64>) ""None"" { %0 = spirv.FOrdEqual %arg0, %arg1 : vector<4xf64> spirv.Return } spirv.func @f_ord_greater_than_equal_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FOrdGreaterThanEqual %arg0, %arg1 : f64 spirv.Return } spirv.func @f_ord_greater_than_equal_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FOrdGreaterThanEqual %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_ord_greater_than_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FOrdGreaterThan %arg0, %arg1 : f64 spirv.Return } spirv.func @f_ord_greater_than_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FOrdGreaterThan %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_ord_less_than_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FOrdLessThan %arg0, %arg1 : f64 spirv.Return } spirv.func @f_ord_less_than_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FOrdLessThan %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_ord_less_than_equal_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FOrdLessThanEqual %arg0, %arg1 : f64 spirv.Return } spirv.func @f_ord_less_than_equal_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FOrdLessThanEqual %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_ord_not_equal_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FOrdNotEqual %arg0, %arg1 : f32 spirv.Return } spirv.func @f_ord_not_equal_vector(%arg0: vector<4xf64>, %arg1: vector<4xf64>) ""None"" { %0 = spirv.FOrdNotEqual %arg0, %arg1 : vector<4xf64> spirv.Return } spirv.func @f_unord_equal_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FUnordEqual %arg0, %arg1 : f32 spirv.Return } spirv.func @f_unord_equal_vector(%arg0: vector<4xf64>, %arg1: vector<4xf64>) ""None"" { %0 = spirv.FUnordEqual %arg0, %arg1 : vector<4xf64> spirv.Return } spirv.func @f_unord_greater_than_equal_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FUnordGreaterThanEqual %arg0, %arg1 : f64 spirv.Return } spirv.func @f_unord_greater_than_equal_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FUnordGreaterThanEqual %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_unord_greater_than_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FUnordGreaterThan %arg0, %arg1 : f64 spirv.Return } spirv.func @f_unord_greater_than_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FUnordGreaterThan %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_unord_less_than_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FUnordLessThan %arg0, %arg1 : f64 spirv.Return } spirv.func @f_unord_less_than_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FUnordLessThan %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_unord_less_than_equal_scalar(%arg0: f64, %arg1: f64) ""None"" { %0 = spirv.FUnordLessThanEqual %arg0, %arg1 : f64 spirv.Return } spirv.func @f_unord_less_than_equal_vector(%arg0: vector<2xf64>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FUnordLessThanEqual %arg0, %arg1 : vector<2xf64> spirv.Return } spirv.func @f_unord_not_equal_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FUnordNotEqual %arg0, %arg1 : f32 spirv.Return } spirv.func @f_unord_not_equal_vector(%arg0: vector<4xf64>, %arg1: vector<4xf64>) ""None"" { %0 = spirv.FUnordNotEqual %arg0, %arg1 : vector<4xf64> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @access_chain() ""None"" { %0 = spirv.Constant 1: i32 %1 = spirv.Variable : !spirv.ptr)>, Function> %2 = spirv.AccessChain %1[%0, %0] : !spirv.ptr)>, Function>, i32, i32 spirv.Return } spirv.func @access_chain_array(%arg0 : i32) ""None"" { %0 = spirv.Variable : !spirv.ptr>, Function> %1 = spirv.AccessChain %0[%arg0] : !spirv.ptr>, Function>, i32 %2 = spirv.Load ""Function"" %1 [""Volatile""] : !spirv.array<4xf32> spirv.Return } spirv.module Logical GLSL450 { spirv.GlobalVariable @var : !spirv.ptr } spirv.module Logical GLSL450 { spirv.GlobalVariable @struct : !spirv.ptr)>, Private> spirv.func @func() ""None"" { %0 = spirv.mlir.addressof @struct : !spirv.ptr)>, Private> spirv.Return } } spirv.module Logical GLSL450 { spirv.GlobalVariable @bar bind(0, 0) : !spirv.ptr spirv.func @foo() ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr spirv.Return } } spirv.module @name Logical GLSL450 { spirv.GlobalVariable @bar bind(0, 0) : !spirv.ptr spirv.func @foo() ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr spirv.Return } } spirv.module Logical GLSL450 { spirv.GlobalVariable @bar {location = 1 : i32} : !spirv.ptr spirv.func @foo() ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr spirv.Return } } spirv.module Logical GLSL450 { spirv.GlobalVariable @bar {descriptor_set = 0 : i32, location = 3 : i32} : !spirv.ptr spirv.func @foo() ""None"" { %0 = spirv.mlir.addressof @bar : !spirv.ptr spirv.Return } } spirv.func @load() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 : f32 spirv.Return } spirv.func @load_none() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""None""] : f32 spirv.Return } spirv.func @load_with_alignment() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Aligned"", 4] : f32 spirv.Return } spirv.func @load_volatile() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Volatile""] : f32 spirv.Return } spirv.func @load_nontemporal() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Load ""Function"" %0 [""Nontemporal""] : f32 spirv.Return } spirv.func @store(%arg0 : f32) ""None"" { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 : f32 spirv.Return } spirv.func @store_composite(%arg0 : !spirv.struct<(f64)>) ""None"" { %0 = spirv.Variable : !spirv.ptr, Function> spirv.Store ""Function"" %0, %arg0 : !spirv.struct<(f64)> spirv.Return } spirv.func @store_with_alignment(%arg0 : f32) ""None"" { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Aligned"", 4] : f32 spirv.Return } spirv.func @store_volatile(%arg0 : f32) ""None"" { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Volatile""] : f32 spirv.Return } spirv.func @store_nontemporal(%arg0 : f32) ""None"" { %0 = spirv.Variable : !spirv.ptr spirv.Store ""Function"" %0, %arg0 [""Nontemporal""] : f32 spirv.Return } spirv.func @variable_scalar() ""None"" { %0 = spirv.Variable : !spirv.ptr %1 = spirv.Variable : !spirv.ptr spirv.Return } spirv.func @variable_scalar_with_initialization() ""None"" { %c = spirv.Constant 0 : i64 %0 = spirv.Variable init(%c) : !spirv.ptr spirv.Return } spirv.func @variable_vector() ""None"" { %0 = spirv.Variable : !spirv.ptr, Function> spirv.Return } spirv.func @variable_vector_with_initialization() ""None"" { %c = spirv.Constant dense : vector<3xi1> %0 = spirv.Variable init(%c) : !spirv.ptr, Function> spirv.Return } spirv.func @variable_array() ""None"" { %0 = spirv.Variable : !spirv.ptr, Function> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @bitcast_float_to_integer_scalar(%arg0 : f32) ""None"" { %0 = spirv.Bitcast %arg0: f32 to i32 spirv.Return } spirv.func @bitcast_float_to_integer_vector(%arg0 : vector<3xf32>) ""None"" { %0 = spirv.Bitcast %arg0: vector<3xf32> to vector<3xi32> spirv.Return } spirv.func @bitcast_vector_to_scalar(%arg0 : vector<2xf32>) ""None"" { %0 = spirv.Bitcast %arg0: vector<2xf32> to i64 spirv.Return } spirv.func @bitcast_scalar_to_vector(%arg0 : f64) ""None"" { %0 = spirv.Bitcast %arg0: f64 to vector<2xi32> spirv.Return } spirv.func @bitcast_vector_to_vector(%arg0 : vector<4xf32>) ""None"" { %0 = spirv.Bitcast %arg0: vector<4xf32> to vector<2xi64> spirv.Return } spirv.func @bitcast_pointer(%arg0: !spirv.ptr) ""None"" { %0 = spirv.Bitcast %arg0 : !spirv.ptr to !spirv.ptr spirv.Return } spirv.func @convert_float_to_signed_scalar(%arg0: f32) ""None"" { %0 = spirv.ConvertFToS %arg0: f32 to i32 spirv.Return } spirv.func @convert_float_to_signed_vector(%arg0: vector<2xf32>) ""None"" { %0 = spirv.ConvertFToS %arg0: vector<2xf32> to vector<2xi32> spirv.Return } spirv.func @convert_float_to_unsigned_scalar(%arg0: f32) ""None"" { %0 = spirv.ConvertFToU %arg0: f32 to i32 spirv.Return } spirv.func @convert_float_to_unsigned_vector(%arg0: vector<2xf32>) ""None"" { %0 = spirv.ConvertFToU %arg0: vector<2xf32> to vector<2xi32> spirv.Return } spirv.func @convert_signed_to_float_scalar(%arg0: i32) ""None"" { %0 = spirv.ConvertSToF %arg0: i32 to f32 spirv.Return } spirv.func @convert_signed_to_float_vector(%arg0: vector<3xi32>) ""None"" { %0 = spirv.ConvertSToF %arg0: vector<3xi32> to vector<3xf32> spirv.Return } spirv.func @convert_unsigned_to_float_scalar(%arg0: i32) ""None"" { %0 = spirv.ConvertUToF %arg0: i32 to f32 spirv.Return } spirv.func @convert_unsigned_to_float_vector(%arg0: vector<3xi32>) ""None"" { %0 = spirv.ConvertUToF %arg0: vector<3xi32> to vector<3xf32> spirv.Return } spirv.func @fconvert_scalar(%arg0: f32, %arg1: f64) ""None"" { %0 = spirv.FConvert %arg0: f32 to f64 %1 = spirv.FConvert %arg1: f64 to f32 spirv.Return } spirv.func @fconvert_vector(%arg0: vector<2xf32>, %arg1: vector<2xf64>) ""None"" { %0 = spirv.FConvert %arg0: vector<2xf32> to vector<2xf64> %1 = spirv.FConvert %arg1: vector<2xf64> to vector<2xf32> spirv.Return } spirv.func @sconvert_scalar(%arg0: i32, %arg1: i64) ""None"" { %0 = spirv.SConvert %arg0: i32 to i64 %1 = spirv.SConvert %arg1: i64 to i32 spirv.Return } spirv.func @sconvert_vector(%arg0: vector<3xi32>, %arg1: vector<3xi64>) ""None"" { %0 = spirv.SConvert %arg0: vector<3xi32> to vector<3xi64> %1 = spirv.SConvert %arg1: vector<3xi64> to vector<3xi32> spirv.Return } spirv.func @uconvert_scalar(%arg0: i32, %arg1: i64) ""None"" { %0 = spirv.UConvert %arg0: i32 to i64 %1 = spirv.UConvert %arg1: i64 to i32 spirv.Return } spirv.func @uconvert_vector(%arg0: vector<3xi32>, %arg1: vector<3xi64>) ""None"" { %0 = spirv.UConvert %arg0: vector<3xi32> to vector<3xi64> %1 = spirv.UConvert %arg1: vector<3xi64> to vector<3xi32> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @logical_equal_scalar(%arg0: i1, %arg1: i1) ""None"" { %0 = spirv.LogicalEqual %arg0, %arg0 : i1 spirv.Return } spirv.func @logical_equal_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) ""None"" { %0 = spirv.LogicalEqual %arg0, %arg0 : vector<4xi1> spirv.Return } spirv.func @logical_not_equal_scalar(%arg0: i1, %arg1: i1) ""None"" { %0 = spirv.LogicalNotEqual %arg0, %arg0 : i1 spirv.Return } spirv.func @logical_not_equal_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) ""None"" { %0 = spirv.LogicalNotEqual %arg0, %arg0 : vector<4xi1> spirv.Return } spirv.func @logical_not_scalar(%arg0: i1) ""None"" { %0 = spirv.LogicalNot %arg0 : i1 spirv.Return } spirv.func @logical_not_vector(%arg0: vector<4xi1>) ""None"" { %0 = spirv.LogicalNot %arg0 : vector<4xi1> spirv.Return } spirv.func @logical_and_scalar(%arg0: i1, %arg1: i1) ""None"" { %0 = spirv.LogicalAnd %arg0, %arg0 : i1 spirv.Return } spirv.func @logical_and_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) ""None"" { %0 = spirv.LogicalAnd %arg0, %arg0 : vector<4xi1> spirv.Return } spirv.func @logical_or_scalar(%arg0: i1, %arg1: i1) ""None"" { %0 = spirv.LogicalOr %arg0, %arg0 : i1 spirv.Return } spirv.func @logical_or_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) ""None"" { %0 = spirv.LogicalOr %arg0, %arg0 : vector<4xi1> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @shift_right_arithmetic_scalar(%arg0: i32, %arg1: si32, %arg2 : i16, %arg3 : ui16) ""None"" { %0 = spirv.ShiftRightArithmetic %arg0, %arg0 : i32, i32 %1 = spirv.ShiftRightArithmetic %arg0, %arg1 : i32, si32 %2 = spirv.ShiftRightArithmetic %arg0, %arg2 : i32, i16 %3 = spirv.ShiftRightArithmetic %arg0, %arg3 : i32, ui16 spirv.Return } spirv.func @shift_right_arithmetic_vector(%arg0: vector<4xi64>, %arg1: vector<4xui64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) ""None"" { %0 = spirv.ShiftRightArithmetic %arg0, %arg0 : vector<4xi64>, vector<4xi64> %1 = spirv.ShiftRightArithmetic %arg0, %arg1 : vector<4xi64>, vector<4xui64> %2 = spirv.ShiftRightArithmetic %arg0, %arg2 : vector<4xi64>, vector<4xi32> %3 = spirv.ShiftRightArithmetic %arg0, %arg3 : vector<4xi64>, vector<4xui32> spirv.Return } spirv.func @shift_right_logical_scalar(%arg0: i32, %arg1: si32, %arg2 : si16, %arg3 : ui16) ""None"" { %0 = spirv.ShiftRightLogical %arg0, %arg0 : i32, i32 %1 = spirv.ShiftRightLogical %arg0, %arg1 : i32, si32 %2 = spirv.ShiftRightLogical %arg0, %arg2 : i32, si16 %3 = spirv.ShiftRightLogical %arg0, %arg3 : i32, ui16 spirv.Return } spirv.func @shift_right_logical_vector(%arg0: vector<4xi64>, %arg1: vector<4xsi64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) ""None"" { %0 = spirv.ShiftRightLogical %arg0, %arg0 : vector<4xi64>, vector<4xi64> %1 = spirv.ShiftRightLogical %arg0, %arg1 : vector<4xi64>, vector<4xsi64> %2 = spirv.ShiftRightLogical %arg0, %arg2 : vector<4xi64>, vector<4xi32> %3 = spirv.ShiftRightLogical %arg0, %arg3 : vector<4xi64>, vector<4xui32> spirv.Return } spirv.func @shift_left_logical_scalar(%arg0: i32, %arg1: si32, %arg2 : i16, %arg3 : ui16) ""None"" { %0 = spirv.ShiftLeftLogical %arg0, %arg0 : i32, i32 %1 = spirv.ShiftLeftLogical %arg0, %arg1 : i32, si32 %2 = spirv.ShiftLeftLogical %arg0, %arg2 : i32, i16 %3 = spirv.ShiftLeftLogical %arg0, %arg3 : i32, ui16 spirv.Return } spirv.func @shift_left_logical_vector(%arg0: vector<4xi64>, %arg1: vector<4xsi64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) ""None"" { %0 = spirv.ShiftLeftLogical %arg0, %arg0 : vector<4xi64>, vector<4xi64> %1 = spirv.ShiftLeftLogical %arg0, %arg1 : vector<4xi64>, vector<4xsi64> %2 = spirv.ShiftLeftLogical %arg0, %arg2 : vector<4xi64>, vector<4xi32> %3 = spirv.ShiftLeftLogical %arg0, %arg3 : vector<4xi64>, vector<4xui32> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @return() ""None"" { spirv.Return } spirv.func @return_value(%arg: i32) -> i32 ""None"" { spirv.ReturnValue %arg : i32 } spirv.func @none() ""None"" { spirv.Return } spirv.func @inline() ""Inline"" { spirv.Return } spirv.func @dont_inline() ""DontInline"" { spirv.Return } spirv.func @pure() ""Pure"" { spirv.Return } spirv.func @const() ""Const"" { spirv.Return } spirv.func @scalar_types(%arg0: i32, %arg1: i1, %arg2: f64, %arg3: f32) ""None"" { spirv.Return } spirv.func @vector_types(%arg0: vector<2xi64>, %arg1: vector<2xi64>) -> vector<2xi64> ""None"" { %0 = spirv.IAdd %arg0, %arg1 : vector<2xi64> spirv.ReturnValue %0 : vector<2xi64> } spirv.func @function_calls(%arg0: i32, %arg1: i1, %arg2: f64, %arg3: vector<2xi64>, %arg4: vector<2xf32>) ""None"" { spirv.FunctionCall @void_1() : () -> () spirv.FunctionCall @void_2(%arg3) : (vector<2xi64>) -> () %0 = spirv.FunctionCall @value_scalar(%arg0, %arg1, %arg2) : (i32, i1, f64) -> i32 %1 = spirv.FunctionCall @value_vector(%arg3, %arg4) : (vector<2xi64>, vector<2xf32>) -> vector<2xf32> spirv.Return } spirv.func @void_1() ""None"" { spirv.Return } spirv.func @void_2(%arg0: vector<2xi64>) ""None"" { spirv.Return } spirv.func @value_scalar(%arg0: i32, %arg1: i1, %arg2: f64) -> i32 ""None"" { spirv.ReturnValue %arg0: i32 } spirv.func @value_vector(%arg0: vector<2xi64>, %arg1: vector<2xf32>) -> vector<2xf32> ""None"" { spirv.ReturnValue %arg1: vector<2xf32> }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.module Logical GLSL450 {} spirv.module @foo Logical GLSL450 {} spirv.module Logical GLSL450 requires #spirv.vce {} spirv.module Logical GLSL450 { spirv.func @empty() -> () ""None"" { spirv.Return } }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @iadd_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.IAdd %arg0, %arg1 : i32 spirv.Return } spirv.func @iadd_vector(%arg0: vector<4xi64>, %arg1: vector<4xi64>) ""None"" { %0 = spirv.IAdd %arg0, %arg1 : vector<4xi64> spirv.Return } spirv.func @isub_scalar(%arg0: i8, %arg1: i8) ""None"" { %0 = spirv.ISub %arg0, %arg1 : i8 spirv.Return } spirv.func @isub_vector(%arg0: vector<2xi16>, %arg1: vector<2xi16>) ""None"" { %0 = spirv.ISub %arg0, %arg1 : vector<2xi16> spirv.Return } spirv.func @imul_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.IMul %arg0, %arg1 : i32 spirv.Return } spirv.func @imul_vector(%arg0: vector<3xi32>, %arg1: vector<3xi32>) ""None"" { %0 = spirv.IMul %arg0, %arg1 : vector<3xi32> spirv.Return } spirv.func @fadd_scalar(%arg0: f16, %arg1: f16) ""None"" { %0 = spirv.FAdd %arg0, %arg1 : f16 spirv.Return } spirv.func @fadd_vector(%arg0: vector<4xf32>, %arg1: vector<4xf32>) ""None"" { %0 = spirv.FAdd %arg0, %arg1 : vector<4xf32> spirv.Return } spirv.func @fsub_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FSub %arg0, %arg1 : f32 spirv.Return } spirv.func @fsub_vector(%arg0: vector<2xf32>, %arg1: vector<2xf32>) ""None"" { %0 = spirv.FSub %arg0, %arg1 : vector<2xf32> spirv.Return } spirv.func @fdiv_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FDiv %arg0, %arg1 : f32 spirv.Return } spirv.func @fdiv_vector(%arg0: vector<3xf64>, %arg1: vector<3xf64>) ""None"" { %0 = spirv.FDiv %arg0, %arg1 : vector<3xf64> spirv.Return } spirv.func @fmul_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FMul %arg0, %arg1 : f32 spirv.Return } spirv.func @fmul_vector(%arg0: vector<2xf32>, %arg1: vector<2xf32>) ""None"" { %0 = spirv.FMul %arg0, %arg1 : vector<2xf32> spirv.Return } spirv.func @frem_scalar(%arg0: f32, %arg1: f32) ""None"" { %0 = spirv.FRem %arg0, %arg1 : f32 spirv.Return } spirv.func @frem_vector(%arg0: vector<3xf64>, %arg1: vector<3xf64>) ""None"" { %0 = spirv.FRem %arg0, %arg1 : vector<3xf64> spirv.Return } spirv.func @fneg_scalar(%arg: f64) ""None"" { %0 = spirv.FNegate %arg : f64 spirv.Return } spirv.func @fneg_vector(%arg: vector<2xf32>) ""None"" { %0 = spirv.FNegate %arg : vector<2xf32> spirv.Return } spirv.func @udiv_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.UDiv %arg0, %arg1 : i32 spirv.Return } spirv.func @udiv_vector(%arg0: vector<3xi64>, %arg1: vector<3xi64>) ""None"" { %0 = spirv.UDiv %arg0, %arg1 : vector<3xi64> spirv.Return } spirv.func @umod_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.UMod %arg0, %arg1 : i32 spirv.Return } spirv.func @umod_vector(%arg0: vector<3xi64>, %arg1: vector<3xi64>) ""None"" { %0 = spirv.UMod %arg0, %arg1 : vector<3xi64> spirv.Return } spirv.func @sdiv_scalar(%arg0: i16, %arg1: i16) ""None"" { %0 = spirv.SDiv %arg0, %arg1 : i16 spirv.Return } spirv.func @sdiv_vector(%arg0: vector<2xi64>, %arg1: vector<2xi64>) ""None"" { %0 = spirv.SDiv %arg0, %arg1 : vector<2xi64> spirv.Return } spirv.func @srem_scalar(%arg0: i32, %arg1: i32) ""None"" { %0 = spirv.SRem %arg0, %arg1 : i32 spirv.Return } spirv.func @srem_vector(%arg0: vector<4xi32>, %arg1: vector<4xi32>) ""None"" { %0 = spirv.SRem %arg0, %arg1 : vector<4xi32> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @array(!spirv.array<16 x f32>, !spirv.array< 32 x vector<4xf32> >) ""None"" spirv.func @array_with_natural_stride(!spirv.array<16 x f32, stride=4>) ""None"" spirv.func @pointer_scalar(!spirv.ptr, !spirv.ptr) ""None"" spirv.func @pointer_vector(!spirv.ptr, Function>) ""None"" spirv.func @runtime_array_vector(!spirv.rtarray< vector<4xf32> >) ""None"" spirv.func @runtime_array_scalar(!spirv.rtarray) ""None"" spirv.func @struct(!spirv.struct<(f64)>) ""None"" spirv.func @struct_nested(!spirv.struct<(i32, !spirv.struct<(i64, i32)>)>) ""None"" spirv.func @struct_with_natural_offset(!spirv.struct<(i8[0], i32[4])>) ""None""", mlir-opt -split-input-file -convert-spirv-to-llvm='use-opaque-pointers=1' -verify-diagnostics ,1 "spirv.func @ceil(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Ceil %arg0 : f32 %1 = spirv.GL.Ceil %arg1 : vector<3xf16> spirv.Return } spirv.func @cos(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Cos %arg0 : f32 %1 = spirv.GL.Cos %arg1 : vector<3xf16> spirv.Return } spirv.func @exp(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Exp %arg0 : f32 %1 = spirv.GL.Exp %arg1 : vector<3xf16> spirv.Return } spirv.func @fabs(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.FAbs %arg0 : f32 %1 = spirv.GL.FAbs %arg1 : vector<3xf16> spirv.Return } spirv.func @floor(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Floor %arg0 : f32 %1 = spirv.GL.Floor %arg1 : vector<3xf16> spirv.Return } spirv.func @fmax(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.FMax %arg0, %arg0 : f32 %1 = spirv.GL.FMax %arg1, %arg1 : vector<3xf16> spirv.Return } spirv.func @fmin(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.FMin %arg0, %arg0 : f32 %1 = spirv.GL.FMin %arg1, %arg1 : vector<3xf16> spirv.Return } spirv.func @log(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Log %arg0 : f32 %1 = spirv.GL.Log %arg1 : vector<3xf16> spirv.Return } spirv.func @sin(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Sin %arg0 : f32 %1 = spirv.GL.Sin %arg1 : vector<3xf16> spirv.Return } spirv.func @smax(%arg0: i16, %arg1: vector<3xi32>) ""None"" { %0 = spirv.GL.SMax %arg0, %arg0 : i16 %1 = spirv.GL.SMax %arg1, %arg1 : vector<3xi32> spirv.Return } spirv.func @smin(%arg0: i16, %arg1: vector<3xi32>) ""None"" { %0 = spirv.GL.SMin %arg0, %arg0 : i16 %1 = spirv.GL.SMin %arg1, %arg1 : vector<3xi32> spirv.Return } spirv.func @sqrt(%arg0: f32, %arg1: vector<3xf16>) ""None"" { %0 = spirv.GL.Sqrt %arg0 : f32 %1 = spirv.GL.Sqrt %arg1 : vector<3xf16> spirv.Return } spirv.func @tan(%arg0: f32) ""None"" { %0 = spirv.GL.Tan %arg0 : f32 spirv.Return } spirv.func @tanh(%arg0: f32) ""None"" { %0 = spirv.GL.Tanh %arg0 : f32 spirv.Return } spirv.func @inverse_sqrt(%arg0: f32) ""None"" { %0 = spirv.GL.InverseSqrt %arg0 : f32 spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @composite_extract_array(%arg: !spirv.array<4x!spirv.array<4xf32>>) ""None"" { %0 = spirv.CompositeExtract %arg[1 : i32, 3 : i32] : !spirv.array<4x!spirv.array<4xf32>> spirv.Return } spirv.func @composite_extract_vector(%arg: vector<3xf32>) ""None"" { %0 = spirv.CompositeExtract %arg[0 : i32] : vector<3xf32> spirv.Return } spirv.func @composite_insert_struct(%arg0: i32, %arg1: !spirv.struct<(f32, !spirv.array<4xi32>)>) ""None"" { %0 = spirv.CompositeInsert %arg0, %arg1[1 : i32, 3 : i32] : i32 into !spirv.struct<(f32, !spirv.array<4xi32>)> spirv.Return } spirv.func @composite_insert_vector(%arg0: vector<3xf32>, %arg1: f32) ""None"" { %0 = spirv.CompositeInsert %arg1, %arg0[1 : i32] : f32 into vector<3xf32> spirv.Return } spirv.func @select_scalar(%arg0: i1, %arg1: vector<3xi32>, %arg2: f32) ""None"" { %0 = spirv.Select %arg0, %arg1, %arg1 : i1, vector<3xi32> %1 = spirv.Select %arg0, %arg2, %arg2 : i1, f32 spirv.Return } spirv.func @select_vector(%arg0: vector<2xi1>, %arg1: vector<2xi32>) ""None"" { %0 = spirv.Select %arg0, %arg1, %arg1 : vector<2xi1>, vector<2xi32> spirv.Return } spirv.func @vector_shuffle_same_size(%vector1: vector<2xf32>, %vector2: vector<2xf32>) -> vector<3xf32> ""None"" { %0 = spirv.VectorShuffle [0: i32, 2: i32, 0xffffffff: i32] %vector1: vector<2xf32>, %vector2: vector<2xf32> -> vector<3xf32> spirv.ReturnValue %0: vector<3xf32> } spirv.func @vector_shuffle_different_size(%vector1: vector<3xf32>, %vector2: vector<2xf32>) -> vector<3xf32> ""None"" { %0 = spirv.VectorShuffle [0: i32, 4: i32, 0xffffffff: i32] %vector1: vector<3xf32>, %vector2: vector<2xf32> -> vector<3xf32> spirv.ReturnValue %0: vector<3xf32> } spirv.module Logical OpenCL { spirv.func @empty() ""None"" { spirv.Return } spirv.EntryPoint ""Kernel"" @empty spirv.ExecutionMode @empty ""ContractionOff"" } spirv.module Logical OpenCL { spirv.func @bar() ""None"" { spirv.Return } spirv.EntryPoint ""Kernel"" @bar spirv.ExecutionMode @bar ""ContractionOff"" spirv.ExecutionMode @bar ""LocalSizeHint"", 32, 1, 1 } spirv.func @undef_scalar() ""None"" { %0 = spirv.Undef : f32 spirv.Return } spirv.func @undef_vector() ""None"" { %0 = spirv.Undef : vector<2xi32> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.func @pointer_scalar(!spirv.ptr, !spirv.ptr) ""None"" spirv.func @pointer_vector(!spirv.ptr, Function>) ""None"" spirv.func @bitcast_pointer(%arg0: !spirv.ptr) ""None"" { %0 = spirv.Bitcast %arg0 : !spirv.ptr to !spirv.ptr spirv.Return }", mlir-opt -split-input-file -convert-spirv-to-llvm='use-opaque-pointers=0' ,1 "module attributes {gpu.container_module, spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits>} { spirv.module @__spv__foo Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @bar_arg_0 bind(0, 0) : !spirv.ptr [0])>, StorageBuffer> spirv.func @bar() ""None"" attributes {workgroup_attributions = 0 : i64} { %0 = spirv.mlir.addressof @bar_arg_0 : !spirv.ptr [0])>, StorageBuffer> spirv.Return } spirv.EntryPoint ""GLCompute"" @bar spirv.ExecutionMode @bar ""LocalSize"", 1, 1, 1 } gpu.module @foo { gpu.func @bar(%arg0: memref<6xi32>) kernel attributes {spirv.entry_point_abi = #spirv.entry_point_abi} { gpu.return } } func.func @main() { %buffer = memref.alloc() : memref<6xi32> %one = arith.constant 1 : index gpu.launch_func @foo::@bar blocks in (%one, %one, %one) threads in (%one, %one, %one) args(%buffer : memref<6xi32>) return } }", mlir-opt --lower-host-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "module { spirv.module Logical GLSL450 attributes { sym_name = ""spirv.sym"" } { spirv.func @bar() ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @bar spirv.ExecutionMode @bar ""LocalSize"", 1, 1, 1 } }", mlir-opt --lower-host-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "module { spirv.module Logical GLSL450 { spirv.func @bar() ""None"" { spirv.Return } spirv.EntryPoint ""GLCompute"" @bar spirv.ExecutionMode @bar ""LocalSize"", 1, 1, 1 } }", mlir-opt --lower-host-to-llvm='use-opaque-pointers=1' -split-input-file ,1 "spirv.func @bool_constant_scalar() ""None"" { %0 = spirv.Constant true %1 = spirv.Constant false spirv.Return } spirv.func @bool_constant_vector() ""None"" { %0 = spirv.Constant dense<[true, false]> : vector<2xi1> %1 = spirv.Constant dense : vector<3xi1> spirv.Return } spirv.func @integer_constant_scalar() ""None"" { %0 = spirv.Constant 0 : i8 %1 = spirv.Constant -5 : si64 %2 = spirv.Constant 10 : ui16 spirv.Return } spirv.func @integer_constant_vector() ""None"" { %0 = spirv.Constant dense<[2, 3]> : vector<2xi32> %1 = spirv.Constant dense<-4> : vector<2xsi32> %2 = spirv.Constant dense<[2, 3, 4]> : vector<3xui32> spirv.Return } spirv.func @float_constant_scalar() ""None"" { %0 = spirv.Constant 5.000000e+00 : f16 %1 = spirv.Constant 5.000000e+00 : f64 spirv.Return } spirv.func @float_constant_vector() ""None"" { %0 = spirv.Constant dense<[2.000000e+00, 3.000000e+00]> : vector<2xf32> spirv.Return }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' ,1 "spirv.module Logical GLSL450 { spirv.func @branch_without_arguments() -> () ""None"" { spirv.Branch ^label ^label: spirv.Return } spirv.func @branch_with_arguments() -> () ""None"" { %0 = spirv.Constant 0 : i32 %1 = spirv.Constant true spirv.Branch ^label(%0, %1: i32, i1) ^label(%arg0: i32, %arg1: i1): spirv.Return } }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @cond_branch_without_arguments() -> () ""None"" { %cond = spirv.Constant true spirv.BranchConditional %cond, ^true, ^false ^true: spirv.Return ^false: spirv.Return } spirv.func @cond_branch_with_arguments_nested() -> () ""None"" { %cond = spirv.Constant true %0 = spirv.Constant 0 : i32 %false = spirv.Constant false spirv.BranchConditional %cond, ^outer_true(%0, %false: i32, i1), ^outer_false ^outer_true(%arg0: i32, %arg1: i1): spirv.BranchConditional %arg1, ^inner_true, ^inner_false(%arg0, %arg0: i32, i32) ^outer_false: spirv.Return ^inner_true: spirv.Return ^inner_false(%arg3: i32, %arg4: i32): spirv.Return } spirv.func @cond_branch_with_weights(%cond: i1) -> () ""None"" { spirv.BranchConditional %cond [1, 2], ^true, ^false ^true: spirv.Return ^false: spirv.Return } }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @infinite_loop(%count : i32) -> () ""None"" { spirv.mlir.loop { spirv.Branch ^header ^header: %cond = spirv.Constant true spirv.BranchConditional %cond, ^body, ^merge ^body: spirv.Branch ^continue ^continue: spirv.Branch ^header ^merge: spirv.mlir.merge } spirv.Return } }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "spirv.module Logical GLSL450 { spirv.func @selection_empty() -> () ""None"" { spirv.mlir.selection { } spirv.Return } spirv.func @selection_with_merge_block_only() -> () ""None"" { %cond = spirv.Constant true spirv.mlir.selection { spirv.BranchConditional %cond, ^merge, ^merge ^merge: spirv.mlir.merge } spirv.Return } spirv.func @selection_with_true_block_only() -> () ""None"" { %cond = spirv.Constant true spirv.mlir.selection { spirv.BranchConditional %cond, ^true, ^merge ^true: spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return } spirv.func @selection_with_both_true_and_false_block() -> () ""None"" { %cond = spirv.Constant true spirv.mlir.selection { spirv.BranchConditional %cond, ^true, ^false ^true: spirv.Branch ^merge ^false: spirv.Branch ^merge ^merge: spirv.mlir.merge } spirv.Return } spirv.func @selection_with_early_return(%arg0: i1) -> i32 ""None"" { %0 = spirv.Constant 0 : i32 spirv.mlir.selection { spirv.BranchConditional %arg0, ^true(%0 : i32), ^merge ^true(%arg1: i32): spirv.ReturnValue %arg1 : i32 ^merge: spirv.mlir.merge } %one = spirv.Constant 1 : i32 spirv.ReturnValue %one : i32 } }", mlir-opt -convert-spirv-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "func.func @gpu_gcn_raw_buffer_load_scalar_i32(%buf: memref) -> i32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[] : memref -> i32 func.return %0 : i32 } func.func @gpu_gcn_raw_buffer_load_i32(%buf: memref<64xi32>, %idx: i32) -> i32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi32>, i32 -> i32 func.return %0 : i32 } func.func @gpu_gcn_raw_buffer_load_i32_oob_off(%buf: memref<64xi32>, %idx: i32) -> i32 { %0 = amdgpu.raw_buffer_load {boundsCheck = false} %buf[%idx] : memref<64xi32>, i32 -> i32 func.return %0 : i32 } func.func @gpu_gcn_raw_buffer_load_2xi32(%buf: memref<64xi32>, %idx: i32) -> vector<2xi32> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi32>, i32 -> vector<2xi32> func.return %0 : vector<2xi32> } func.func @gpu_gcn_raw_buffer_load_i8(%buf: memref<64xi8>, %idx: i32) -> i8 { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi8>, i32 -> i8 func.return %0 : i8 } func.func @gpu_gcn_raw_buffer_load_2xi8(%buf: memref<64xi8>, %idx: i32) -> vector<2xi8> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi8>, i32 -> vector<2xi8> func.return %0 : vector<2xi8> } func.func @gpu_gcn_raw_buffer_load_16xi8(%buf: memref<64xi8>, %idx: i32) -> vector<16xi8> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi8>, i32 -> vector<16xi8> func.return %0 : vector<16xi8> } func.func @gpu_gcn_raw_buffer_load_f8E5M2FNUZ(%buf: memref<64xf8E5M2FNUZ>, %idx: i32) -> f8E5M2FNUZ { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xf8E5M2FNUZ>, i32 -> f8E5M2FNUZ func.return %0 : f8E5M2FNUZ } func.func @gpu_gcn_raw_buffer_load_4xf8E4M3FNUZ(%buf: memref<64xf8E4M3FNUZ>, %idx: i32) -> vector<4xf8E4M3FNUZ> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xf8E4M3FNUZ>, i32 -> vector<4xf8E4M3FNUZ> func.return %0 : vector<4xf8E4M3FNUZ> } func.func @gpu_gcn_raw_buffer_store_scalar_i32(%value: i32, %buf: memref) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[] : i32 -> memref func.return } func.func @gpu_gcn_raw_buffer_store_i32(%value: i32, %buf: memref<64xi32>, %idx: i32) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[%idx] : i32 -> memref<64xi32>, i32 func.return } func.func @gpu_gcn_raw_buffer_store_2xi8(%value: vector<2xi8>, %buf: memref<64xi8>, %idx: i32) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[%idx] : vector<2xi8> -> memref<64xi8>, i32 func.return } func.func @gpu_gcn_raw_buffer_store_16xi8(%value: vector<16xi8>, %buf: memref<64xi8>, %idx: i32) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[%idx] : vector<16xi8> -> memref<64xi8>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_fadd_f32(%value: f32, %buf: memref<64xf32>, %idx: i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true} %value -> %buf[%idx] : f32 -> memref<64xf32>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_fmax_f32(%value: f32, %buf: memref<64xf32>, %idx: i32) { amdgpu.raw_buffer_atomic_fmax {boundsCheck = true} %value -> %buf[%idx] : f32 -> memref<64xf32>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_smax_i32(%value: i32, %buf: memref<64xi32>, %idx: i32) { amdgpu.raw_buffer_atomic_smax {boundsCheck = true} %value -> %buf[%idx] : i32 -> memref<64xi32>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_umin_i32(%value: i32, %buf: memref<64xi32>, %idx: i32) { amdgpu.raw_buffer_atomic_umin {boundsCheck = true} %value -> %buf[%idx] : i32 -> memref<64xi32>, i32 func.return } func.func @amdgpu_raw_buffer_atomic_cmpswap_f32(%src : f32, %cmp : f32, %buf : memref<64xf32>, %idx: i32) -> f32 { %dst = amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true} %src, %cmp -> %buf[%idx] : f32 -> memref<64xf32>, i32 func.return %dst : f32 } func.func @amdgpu_raw_buffer_atomic_cmpswap_i64(%src : i64, %cmp : i64, %buf : memref<64xi64>, %idx: i32) -> i64 { %dst = amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true} %src, %cmp -> %buf[%idx] : i64 -> memref<64xi64>, i32 func.return %dst : i64 } func.func @lds_barrier() { amdgpu.lds_barrier func.return }", mlir-opt -convert-amdgpu-to-rocdl=chipset=gfx908 ,1 "func.func @gpu_gcn_raw_buffer_load_scalar_i32(%buf: memref) -> i32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[] : memref -> i32 func.return %0 : i32 } func.func @gpu_gcn_raw_buffer_load_i32(%buf: memref<64xi32>, %idx: i32) -> i32 { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi32>, i32 -> i32 func.return %0 : i32 } func.func @gpu_gcn_raw_buffer_load_i32_oob_off(%buf: memref<64xi32>, %idx: i32) -> i32 { %0 = amdgpu.raw_buffer_load {boundsCheck = false} %buf[%idx] : memref<64xi32>, i32 -> i32 func.return %0 : i32 } func.func @gpu_gcn_raw_buffer_load_2xi32(%buf: memref<64xi32>, %idx: i32) -> vector<2xi32> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi32>, i32 -> vector<2xi32> func.return %0 : vector<2xi32> } func.func @gpu_gcn_raw_buffer_load_i8(%buf: memref<64xi8>, %idx: i32) -> i8 { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi8>, i32 -> i8 func.return %0 : i8 } func.func @gpu_gcn_raw_buffer_load_2xi8(%buf: memref<64xi8>, %idx: i32) -> vector<2xi8> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi8>, i32 -> vector<2xi8> func.return %0 : vector<2xi8> } func.func @gpu_gcn_raw_buffer_load_16xi8(%buf: memref<64xi8>, %idx: i32) -> vector<16xi8> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xi8>, i32 -> vector<16xi8> func.return %0 : vector<16xi8> } func.func @gpu_gcn_raw_buffer_load_f8E5M2FNUZ(%buf: memref<64xf8E5M2FNUZ>, %idx: i32) -> f8E5M2FNUZ { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xf8E5M2FNUZ>, i32 -> f8E5M2FNUZ func.return %0 : f8E5M2FNUZ } func.func @gpu_gcn_raw_buffer_load_4xf8E4M3FNUZ(%buf: memref<64xf8E4M3FNUZ>, %idx: i32) -> vector<4xf8E4M3FNUZ> { %0 = amdgpu.raw_buffer_load {boundsCheck = true} %buf[%idx] : memref<64xf8E4M3FNUZ>, i32 -> vector<4xf8E4M3FNUZ> func.return %0 : vector<4xf8E4M3FNUZ> } func.func @gpu_gcn_raw_buffer_store_scalar_i32(%value: i32, %buf: memref) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[] : i32 -> memref func.return } func.func @gpu_gcn_raw_buffer_store_i32(%value: i32, %buf: memref<64xi32>, %idx: i32) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[%idx] : i32 -> memref<64xi32>, i32 func.return } func.func @gpu_gcn_raw_buffer_store_2xi8(%value: vector<2xi8>, %buf: memref<64xi8>, %idx: i32) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[%idx] : vector<2xi8> -> memref<64xi8>, i32 func.return } func.func @gpu_gcn_raw_buffer_store_16xi8(%value: vector<16xi8>, %buf: memref<64xi8>, %idx: i32) { amdgpu.raw_buffer_store {boundsCheck = true} %value -> %buf[%idx] : vector<16xi8> -> memref<64xi8>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_fadd_f32(%value: f32, %buf: memref<64xf32>, %idx: i32) { amdgpu.raw_buffer_atomic_fadd {boundsCheck = true} %value -> %buf[%idx] : f32 -> memref<64xf32>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_fmax_f32(%value: f32, %buf: memref<64xf32>, %idx: i32) { amdgpu.raw_buffer_atomic_fmax {boundsCheck = true} %value -> %buf[%idx] : f32 -> memref<64xf32>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_smax_i32(%value: i32, %buf: memref<64xi32>, %idx: i32) { amdgpu.raw_buffer_atomic_smax {boundsCheck = true} %value -> %buf[%idx] : i32 -> memref<64xi32>, i32 func.return } func.func @gpu_gcn_raw_buffer_atomic_umin_i32(%value: i32, %buf: memref<64xi32>, %idx: i32) { amdgpu.raw_buffer_atomic_umin {boundsCheck = true} %value -> %buf[%idx] : i32 -> memref<64xi32>, i32 func.return } func.func @amdgpu_raw_buffer_atomic_cmpswap_f32(%src : f32, %cmp : f32, %buf : memref<64xf32>, %idx: i32) -> f32 { %dst = amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true} %src, %cmp -> %buf[%idx] : f32 -> memref<64xf32>, i32 func.return %dst : f32 } func.func @amdgpu_raw_buffer_atomic_cmpswap_i64(%src : i64, %cmp : i64, %buf : memref<64xi64>, %idx: i32) -> i64 { %dst = amdgpu.raw_buffer_atomic_cmpswap {boundsCheck = true} %src, %cmp -> %buf[%idx] : i64 -> memref<64xi64>, i32 func.return %dst : i64 } func.func @lds_barrier() { amdgpu.lds_barrier func.return }", mlir-opt -convert-amdgpu-to-rocdl=chipset=gfx1030 ,1 "func.func @mfma_to_rocdl(%arg0 : f32, %arg1 : vector<32xf32>, %arg2 : vector<16xf32>, %arg3 : vector<4xf32>, %arg4 : vector<4xf16>, %arg5 : vector<4xi8>, %arg6 : vector<32xi32>, %arg7 : vector<16xi32>, %arg8 : vector<4xi32>, %arg9 : vector<2xbf16>, %arg10 : vector<4xbf16>, %arg11 : f64, %arg12 : vector<4xf64>, %arg13 : vector<8xi8>, %arg14 : vector<2xf32>, %arg15 : vector<8xf8E5M2FNUZ>, %arg16 : vector<8xf8E4M3FNUZ>) { amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 1 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : f32, f32, vector<32xf32> amdgpu.mfma %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 1 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : f32, f32, vector<16xf32> amdgpu.mfma %arg0 * %arg0 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 1 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : f32, f32, vector<4xf32> amdgpu.mfma %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : f32, f32, vector<16xf32> amdgpu.mfma %arg0 * %arg0 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : f32, f32, vector<4xf32> amdgpu.mfma %arg4 * %arg4 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<32xf32> amdgpu.mfma %arg4 * %arg4 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<16xf32> amdgpu.mfma %arg4 * %arg4 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> amdgpu.mfma %arg4 * %arg4 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<16xf32> amdgpu.mfma %arg4 * %arg4 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> amdgpu.mfma %arg5 * %arg5 + %arg6 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<32xi32> amdgpu.mfma %arg5 * %arg5 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<16xi32> amdgpu.mfma %arg5 * %arg5 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<4xi32> amdgpu.mfma %arg5 * %arg5 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<16xi32> amdgpu.mfma %arg5 * %arg5 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<4xi32> amdgpu.mfma %arg9 * %arg9 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<32xf32> amdgpu.mfma %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<16xf32> amdgpu.mfma %arg9 * %arg9 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<4xf32> amdgpu.mfma %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<16xf32> amdgpu.mfma %arg9 * %arg9 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<4xf32> amdgpu.mfma %arg10 * %arg10 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<32xf32> amdgpu.mfma %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<16xf32> amdgpu.mfma %arg10 * %arg10 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<4xf32> amdgpu.mfma %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<16xf32> amdgpu.mfma %arg10 * %arg10 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<4xf32> amdgpu.mfma %arg11 * %arg11 + %arg12 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : f64, f64, vector<4xf64> amdgpu.mfma %arg11 * %arg11 + %arg11 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 4 : i32 } blgp = none : f64, f64, f64 amdgpu.mfma %arg13 * %arg13 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xi8>, vector<8xi8>, vector<4xi32> amdgpu.mfma %arg13 * %arg13 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xi8>, vector<8xi8>, vector<16xi32> amdgpu.mfma %arg14 * %arg14 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32, reducePrecision } blgp = none : vector<2xf32>, vector<2xf32>, vector<4xf32> amdgpu.mfma %arg14 * %arg14 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32, reducePrecision } blgp = none : vector<2xf32>, vector<2xf32>, vector<16xf32> amdgpu.mfma %arg15 * %arg15 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E5M2FNUZ>, vector<4xf32> amdgpu.mfma %arg15 * %arg16 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E4M3FNUZ>, vector<4xf32> amdgpu.mfma %arg16 * %arg15 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E5M2FNUZ>, vector<4xf32> amdgpu.mfma %arg16 * %arg16 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E4M3FNUZ>, vector<4xf32> amdgpu.mfma %arg15 * %arg15 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E5M2FNUZ>, vector<16xf32> amdgpu.mfma %arg15 * %arg16 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E4M3FNUZ>, vector<16xf32> amdgpu.mfma %arg16 * %arg15 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E5M2FNUZ>, vector<16xf32> amdgpu.mfma %arg16 * %arg16 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E4M3FNUZ>, vector<16xf32> func.return }", mlir-opt -convert-amdgpu-to-rocdl=chipset=gfx940 ,1 "gpu.module @test_module { func.func @gpu_index_ops() -> (index, index, index, index, index, index, index, index, index, index, index, index, index) { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z %laneId = gpu.lane_id func.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ, %bIdX, %bIdY, %bIdZ, %gDimX, %gDimY, %gDimZ, %laneId : index, index, index, index, index, index, index, index, index, index, index, index, index } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_ops() -> (index, index, index, index, index, index, index, index, index, index, index, index, index) { %tIdX = gpu.thread_id x %tIdY = gpu.thread_id y %tIdZ = gpu.thread_id z %bDimX = gpu.block_dim x %bDimY = gpu.block_dim y %bDimZ = gpu.block_dim z %bIdX = gpu.block_id x %bIdY = gpu.block_id y %bIdZ = gpu.block_id z %gDimX = gpu.grid_dim x %gDimY = gpu.grid_dim y %gDimZ = gpu.grid_dim z %laneId = gpu.lane_id func.return %tIdX, %tIdY, %tIdZ, %bDimX, %bDimY, %bDimZ, %bIdX, %bIdY, %bIdZ, %gDimX, %gDimY, %gDimZ, %laneId : index, index, index, index, index, index, index, index, index, index, index, index, index } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_comp(%idx : index) -> index { %0 = arith.addi %idx, %idx : index func.return %0 : index } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_index_comp(%idx : index) -> index { %0 = arith.addi %idx, %idx : index func.return %0 : index } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @gpu_all_reduce_op() { %arg0 = arith.constant 1.0 : f32 %result = gpu.all_reduce add %arg0 uniform {} : (f32) -> (f32) gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @gpu_all_reduce_op() { %arg0 = arith.constant 1.0 : f32 %result = gpu.all_reduce add %arg0 uniform {} : (f32) -> (f32) gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @gpu_all_reduce_region() { %arg0 = arith.constant 1 : i32 %result = gpu.all_reduce %arg0 uniform { ^bb(%lhs : i32, %rhs : i32): %xor = arith.xori %lhs, %rhs : i32 ""gpu.yield""(%xor) : (i32) -> () } : (i32) -> (i32) gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @gpu_all_reduce_region() { %arg0 = arith.constant 1 : i32 %result = gpu.all_reduce %arg0 uniform { ^bb(%lhs : i32, %rhs : i32): %xor = arith.xori %lhs, %rhs : i32 ""gpu.yield""(%xor) : (i32) -> () } : (i32) -> (i32) gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_shuffle() -> (f32, f32, f32, f32) { %arg0 = arith.constant 1.0 : f32 %arg1 = arith.constant 4 : i32 %arg2 = arith.constant 23 : i32 %shfl, %pred = gpu.shuffle xor %arg0, %arg1, %arg2 : f32 %shflu, %predu = gpu.shuffle up %arg0, %arg1, %arg2 : f32 %shfld, %predd = gpu.shuffle down %arg0, %arg1, %arg2 : f32 %shfli, %predi = gpu.shuffle idx %arg0, %arg1, %arg2 : f32 func.return %shfl, %shflu, %shfld, %shfli : f32, f32,f32, f32 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_shuffle() -> (f32, f32, f32, f32) { %arg0 = arith.constant 1.0 : f32 %arg1 = arith.constant 4 : i32 %arg2 = arith.constant 23 : i32 %shfl, %pred = gpu.shuffle xor %arg0, %arg1, %arg2 : f32 %shflu, %predu = gpu.shuffle up %arg0, %arg1, %arg2 : f32 %shfld, %predd = gpu.shuffle down %arg0, %arg1, %arg2 : f32 %shfli, %predi = gpu.shuffle idx %arg0, %arg1, %arg2 : f32 func.return %shfl, %shflu, %shfld, %shfli : f32, f32,f32, f32 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sync() { gpu.barrier func.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sync() { gpu.barrier func.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_fabs(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.absf %arg_f32 : f32 %result64 = math.absf %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_fabs(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.absf %arg_f32 : f32 %result64 = math.absf %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cbrt(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cbrt %arg_f32 : f32 %result64 = math.cbrt %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cbrt(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cbrt %arg_f32 : f32 %result64 = math.cbrt %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_ceil(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.ceil %arg_f32 : f32 %result64 = math.ceil %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_ceil(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.ceil %arg_f32 : f32 %result64 = math.ceil %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_floor(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.floor %arg_f32 : f32 %result64 = math.floor %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_floor(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.floor %arg_f32 : f32 %result64 = math.floor %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cos(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cos %arg_f32 : f32 %result64 = math.cos %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_cos(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.cos %arg_f32 : f32 %result64 = math.cos %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.exp %arg_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.exp %arg_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.exp2 %arg_f32 : f32 %result64 = math.exp2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_exp2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.exp2 %arg_f32 : f32 %result64 = math.exp2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log %arg_f32 : f32 %result64 = math.log %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log %arg_f32 : f32 %result64 = math.log %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log10(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log10 %arg_f32 : f32 %result64 = math.log10 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log10(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log10 %arg_f32 : f32 %result64 = math.log10 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log1p(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log1p %arg_f32 : f32 %result64 = math.log1p %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log1p(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log1p %arg_f32 : f32 %result64 = math.log1p %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log2 %arg_f32 : f32 %result64 = math.log2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_log2(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.log2 %arg_f32 : f32 %result64 = math.log2 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sin(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.sin %arg_f32 : f32 %result64 = math.sin %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sin(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.sin %arg_f32 : f32 %result64 = math.sin %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tan(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.tan %arg_f16 : f16 %result32 = math.tan %arg_f32 : f32 %result64 = math.tan %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tan(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.tan %arg_f16 : f16 %result32 = math.tan %arg_f32 : f32 %result64 = math.tan %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tanh(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.tanh %arg_f16 : f16 %result32 = math.tanh %arg_f32 : f32 %result64 = math.tanh %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_tanh(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.tanh %arg_f16 : f16 %result32 = math.tanh %arg_f32 : f32 %result64 = math.tanh %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_rsqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.rsqrt %arg_f16 : f16 %result32 = math.rsqrt %arg_f32 : f32 %result64 = math.rsqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_rsqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.rsqrt %arg_f16 : f16 %result32 = math.rsqrt %arg_f32 : f32 %result64 = math.rsqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.sqrt %arg_f16 : f16 %result32 = math.sqrt %arg_f32 : f32 %result64 = math.sqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_sqrt(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.sqrt %arg_f16 : f16 %result32 = math.sqrt %arg_f32 : f32 %result64 = math.sqrt %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.atan %arg_f16 : f16 %result32 = math.atan %arg_f32 : f32 %result64 = math.atan %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.atan %arg_f16 : f16 %result32 = math.atan %arg_f32 : f32 %result64 = math.atan %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan2(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.atan2 %arg_f16, %arg_f16 : f16 %result32 = math.atan2 %arg_f32, %arg_f32 : f32 %result64 = math.atan2 %arg_f64, %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_atan2(%arg_f16 : f16, %arg_f32 : f32, %arg_f64 : f64) -> (f16, f32, f64) { %result16 = math.atan2 %arg_f16, %arg_f16 : f16 %result32 = math.atan2 %arg_f32, %arg_f32 : f32 %result64 = math.atan2 %arg_f64, %arg_f64 : f64 func.return %result16, %result32, %result64 : f16, f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { ""test.symbol_scope""() ({ func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.exp %arg_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } ""test.finish"" () : () -> () }) : () -> () }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { ""test.symbol_scope""() ({ func.func @gpu_exp(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.exp %arg_f32 : f32 %result64 = math.exp %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } ""test.finish"" () : () -> () }) : () -> () }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_expm1(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.expm1 %arg_f32 : f32 %result64 = math.expm1 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_expm1(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.expm1 %arg_f32 : f32 %result64 = math.expm1 %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_pow(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.powf %arg_f32, %arg_f32 : f32 %result64 = math.powf %arg_f64, %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_pow(%arg_f32 : f32, %arg_f64 : f64) -> (f32, f64) { %result32 = math.powf %arg_f32, %arg_f32 : f32 %result64 = math.powf %arg_f64, %arg_f64 : f64 func.return %result32, %result64 : f32, f64 } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_unroll(%arg0 : vector<4xf32>) -> vector<4xf32> { %result = math.exp %arg0 : vector<4xf32> func.return %result : vector<4xf32> } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_unroll(%arg0 : vector<4xf32>) -> vector<4xf32> { %result = math.exp %arg0 : vector<4xf32> func.return %result : vector<4xf32> } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @kernel_func() kernel { gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @kernel_func() kernel { gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @test_const_printf() { gpu.printf ""Hello, world\n"" gpu.return } gpu.func @test_printf(%arg0: i32, %arg1: f32) { gpu.printf ""Hello: %d\n"" %arg0, %arg1 : i32, f32 gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @test_const_printf() { gpu.printf ""Hello, world\n"" gpu.return } gpu.func @test_printf(%arg0: i32, %arg1: f32) { gpu.printf ""Hello: %d\n"" %arg0, %arg1 : i32, f32 gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @subgroup_reduce_add(%arg0 : i32) { %result = gpu.subgroup_reduce add %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_and(%arg0 : i32) { %result = gpu.subgroup_reduce and %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_max(%arg0 : i32) { %result = gpu.subgroup_reduce max %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_min(%arg0 : i32) { %result = gpu.subgroup_reduce min %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_or(%arg0 : i32) { %result = gpu.subgroup_reduce or %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_xor(%arg0 : i32) { %result = gpu.subgroup_reduce xor %arg0 uniform {} : (i32) -> (i32) gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { gpu.func @subgroup_reduce_add(%arg0 : i32) { %result = gpu.subgroup_reduce add %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_and(%arg0 : i32) { %result = gpu.subgroup_reduce and %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_max(%arg0 : i32) { %result = gpu.subgroup_reduce max %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_min(%arg0 : i32) { %result = gpu.subgroup_reduce min %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_or(%arg0 : i32) { %result = gpu.subgroup_reduce or %arg0 uniform {} : (i32) -> (i32) gpu.return } gpu.func @subgroup_reduce_xor(%arg0 : i32) { %result = gpu.subgroup_reduce xor %arg0 uniform {} : (i32) -> (i32) gpu.return } }", mlir-opt -convert-gpu-to-nvvm='has-redux=1 index-bitwidth=32 use-opaque-pointers=1' -split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_load_op() -> (!gpu.mma_matrix<16x16xf16, ""AOp"">) { %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> return %0 : !gpu.mma_matrix<16x16xf16, ""AOp""> } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_load_op() -> (!gpu.mma_matrix<16x16xf16, ""AOp"">) { %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> return %0 : !gpu.mma_matrix<16x16xf16, ""AOp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_int8_load_op() -> (!gpu.mma_matrix<16x16xsi8, ""AOp"">) { %wg = memref.alloca() {alignment = 32} : memref<32x32xi8, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xi8, 3> -> !gpu.mma_matrix<16x16xsi8, ""AOp""> return %0 : !gpu.mma_matrix<16x16xsi8, ""AOp""> } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_int8_load_op() -> (!gpu.mma_matrix<16x16xsi8, ""AOp"">) { %wg = memref.alloca() {alignment = 32} : memref<32x32xi8, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xi8, 3> -> !gpu.mma_matrix<16x16xsi8, ""AOp""> return %0 : !gpu.mma_matrix<16x16xsi8, ""AOp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_store_op(%arg0 : !gpu.mma_matrix<16x16xf16, ""COp"">) -> () { %sg = memref.alloca(){alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index gpu.subgroup_mma_store_matrix %arg0, %sg[%i,%j] {leadDimension= 32 : index, transpose} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x32xf16, 3> return } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_store_op(%arg0 : !gpu.mma_matrix<16x16xf16, ""COp"">) -> () { %sg = memref.alloca(){alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index gpu.subgroup_mma_store_matrix %arg0, %sg[%i,%j] {leadDimension= 32 : index, transpose} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<32x32xf16, 3> return } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_mma_op(%A : !gpu.mma_matrix<16x16xf16, ""AOp"">, %B : !gpu.mma_matrix<16x16xf16, ""BOp"">, %C : !gpu.mma_matrix<16x16xf16, ""COp"">) -> (!gpu.mma_matrix<16x16xf16, ""COp"">) { %D = gpu.subgroup_mma_compute %A, %B, %C {a_transpose} : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf16, ""COp""> return %D : !gpu.mma_matrix<16x16xf16, ""COp""> } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_mma_op(%A : !gpu.mma_matrix<16x16xf16, ""AOp"">, %B : !gpu.mma_matrix<16x16xf16, ""BOp"">, %C : !gpu.mma_matrix<16x16xf16, ""COp"">) -> (!gpu.mma_matrix<16x16xf16, ""COp"">) { %D = gpu.subgroup_mma_compute %A, %B, %C {a_transpose} : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf16, ""COp""> return %D : !gpu.mma_matrix<16x16xf16, ""COp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_mma_int8_op(%A : !gpu.mma_matrix<32x16xsi8, ""AOp"">, %B : !gpu.mma_matrix<16x8xsi8, ""BOp"">, %C : !gpu.mma_matrix<32x8xi32, ""COp"">) -> (!gpu.mma_matrix<32x8xi32, ""COp"">) { %D = gpu.subgroup_mma_compute %A, %B, %C {a_transpose} : !gpu.mma_matrix<32x16xsi8, ""AOp"">, !gpu.mma_matrix<16x8xsi8, ""BOp""> -> !gpu.mma_matrix<32x8xi32, ""COp""> return %D : !gpu.mma_matrix<32x8xi32, ""COp""> } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_mma_int8_op(%A : !gpu.mma_matrix<32x16xsi8, ""AOp"">, %B : !gpu.mma_matrix<16x8xsi8, ""BOp"">, %C : !gpu.mma_matrix<32x8xi32, ""COp"">) -> (!gpu.mma_matrix<32x8xi32, ""COp"">) { %D = gpu.subgroup_mma_compute %A, %B, %C {a_transpose} : !gpu.mma_matrix<32x16xsi8, ""AOp"">, !gpu.mma_matrix<16x8xsi8, ""BOp""> -> !gpu.mma_matrix<32x8xi32, ""COp""> return %D : !gpu.mma_matrix<32x8xi32, ""COp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_mma_loop_op(%arg0: memref<128x128xf16>, %arg1: memref<128x128xf16>, %arg2: memref<128x128xf16>) { %c0 = arith.constant 0 : index %c128 = arith.constant 128 : index %c32 = arith.constant 32 : index %0 = gpu.subgroup_mma_load_matrix %arg2[%c0, %c0] {leadDimension = 128 : index} : memref<128x128xf16> -> !gpu.mma_matrix<16x16xf16, ""COp""> cf.br ^bb1(%c0, %0 : index, !gpu.mma_matrix<16x16xf16, ""COp"">) ^bb1(%1: index, %2: !gpu.mma_matrix<16x16xf16, ""COp"">): %3 = arith.cmpi slt, %1, %c128 : index cf.cond_br %3, ^bb2, ^bb3 ^bb2: %4 = gpu.subgroup_mma_load_matrix %arg0[%c0, %1] {leadDimension = 128 : index} : memref<128x128xf16> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %5 = gpu.subgroup_mma_load_matrix %arg1[%1, %c0] {leadDimension = 128 : index} : memref<128x128xf16> -> !gpu.mma_matrix<16x16xf16, ""BOp""> %6 = gpu.subgroup_mma_compute %4, %5, %2 : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf16, ""COp""> %7 = arith.addi %1, %c32 : index cf.br ^bb1(%7, %6 : index, !gpu.mma_matrix<16x16xf16, ""COp"">) ^bb3: gpu.subgroup_mma_store_matrix %2, %arg2[%c0, %c0] {leadDimension = 128 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<128x128xf16> return } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_mma_loop_op(%arg0: memref<128x128xf16>, %arg1: memref<128x128xf16>, %arg2: memref<128x128xf16>) { %c0 = arith.constant 0 : index %c128 = arith.constant 128 : index %c32 = arith.constant 32 : index %0 = gpu.subgroup_mma_load_matrix %arg2[%c0, %c0] {leadDimension = 128 : index} : memref<128x128xf16> -> !gpu.mma_matrix<16x16xf16, ""COp""> cf.br ^bb1(%c0, %0 : index, !gpu.mma_matrix<16x16xf16, ""COp"">) ^bb1(%1: index, %2: !gpu.mma_matrix<16x16xf16, ""COp"">): %3 = arith.cmpi slt, %1, %c128 : index cf.cond_br %3, ^bb2, ^bb3 ^bb2: %4 = gpu.subgroup_mma_load_matrix %arg0[%c0, %1] {leadDimension = 128 : index} : memref<128x128xf16> -> !gpu.mma_matrix<16x16xf16, ""AOp""> %5 = gpu.subgroup_mma_load_matrix %arg1[%1, %c0] {leadDimension = 128 : index} : memref<128x128xf16> -> !gpu.mma_matrix<16x16xf16, ""BOp""> %6 = gpu.subgroup_mma_compute %4, %5, %2 : !gpu.mma_matrix<16x16xf16, ""AOp"">, !gpu.mma_matrix<16x16xf16, ""BOp""> -> !gpu.mma_matrix<16x16xf16, ""COp""> %7 = arith.addi %1, %c32 : index cf.br ^bb1(%7, %6 : index, !gpu.mma_matrix<16x16xf16, ""COp"">) ^bb3: gpu.subgroup_mma_store_matrix %2, %arg2[%c0, %c0] {leadDimension = 128 : index} : !gpu.mma_matrix<16x16xf16, ""COp"">, memref<128x128xf16> return } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_constant_op() ->(!gpu.mma_matrix<16x16xf16, ""COp"">) { %cst = arith.constant 1.0 : f16 %C = gpu.subgroup_mma_constant_matrix %cst : !gpu.mma_matrix<16x16xf16, ""COp""> return %C : !gpu.mma_matrix<16x16xf16, ""COp""> } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_constant_op() ->(!gpu.mma_matrix<16x16xf16, ""COp"">) { %cst = arith.constant 1.0 : f16 %C = gpu.subgroup_mma_constant_matrix %cst : !gpu.mma_matrix<16x16xf16, ""COp""> return %C : !gpu.mma_matrix<16x16xf16, ""COp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_elementwise(%A : !gpu.mma_matrix<16x16xf16, ""COp"">, %B : !gpu.mma_matrix<16x16xf16, ""COp"">) ->(!gpu.mma_matrix<16x16xf16, ""COp"">) { %C = gpu.subgroup_mma_elementwise addf %A, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> %D = gpu.subgroup_mma_elementwise maxf %C, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> return %D : !gpu.mma_matrix<16x16xf16, ""COp""> } }", mlir-opt --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @test_module { func.func @gpu_wmma_elementwise(%A : !gpu.mma_matrix<16x16xf16, ""COp"">, %B : !gpu.mma_matrix<16x16xf16, ""COp"">) ->(!gpu.mma_matrix<16x16xf16, ""COp"">) { %C = gpu.subgroup_mma_elementwise addf %A, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> %D = gpu.subgroup_mma_elementwise maxf %C, %B : (!gpu.mma_matrix<16x16xf16, ""COp"">, !gpu.mma_matrix<16x16xf16, ""COp"">) -> !gpu.mma_matrix<16x16xf16, ""COp""> return %D : !gpu.mma_matrix<16x16xf16, ""COp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=1"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_load_op() -> (!gpu.mma_matrix<16x16xf16, ""AOp"">) { %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> return %0 : !gpu.mma_matrix<16x16xf16, ""AOp""> } }"," mlir-opt --convert-gpu-to-nvvm=""use-opaque-pointers=0"" --split-input-file ",1 "gpu.module @test_module { func.func @gpu_wmma_load_op() -> (!gpu.mma_matrix<16x16xf16, ""AOp"">) { %wg = memref.alloca() {alignment = 32} : memref<32x32xf16, 3> %i = arith.constant 16 : index %j = arith.constant 16 : index %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] {leadDimension = 32 : index, transpose} : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, ""AOp""> return %0 : !gpu.mma_matrix<16x16xf16, ""AOp""> } }"," mlir-opt --convert-gpu-to-nvvm=""index-bitwidth=32 use-opaque-pointers=0"" --split-input-file ",1 "func.func @pack_unpack(%arg0: i1, %arg1: i2) -> (i1, i2) { %0 = ""test.make_tuple""() : () -> tuple<> %1 = ""test.make_tuple""(%arg1) : (i2) -> tuple %2 = ""test.make_tuple""(%1) : (tuple) -> tuple> %3 = ""test.make_tuple""(%0, %arg0, %2) : (tuple<>, i1, tuple>) -> tuple, i1, tuple>> %4 = ""test.get_tuple_element""(%3) {index = 0 : i32} : (tuple, i1, tuple>>) -> tuple<> %5 = ""test.get_tuple_element""(%3) {index = 1 : i32} : (tuple, i1, tuple>>) -> i1 %6 = ""test.get_tuple_element""(%3) {index = 2 : i32} : (tuple, i1, tuple>>) -> tuple> %7 = ""test.get_tuple_element""(%6) {index = 0 : i32} : (tuple>) -> tuple %8 = ""test.get_tuple_element""(%7) {index = 0 : i32} : (tuple) -> i2 return %5, %8 : i1, i2 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-tuple-ops"" ",1 "func.func @pack_unpack(%arg0: i1, %arg1: i2) -> (i1, i2) { %0 = ""test.make_tuple""() : () -> tuple<> %1 = ""test.make_tuple""(%arg1) : (i2) -> tuple %2 = ""test.make_tuple""(%1) : (tuple) -> tuple> %3 = ""test.make_tuple""(%0, %arg0, %2) : (tuple<>, i1, tuple>) -> tuple, i1, tuple>> %4 = ""test.get_tuple_element""(%3) {index = 0 : i32} : (tuple, i1, tuple>>) -> tuple<> %5 = ""test.get_tuple_element""(%3) {index = 1 : i32} : (tuple, i1, tuple>>) -> i1 %6 = ""test.get_tuple_element""(%3) {index = 2 : i32} : (tuple, i1, tuple>>) -> tuple> %7 = ""test.get_tuple_element""(%6) {index = 0 : i32} : (tuple>) -> tuple %8 = ""test.get_tuple_element""(%7) {index = 0 : i32} : (tuple) -> i2 return %5, %8 : i1, i2 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @pack_unpack(%arg0: i1, %arg1: i2) -> (i1, i2) { %0 = ""test.make_tuple""() : () -> tuple<> %1 = ""test.make_tuple""(%arg1) : (i2) -> tuple %2 = ""test.make_tuple""(%1) : (tuple) -> tuple> %3 = ""test.make_tuple""(%0, %arg0, %2) : (tuple<>, i1, tuple>) -> tuple, i1, tuple>> %4 = ""test.get_tuple_element""(%3) {index = 0 : i32} : (tuple, i1, tuple>>) -> tuple<> %5 = ""test.get_tuple_element""(%3) {index = 1 : i32} : (tuple, i1, tuple>>) -> i1 %6 = ""test.get_tuple_element""(%3) {index = 2 : i32} : (tuple, i1, tuple>>) -> tuple> %7 = ""test.get_tuple_element""(%6) {index = 0 : i32} : (tuple>) -> tuple %8 = ""test.get_tuple_element""(%7) {index = 0 : i32} : (tuple) -> i2 return %5, %8 : i1, i2 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-tuple-ops"" ",1 "func.func @materializations_tuple_args(%arg0: tuple, i1, tuple>>) -> (i1, i2) { %0 = ""test.get_tuple_element""(%arg0) {index = 0 : i32} : (tuple, i1, tuple>>) -> tuple<> %1 = ""test.get_tuple_element""(%arg0) {index = 1 : i32} : (tuple, i1, tuple>>) -> i1 %2 = ""test.get_tuple_element""(%arg0) {index = 2 : i32} : (tuple, i1, tuple>>) -> tuple> %3 = ""test.get_tuple_element""(%2) {index = 0 : i32} : (tuple>) -> tuple %4 = ""test.get_tuple_element""(%3) {index = 0 : i32} : (tuple) -> i2 return %1, %4 : i1, i2 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-tuple-ops"" ",1 "func.func @materializations_tuple_args(%arg0: tuple, i1, tuple>>) -> (i1, i2) { %0 = ""test.get_tuple_element""(%arg0) {index = 0 : i32} : (tuple, i1, tuple>>) -> tuple<> %1 = ""test.get_tuple_element""(%arg0) {index = 1 : i32} : (tuple, i1, tuple>>) -> i1 %2 = ""test.get_tuple_element""(%arg0) {index = 2 : i32} : (tuple, i1, tuple>>) -> tuple> %3 = ""test.get_tuple_element""(%2) {index = 0 : i32} : (tuple>) -> tuple %4 = ""test.get_tuple_element""(%3) {index = 0 : i32} : (tuple) -> i2 return %1, %4 : i1, i2 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @materializations_tuple_args(%arg0: tuple, i1, tuple>>) -> (i1, i2) { %0 = ""test.get_tuple_element""(%arg0) {index = 0 : i32} : (tuple, i1, tuple>>) -> tuple<> %1 = ""test.get_tuple_element""(%arg0) {index = 1 : i32} : (tuple, i1, tuple>>) -> i1 %2 = ""test.get_tuple_element""(%arg0) {index = 2 : i32} : (tuple, i1, tuple>>) -> tuple> %3 = ""test.get_tuple_element""(%2) {index = 0 : i32} : (tuple>) -> tuple %4 = ""test.get_tuple_element""(%3) {index = 0 : i32} : (tuple) -> i2 return %1, %4 : i1, i2 }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-tuple-ops"" ",1 "func.func @materializations_tuple_return(%arg0: i1, %arg1: i2) -> tuple, i1, tuple>> { %0 = ""test.make_tuple""() : () -> tuple<> %1 = ""test.make_tuple""(%arg1) : (i2) -> tuple %2 = ""test.make_tuple""(%1) : (tuple) -> tuple> %3 = ""test.make_tuple""(%0, %arg0, %2) : (tuple<>, i1, tuple>) -> tuple, i1, tuple>> return %3 : tuple, i1, tuple>> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-tuple-ops"" ",1 "func.func @materializations_tuple_return(%arg0: i1, %arg1: i2) -> tuple, i1, tuple>> { %0 = ""test.make_tuple""() : () -> tuple<> %1 = ""test.make_tuple""(%arg1) : (i2) -> tuple %2 = ""test.make_tuple""(%1) : (tuple) -> tuple> %3 = ""test.make_tuple""(%0, %arg0, %2) : (tuple<>, i1, tuple>) -> tuple, i1, tuple>> return %3 : tuple, i1, tuple>> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops"" ",1 "func.func @materializations_tuple_return(%arg0: i1, %arg1: i2) -> tuple, i1, tuple>> { %0 = ""test.make_tuple""() : () -> tuple<> %1 = ""test.make_tuple""(%arg1) : (i2) -> tuple %2 = ""test.make_tuple""(%1) : (tuple) -> tuple> %3 = ""test.make_tuple""(%0, %arg0, %2) : (tuple<>, i1, tuple>) -> tuple, i1, tuple>> return %3 : tuple, i1, tuple>> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-tuple-ops"" ",1 "func.func @if_result(%arg0: tuple, i1, tuple>, %arg1: i1) -> tuple, i1, tuple> { %0 = scf.if %arg1 -> (tuple, i1, tuple>) { scf.yield %arg0 : tuple, i1, tuple> } else { scf.yield %arg0 : tuple, i1, tuple> } return %0 : tuple, i1, tuple> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-scf-ops"" ",1 "func.func @if_tuple_ops(%arg0: tuple, i1>, %arg1: i1) -> tuple, i1> { %0 = scf.if %arg1 -> (tuple, i1>) { %1 = ""test.op""(%arg0) : (tuple, i1>) -> tuple, i1> scf.yield %1 : tuple, i1> } else { %1 = ""test.source""() : () -> tuple, i1> scf.yield %1 : tuple, i1> } return %0 : tuple, i1> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-scf-ops"" ",1 "func.func @while_operands_results(%arg0: tuple, i1, tuple>, %arg1: i1) -> tuple, i1, tuple> { %0 = scf.while (%arg2 = %arg0) : (tuple, i1, tuple>) -> tuple, i1, tuple> { scf.condition(%arg1) %arg2 : tuple, i1, tuple> } do { ^bb0(%arg2: tuple, i1, tuple>): scf.yield %arg2 : tuple, i1, tuple> } return %0 : tuple, i1, tuple> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-scf-ops"" ",1 "func.func @while_tuple_ops(%arg0: tuple, i1>, %arg1: i1) -> tuple, i1> { %0 = scf.while (%arg2 = %arg0) : (tuple, i1>) -> tuple, i1> { %1 = ""test.op""(%arg2) : (tuple, i1>) -> tuple, i1> scf.condition(%arg1) %1 : tuple, i1> } do { ^bb0(%arg2: tuple, i1>): %1 = ""test.source""() : () -> tuple, i1> scf.yield %1 : tuple, i1> } return %0 : tuple, i1> }"," mlir-opt -split-input-file -test-one-to-n-type-conversion=""convert-func-ops convert-scf-ops"" ",1 "module attributes {gpu.container_module} { llvm.func @malloc(i64) -> !llvm.ptr llvm.func @foo() { %0 = llvm.mlir.constant(12 : index) : i64 %1 = llvm.mlir.null : !llvm.ptr %2 = llvm.mlir.constant(1 : index) : i64 %3 = llvm.getelementptr %1[%2] : (!llvm.ptr, i64) -> !llvm.ptr, f32 %4 = llvm.ptrtoint %3 : !llvm.ptr to i64 %5 = llvm.mul %0, %4 : i64 %6 = llvm.call @malloc(%5) : (i64) -> !llvm.ptr %8 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %9 = llvm.insertvalue %6, %8[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %10 = llvm.insertvalue %6, %9[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %11 = llvm.mlir.constant(0 : index) : i64 %12 = llvm.insertvalue %11, %10[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %13 = llvm.mlir.constant(1 : index) : i64 %14 = llvm.insertvalue %0, %12[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %15 = llvm.insertvalue %13, %14[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %16 = llvm.mlir.constant(1 : index) : i64 %17 = llvm.extractvalue %15[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %18 = llvm.extractvalue %15[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %19 = llvm.extractvalue %15[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %20 = llvm.extractvalue %15[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %21 = llvm.extractvalue %15[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> llvm.call @vulkanLaunch(%16, %16, %16, %17, %18, %19, %20, %21) {spirv_blob = ""\03\02#\07\00"", spirv_element_types = [f32], spirv_entry_point = ""kernel""} : (i64, i64, i64, !llvm.ptr, !llvm.ptr, i64, i64, i64) -> () llvm.return } llvm.func @vulkanLaunch(%arg0: i64, %arg1: i64, %arg2: i64, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: i64, %arg9: i64, %arg10: i64) { %0 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %1 = llvm.insertvalue %arg6, %0[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %2 = llvm.insertvalue %arg7, %1[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %3 = llvm.insertvalue %arg8, %2[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %4 = llvm.insertvalue %arg9, %3[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %5 = llvm.insertvalue %arg10, %4[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %6 = llvm.mlir.constant(1 : index) : i64 %7 = llvm.alloca %6 x !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> : (i64) -> !llvm.ptr llvm.store %5, %7 : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, !llvm.ptr llvm.call @_mlir_ciface_vulkanLaunch(%arg0, %arg1, %arg2, %7) : (i64, i64, i64, !llvm.ptr) -> () llvm.return } llvm.func @_mlir_ciface_vulkanLaunch(i64, i64, i64, !llvm.ptr) }", mlir-opt -launch-func-to-vulkan='use-opaque-pointers=1' ,1 "module attributes {gpu.container_module} { spirv.module Logical GLSL450 requires #spirv.vce { spirv.GlobalVariable @kernel_arg_0 bind(0, 0) : !spirv.ptr [0])>, StorageBuffer> spirv.func @kernel() ""None"" attributes {workgroup_attributions = 0 : i64} { %0 = spirv.mlir.addressof @kernel_arg_0 : !spirv.ptr [0])>, StorageBuffer> %2 = spirv.Constant 0 : i32 %3 = spirv.mlir.addressof @kernel_arg_0 : !spirv.ptr [0])>, StorageBuffer> %4 = spirv.AccessChain %0[%2, %2] : !spirv.ptr [0])>, StorageBuffer>, i32, i32 %5 = spirv.Load ""StorageBuffer"" %4 : f32 spirv.Return } spirv.EntryPoint ""GLCompute"" @kernel spirv.ExecutionMode @kernel ""LocalSize"", 1, 1, 1 } gpu.module @kernels { gpu.func @kernel(%arg0: memref<12xf32>) kernel { gpu.return } } func.func @foo() { %0 = memref.alloc() : memref<12xf32> %c1 = arith.constant 1 : index gpu.launch_func @kernels::@kernel blocks in(%c1, %c1, %c1) threads in(%c1, %c1, %c1) args(%0 : memref<12xf32>) return } }", mlir-opt -convert-gpu-launch-to-vulkan-launch ,1 "module attributes {gpu.container_module} { llvm.func @malloc(i64) -> !llvm.ptr llvm.func @foo() { %0 = llvm.mlir.constant(12 : index) : i64 %1 = llvm.mlir.null : !llvm.ptr %2 = llvm.mlir.constant(1 : index) : i64 %3 = llvm.getelementptr %1[%2] : (!llvm.ptr, i64) -> !llvm.ptr %4 = llvm.ptrtoint %3 : !llvm.ptr to i64 %5 = llvm.mul %0, %4 : i64 %6 = llvm.call @malloc(%5) : (i64) -> !llvm.ptr %7 = llvm.bitcast %6 : !llvm.ptr to !llvm.ptr %8 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %9 = llvm.insertvalue %7, %8[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %10 = llvm.insertvalue %7, %9[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %11 = llvm.mlir.constant(0 : index) : i64 %12 = llvm.insertvalue %11, %10[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %13 = llvm.mlir.constant(1 : index) : i64 %14 = llvm.insertvalue %0, %12[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %15 = llvm.insertvalue %13, %14[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %16 = llvm.mlir.constant(1 : index) : i64 %17 = llvm.extractvalue %15[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %18 = llvm.extractvalue %15[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %19 = llvm.extractvalue %15[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %20 = llvm.extractvalue %15[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %21 = llvm.extractvalue %15[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> llvm.call @vulkanLaunch(%16, %16, %16, %17, %18, %19, %20, %21) {spirv_blob = ""\03\02#\07\00"", spirv_element_types = [f32], spirv_entry_point = ""kernel""} : (i64, i64, i64, !llvm.ptr, !llvm.ptr, i64, i64, i64) -> () llvm.return } llvm.func @vulkanLaunch(%arg0: i64, %arg1: i64, %arg2: i64, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: i64, %arg9: i64, %arg10: i64) { %0 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %1 = llvm.insertvalue %arg6, %0[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %2 = llvm.insertvalue %arg7, %1[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %3 = llvm.insertvalue %arg8, %2[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %4 = llvm.insertvalue %arg9, %3[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %5 = llvm.insertvalue %arg10, %4[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> %6 = llvm.mlir.constant(1 : index) : i64 %7 = llvm.alloca %6 x !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> : (i64) -> !llvm.ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>> llvm.store %5, %7 : !llvm.ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>> llvm.call @_mlir_ciface_vulkanLaunch(%arg0, %arg1, %arg2, %7) : (i64, i64, i64, !llvm.ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>>) -> () llvm.return } llvm.func @_mlir_ciface_vulkanLaunch(i64, i64, i64, !llvm.ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>>) }", mlir-opt -launch-func-to-vulkan='use-opaque-pointers=0' ,1 "func.func private @res_attrs_with_memref_return() -> (memref {test.returnOne}) func.func private @res_attrs_with_value_return() -> (f32 {test.returnOne = 1}) func.func private @multiple_return() -> (memref {test.returnOne = 1}, f32 {test.returnTwo = 2, test.returnThree = 3}) func.func private @multiple_return_missing_res_attr() -> (memref {test.returnOne = 1}, i64, f32 {test.returnTwo = 2, test.returnThree = 3}) func.func private @one_arg_attr_no_res_attrs_with_memref_return(%arg0: memref {test.argOne = 1}) -> memref func.func private @one_arg_attr_one_res_attr_with_memref_return(%arg0: memref {test.argOne = 1}) -> (memref {test.returnOne = 1}) func.func private @one_arg_attr_one_res_attr_with_value_return(%arg0: memref {test.argOne = 1}) -> (f32 {test.returnOne = 1}) func.func private @multiple_arg_attr_multiple_res_attr(%arg0: memref {test.argZero = 0}, %arg1: f32, %arg2: i32 {test.argTwo = 2}) -> (f32, memref {test.returnOne = 1}, i32 {test.returnTwo = 2}) func.func private @drop_linkage_attr() -> (memref {test.returnOne}) attributes { llvm.linkage = #llvm.linkage }", mlir-opt -llvm-request-c-wrappers -convert-func-to-llvm='use-opaque-pointers=1' ,1 "func.func @res_attrs_with_memref_return() -> (memref {test.returnOne}) { %0 = memref.alloc() : memref return %0 : memref } func.func @res_attrs_with_value_return() -> (f32 {test.returnOne = 1}) { %0 = arith.constant 1.00 : f32 return %0 : f32 } func.func @multiple_return() -> (memref {test.returnOne = 1}, f32 {test.returnTwo = 2, test.returnThree = 3}) { %0 = memref.alloc() : memref %1 = arith.constant 1.00 : f32 return %0, %1 : memref, f32 } func.func @multiple_return_missing_res_attr() -> (memref {test.returnOne = 1}, i64, f32 {test.returnTwo = 2, test.returnThree = 3}) { %0 = memref.alloc() : memref %1 = arith.constant 2 : i64 %2 = arith.constant 1.00 : f32 return %0, %1, %2 : memref, i64, f32 } func.func @one_arg_attr_no_res_attrs_with_memref_return(%arg0: memref {test.argOne = 1}) -> memref { %0 = memref.alloc() : memref return %0 : memref } func.func @one_arg_attr_one_res_attr_with_memref_return(%arg0: memref {test.argOne = 1}) -> (memref {test.returnOne = 1}) { %0 = memref.alloc() : memref return %0 : memref } func.func @one_arg_attr_one_res_attr_with_value_return(%arg0: memref {test.argOne = 1}) -> (f32 {test.returnOne = 1}) { %0 = arith.constant 1.00 : f32 return %0 : f32 } func.func @multiple_arg_attr_multiple_res_attr(%arg0: memref {test.argZero = 0}, %arg1: f32, %arg2: i32 {test.argTwo = 2}) -> (f32, memref {test.returnOne = 1}, i32 {test.returnTwo = 2}) { %0 = arith.constant 1.00 : f32 %1 = memref.alloc() : memref %2 = arith.constant 2 : i32 return %0, %1, %2 : f32, memref, i32 } func.func @drop_linkage_attr() -> (memref {test.returnOne}) attributes { llvm.linkage = #llvm.linkage } { %0 = memref.alloc() : memref return %0 : memref }", mlir-opt -llvm-request-c-wrappers -convert-func-to-llvm='use-opaque-pointers=1' ,1 "func.func @check_noalias(%static : memref<2xf32> {llvm.noalias}, %other : memref<2xf32> {llvm.noalias}) { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @check_noalias(%static : memref<2xf32> {llvm.noalias}, %other : memref<2xf32> {llvm.noalias}) { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @check_strided_memref_arguments(%static: memref<10x20xf32, affine_map<(i,j)->(20 * i + j + 1)>>, %dynamic : memref(M * i + j + 1)>>, %mixed : memref<10x?xf32, affine_map<(i,j)[M]->(M * i + j + 1)>>) { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @check_strided_memref_arguments(%static: memref<10x20xf32, affine_map<(i,j)->(20 * i + j + 1)>>, %dynamic : memref(M * i + j + 1)>>, %mixed : memref<10x?xf32, affine_map<(i,j)[M]->(M * i + j + 1)>>) { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @memref_index(%arg0: memref<32xindex>) -> memref<32xindex> { return %arg0 : memref<32xindex> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @memref_index(%arg0: memref<32xindex>) -> memref<32xindex> { return %arg0 : memref<32xindex> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @check_arguments(%static: memref<10x20xf32>, %dynamic : memref, %mixed : memref<10x?xf32>) { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @check_arguments(%static: memref<10x20xf32>, %dynamic : memref, %mixed : memref<10x?xf32>) { return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @hoo(memref<*xi8>) -> memref<*xi8> func.func @check_unranked_memref_func_call(%in: memref<*xi8>) -> memref<*xi8> { %res = call @hoo(%in) : (memref<*xi8>) -> memref<*xi8> return %res : memref<*xi8> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @hoo(memref<*xi8>) -> memref<*xi8> func.func @check_unranked_memref_func_call(%in: memref<*xi8>) -> memref<*xi8> { %res = call @hoo(%in) : (memref<*xi8>) -> memref<*xi8> return %res : memref<*xi8> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @unsupported_memref_element_type() -> memref<42 x !test.memref_element> func.func private @unsupported_unranked_memref_element_type() -> memref<* x !test.memref_element>"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @unsupported_memref_element_type() -> memref<42 x !test.memref_element> func.func private @unsupported_unranked_memref_element_type() -> memref<* x !test.memref_element>"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @goo(f32) -> f32 func.func @check_scalar_func_call(%in : f32) { %res = call @goo(%in) : (f32) -> (f32) return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @goo(f32) -> f32 func.func @check_scalar_func_call(%in : f32) { %res = call @goo(%in) : (f32) -> (f32) return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "!base_type = memref<64xi32, 201> func.func @loop_carried(%arg0 : index, %arg1 : index, %arg2 : index, %base0 : !base_type, %base1 : !base_type) -> (!base_type, !base_type) { cf.br ^bb1(%arg0, %base0, %base1 : index, memref<64xi32, 201>, memref<64xi32, 201>) ^bb1(%0: index, %1: memref<64xi32, 201>, %2: memref<64xi32, 201>): %3 = arith.cmpi slt, %0, %arg1 : index cf.cond_br %3, ^bb2, ^bb3 ^bb2: %4 = arith.addi %0, %arg2 : index cf.br ^bb1(%4, %2, %1 : index, memref<64xi32, 201>, memref<64xi32, 201>) ^bb3: return %1, %2 : memref<64xi32, 201>, memref<64xi32, 201> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "!base_type = memref<64xi32, 201> func.func @loop_carried(%arg0 : index, %arg1 : index, %arg2 : index, %base0 : !base_type, %base1 : !base_type) -> (!base_type, !base_type) { cf.br ^bb1(%arg0, %base0, %base1 : index, memref<64xi32, 201>, memref<64xi32, 201>) ^bb1(%0: index, %1: memref<64xi32, 201>, %2: memref<64xi32, 201>): %3 = arith.cmpi slt, %0, %arg1 : index cf.cond_br %3, ^bb2, ^bb3 ^bb2: %4 = arith.addi %0, %arg2 : index cf.br ^bb1(%4, %2, %1 : index, memref<64xi32, 201>, memref<64xi32, 201>) ^bb3: return %1, %2 : memref<64xi32, 201>, memref<64xi32, 201> }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-arith-to-llvm),convert-func-to-llvm{use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @check_static_return(%static : memref<32x18xf32>) -> memref<32x18xf32> { return %static : memref<32x18xf32> }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func @check_static_return(%static : memref<32x18xf32>) -> memref<32x18xf32> { return %static : memref<32x18xf32> }", mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' -split-input-file ,1 "func.func @check_static_return_with_offset(%static : memref<32x18xf32, strided<[22,1], offset: 7>>) -> memref<32x18xf32, strided<[22,1], offset: 7>> { return %static : memref<32x18xf32, strided<[22,1], offset: 7>> }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func @check_static_return_with_offset(%static : memref<32x18xf32, strided<[22,1], offset: 7>>) -> memref<32x18xf32, strided<[22,1], offset: 7>> { return %static : memref<32x18xf32, strided<[22,1], offset: 7>> }", mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' -split-input-file ,1 "func.func private @foo(memref<10xi8>) -> memref<20xi8> func.func @check_memref_func_call(%in : memref<10xi8>) -> memref<20xi8> { %res = call @foo(%in) : (memref<10xi8>) -> (memref<20xi8>) return %res : memref<20xi8> }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func private @foo(memref<10xi8>) -> memref<20xi8> func.func @check_memref_func_call(%in : memref<10xi8>) -> memref<20xi8> { %res = call @foo(%in) : (memref<10xi8>) -> (memref<20xi8>) return %res : memref<20xi8> }", mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' -split-input-file ,1 "func.func @check_return(%in : memref) -> memref { return %in : memref }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func @check_return(%in : memref) -> memref { return %in : memref }", mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' -split-input-file ,1 "func.func @unconvertible_multiresult(%arg0: memref , %arg1: memref) -> (memref, memref) { return %arg0, %arg1 : memref, memref }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func @unconvertible_multiresult(%arg0: memref , %arg1: memref) -> (memref, memref) { return %arg0, %arg1 : memref, memref }", mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' -split-input-file ,1 "func.func @unranked_memref(%arg0:memref<*xi32>) { call @printMemrefI32(%arg0) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func @unranked_memref(%arg0:memref<*xi32>) { call @printMemrefI32(%arg0) : (memref<*xi32>) -> () return } func.func private @printMemrefI32(memref<*xi32>)", mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' -split-input-file ,1 module {}, mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' ,1 "func.func private @second_order_arg(%arg0 : () -> ()) func.func private @second_order_result() -> (() -> ()) func.func private @second_order_multi_result() -> (() -> (i32), () -> (i64), () -> (f32)) func.func private @memref_call_conv(%arg0: memref) func.func private @memref_call_conv_nested(%arg0: (memref) -> ()) func.func @pass_through(%arg0: () -> ()) -> (() -> ()) { cf.br ^bb1(%arg0 : () -> ()) ^bb1(%bbarg: () -> ()): return %bbarg : () -> () } func.func private @llvmlinkage(i32) attributes { ""llvm.linkage"" = #llvm.linkage } func.func private @llvmreadnone(i32) attributes { llvm.readnone } func.func private @body(i32) func.func @indirect_const_call(%arg0: i32) { %0 = constant @body : (i32) -> () call_indirect %0(%arg0) : (i32) -> () return } func.func @indirect_call(%arg0: (f32) -> i32, %arg1: f32) -> i32 { %0 = call_indirect %arg0(%arg1) : (f32) -> i32 return %0 : i32 } func.func @variadic_func(%arg0: i32) attributes { ""func.varargs"" = true } { return }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "func.func private @badllvmlinkage(i32) attributes { ""llvm.linkage"" = 3 : i64 } ", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "func.func @variadic_func(%arg0: i32) attributes { ""func.varargs"" = true, ""llvm.emit_c_interface"" } { return }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' -split-input-file -verify-diagnostics ,1 "func.func private @ptr() -> !llvm.ptr func.func private @opaque_ptr() -> !llvm.ptr func.func private @ptr_ptr() -> !llvm.ptr> func.func private @struct_ptr() -> !llvm.struct<(ptr)> func.func private @named_struct_ptr() -> !llvm.struct<""named"", (ptr)> func.func private @named_no_convert() -> !llvm.struct<""no_convert"", (ptr>)> func.func private @array_ptr() -> !llvm.array<10 x ptr> func.func private @func() -> !llvm.ptr> func.func private @named_recursive() -> !llvm.struct<""recursive"", (ptr, ptr>)>", mlir-opt -test-convert-call-op ,1 "func.func @check_attributes(%int: i64 {dialect.a = true, dialect.b = 4 : i64 }) { return } func.func @check_memref(%static: memref<10x20xf32> {llvm.noalias}) { return } func.func @check_multiple(%first: f32 {first.arg = true}, %second: i64 {second.arg = 42 : i32}) { return }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=1' ,1 "func.func private @external(%arg0: memref, %arg1: memref) func.func private @returner() -> (memref, memref) func.func @caller() { %0:2 = call @returner() : () -> (memref, memref) call @external(%0#0, %0#1) : (memref, memref) -> () return } func.func @callee(%arg0: memref, %arg1: index) { %0 = memref.load %arg0[%arg1] : memref return } func.func @other_callee(%arg0: memref, %arg1: index) attributes { llvm.emit_c_interface } { %0 = memref.load %arg0[%arg1] : memref return } func.func @return_var_memref_caller(%arg0: memref<4x3xf32>) { %0 = call @return_var_memref(%arg0) : (memref<4x3xf32>) -> memref<*xf32> return } func.func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> attributes { llvm.emit_c_interface } { %0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32> return %0 : memref<*xf32> } func.func @return_two_var_memref_caller(%arg0: memref<4x3xf32>) { %0:2 = call @return_two_var_memref(%arg0) : (memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) return } func.func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) attributes { llvm.emit_c_interface } { %0 = memref.cast %arg0 : memref<4x3xf32> to memref<*xf32> return %0, %0 : memref<*xf32>, memref<*xf32> } func.func @bare_ptr_calling_conv(%arg0: memref<4x3xf32>, %arg1 : index, %arg2 : index, %arg3 : f32) -> (memref<4x3xf32>) attributes { llvm.bareptr } { memref.store %arg3, %arg0[%arg1, %arg2] : memref<4x3xf32> return %arg0 : memref<4x3xf32> } func.func @bare_ptr_calling_conv_multiresult(%arg0: memref<4x3xf32>, %arg1 : index, %arg2 : index, %arg3 : f32) -> (f32, memref<4x3xf32>) attributes { llvm.bareptr } { memref.store %arg3, %arg0[%arg1, %arg2] : memref<4x3xf32> %0 = memref.load %arg0[%arg1, %arg2] : memref<4x3xf32> return %0, %arg0 : f32, memref<4x3xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -llvm-request-c-wrappers -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func private @external(%arg0: memref, %arg1: memref) func.func private @returner() -> (memref, memref) func.func @caller() { %0:2 = call @returner() : () -> (memref, memref) call @external(%0#0, %0#1) : (memref, memref) -> () return } func.func @callee(%arg0: memref, %arg1: index) { %0 = memref.load %arg0[%arg1] : memref return } func.func @other_callee(%arg0: memref, %arg1: index) attributes { llvm.emit_c_interface } { %0 = memref.load %arg0[%arg1] : memref return } func.func @return_var_memref_caller(%arg0: memref<4x3xf32>) { %0 = call @return_var_memref(%arg0) : (memref<4x3xf32>) -> memref<*xf32> return } func.func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> attributes { llvm.emit_c_interface } { %0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32> return %0 : memref<*xf32> } func.func @return_two_var_memref_caller(%arg0: memref<4x3xf32>) { %0:2 = call @return_two_var_memref(%arg0) : (memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) return } func.func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) attributes { llvm.emit_c_interface } { %0 = memref.cast %arg0 : memref<4x3xf32> to memref<*xf32> return %0, %0 : memref<*xf32>, memref<*xf32> } func.func @bare_ptr_calling_conv(%arg0: memref<4x3xf32>, %arg1 : index, %arg2 : index, %arg3 : f32) -> (memref<4x3xf32>) attributes { llvm.bareptr } { memref.store %arg3, %arg0[%arg1, %arg2] : memref<4x3xf32> return %arg0 : memref<4x3xf32> } func.func @bare_ptr_calling_conv_multiresult(%arg0: memref<4x3xf32>, %arg1 : index, %arg2 : index, %arg3 : f32) -> (f32, memref<4x3xf32>) attributes { llvm.bareptr } { memref.store %arg3, %arg0[%arg1, %arg2] : memref<4x3xf32> %0 = memref.load %arg0[%arg1, %arg2] : memref<4x3xf32> return %0, %arg0 : f32, memref<4x3xf32> }", mlir-opt -finalize-memref-to-llvm='use-opaque-pointers=1' -convert-func-to-llvm='use-opaque-pointers=1' -reconcile-unrealized-casts ,1 "func.func @empty() { ^bb0: return } func.func private @body(index) func.func @simple_loop() { ^bb0: cf.br ^bb1 ^bb1: %c1 = arith.constant 1 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c1 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb4 ^bb3: call @body(%0) : (index) -> () %c1_0 = arith.constant 1 : index %2 = arith.addi %0, %c1_0 : index cf.br ^bb2(%2 : index) ^bb4: return } func.func @simple_caller() { ^bb0: call @simple_loop() : () -> () return } func.func @call_with_attributes() { call @simple_loop() {foo=""bar"", baz=[1,2,3,4]} : () -> () return } func.func @ml_caller() { ^bb0: call @simple_loop() : () -> () call @more_imperfectly_nested_loops() : () -> () return } func.func private @body_args(index) -> index func.func private @other(index, i32) -> i32 func.func @func_args(i32, i32) -> i32 { ^bb0(%arg0: i32, %arg1: i32): %c0_i32 = arith.constant 0 : i32 cf.br ^bb1 ^bb1: %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c0 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb4 ^bb3: %2 = call @body_args(%0) : (index) -> index %3 = call @other(%2, %arg0) : (index, i32) -> i32 %4 = call @other(%2, %3) : (index, i32) -> i32 %5 = call @other(%2, %arg1) : (index, i32) -> i32 %c1 = arith.constant 1 : index %6 = arith.addi %0, %c1 : index cf.br ^bb2(%6 : index) ^bb4: %c0_0 = arith.constant 0 : index %7 = call @other(%c0_0, %c0_i32) : (index, i32) -> i32 return %7 : i32 } func.func private @pre(index) func.func private @body2(index, index) func.func private @post(index) func.func @imperfectly_nested_loops() { ^bb0: cf.br ^bb1 ^bb1: %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c0 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb8 ^bb3: call @pre(%0) : (index) -> () cf.br ^bb4 ^bb4: %c7 = arith.constant 7 : index %c56 = arith.constant 56 : index cf.br ^bb5(%c7 : index) ^bb5(%2: index): %3 = arith.cmpi slt, %2, %c56 : index cf.cond_br %3, ^bb6, ^bb7 ^bb6: call @body2(%0, %2) : (index, index) -> () %c2 = arith.constant 2 : index %4 = arith.addi %2, %c2 : index cf.br ^bb5(%4 : index) ^bb7: call @post(%0) : (index) -> () %c1 = arith.constant 1 : index %5 = arith.addi %0, %c1 : index cf.br ^bb2(%5 : index) ^bb8: return } func.func private @mid(index) func.func private @body3(index, index) func.func @more_imperfectly_nested_loops() { ^bb0: cf.br ^bb1 ^bb1: %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c0 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb12 ^bb3: call @pre(%0) : (index) -> () cf.br ^bb4 ^bb4: %c7 = arith.constant 7 : index %c56 = arith.constant 56 : index cf.br ^bb5(%c7 : index) ^bb5(%2: index): %3 = arith.cmpi slt, %2, %c56 : index cf.cond_br %3, ^bb6, ^bb7 ^bb6: call @body2(%0, %2) : (index, index) -> () %c2 = arith.constant 2 : index %4 = arith.addi %2, %c2 : index cf.br ^bb5(%4 : index) ^bb7: call @mid(%0) : (index) -> () cf.br ^bb8 ^bb8: %c18 = arith.constant 18 : index %c37 = arith.constant 37 : index cf.br ^bb9(%c18 : index) ^bb9(%5: index): %6 = arith.cmpi slt, %5, %c37 : index cf.cond_br %6, ^bb10, ^bb11 ^bb10: call @body3(%0, %5) : (index, index) -> () %c3 = arith.constant 3 : index %7 = arith.addi %5, %c3 : index cf.br ^bb9(%7 : index) ^bb11: call @post(%0) : (index) -> () %c1 = arith.constant 1 : index %8 = arith.addi %0, %c1 : index cf.br ^bb2(%8 : index) ^bb12: return } func.func private @get_i64() -> (i64) func.func private @get_f32() -> (f32) func.func private @get_c16() -> (complex) func.func private @get_c32() -> (complex) func.func private @get_c64() -> (complex) func.func private @get_memref() -> (memref<42x?x10x?xf32>) func.func @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) { ^bb0: %0 = call @get_i64() : () -> (i64) %1 = call @get_f32() : () -> (f32) %2 = call @get_memref() : () -> (memref<42x?x10x?xf32>) return %0, %1, %2 : i64, f32, memref<42x?x10x?xf32> } func.func @multireturn_caller() { ^bb0: %0:3 = call @multireturn() : () -> (i64, f32, memref<42x?x10x?xf32>) %1 = arith.constant 42 : i64 %2 = arith.addi %0#0, %1 : i64 %3 = arith.constant 42.0 : f32 %4 = arith.addf %0#1, %3 : f32 %5 = arith.constant 0 : index return } func.func @dfs_block_order(%arg0: i32) -> (i32) { %0 = arith.constant 42 : i32 cf.br ^bb2 ^bb1: %2 = arith.addi %arg0, %0 : i32 return %2 : i32 ^bb2: cf.br ^bb1 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @empty() { ^bb0: return } func.func private @body(index) func.func @simple_loop() { ^bb0: cf.br ^bb1 ^bb1: %c1 = arith.constant 1 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c1 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb4 ^bb3: call @body(%0) : (index) -> () %c1_0 = arith.constant 1 : index %2 = arith.addi %0, %c1_0 : index cf.br ^bb2(%2 : index) ^bb4: return } func.func @simple_caller() { ^bb0: call @simple_loop() : () -> () return } func.func @call_with_attributes() { call @simple_loop() {foo=""bar"", baz=[1,2,3,4]} : () -> () return } func.func @ml_caller() { ^bb0: call @simple_loop() : () -> () call @more_imperfectly_nested_loops() : () -> () return } func.func private @body_args(index) -> index func.func private @other(index, i32) -> i32 func.func @func_args(i32, i32) -> i32 { ^bb0(%arg0: i32, %arg1: i32): %c0_i32 = arith.constant 0 : i32 cf.br ^bb1 ^bb1: %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c0 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb4 ^bb3: %2 = call @body_args(%0) : (index) -> index %3 = call @other(%2, %arg0) : (index, i32) -> i32 %4 = call @other(%2, %3) : (index, i32) -> i32 %5 = call @other(%2, %arg1) : (index, i32) -> i32 %c1 = arith.constant 1 : index %6 = arith.addi %0, %c1 : index cf.br ^bb2(%6 : index) ^bb4: %c0_0 = arith.constant 0 : index %7 = call @other(%c0_0, %c0_i32) : (index, i32) -> i32 return %7 : i32 } func.func private @pre(index) func.func private @body2(index, index) func.func private @post(index) func.func @imperfectly_nested_loops() { ^bb0: cf.br ^bb1 ^bb1: %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c0 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb8 ^bb3: call @pre(%0) : (index) -> () cf.br ^bb4 ^bb4: %c7 = arith.constant 7 : index %c56 = arith.constant 56 : index cf.br ^bb5(%c7 : index) ^bb5(%2: index): %3 = arith.cmpi slt, %2, %c56 : index cf.cond_br %3, ^bb6, ^bb7 ^bb6: call @body2(%0, %2) : (index, index) -> () %c2 = arith.constant 2 : index %4 = arith.addi %2, %c2 : index cf.br ^bb5(%4 : index) ^bb7: call @post(%0) : (index) -> () %c1 = arith.constant 1 : index %5 = arith.addi %0, %c1 : index cf.br ^bb2(%5 : index) ^bb8: return } func.func private @mid(index) func.func private @body3(index, index) func.func @more_imperfectly_nested_loops() { ^bb0: cf.br ^bb1 ^bb1: %c0 = arith.constant 0 : index %c42 = arith.constant 42 : index cf.br ^bb2(%c0 : index) ^bb2(%0: index): %1 = arith.cmpi slt, %0, %c42 : index cf.cond_br %1, ^bb3, ^bb12 ^bb3: call @pre(%0) : (index) -> () cf.br ^bb4 ^bb4: %c7 = arith.constant 7 : index %c56 = arith.constant 56 : index cf.br ^bb5(%c7 : index) ^bb5(%2: index): %3 = arith.cmpi slt, %2, %c56 : index cf.cond_br %3, ^bb6, ^bb7 ^bb6: call @body2(%0, %2) : (index, index) -> () %c2 = arith.constant 2 : index %4 = arith.addi %2, %c2 : index cf.br ^bb5(%4 : index) ^bb7: call @mid(%0) : (index) -> () cf.br ^bb8 ^bb8: %c18 = arith.constant 18 : index %c37 = arith.constant 37 : index cf.br ^bb9(%c18 : index) ^bb9(%5: index): %6 = arith.cmpi slt, %5, %c37 : index cf.cond_br %6, ^bb10, ^bb11 ^bb10: call @body3(%0, %5) : (index, index) -> () %c3 = arith.constant 3 : index %7 = arith.addi %5, %c3 : index cf.br ^bb9(%7 : index) ^bb11: call @post(%0) : (index) -> () %c1 = arith.constant 1 : index %8 = arith.addi %0, %c1 : index cf.br ^bb2(%8 : index) ^bb12: return } func.func private @get_i64() -> (i64) func.func private @get_f32() -> (f32) func.func private @get_c16() -> (complex) func.func private @get_c32() -> (complex) func.func private @get_c64() -> (complex) func.func private @get_memref() -> (memref<42x?x10x?xf32>) func.func @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) { ^bb0: %0 = call @get_i64() : () -> (i64) %1 = call @get_f32() : () -> (f32) %2 = call @get_memref() : () -> (memref<42x?x10x?xf32>) return %0, %1, %2 : i64, f32, memref<42x?x10x?xf32> } func.func @multireturn_caller() { ^bb0: %0:3 = call @multireturn() : () -> (i64, f32, memref<42x?x10x?xf32>) %1 = arith.constant 42 : i64 %2 = arith.addi %0#0, %1 : i64 %3 = arith.constant 42.0 : f32 %4 = arith.addf %0#1, %3 : f32 %5 = arith.constant 0 : index return } func.func @dfs_block_order(%arg0: i32) -> (i32) { %0 = arith.constant 42 : i32 cf.br ^bb2 ^bb1: %2 = arith.addi %arg0, %0 : i32 return %2 : i32 ^bb2: cf.br ^bb1 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @ceilf(%arg0 : f32) { %0 = math.ceil %arg0 : f32 func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @ceilf(%arg0 : f32) { %0 = math.ceil %arg0 : f32 func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @floorf(%arg0 : f32) { %0 = math.floor %arg0 : f32 func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @floorf(%arg0 : f32) { %0 = math.floor %arg0 : f32 func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @assert_test_function(%arg : i1) { cf.assert %arg, ""Computer says no"" return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @assert_test_function(%arg : i1) { cf.assert %arg, ""Computer says no"" return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @call_zero_result_func() { call @zero_result_func() : () -> () return } func.func private @zero_result_func()"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @call_zero_result_func() { call @zero_result_func() : () -> () return } func.func private @zero_result_func()"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @fmaf(%arg0: f32, %arg1: vector<4xf32>) { %0 = math.fma %arg0, %arg0, %arg0 : f32 %1 = math.fma %arg1, %arg1, %arg1 : vector<4xf32> func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @fmaf(%arg0: f32, %arg1: vector<4xf32>) { %0 = math.fma %arg0, %arg0, %arg0 : f32 %1 = math.fma %arg1, %arg1, %arg1 : vector<4xf32> func.return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @switchi8(%arg0 : i8) -> i32 { cf.switch %arg0 : i8, [ default: ^bb1, 42: ^bb1, 43: ^bb3 ] ^bb1: %c_1 = arith.constant 1 : i32 func.return %c_1 : i32 ^bb3: %c_42 = arith.constant 42 : i32 func.return %c_42: i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm),convert-func-to-llvm{use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func @switchi8(%arg0 : i8) -> i32 { cf.switch %arg0 : i8, [ default: ^bb1, 42: ^bb1, 43: ^bb3 ] ^bb1: %c_1 = arith.constant 1 : i32 func.return %c_1 : i32 ^bb3: %c_42 = arith.constant 42 : i32 func.return %c_42: i32 }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)"" -split-input-file ",1 "func.func private @second_order_arg(%arg0 : () -> ()) func.func private @second_order_result() -> (() -> ()) func.func private @second_order_multi_result() -> (() -> (i32), () -> (i64), () -> (f32)) func.func private @third_order(%arg0 : (() -> ()) -> (() -> ())) -> ((() -> ()) -> (() -> ())) func.func private @fifth_order_left(%arg0: (((() -> ()) -> ()) -> ()) -> ()) func.func private @fifth_order_right(%arg0: () -> (() -> (() -> (() -> ())))) func.func private @memref_call_conv(%arg0: memref) func.func private @memref_call_conv_nested(%arg0: (memref) -> ()) func.func @pass_through(%arg0: () -> ()) -> (() -> ()) { cf.br ^bb1(%arg0 : () -> ()) ^bb1(%bbarg: () -> ()): return %bbarg : () -> () } func.func @indirect_call(%arg0: (f32) -> i32, %arg1: f32) -> i32 { %0 = call_indirect %arg0(%arg1) : (f32) -> i32 return %0 : i32 } func.func private @get_i64() -> (i64) func.func private @get_f32() -> (f32) func.func private @get_memref() -> (memref<42x?x10x?xf32>) func.func @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) { ^bb0: %0 = call @get_i64() : () -> (i64) %1 = call @get_f32() : () -> (f32) %2 = call @get_memref() : () -> (memref<42x?x10x?xf32>) return %0, %1, %2 : i64, f32, memref<42x?x10x?xf32> } func.func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> attributes {llvm.emit_c_interface} { %0 = builtin.unrealized_conversion_cast %arg0 : memref<4x3xf32> to !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> %1 = llvm.mlir.constant(1 : index) : i64 %2 = llvm.alloca %1 x !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> : (i64) -> !llvm.ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>> llvm.store %0, %2 : !llvm.ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>> %3 = llvm.bitcast %2 : !llvm.ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>> to !llvm.ptr %4 = llvm.mlir.constant(2 : index) : i64 %5 = llvm.mlir.undef : !llvm.struct<(i64, ptr)> %6 = llvm.insertvalue %4, %5[0] : !llvm.struct<(i64, ptr)> %7 = llvm.insertvalue %3, %6[1] : !llvm.struct<(i64, ptr)> %8 = builtin.unrealized_conversion_cast %7 : !llvm.struct<(i64, ptr)> to memref<*xf32> return %8 : memref<*xf32> } func.func @return_two_var_memref(%arg0: memref<4x3xf32>) -> (memref<*xf32>, memref<*xf32>) attributes {llvm.emit_c_interface} { %0 = builtin.unrealized_conversion_cast %arg0 : memref<4x3xf32> to !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> %1 = llvm.mlir.constant(1 : index) : i64 %2 = llvm.alloca %1 x !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> : (i64) -> !llvm.ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>> llvm.store %0, %2 : !llvm.ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>> %3 = llvm.bitcast %2 : !llvm.ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>> to !llvm.ptr %4 = llvm.mlir.constant(2 : index) : i64 %5 = llvm.mlir.undef : !llvm.struct<(i64, ptr)> %6 = llvm.insertvalue %4, %5[0] : !llvm.struct<(i64, ptr)> %7 = llvm.insertvalue %3, %6[1] : !llvm.struct<(i64, ptr)> %8 = builtin.unrealized_conversion_cast %7 : !llvm.struct<(i64, ptr)> to memref<*xf32> return %8, %8 : memref<*xf32>, memref<*xf32> }", mlir-opt -convert-func-to-llvm='use-opaque-pointers=0' -split-input-file ,1 "func.func @parallel(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) { scf.parallel (%i, %j) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %arg5) { ""test.payload""(%i, %j) : (index, index) -> () } return } func.func @nested_loops(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) { scf.parallel (%i) = (%arg0) to (%arg2) step (%arg4) { scf.parallel (%j) = (%arg1) to (%arg3) step (%arg5) { ""test.payload""(%i, %j) : (index, index) -> () } } return } func.func @adjacent_loops(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) { scf.parallel (%i) = (%arg0) to (%arg2) step (%arg4) { ""test.payload1""(%i) : (index) -> () } scf.parallel (%j) = (%arg1) to (%arg3) step (%arg5) { ""test.payload2""(%j) : (index) -> () } return }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=1' ,1 "func.func @reduction1(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index %zero = arith.constant 0.0 : f32 scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init (%zero) -> (f32) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32 } } return }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduction2(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index %zero = arith.constant 0.0 : f32 scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init (%zero) -> (f32) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %res = arith.mulf %lhs, %rhs : f32 scf.reduce.return %res : f32 } } return }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduction_muli(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index %one = arith.constant 1 : i32 scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init (%one) -> (i32) { %pow2 = arith.constant 2 : i32 scf.reduce(%pow2) : i32 { ^bb0(%lhs : i32, %rhs: i32): %res = arith.muli %lhs, %rhs : i32 scf.reduce.return %res : i32 } } return }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduction3(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index %zero = arith.constant 0.0 : f32 scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init (%zero) -> (f32) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %cmp = arith.cmpf oge, %lhs, %rhs : f32 %res = arith.select %cmp, %lhs, %rhs : f32 scf.reduce.return %res : f32 } } return }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduction4(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> (f32, i64) { %step = arith.constant 1 : index %zero = arith.constant 0.0 : f32 %ione = arith.constant 1 : i64 %res:2 = scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init (%zero, %ione) -> (f32, i64) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %cmp = arith.cmpf oge, %lhs, %rhs : f32 %res = arith.select %cmp, %lhs, %rhs : f32 scf.reduce.return %res : f32 } %1 = arith.fptosi %one : f32 to i64 scf.reduce(%1) : i64 { ^bb1(%lhs: i64, %rhs: i64): %cmp = arith.cmpi slt, %lhs, %rhs : i64 %res = arith.select %cmp, %rhs, %lhs : i64 scf.reduce.return %res : i64 } } return %res#0, %res#1 : f32, i64 }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=1' -split-input-file ,1 "func.func @reduction4(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> (f32, i64) { %step = arith.constant 1 : index %zero = arith.constant 0.0 : f32 %ione = arith.constant 1 : i64 %res:2 = scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init (%zero, %ione) -> (f32, i64) { %one = arith.constant 1.0 : f32 scf.reduce(%one) : f32 { ^bb0(%lhs : f32, %rhs: f32): %cmp = arith.cmpf oge, %lhs, %rhs : f32 %res = arith.select %cmp, %lhs, %rhs : f32 scf.reduce.return %res : f32 } %1 = arith.fptosi %one : f32 to i64 scf.reduce(%1) : i64 { ^bb1(%lhs: i64, %rhs: i64): %cmp = arith.cmpi slt, %lhs, %rhs : i64 %res = arith.select %cmp, %rhs, %lhs : i64 scf.reduce.return %res : i64 } } return %res#0, %res#1 : f32, i64 }", mlir-opt -convert-scf-to-openmp='use-opaque-pointers=0' -split-input-file ,1 "module attributes {gpu.container_module} { gpu.module @kernel_module attributes { nvvm.cubin = ""CUBIN"", rocdl.hsaco = ""HSACO"" } { llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, %arg5: i64) attributes {gpu.kernel} { llvm.return } } func.func @foo(%buffer: memref) { %c8 = arith.constant 8 : index %c32 = arith.constant 32 : i32 %c256 = arith.constant 256 : i32 gpu.launch_func @kernel_module::@kernel blocks in (%c8, %c8, %c8) threads in (%c8, %c8, %c8) dynamic_shared_memory_size %c256 args(%c32 : i32, %buffer : memref) return } }"," mlir-opt --gpu-to-llvm=""gpu-binary-annotation=nvvm.cubin use-opaque-pointers=1"" ",1 "module attributes {gpu.container_module} { gpu.module @kernel_module attributes { nvvm.cubin = ""CUBIN"", rocdl.hsaco = ""HSACO"" } { llvm.func @kernel(%arg0: i32, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, %arg5: i64) attributes {gpu.kernel} { llvm.return } } func.func @foo(%buffer: memref) { %c8 = arith.constant 8 : index %c32 = arith.constant 32 : i32 %c256 = arith.constant 256 : i32 gpu.launch_func @kernel_module::@kernel blocks in (%c8, %c8, %c8) threads in (%c8, %c8, %c8) dynamic_shared_memory_size %c256 args(%c32 : i32, %buffer : memref) return } }"," mlir-opt --gpu-to-llvm=""gpu-binary-annotation=rocdl.hsaco use-opaque-pointers=1"" ",1 "module attributes {gpu.container_module} { func.func @foo() { %t0 = gpu.wait async %t1 = gpu.wait async [%t0] gpu.wait [%t0, %t1] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @private(%arg0: f32) private(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> gpu.return } }", mlir-opt -split-input-file -convert-gpu-to-rocdl='use-opaque-pointers=0' ,1 "gpu.module @kernel { gpu.func @private(%arg0: f32) private(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> gpu.return } }", mlir-opt -split-input-file -convert-gpu-to-nvvm='use-opaque-pointers=0' ,1 "module attributes {gpu.container_module} { func.func @foo(%dst : memref<7xf32, 1>, %src : memref<7xf32>) { %t0 = gpu.wait async %t1 = gpu.memcpy async [%t0] %dst, %src : memref<7xf32, 1>, memref<7xf32> gpu.wait [%t1] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=1' ,1 " func.func @warp_extract(%arg0: index, %arg1: memref<1024x1024xf32>, %arg2: index, %arg3: vector<1xf32>) { %c0 = arith.constant 0 : index vector.warp_execute_on_lane_0(%arg0)[32] { vector.transfer_write %arg3, %arg1[%c0, %c0] {in_bounds = [true]} : vector<1xf32>, memref<1024x1024xf32> } return }", mlir-opt --gpu-to-llvm='use-opaque-pointers=1' ,1 "module attributes {gpu.container_module} { func.func @matvec(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_coo async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnvec, %token5 = gpu.create_dn_vec async [%token4] %mem2, %arg0 : memref %bufferSz, %token6 = gpu.spmv_buffer_size async [%token5] %env, %spmat, %dnvec, %dnvec into f64 %token7 = gpu.spmv async [%token6] %env, %spmat, %dnvec, %dnvec, %mem2 : memref into f64 %token8 = gpu.destroy_sp_mat async [%token7] %spmat %token9 = gpu.destroy_dn_vec async [%token8] %dnvec %token10 = gpu.destroy_sparse_env async [%token9] %env gpu.wait [%token10] return } func.func @matmul(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_csr async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnmat, %token5 = gpu.create_dn_mat async [%token4] %arg0, %arg0, %mem2 : memref %bufferSz, %token6 = gpu.spmm_buffer_size async [%token5] %env, %spmat, %dnmat, %dnmat into f64 %token7 = gpu.spmm async [%token6] %env, %spmat, %dnmat, %dnmat, %mem2 : memref into f64 %token8 = gpu.destroy_sp_mat async [%token7] %spmat %token9 = gpu.destroy_dn_mat async [%token8] %dnmat %token10 = gpu.destroy_sparse_env async [%token9] %env gpu.wait [%token10] return } func.func @sddmm(%arg0: index) { %token0 = gpu.wait async %mem1, %token1 = gpu.alloc async [%token0] (%arg0) : memref %mem2, %token2 = gpu.alloc async [%token1] (%arg0) : memref %env, %token3 = gpu.create_sparse_env async [%token2] %spmat, %token4 = gpu.create_csr async [%token3] %arg0, %arg0, %arg0, %mem1, %mem1, %mem2 : memref, memref, memref %dnmat, %token5 = gpu.create_dn_mat async [%token4] %arg0, %arg0, %mem2 : memref %bufferSz, %token6 = gpu.sddmm_buffer_size async [%token5] %env, %dnmat, %dnmat, %spmat into f64 %token7 = gpu.sddmm async [%token6] %env, %dnmat, %dnmat, %spmat, %mem2 : memref into f64 %token8 = gpu.destroy_sp_mat async [%token7] %spmat %token9 = gpu.destroy_dn_mat async [%token8] %dnmat %token10 = gpu.destroy_sparse_env async [%token9] %env gpu.wait [%token10] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=1' ,1 "module attributes {gpu.container_module} { func.func @main(%size : index) { %0 = gpu.wait async %1, %2 = gpu.alloc async [%0] (%size) : memref %3 = gpu.dealloc async [%2] %1 : memref gpu.wait [%3] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @private(%arg0: f32) private(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @private(%arg0: f32) private(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-rocdl='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @workgroup(%arg0: f32) workgroup(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @workgroup(%arg0: f32) workgroup(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-rocdl='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @workgroup3d(%arg0: f32) workgroup(%arg1: memref<4x2x6xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0,%c0,%c0] : memref<4x2x6xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @workgroup3d(%arg0: f32) workgroup(%arg1: memref<4x2x6xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0,%c0,%c0] : memref<4x2x6xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-rocdl='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @multiple(%arg0: f32) workgroup(%arg1: memref<1xf32, #gpu.address_space>, %arg2: memref<2xf32, #gpu.address_space>) private(%arg3: memref<3xf32, #gpu.address_space>, %arg4: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32, #gpu.address_space> memref.store %arg0, %arg2[%c0] : memref<2xf32, #gpu.address_space> memref.store %arg0, %arg3[%c0] : memref<3xf32, #gpu.address_space> memref.store %arg0, %arg4[%c0] : memref<4xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @multiple(%arg0: f32) workgroup(%arg1: memref<1xf32, #gpu.address_space>, %arg2: memref<2xf32, #gpu.address_space>) private(%arg3: memref<3xf32, #gpu.address_space>, %arg4: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<1xf32, #gpu.address_space> memref.store %arg0, %arg2[%c0] : memref<2xf32, #gpu.address_space> memref.store %arg0, %arg3[%c0] : memref<3xf32, #gpu.address_space> memref.store %arg0, %arg4[%c0] : memref<4xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-rocdl='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @explicitAlign(%arg0 : index) workgroup(%arg1: memref<48xf32, #gpu.address_space> {llvm.align = 8 : i64}) private(%arg2: memref<48xf32, #gpu.address_space> {llvm.align = 4 : i64}) { %val = memref.load %arg1[%arg0] : memref<48xf32, #gpu.address_space> memref.store %val, %arg2[%arg0] : memref<48xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-nvvm='use-opaque-pointers=1' --split-input-file ,1 "gpu.module @kernel { gpu.func @explicitAlign(%arg0 : index) workgroup(%arg1: memref<48xf32, #gpu.address_space> {llvm.align = 8 : i64}) private(%arg2: memref<48xf32, #gpu.address_space> {llvm.align = 4 : i64}) { %val = memref.load %arg1[%arg0] : memref<48xf32, #gpu.address_space> memref.store %val, %arg2[%arg0] : memref<48xf32, #gpu.address_space> ""terminator""() : () -> () } }", mlir-opt -allow-unregistered-dialect --convert-gpu-to-rocdl='use-opaque-pointers=1' --split-input-file ,1 "module { func.func @func(%arg: vector<11xf32>) { %cst_41 = arith.constant dense : vector<11xi1> %127 = vector.mask %cst_41 { vector.yield %arg : vector<11xf32> } : vector<11xi1> -> vector<11xf32> return } }", mlir-opt --gpu-to-llvm ,1 "gpu.module @kernel { gpu.func @private(%arg0: f32) private(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> gpu.return } }", mlir-opt -split-input-file -convert-gpu-to-rocdl='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @private(%arg0: f32) private(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> gpu.return } }", mlir-opt -split-input-file -convert-gpu-to-nvvm='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @workgroup(%arg0: f32) workgroup(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> gpu.return } }", mlir-opt -split-input-file -convert-gpu-to-rocdl='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @workgroup(%arg0: f32) workgroup(%arg1: memref<4xf32, #gpu.address_space>) { %c0 = arith.constant 0 : index memref.store %arg0, %arg1[%c0] : memref<4xf32, #gpu.address_space> gpu.return } }", mlir-opt -split-input-file -convert-gpu-to-nvvm='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @nested_memref(%arg0: memref<4xmemref<4xf32, #gpu.address_space>, #gpu.address_space>) -> f32 { %c0 = arith.constant 0 : index %inner = memref.load %arg0[%c0] : memref<4xmemref<4xf32, #gpu.address_space>, #gpu.address_space> %value = memref.load %inner[%c0] : memref<4xf32, #gpu.address_space> gpu.return %value : f32 } }", mlir-opt -split-input-file -convert-gpu-to-rocdl='use-opaque-pointers=1' ,1 "gpu.module @kernel { gpu.func @nested_memref(%arg0: memref<4xmemref<4xf32, #gpu.address_space>, #gpu.address_space>) -> f32 { %c0 = arith.constant 0 : index %inner = memref.load %arg0[%c0] : memref<4xmemref<4xf32, #gpu.address_space>, #gpu.address_space> %value = memref.load %inner[%c0] : memref<4xf32, #gpu.address_space> gpu.return %value : f32 } }", mlir-opt -split-input-file -convert-gpu-to-nvvm='use-opaque-pointers=1' ,1 "module attributes {gpu.container_module} { func.func @foo(%dst : memref<7xf32, 1>, %value : f32) { %t0 = gpu.wait async %t1 = gpu.memset async [%t0] %dst, %value : memref<7xf32, 1>, f32 gpu.wait [%t1] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=1' ,1 "module attributes {gpu.container_module} { func.func @main(%size : index) { %0 = gpu.wait async %1, %2 = gpu.alloc async [%0] (%size) : memref %3 = gpu.dealloc async [%2] %1 : memref gpu.wait [%3] return } func.func @foo(%dst : memref<7xf32, 1>, %src : memref<7xf32>) { %t0 = gpu.wait async %t1 = gpu.memcpy async [%t0] %dst, %src : memref<7xf32, 1>, memref<7xf32> gpu.wait [%t1] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=0' --split-input-file ,1 "module attributes {gpu.container_module} { func.func @foo(%dst : memref<7xf32, 1>, %value : f32) { %t0 = gpu.wait async %t1 = gpu.memset async [%t0] %dst, %value : memref<7xf32, 1>, f32 gpu.wait [%t1] return } }", mlir-opt --gpu-to-llvm='use-opaque-pointers=0' --split-input-file ,1 "func.func @tensor_extract_constant(%a : index, %b: index, %c: index) -> i32 { %cst = arith.constant dense<[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]> : tensor<2x2x3xi32> %extract = tensor.extract %cst[%a, %b, %c] : tensor<2x2x3xi32> return %extract : i32 }", mlir-opt -split-input-file -convert-tensor-to-spirv -verify-diagnostics ,1 "func.func @liveSingleCast(%arg0: i64) -> i32 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 return %0 : i32 }", not mlir-opt -split-input-file -mlir-print-ir-after-failure -reconcile-unrealized-casts 2>&1 ,1 "func.func @liveChain(%arg0: i64) -> i32 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i1 %1 = builtin.unrealized_conversion_cast %0 : i1 to i32 return %1 : i32 }", not mlir-opt -split-input-file -mlir-print-ir-after-failure -reconcile-unrealized-casts 2>&1 ,1 "func.func @liveBifurcation(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i64 %2 = builtin.unrealized_conversion_cast %0 : i32 to i1 %3 = arith.extsi %2 : i1 to i64 %4 = arith.addi %1, %3 : i64 return %4 : i64 }", not mlir-opt -split-input-file -mlir-print-ir-after-failure -reconcile-unrealized-casts 2>&1 ,1 "func.func @unusedCast(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 return %arg0 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @sameTypes(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i64 return %0 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @pair(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i64 return %1 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @symmetricChain(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i1 %2 = builtin.unrealized_conversion_cast %1 : i1 to i32 %3 = builtin.unrealized_conversion_cast %2 : i32 to i64 return %3 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @asymmetricChain(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i1 %2 = builtin.unrealized_conversion_cast %1 : i1 to i64 return %2 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @unusedChain(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i1 return %arg0 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @bifurcation(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i1 %2 = builtin.unrealized_conversion_cast %1 : i1 to i64 %3 = builtin.unrealized_conversion_cast %1 : i1 to i32 %4 = builtin.unrealized_conversion_cast %3 : i32 to i64 %5 = arith.addi %2, %4 : i64 return %5 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func @unusedBifurcation(%arg0: i64) -> i64 { %0 = builtin.unrealized_conversion_cast %arg0 : i64 to i32 %1 = builtin.unrealized_conversion_cast %0 : i32 to i1 %2 = builtin.unrealized_conversion_cast %1 : i1 to i64 %3 = builtin.unrealized_conversion_cast %0 : i32 to i64 %4 = arith.addi %arg0, %3 : i64 return %4 : i64 }", mlir-opt -split-input-file -reconcile-unrealized-casts ,1 "func.func private @foo(index, index) func.func @critical_block_arg() { omp.critical { ^bb0(%arg1: index, %arg2: index): func.call @foo(%arg1, %arg2) : (index, index) -> () omp.terminator } return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @master_block_arg() { omp.master { ^bb0(%arg1: index, %arg2: index): ""test.payload""(%arg1, %arg2) : (index, index) -> () omp.terminator } return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @branch_loop() { %start = arith.constant 0 : index %end = arith.constant 0 : index omp.parallel { cf.br ^bb1(%start, %end : index, index) ^bb1(%0: index, %1: index): %2 = arith.cmpi slt, %0, %1 : index cf.cond_br %2, ^bb2(%end, %end : index, index), ^bb3 ^bb2(%3: index, %4: index): cf.br ^bb1(%3, %4 : index, index) ^bb3: omp.flush omp.barrier omp.taskwait omp.taskyield omp.terminator } return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @wsloop(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) { omp.parallel { ""omp.wsloop""(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) ({ ^bb0(%arg6: index, %arg7: index): ""test.payload""(%arg6, %arg7) : (index, index) -> () omp.yield }) {operand_segment_sizes = array} : (index, index, index, index, index, index) -> () omp.terminator } return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @atomic_write(%a: !llvm.ptr) -> () { %1 = arith.constant 1 : i32 omp.atomic.write %a = %1 hint(none) memory_order(relaxed) : !llvm.ptr, i32 return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @atomic_read(%a: !llvm.ptr, %b: !llvm.ptr) -> () { omp.atomic.read %b = %a memory_order(acquire) hint(contended) : !llvm.ptr, i32 return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @atomic_update() { %0 = llvm.mlir.addressof @_QFsEc : !llvm.ptr omp.atomic.update %0 : !llvm.ptr { ^bb0(%arg0: i32): %1 = arith.constant 1 : i32 %2 = arith.addi %arg0, %1 : i32 omp.yield(%2 : i32) } return } llvm.mlir.global internal @_QFsEc() : i32 { %0 = arith.constant 10 : i32 llvm.return %0 : i32 }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @threadprivate(%a: !llvm.ptr) -> () { %1 = omp.threadprivate %a : !llvm.ptr -> !llvm.ptr return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @simdloop_block_arg(%val : i32, %ub : i32, %i : index) { omp.simdloop for (%arg0) : i32 = (%val) to (%ub) inclusive step (%val) { cf.br ^bb1(%i : index) ^bb1(%0: index): %1 = arith.cmpi slt, %0, %i : index cf.cond_br %1, ^bb2, ^bb3 ^bb2: %2 = arith.addi %0, %i : index cf.br ^bb1(%2 : index) ^bb3: omp.yield } return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @task_depend(%arg0: !llvm.ptr) { omp.task depend(taskdependin -> %arg0 : !llvm.ptr) { omp.terminator } return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "llvm.func @_QPomp_target_data(%a : !llvm.ptr, %b : !llvm.ptr, %c : !llvm.ptr, %d : !llvm.ptr) { omp.target_enter_data map((to -> %a : !llvm.ptr), (to -> %b : !llvm.ptr), (always, alloc -> %c : !llvm.ptr)) omp.target_exit_data map((from -> %a : !llvm.ptr), (from -> %b : !llvm.ptr), (release -> %c : !llvm.ptr), (always, delete -> %d : !llvm.ptr)) llvm.return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "llvm.func @_QPomp_target_data_region(%a : !llvm.ptr>, %i : !llvm.ptr) { omp.target_data map((tofrom -> %a : !llvm.ptr>)) { %1 = llvm.mlir.constant(10 : i32) : i32 llvm.store %1, %i : !llvm.ptr omp.terminator } llvm.return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "llvm.func @_QPomp_target(%a : !llvm.ptr>, %i : !llvm.ptr) { %0 = llvm.mlir.constant(64 : i32) : i32 omp.target thread_limit(%0 : i32) map((tofrom -> %a : !llvm.ptr>)) { %1 = llvm.mlir.constant(10 : i32) : i32 llvm.store %1, %i : !llvm.ptr omp.terminator } llvm.return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "llvm.func @_QPsb() { %0 = llvm.mlir.constant(0 : i64) : i64 %1 = llvm.mlir.constant(10 : i64) : i64 %2 = llvm.mlir.constant(1 : i64) : i64 omp.sections { omp.section { llvm.br ^bb1(%1 : i64) ^bb1(%3: i64): %4 = llvm.icmp ""sgt"" %3, %0 : i64 llvm.cond_br %4, ^bb2, ^bb3 ^bb2: %5 = llvm.sub %3, %2 : i64 llvm.br ^bb1(%5 : i64) ^bb3: omp.terminator } omp.terminator } llvm.return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "omp.reduction.declare @eqv_reduction : i32 init { ^bb0(%arg0: i32): %0 = llvm.mlir.constant(true) : i1 %1 = llvm.zext %0 : i1 to i32 omp.yield(%1 : i32) } combiner { ^bb0(%arg0: i32, %arg1: i32): %0 = llvm.mlir.constant(0 : i64) : i32 %1 = llvm.icmp ""ne"" %arg0, %0 : i32 %2 = llvm.icmp ""ne"" %arg1, %0 : i32 %3 = llvm.icmp ""eq"" %1, %2 : i1 %4 = llvm.zext %3 : i1 to i32 omp.yield(%4 : i32) } llvm.func @_QPsimple_reduction(%arg0: !llvm.ptr> {fir.bindc_name = ""y""}) { %0 = llvm.mlir.constant(100 : i32) : i32 %1 = llvm.mlir.constant(1 : i32) : i32 %2 = llvm.mlir.constant(true) : i1 %3 = llvm.mlir.constant(1 : i64) : i64 %4 = llvm.alloca %3 x i32 {bindc_name = ""x"", uniq_name = ""_QFsimple_reductionEx""} : (i64) -> !llvm.ptr %5 = llvm.zext %2 : i1 to i32 llvm.store %5, %4 : !llvm.ptr omp.parallel { %6 = llvm.alloca %3 x i32 {adapt.valuebyref, in_type = i32, operand_segment_sizes = array, pinned} : (i64) -> !llvm.ptr omp.wsloop reduction(@eqv_reduction -> %4 : !llvm.ptr) for (%arg1) : i32 = (%1) to (%0) inclusive step (%1) { llvm.store %arg1, %6 : !llvm.ptr %7 = llvm.load %6 : !llvm.ptr %8 = llvm.sext %7 : i32 to i64 %9 = llvm.sub %8, %3 : i64 %10 = llvm.getelementptr %arg0[0, %9] : (!llvm.ptr>, i64) -> !llvm.ptr %11 = llvm.load %10 : !llvm.ptr omp.reduction %11, %4 : i32, !llvm.ptr omp.yield } omp.terminator } llvm.return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "llvm.func @_QQmain() { %0 = llvm.mlir.constant(0 : index) : i64 %1 = llvm.mlir.constant(5 : index) : i64 %2 = llvm.mlir.constant(1 : index) : i64 %3 = llvm.mlir.constant(1 : i64) : i64 %4 = llvm.alloca %3 x i32 : (i64) -> !llvm.ptr omp.taskgroup { %5 = llvm.trunc %2 : i64 to i32 llvm.br ^bb1(%5, %1 : i32, i64) ^bb1(%6: i32, %7: i64): %8 = llvm.icmp ""sgt"" %7, %0 : i64 llvm.cond_br %8, ^bb2, ^bb3 ^bb2: llvm.store %6, %4 : !llvm.ptr omp.task { llvm.call @_QFPdo_work(%4) : (!llvm.ptr) -> () omp.terminator } %9 = llvm.load %4 : !llvm.ptr %10 = llvm.add %9, %5 : i32 %11 = llvm.sub %7, %2 : i64 llvm.br ^bb1(%10, %11 : i32, i64) ^bb3: llvm.store %6, %4 : !llvm.ptr omp.terminator } llvm.return } llvm.func @_QFPdo_work(%arg0: !llvm.ptr {fir.bindc_name = ""i""}) { llvm.return }", mlir-opt -convert-openmp-to-llvm -split-input-file ,1 "func.func @while_test(%arg0 : tensor) -> (tensor) { %1 = ""tosa.while_loop""(%arg0) ({ ^bb0(%arg2: tensor): %2 = ""tosa.const""() {value = dense<3> : tensor} : () -> tensor %3 = ""tosa.greater_equal""(%2, %arg2) : (tensor, tensor) -> tensor ""tosa.yield""(%3) : (tensor) -> () }, { ^bb0(%arg2: tensor): %2 = ""tosa.const""() {value = dense<1> : tensor} : () -> tensor %3 = ""tosa.add""(%arg2, %2) : (tensor, tensor) -> tensor ""tosa.yield""(%3) : (tensor) -> () }) : (tensor) -> (tensor) return %1 : tensor }", mlir-opt --split-input-file --tosa-to-scf -verify-diagnostics -o -,1 "func.func @if_test(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> (tensor) { %0 = ""tosa.cond_if""(%arg2, %arg0, %arg1) ({ ^bb1(%arg3 : tensor, %arg4 : tensor): ""tosa.yield""(%arg3) : (tensor) -> () }, { ^bb1(%arg5 : tensor, %arg6 : tensor): ""tosa.yield""(%arg6) : (tensor) -> () }) : (tensor, tensor, tensor) -> (tensor) return %0 : tensor }", mlir-opt --split-input-file --tosa-to-scf -verify-diagnostics -o -,1 "func.func @scatter_test(%values_in: tensor<3x7x5xi32>, %indices : tensor<3x6xi32>, %input: tensor<3x6x5xi32>) -> tensor<3x7x5xi32> { %0 = ""tosa.scatter""(%values_in, %indices, %input) : (tensor<3x7x5xi32>, tensor<3x6xi32>, tensor<3x6x5xi32>) -> (tensor<3x7x5xi32>) return %0 : tensor<3x7x5xi32> }", mlir-opt --split-input-file --tosa-to-scf -verify-diagnostics -o -,1 "func.func @simple_std_for_loop(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { %c1 = arith.constant 1 : index } return } func.func @simple_std_2_for_loops(%arg0 : index, %arg1 : index, %arg2 : index) { scf.for %i0 = %arg0 to %arg1 step %arg2 { %c1 = arith.constant 1 : index scf.for %i1 = %arg0 to %arg1 step %arg2 { %c1_0 = arith.constant 1 : index } } return } func.func @simple_std_if(%arg0: i1) { scf.if %arg0 { %c1 = arith.constant 1 : index } return } func.func @simple_std_if_else(%arg0: i1) { scf.if %arg0 { %c1 = arith.constant 1 : index } else { %c1_0 = arith.constant 1 : index } return } func.func @simple_std_2_ifs(%arg0: i1) { scf.if %arg0 { %c1 = arith.constant 1 : index scf.if %arg0 { %c1_0 = arith.constant 1 : index } else { %c1_1 = arith.constant 1 : index } } return } func.func @simple_std_for_loop_with_2_ifs(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : i1) { scf.for %i0 = %arg0 to %arg1 step %arg2 { %c1 = arith.constant 1 : index scf.if %arg3 { %c1_0 = arith.constant 1 : index scf.if %arg3 { %c1_1 = arith.constant 1 : index } else { %c1_2 = arith.constant 1 : index } } } return } func.func @simple_if_yield(%arg0: i1) -> (i1, i1) { %0:2 = scf.if %arg0 -> (i1, i1) { %c0 = arith.constant false %c1 = arith.constant true scf.yield %c0, %c1 : i1, i1 } else { %c0 = arith.constant false %c1 = arith.constant true scf.yield %c1, %c0 : i1, i1 } return %0#0, %0#1 : i1, i1 } func.func @nested_if_yield(%arg0: i1) -> (index) { %0 = scf.if %arg0 -> i1 { %1 = arith.constant true scf.yield %1 : i1 } else { %2 = arith.constant false scf.yield %2 : i1 } %1 = scf.if %0 -> index { %3 = scf.if %arg0 -> index { %4 = arith.constant 40 : index scf.yield %4 : index } else { %5 = arith.constant 41 : index scf.yield %5 : index } scf.yield %3 : index } else { %6 = arith.constant 42 : index scf.yield %6 : index } return %1 : index } func.func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) { %step = arith.constant 1 : index scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) { %c1 = arith.constant 1 : index } return } func.func @for_yield(%arg0 : index, %arg1 : index, %arg2 : index) -> (f32, f32) { %s0 = arith.constant 0.0 : f32 %s1 = arith.constant 1.0 : f32 %result:2 = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%si = %s0, %sj = %s1) -> (f32, f32) { %sn = arith.addf %si, %sj : f32 scf.yield %sn, %sn : f32, f32 } return %result#0, %result#1 : f32, f32 } func.func @nested_for_yield(%arg0 : index, %arg1 : index, %arg2 : index) -> f32 { %s0 = arith.constant 1.0 : f32 %r = scf.for %i0 = %arg0 to %arg1 step %arg2 iter_args(%iter = %s0) -> (f32) { %result = scf.for %i1 = %arg0 to %arg1 step %arg2 iter_args(%si = %iter) -> (f32) { %sn = arith.addf %si, %si : f32 scf.yield %sn : f32 } scf.yield %result : f32 } return %r : f32 } func.func private @generate() -> i64 func.func @simple_parallel_reduce_loop(%arg0: index, %arg1: index, %arg2: index, %arg3: f32) -> f32 { %0 = scf.parallel (%i) = (%arg0) to (%arg1) step (%arg2) init(%arg3) -> f32 { %cst = arith.constant 42.0 : f32 scf.reduce(%cst) : f32 { ^bb0(%lhs: f32, %rhs: f32): %1 = arith.mulf %lhs, %rhs : f32 scf.reduce.return %1 : f32 } } return %0 : f32 } func.func @parallel_reduce_loop(%arg0 : index, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index, %arg5 : f32) -> (f32, i64) { %step = arith.constant 1 : index %init = arith.constant 42 : i64 %0:2 = scf.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %step) init(%arg5, %init) -> (f32, i64) { %cf = arith.constant 42.0 : f32 scf.reduce(%cf) : f32 { ^bb0(%lhs: f32, %rhs: f32): %1 = arith.addf %lhs, %rhs : f32 scf.reduce.return %1 : f32 } %2 = func.call @generate() : () -> i64 scf.reduce(%2) : i64 { ^bb0(%lhs: i64, %rhs: i64): %3 = arith.ori %lhs, %rhs : i64 scf.reduce.return %3 : i64 } } return %0#0, %0#1 : f32, i64 } func.func @unknown_op_inside_loop(%arg0: index, %arg1: index, %arg2: index) { scf.for %i = %arg0 to %arg1 step %arg2 { ""unknown.op""() : () -> () scf.yield } return } func.func @minimal_while() { %0 = ""test.make_condition""() : () -> i1 scf.while : () -> () { scf.condition(%0) } do { ""test.some_payload""() : () -> () scf.yield } return } func.func @do_while(%arg0: f32) { scf.while (%arg1 = %arg0) : (f32) -> (f32) { %0 = ""test.make_condition""() : () -> i1 scf.condition(%0) %arg1 : f32 } do { ^bb0(%arg2: f32): scf.yield %arg2 : f32 } return } func.func @while_values(%arg0: i32, %arg1: f32) { %0 = ""test.make_condition""() : () -> i1 %c0_i32 = arith.constant 0 : i32 %cst = arith.constant 0.000000e+00 : f32 %1:2 = scf.while (%arg2 = %arg0, %arg3 = %arg1) : (i32, f32) -> (i64, f64) { %2 = arith.extui %arg0 : i32 to i64 %3 = arith.extf %arg3 : f32 to f64 scf.condition(%0) %2, %3 : i64, f64 } do { ^bb0(%arg2: i64, %arg3: f64): scf.yield %c0_i32, %cst : i32, f32 } return } func.func @nested_while_ops(%arg0: f32) -> i64 { %0 = scf.while(%outer = %arg0) : (f32) -> i64 { %cond = ""test.outer_before_pre""() : () -> i1 %1 = scf.while(%inner = %outer) : (f32) -> i64 { %2:2 = ""test.inner_before""(%inner) : (f32) -> (i1, i64) scf.condition(%2#0) %2#1 : i64 } do { ^bb0(%arg1: i64): %3 = ""test.inner_after""(%arg1) : (i64) -> f32 scf.yield %3 : f32 } ""test.outer_before_post""() : () -> () scf.condition(%cond) %1 : i64 } do { ^bb2(%arg2: i64): ""test.outer_after_pre""(%arg2) : (i64) -> () %4 = scf.while(%inner = %arg2) : (i64) -> f32 { %5:2 = ""test.inner2_before""(%inner) : (i64) -> (i1, f32) scf.condition(%5#0) %5#1 : f32 } do { ^bb3(%arg3: f32): %6 = ""test.inner2_after""(%arg3) : (f32) -> i64 scf.yield %6 : i64 } ""test.outer_after_post""() : () -> () scf.yield %4 : f32 } return %0 : i64 } func.func @ifs_in_parallel(%arg1: index, %arg2: index, %arg3: index, %arg4: i1, %arg5: i1) { scf.parallel (%i) = (%arg1) to (%arg2) step (%arg3) { scf.if %arg4 { %0 = scf.if %arg5 -> (index) { %1 = ""test.if2""() : () -> index scf.yield %1 : index } else { %2 = ""test.else2""() : () -> index scf.yield %2 : index } } scf.yield } return } func.func @func_execute_region_elim_multi_yield() { ""test.foo""() : () -> () %v = scf.execute_region -> i64 { %c = ""test.cmp""() : () -> i1 cf.cond_br %c, ^bb2, ^bb3 ^bb2: %x = ""test.val1""() : () -> i64 scf.yield %x : i64 ^bb3: %y = ""test.val2""() : () -> i64 scf.yield %y : i64 } ""test.bar""(%v) : (i64) -> () return } func.func @index_switch(%i: index, %a: i32, %b: i32, %c: i32) -> i32 { %0 = scf.index_switch %i -> i32 case 0 { scf.yield %a : i32 } case 1 { scf.yield %b : i32 } default { scf.yield %c : i32 } return %0 : i32 }", mlir-opt -allow-unregistered-dialect -convert-scf-to-cf ,1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul(%arg0: memref<16x16xf16>, %arg1: memref<16x16xf16>, %arg2: memref<16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_cst(%arg0: memref<16x16xf16>, %arg1: memref<16x16xf16>, %arg2: memref<16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %cst_0 : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_broadcast(%arg0: memref<16x16xf16>, %arg1: memref<16x16xf16>, %arg2: memref<16x16xf16>, %f: f16) { %C = vector.broadcast %f : f16 to vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_loop(%arg0: memref<128x128xf16>, %arg1: memref<128x128xf16>, %arg2: memref<128x128xf16>) { %c0 = arith.constant 0 : index %c128 = arith.constant 128 : index %c32 = arith.constant 32 : index %cst = arith.constant 0.000000e+00 : f16 %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<128x128xf16>, vector<16x16xf16> %14 = scf.for %arg17 = %c0 to %c128 step %c32 iter_args(%arg18 = %C) -> (vector<16x16xf16>) { %17 = vector.transfer_read %arg0[%c0, %arg17], %cst {in_bounds = [true, true]} : memref<128x128xf16>, vector<16x16xf16> %18 = vector.transfer_read %arg1[%arg17, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<128x128xf16>, vector<16x16xf16> %19 = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %17, %18, %arg18 : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> scf.yield %19 : vector<16x16xf16> } vector.transfer_write %14, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<128x128xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_fused_elementwise(%arg0: memref<16x16xf16>, %arg1: memref<16x16xf16>, %arg2: memref<16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %cst_1 = arith.constant dense<1.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %cst_0 : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> %E = arith.addf %D, %cst_1 : vector<16x16xf16> vector.transfer_write %E, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_fused_broadcast(%arg0: memref<16x16xf16>, %arg1: memref<16x16xf16>, %arg2: memref<16x16xf16>, %arg3: memref<16x16x16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %cst_0 : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> %E = vector.transfer_read %arg3[%c0, %c0, %c0, %c0], %cst {in_bounds = [true, true], permutation_map = affine_map<(d0, d1, d2, d3)->(0, d3)>} : memref<16x16x16x16xf16>, vector<16x16xf16> %F = arith.divf %D, %E : vector<16x16xf16> vector.transfer_write %F, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_3Dmemref(%arg0: memref<2x16x16xf16>, %arg1: memref<16xf16>, %arg2: memref<2x16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<2x16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0], %cst {permutation_map = #map4, in_bounds = [true, true]} : memref<16xf16>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<2x16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<2x16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_memref_strided(%arg0: memref<2x16x16xf16, affine_map<(d0, d1, d2) -> (d0 * 512 + d1 * 32 + d2)>>, %arg1: memref<16xf16>, %arg2: memref<2x16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<2x16x16xf16, affine_map<(d0, d1, d2) -> (d0 * 512 + d1 * 32 + d2)>>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0], %cst {permutation_map = #map4, in_bounds = [true, true]} : memref<16xf16>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<2x16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<2x16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_transposed(%arg0: memref<16x16xf16>, %arg1: memref<16x16xf16>, %arg2: memref<16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map5, in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_transposed_broadcasted_1d(%arg0: memref<16xf16>, %arg1: memref<16xf16>, %arg2: memref<16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0], %cst {in_bounds = [true, true], permutation_map = affine_map<(d0) -> (d0, 0)>} : memref<16xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0], %cst {in_bounds = [true, true], permutation_map = affine_map<(d0) -> (d0, 0)>} : memref<16xf16>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_transposed_broadcasted_2d(%arg0: memref<32x32xf16>, %arg1: memref<32x32xf16>, %arg2: memref<16x16xf16>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x16xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true], permutation_map = affine_map<(d0, d1) -> (d1, 0)>} : memref<32x32xf16>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {in_bounds = [true, true], permutation_map = affine_map<(d0, d1) -> (d1, 0)>} : memref<32x32xf16>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<16x16xf16>, vector<16x16xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<16x16xf16> into vector<16x16xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xf16>, memref<16x16xf16> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_no_extend_int8(%arg0: memref<16x16xi8>, %arg1: memref<16x16xi8>, %arg2: memref<16x16xi32>) { %cst_0 = arith.constant dense<0> : vector<16x16xi8> %c0 = arith.constant 0 : index %cst_i8 = arith.constant 0 : i8 %cst_i32 = arith.constant 0 : i32 %A = vector.transfer_read %arg0[%c0, %c0], %cst_i8 {in_bounds = [true, true]} : memref<16x16xi8>, vector<16x16xi8> %B = vector.transfer_read %arg1[%c0, %c0], %cst_i8 {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xi8>, vector<16x16xi8> %C = vector.transfer_read %arg2[%c0, %c0], %cst_i32 {in_bounds = [true, true]} : memref<16x16xi32>, vector<16x16xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xi8>, vector<16x16xi8> into vector<16x16xi32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xi32>, memref<16x16xi32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_int8(%arg0: memref<16x16xi8>, %arg1: memref<16x16xi8>, %arg2: memref<16x16xi32>) { %cst_0 = arith.constant dense<0> : vector<16x16xi8> %c0 = arith.constant 0 : index %cst_i8 = arith.constant 0 : i8 %cst_i32 = arith.constant 0 : i32 %Ar = vector.transfer_read %arg0[%c0, %c0], %cst_i8 {in_bounds = [true, true]} : memref<16x16xi8>, vector<16x16xi8> %Br = vector.transfer_read %arg1[%c0, %c0], %cst_i8 {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xi8>, vector<16x16xi8> %C = vector.transfer_read %arg2[%c0, %c0], %cst_i32 {in_bounds = [true, true]} : memref<16x16xi32>, vector<16x16xi32> %Ae = arith.extsi %Ar : vector<16x16xi8> to vector<16x16xi32> %Be = arith.extsi %Br : vector<16x16xi8> to vector<16x16xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %Ae, %Be, %C : vector<16x16xi32>, vector<16x16xi32> into vector<16x16xi32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xi32>, memref<16x16xi32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_mixed_signedness_int8(%arg0: memref<16x16xi8>, %arg1: memref<16x16xi8>, %arg2: memref<16x16xi32>) { %cst_0 = arith.constant dense<0> : vector<16x16xi8> %c0 = arith.constant 0 : index %cst_i8 = arith.constant 0 : i8 %cst_i32 = arith.constant 0 : i32 %Ar = vector.transfer_read %arg0[%c0, %c0], %cst_i8 {in_bounds = [true, true]} : memref<16x16xi8>, vector<16x16xi8> %Br = vector.transfer_read %arg1[%c0, %c0], %cst_i8 {permutation_map = #map0, in_bounds = [true, true]} : memref<16x16xi8>, vector<16x16xi8> %C = vector.transfer_read %arg2[%c0, %c0], %cst_i32 {in_bounds = [true, true]} : memref<16x16xi32>, vector<16x16xi32> %Ae = arith.extui %Ar : vector<16x16xi8> to vector<16x16xi32> %Be = arith.extsi %Br : vector<16x16xi8> to vector<16x16xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %Ae, %Be, %C : vector<16x16xi32>, vector<16x16xi32> into vector<16x16xi32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xi32>, memref<16x16xi32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map4 = affine_map<(d0) -> (d0, 0)> #map5 = affine_map<(d0, d1) -> (d0, d1)> func.func @matmul_mixed_signedness_int8(%arg0: memref<16x32xi8>, %arg1: memref<16x32xi8>, %arg2: memref<16x16xi32>) { %cst_0 = arith.constant dense<0> : vector<16x16xi8> %c0 = arith.constant 0 : index %cst_i8 = arith.constant 0 : i8 %cst_i32 = arith.constant 0 : i32 %Ar = vector.transfer_read %arg0[%c0, %c0], %cst_i8 {in_bounds = [true, true]} : memref<16x32xi8>, vector<16x32xi8> %Br = vector.transfer_read %arg1[%c0, %c0], %cst_i8 {permutation_map = #map0, in_bounds = [true, true]} : memref<16x32xi8>, vector<16x32xi8> %C = vector.transfer_read %arg2[%c0, %c0], %cst_i32 {in_bounds = [true, true]} : memref<16x16xi32>, vector<16x16xi32> %Ae = arith.extui %Ar : vector<16x32xi8> to vector<16x32xi32> %Be = arith.extsi %Br : vector<16x32xi8> to vector<16x32xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %Ae, %Be, %C : vector<16x32xi32>, vector<16x32xi32> into vector<16x16xi32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x16xi32>, memref<16x16xi32> return }"," mlir-opt -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu),canonicalize)"" --split-input-file ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k32_int8_row_row_row(%arg0: memref<128x128xi8, #gpu.address_space>, %arg1: memref<128x128xi8, #gpu.address_space>, %arg2: memref<128x128xi32>) { %cst_0 = arith.constant dense<0> : vector<32x8xi8> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c17 = arith.constant 17 : index %c39 = arith.constant 39 : index %c40 = arith.constant 40 : index %c49 = arith.constant 49 : index %c50 = arith.constant 50 : index %cst = arith.constant 0 : i8 %cst0 = arith.constant 0 : i32 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<128x128xi8, #gpu.address_space>, vector<16x32xi8> %B = vector.transfer_read %arg1[%c39, %c40], %cst {in_bounds = [true, true], permutation_map = #map0} : memref<128x128xi8, #gpu.address_space>, vector<8x32xi8> %C = vector.transfer_read %arg2[%c49, %c40], %cst0 {in_bounds = [true, true]} : memref<128x128xi32>, vector<16x8xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x32xi8>, vector<8x32xi8> into vector<16x8xi32> vector.transfer_write %D, %arg2[%c49, %c40] {in_bounds = [true, true]} : vector<16x8xi32>, memref<128x128xi32> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m8n8k4_f64_row_row_row(%arg0: memref<128x128xf64>, %arg1: memref<128x128xf64>, %arg2: memref<128x128xf64>) { %cst_0 = arith.constant dense<0.0> : vector<4x8xf64> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c17 = arith.constant 17 : index %c39 = arith.constant 39 : index %c40 = arith.constant 40 : index %c49 = arith.constant 49 : index %c50 = arith.constant 50 : index %cst = arith.constant 0.0 : f64 %cst0 = arith.constant 0.0 : f64 %A = vector.transfer_read %arg0[%c1, %c1], %cst {in_bounds = [true, true]} : memref<128x128xf64>, vector<8x4xf64> %B = vector.transfer_read %arg1[%c39, %c40], %cst {in_bounds = [true, true], permutation_map = #map0} : memref<128x128xf64>, vector<8x4xf64> %C = vector.transfer_read %arg2[%c49, %c40], %cst0 {in_bounds = [true, true]} : memref<128x128xf64>, vector<8x8xf64> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<8x4xf64>, vector<8x4xf64> into vector<8x8xf64> vector.transfer_write %D, %arg2[%c49, %c40] {in_bounds = [true, true]} : vector<8x8xf64>, memref<128x128xf64> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k16_fp16_row_row_row(%arg0: memref<20x20xf16, #gpu.address_space>, %arg1: memref<20x20xf16, #gpu.address_space>, %arg2: memref<20x20xf16, #gpu.address_space>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x8xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<20x20xf16, #gpu.address_space>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<20x20xf16, #gpu.address_space>, vector<8x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<20x20xf16, #gpu.address_space>, vector<16x8xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<8x16xf16> into vector<16x8xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xf16>, memref<20x20xf16, #gpu.address_space> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n16k16_mmasync16816_fp16_f16_row_row_row(%arg0: memref<42x32xf16, #gpu.address_space>, %arg1: memref<32x64xf16, #gpu.address_space>, %arg2: memref<42x64xf16, #gpu.address_space>) { %c0 = arith.constant 0 : index %c8 = arith.constant 8 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<42x32xf16, #gpu.address_space>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<32x64xf16, #gpu.address_space>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<42x64xf16, #gpu.address_space>, vector<16x16xf16> %B0 = vector.extract_strided_slice %B {offsets = [0, 0], sizes = [8, 16], strides = [1, 1]} : vector<16x16xf16> to vector<8x16xf16> %C0 = vector.extract_strided_slice %C {offsets = [0, 0], sizes = [16, 8], strides = [1, 1]} : vector<16x16xf16> to vector<16x8xf16> %D0 = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B0, %C0 : vector<16x16xf16>, vector<8x16xf16> into vector<16x8xf16> vector.transfer_write %D0, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xf16>, memref<42x64xf16, #gpu.address_space> %B1 = vector.extract_strided_slice %B {offsets = [8, 0], sizes = [8, 16], strides = [1, 1]} : vector<16x16xf16> to vector<8x16xf16> %C1 = vector.extract_strided_slice %C {offsets = [0, 8], sizes = [16, 8], strides = [1, 1]} : vector<16x16xf16> to vector<16x8xf16> %D1 = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B1, %C1 : vector<16x16xf16>, vector<8x16xf16> into vector<16x8xf16> vector.transfer_write %D1, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xf16>, memref<42x64xf16, #gpu.address_space> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1, d2) -> (d2, d1)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> #map_a = affine_map<(d0, d1, d2, d3) -> (d1, d3)> #map_b = affine_map<(d0, d1, d2, d3) -> (d3, d2)> func.func @multi_dim_m16n8k16_fp16_row_row_row(%arg0: memref<4x32x1x32xf16, #gpu.address_space>, %arg1: memref<4x1x32x32xf16, #gpu.address_space>, %arg2: memref<1x32x40xf16, #gpu.address_space>) { %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0, %c0, %c0], %cst {in_bounds = [true, true], permutation_map = #map_a} : memref<4x32x1x32xf16, #gpu.address_space>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0, %c0, %c0], %cst {in_bounds = [true, true], permutation_map = #map_b} : memref<4x1x32x32xf16, #gpu.address_space>, vector<16x16xf16> %C = vector.transfer_read %arg2[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<1x32x40xf16, #gpu.address_space>, vector<16x16xf16> %B0 = vector.extract_strided_slice %B {offsets = [0, 0], sizes = [8, 16], strides = [1, 1]} : vector<16x16xf16> to vector<8x16xf16> %C0 = vector.extract_strided_slice %C {offsets = [0, 0], sizes = [16, 8], strides = [1, 1]} : vector<16x16xf16> to vector<16x8xf16> %D0 = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B0, %C0 : vector<16x16xf16>, vector<8x16xf16> into vector<16x8xf16> vector.transfer_write %D0, %arg2[%c0, %c0, %c0] {in_bounds = [true, true]} : vector<16x8xf16>, memref<1x32x40xf16, #gpu.address_space> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1, d2) -> (d2, d1)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @batch_m16n8k16_fp16_row_row_row(%arg0: memref<2x20x20xf16, #gpu.address_space>, %arg1: memref<2x20x20xf16, #gpu.address_space>, %arg2: memref<2x20x20xf16, #gpu.address_space>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<20x20xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<2x20x20xf16, #gpu.address_space>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0, %c0], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<2x20x20xf16, #gpu.address_space>, vector<8x16xf16> %C = vector.transfer_read %arg2[%c0, %c0, %c0], %cst {in_bounds = [true, true]} : memref<2x20x20xf16, #gpu.address_space>, vector<16x8xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<8x16xf16> into vector<16x8xf16> vector.transfer_write %D, %arg2[%c0, %c0, %c0] {in_bounds = [true, true]} : vector<16x8xf16>, memref<2x20x20xf16, #gpu.address_space> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k16_fp16_row_col_row(%arg0: memref<20x20xf16, #gpu.address_space>, %arg1: memref<20x20xf16, #gpu.address_space>, %arg2: memref<20x20xf16, #gpu.address_space>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x8xf16> %c0 = arith.constant 0 : index %cst = arith.constant 0.000000e+00 : f16 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<20x20xf16, #gpu.address_space>, vector<16x16xf16> %B = vector.transfer_read %arg1[%c0, %c0], %cst {in_bounds = [true, true]} : memref<20x20xf16, #gpu.address_space>, vector<8x16xf16> %C = vector.transfer_read %arg2[%c0, %c0], %cst {in_bounds = [true, true]} : memref<20x20xf16, #gpu.address_space>, vector<16x8xf16> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x16xf16>, vector<8x16xf16> into vector<16x8xf16> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xf16>, memref<20x20xf16, #gpu.address_space> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k4_tf32_f32_row_row_row(%arg0: memref<20x20xf32, #gpu.address_space>, %arg1: memref<20x20xf32, #gpu.address_space>, %arg2: memref<20x20xf32>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x8xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %cst = arith.constant 0.000000e+00 : f32 %A = vector.transfer_read %arg0[%c1, %c3], %cst {in_bounds = [true, true]} : memref<20x20xf32, #gpu.address_space>, vector<16x4xf32> %B = vector.transfer_read %arg1[%c3, %c3], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<20x20xf32, #gpu.address_space>, vector<8x4xf32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %cst_0 : vector<16x4xf32>, vector<8x4xf32> into vector<16x8xf32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xf32>, memref<20x20xf32> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k8_tf32_f32_row_row_row(%arg0: memref<20x20xf32, #gpu.address_space>, %arg1: memref<20x20xf32, #gpu.address_space>, %arg2: memref<20x20xf32>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x8xf32> %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c3 = arith.constant 3 : index %cst = arith.constant 0.000000e+00 : f32 %A = vector.transfer_read %arg0[%c1, %c3], %cst {in_bounds = [true, true]} : memref<20x20xf32, #gpu.address_space>, vector<16x8xf32> %B = vector.transfer_read %arg1[%c3, %c3], %cst {permutation_map = #map0, in_bounds = [true, true]} : memref<20x20xf32, #gpu.address_space>, vector<8x8xf32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %cst_0 : vector<16x8xf32>, vector<8x8xf32> into vector<16x8xf32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xf32>, memref<20x20xf32> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k8_tf32_f32_col_col_row(%arg0: memref<20x20xf32, #gpu.address_space>, %arg1: memref<20x20xf32, #gpu.address_space>, %arg2: memref<20x20xf32>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<16x8xf32> %c0 = arith.constant 0 : index %c16 = arith.constant 16 : index %c8 = arith.constant 8 : index %cst = arith.constant 0.000000e+00 : f32 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true], permutation_map = #map0} : memref<20x20xf32, #gpu.address_space>, vector<16x8xf32> %B = vector.transfer_read %arg1[%c0, %c0], %cst {in_bounds = [true, true]} : memref<20x20xf32, #gpu.address_space>, vector<8x8xf32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %cst_0 : vector<16x8xf32>, vector<8x8xf32> into vector<16x8xf32> vector.transfer_write %D, %arg2[%c16, %c8] {in_bounds = [true, true]} : vector<16x8xf32>, memref<20x20xf32> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k64_int4_row_col_row(%arg0: memref<128x128xi4, #gpu.address_space>, %arg1: memref<128x128xi4, #gpu.address_space>, %arg2: memref<128x128xi32>) { %cst = arith.constant 0 : i4 %cst0 = arith.constant 0 : i32 %cst_0 = arith.constant dense<0> : vector<32x8xi4> %c0 = arith.constant 0 : index %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<128x128xi4, #gpu.address_space>, vector<16x64xi4> %B = vector.transfer_read %arg1[%c0, %c0], %cst {in_bounds = [true, true]} : memref<128x128xi4, #gpu.address_space>, vector<8x64xi4> %C = vector.transfer_read %arg2[%c0, %c0], %cst0 {in_bounds = [true, true]} : memref<128x128xi32>, vector<16x8xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x64xi4>, vector<8x64xi4> into vector<16x8xi32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xi32>, memref<128x128xi32> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "#map0 = affine_map<(d0, d1) -> (d1, d0)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2)> #map2 = affine_map<(d0, d1, d2) -> (d1, d2)> #map3 = affine_map<(d0, d1, d2) -> (d0, d1)> func.func @m16n8k32_int8_row_col_row(%arg0: memref<128x128xi8, #gpu.address_space>, %arg1: memref<128x128xi8, #gpu.address_space>, %arg2: memref<128x128xi32>) { %cst_0 = arith.constant dense<0> : vector<32x8xi8> %c0 = arith.constant 0 : index %cst = arith.constant 0 : i8 %cst0 = arith.constant 0 : i32 %A = vector.transfer_read %arg0[%c0, %c0], %cst {in_bounds = [true, true]} : memref<128x128xi8, #gpu.address_space>, vector<16x32xi8> %B = vector.transfer_read %arg1[%c0, %c0], %cst {in_bounds = [true, true]} : memref<128x128xi8, #gpu.address_space>, vector<8x32xi8> %C = vector.transfer_read %arg2[%c0, %c0], %cst0 {in_bounds = [true, true]} : memref<128x128xi32>, vector<16x8xi32> %D = vector.contract {indexing_maps = [#map1, #map2, #map3], iterator_types = [""parallel"", ""parallel"", ""reduction""], kind = #vector.kind} %A, %B, %C : vector<16x32xi8>, vector<8x32xi8> into vector<16x8xi32> vector.transfer_write %D, %arg2[%c0, %c0] {in_bounds = [true, true]} : vector<16x8xi32>, memref<128x128xi32> return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(func.func(convert-vector-to-gpu{use-nvgpu=true}))"" ",1 "func.func @testenterdataop(%a: memref, %ifCond: i1) -> () { %0 = acc.create varPtr(%a : memref) -> memref acc.enter_data if(%ifCond) dataOperands(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @testexitdataop(%a: memref, %ifCond: i1) -> () { %0 = acc.getdeviceptr varPtr(%a : memref) -> memref acc.exit_data if(%ifCond) dataOperands(%0 : memref) acc.delete accPtr(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @testupdateop(%a: memref, %ifCond: i1) -> () { %0 = acc.update_device varPtr(%a : memref) -> memref acc.update if(%ifCond) dataOperands(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @update_true(%arg0: memref) { %true = arith.constant true %0 = acc.update_device varPtr(%arg0 : memref) -> memref acc.update if(%true) dataOperands(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @update_false(%arg0: memref) { %false = arith.constant false %0 = acc.update_device varPtr(%arg0 : memref) -> memref acc.update if(%false) dataOperands(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @enter_data_true(%d1 : memref) { %true = arith.constant true %0 = acc.create varPtr(%d1 : memref) -> memref acc.enter_data if(%true) dataOperands(%0 : memref) attributes {async} return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @enter_data_false(%d1 : memref) { %false = arith.constant false %0 = acc.create varPtr(%d1 : memref) -> memref acc.enter_data if(%false) dataOperands(%0 : memref) attributes {async} return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @exit_data_true(%d1 : memref) { %true = arith.constant true %0 = acc.getdeviceptr varPtr(%d1 : memref) -> memref acc.exit_data if(%true) dataOperands(%0 : memref) attributes {async} acc.delete accPtr(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @exit_data_false(%d1 : memref) { %false = arith.constant false %0 = acc.getdeviceptr varPtr(%d1 : memref) -> memref acc.exit_data if(%false) dataOperands(%0 : memref) attributes {async} acc.delete accPtr(%0 : memref) return }", mlir-opt -convert-openacc-to-scf -split-input-file ,1 "func.func @copy_sign_scalar(%value: f32, %sign: f32) -> f32 { %0 = math.copysign %value, %sign : f32 return %0: f32 }", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @copy_sign_vector(%value: vector<3xf16>, %sign: vector<3xf16>) -> vector<3xf16> { %0 = math.copysign %value, %sign : vector<3xf16> return %0: vector<3xf16> } }", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "func.func @copy_sign_2d_vector(%value: vector<3x3xf32>, %sign: vector<3x3xf32>) -> vector<3x3xf32> { %0 = math.copysign %value, %sign : vector<3x3xf32> return %0: vector<3x3xf32> }", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "func.func @copy_sign_tensor(%value: tensor<3x3xf32>, %sign: tensor<3x3xf32>) -> tensor<3x3xf32> { %0 = math.copysign %value, %sign : tensor<3x3xf32> return %0: tensor<3x3xf32> }", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @copy_sign_vector_0D(%value: vector<1xf16>, %sign: vector<1xf16>) -> vector<1xf16> { %0 = math.copysign %value, %sign : vector<1xf16> return %0: vector<1xf16> } }", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @float32_unary_scalar(%arg0: f32) { %0 = math.cos %arg0 : f32 %1 = math.exp %arg0 : f32 %2 = math.expm1 %arg0 : f32 %3 = math.log %arg0 : f32 %4 = math.log1p %arg0 : f32 %5 = math.roundeven %arg0 : f32 %6 = math.rsqrt %arg0 : f32 %7 = math.sqrt %arg0 : f32 %8 = math.tanh %arg0 : f32 %9 = math.sin %arg0 : f32 %10 = math.absf %arg0 : f32 %11 = math.ceil %arg0 : f32 %12 = math.floor %arg0 : f32 return } func.func @float32_unary_vector(%arg0: vector<3xf32>) { %0 = math.cos %arg0 : vector<3xf32> %1 = math.exp %arg0 : vector<3xf32> %2 = math.expm1 %arg0 : vector<3xf32> %3 = math.log %arg0 : vector<3xf32> %4 = math.log1p %arg0 : vector<3xf32> %5 = math.roundeven %arg0 : vector<3xf32> %6 = math.rsqrt %arg0 : vector<3xf32> %7 = math.sqrt %arg0 : vector<3xf32> %8 = math.tanh %arg0 : vector<3xf32> %9 = math.sin %arg0 : vector<3xf32> return } func.func @float32_ternary_scalar(%a: f32, %b: f32, %c: f32) { %0 = math.fma %a, %b, %c : f32 return } func.func @float32_ternary_vector(%a: vector<4xf32>, %b: vector<4xf32>, %c: vector<4xf32>) { %0 = math.fma %a, %b, %c : vector<4xf32> return } func.func @int_unary(%arg0: i32) { %0 = math.absi %arg0 : i32 return } func.func @ctlz_scalar(%val: i32) -> i32 { %0 = math.ctlz %val : i32 return %0 : i32 } func.func @ctlz_vector1(%val: vector<1xi32>) -> vector<1xi32> { %0 = math.ctlz %val : vector<1xi32> return %0 : vector<1xi32> } func.func @ctlz_vector2(%val: vector<2xi32>) -> vector<2xi32> { %0 = math.ctlz %val : vector<2xi32> return %0 : vector<2xi32> } func.func @powf_scalar(%lhs: f32, %rhs: f32) -> f32 { %0 = math.powf %lhs, %rhs : f32 return %0: f32 } func.func @powf_vector(%lhs: vector<4xf32>, %rhs: vector<4xf32>) -> vector<4xf32> { %0 = math.powf %lhs, %rhs : vector<4xf32> return %0: vector<4xf32> } func.func @round_scalar(%x: f32) -> f32 { %0 = math.round %x : f32 return %0: f32 } func.func @round_vector(%x: vector<4xf32>) -> vector<4xf32> { %0 = math.round %x : vector<4xf32> return %0: vector<4xf32> } } ", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @ctlz_scalar(%val: i64) -> i64 { %0 = math.ctlz %val : i64 return %0 : i64 } func.func @ctlz_vector2(%val: vector<2xi16>) -> vector<2xi16> { %0 = math.ctlz %val : vector<2xi16> return %0 : vector<2xi16> } } ", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @vector_2d(%arg0: vector<2x2xf32>) { %0 = math.cos %arg0 : vector<2x2xf32> %1 = math.exp %arg0 : vector<2x2xf32> %2 = math.absf %arg0 : vector<2x2xf32> %3 = math.ceil %arg0 : vector<2x2xf32> %4 = math.floor %arg0 : vector<2x2xf32> %5 = math.powf %arg0, %arg0 : vector<2x2xf32> return } func.func @tensor_1d(%arg0: tensor<2xf32>) { %0 = math.cos %arg0 : tensor<2xf32> %1 = math.exp %arg0 : tensor<2xf32> %2 = math.absf %arg0 : tensor<2xf32> %3 = math.ceil %arg0 : tensor<2xf32> %4 = math.floor %arg0 : tensor<2xf32> %5 = math.powf %arg0, %arg0 : tensor<2xf32> return } } ", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @float32_unary_scalar(%arg0: f32) { %0 = math.cos %arg0 : f32 %1 = math.exp %arg0 : f32 %2 = math.expm1 %arg0 : f32 %3 = math.log %arg0 : f32 %4 = math.log1p %arg0 : f32 %5 = math.roundeven %arg0 : f32 %6 = math.rsqrt %arg0 : f32 %7 = math.sqrt %arg0 : f32 %8 = math.tanh %arg0 : f32 %9 = math.sin %arg0 : f32 %10 = math.absf %arg0 : f32 %11 = math.ceil %arg0 : f32 %12 = math.floor %arg0 : f32 %13 = math.erf %arg0 : f32 %14 = math.round %arg0 : f32 return } func.func @float32_unary_vector(%arg0: vector<3xf32>) { %0 = math.cos %arg0 : vector<3xf32> %1 = math.exp %arg0 : vector<3xf32> %2 = math.expm1 %arg0 : vector<3xf32> %3 = math.log %arg0 : vector<3xf32> %4 = math.log1p %arg0 : vector<3xf32> %5 = math.roundeven %arg0 : vector<3xf32> %6 = math.rsqrt %arg0 : vector<3xf32> %7 = math.sqrt %arg0 : vector<3xf32> %8 = math.tanh %arg0 : vector<3xf32> %9 = math.sin %arg0 : vector<3xf32> return } func.func @float32_binary_scalar(%lhs: f32, %rhs: f32) { %0 = math.powf %lhs, %rhs : f32 return } func.func @float32_binary_vector(%lhs: vector<4xf32>, %rhs: vector<4xf32>) { %0 = math.powf %lhs, %rhs : vector<4xf32> return } func.func @float32_ternary_scalar(%a: f32, %b: f32, %c: f32) { %0 = math.fma %a, %b, %c : f32 return } func.func @float32_ternary_vector(%a: vector<4xf32>, %b: vector<4xf32>, %c: vector<4xf32>) { %0 = math.fma %a, %b, %c : vector<4xf32> return } func.func @int_unary(%arg0: i32) { %0 = math.absi %arg0 : i32 return } } ", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "module attributes { spirv.target_env = #spirv.target_env<#spirv.vce, #spirv.resource_limits<>> } { func.func @vector_2d(%arg0: vector<2x2xf32>) { %0 = math.cos %arg0 : vector<2x2xf32> %1 = math.exp %arg0 : vector<2x2xf32> %2 = math.absf %arg0 : vector<2x2xf32> %3 = math.ceil %arg0 : vector<2x2xf32> %4 = math.floor %arg0 : vector<2x2xf32> %5 = math.powf %arg0, %arg0 : vector<2x2xf32> return } func.func @tensor_1d(%arg0: tensor<2xf32>) { %0 = math.cos %arg0 : tensor<2xf32> %1 = math.exp %arg0 : tensor<2xf32> %2 = math.absf %arg0 : tensor<2xf32> %3 = math.ceil %arg0 : tensor<2xf32> %4 = math.floor %arg0 : tensor<2xf32> %5 = math.powf %arg0, %arg0 : tensor<2xf32> return } } ", mlir-opt -split-input-file -convert-math-to-spirv -verify-diagnostics -o - ,1 "func.func @ipowi(%arg0: i64, %arg1: i64) { %0 = math.ipowi %arg0, %arg1 : i64 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs)"" ",1 "func.func @ipowi(%arg0: i8, %arg1: i8) { %0 = math.ipowi %arg0, %arg1 : i8 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs)"" ",1 "func.func @ipowi_vec(%arg0: vector<2x3xi64>, %arg1: vector<2x3xi64>) { %0 = math.ipowi %arg0, %arg1 : vector<2x3xi64> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs)"" ",1 "func.func @fpowi32(%arg0: f64, %arg1: i32) { %0 = math.fpowi %arg0, %arg1 : f64, i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{min-width-of-fpowi-exponent=33})"" ",1 "func.func @fpowi64(%arg0: f64, %arg1: i64) { %0 = math.fpowi %arg0, %arg1 : f64, i64 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{min-width-of-fpowi-exponent=33})"" ",1 "func.func @fpowi64_vec(%arg0: vector<2x3xf32>, %arg1: vector<2x3xi64>) { %0 = math.fpowi %arg0, %arg1 : vector<2x3xf32>, vector<2x3xi64> func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{min-width-of-fpowi-exponent=33})"" ",1 "func.func @main(%arg0: i32) { %0 = math.ctlz %arg0 : i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{convert-ctlz})"" ",1 "func.func @main(%arg0: i32) { %0 = math.ctlz %arg0 : i32 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{convert-ctlz=false})"" ",1 "func.func @main(%arg0: i8) { %0 = math.ctlz %arg0 : i8 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{convert-ctlz})"" ",1 "func.func @main(%arg0: i8) { %0 = math.ctlz %arg0 : i8 func.return }"," mlir-opt -split-input-file -pass-pipeline=""builtin.module(convert-math-to-funcs{convert-ctlz=false})"" ",1 "func.func @name(%flag: i32, %pred: i1){ %c0 = arith.constant 0 : index cf.br ^bb1(%c0 : index) ^bb1(%0: index): %c1 = arith.constant 1 : i1 %c2 = arith.constant 1 : index cf.cond_br %pred, ^bb2(%c1: i1), ^bb3(%c2: index) ^bb2(%1: i1): %c3 = arith.constant 1 : i1 %c4 = arith.constant 1 : index cf.cond_br %pred, ^bb3(%c4: index), ^bb2(%c3: i1) ^bb3(%2: index): %c5 = arith.constant 1 : i1 %c6 = arith.constant 1 : index cf.switch %flag : i32, [ default: ^bb1(%c6 : index), 42: ^bb4(%c5 : i1) ] ^bb4(%3: i1): %c7 = arith.constant 1 : i1 %c8 = arith.constant 1 : index cf.switch %flag : i32, [ default: ^bb2(%c7 : i1), 41: ^bb1(%c8 : index) ] }", mlir-opt -convert-cf-to-llvm ,1 "func.func @main() { %a = arith.constant 0 : i1 cf.assert %a, ""assertion foo"" return }", mlir-opt -convert-cf-to-llvm='use-opaque-pointers=1' ,1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits< max_compute_workgroup_invocations = 128, max_compute_workgroup_size = [128, 128, 64]>> } { gpu.module @kernels { gpu.func @double(%arg0 : memref<6xi32>, %arg1 : memref<6xi32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %factor = arith.constant 2 : i32 %i0 = arith.constant 0 : index %i1 = arith.constant 1 : index %i2 = arith.constant 2 : index %i3 = arith.constant 3 : index %i4 = arith.constant 4 : index %i5 = arith.constant 5 : index %x0 = memref.load %arg0[%i0] : memref<6xi32> %x1 = memref.load %arg0[%i1] : memref<6xi32> %x2 = memref.load %arg0[%i2] : memref<6xi32> %x3 = memref.load %arg0[%i3] : memref<6xi32> %x4 = memref.load %arg0[%i4] : memref<6xi32> %x5 = memref.load %arg0[%i5] : memref<6xi32> %y0 = arith.muli %x0, %factor : i32 %y1 = arith.muli %x1, %factor : i32 %y2 = arith.muli %x2, %factor : i32 %y3 = arith.muli %x3, %factor : i32 %y4 = arith.muli %x4, %factor : i32 %y5 = arith.muli %x5, %factor : i32 memref.store %y0, %arg1[%i0] : memref<6xi32> memref.store %y1, %arg1[%i1] : memref<6xi32> memref.store %y2, %arg1[%i2] : memref<6xi32> memref.store %y3, %arg1[%i3] : memref<6xi32> memref.store %y4, %arg1[%i4] : memref<6xi32> memref.store %y5, %arg1[%i5] : memref<6xi32> gpu.return } } func.func @main() { %input = memref.alloc() : memref<6xi32> %output = memref.alloc() : memref<6xi32> %four = arith.constant 4 : i32 %zero = arith.constant 0 : i32 %input_casted = memref.cast %input : memref<6xi32> to memref %output_casted = memref.cast %output : memref<6xi32> to memref call @fillI32Buffer(%input_casted, %four) : (memref, i32) -> () call @fillI32Buffer(%output_casted, %zero) : (memref, i32) -> () %one = arith.constant 1 : index gpu.launch_func @kernels::@double blocks in (%one, %one, %one) threads in (%one, %one, %one) args(%input : memref<6xi32>, %output : memref<6xi32>) %result = memref.cast %output : memref<6xi32> to memref<*xi32> call @printMemrefI32(%result) : (memref<*xi32>) -> () return } func.func private @fillI32Buffer(%arg0 : memref, %arg1 : i32) func.func private @printMemrefI32(%ptr : memref<*xi32>) }"," mlir-spirv-cpu-runner -e main --entry-point-result=void --shared-libs=%mlir_runner_utils,%mlir_test_spirv_cpu_runner_c_wrappers ",1 "module attributes { gpu.container_module, spirv.target_env = #spirv.target_env< #spirv.vce, #spirv.resource_limits< max_compute_workgroup_invocations = 128, max_compute_workgroup_size = [128, 128, 64]>> } { gpu.module @kernels { gpu.func @sum(%arg0 : memref<3xf32>, %arg1 : memref<3x3xf32>, %arg2 : memref<3x3x3xf32>) kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi} { %i0 = arith.constant 0 : index %i1 = arith.constant 1 : index %i2 = arith.constant 2 : index %x = memref.load %arg0[%i0] : memref<3xf32> %y = memref.load %arg1[%i0, %i0] : memref<3x3xf32> %sum = arith.addf %x, %y : f32 memref.store %sum, %arg2[%i0, %i0, %i0] : memref<3x3x3xf32> memref.store %sum, %arg2[%i0, %i1, %i0] : memref<3x3x3xf32> memref.store %sum, %arg2[%i0, %i2, %i0] : memref<3x3x3xf32> memref.store %sum, %arg2[%i1, %i0, %i1] : memref<3x3x3xf32> memref.store %sum, %arg2[%i1, %i1, %i1] : memref<3x3x3xf32> memref.store %sum, %arg2[%i1, %i2, %i1] : memref<3x3x3xf32> memref.store %sum, %arg2[%i2, %i0, %i2] : memref<3x3x3xf32> memref.store %sum, %arg2[%i2, %i1, %i2] : memref<3x3x3xf32> memref.store %sum, %arg2[%i2, %i2, %i2] : memref<3x3x3xf32> gpu.return } } func.func @main() { %input1 = memref.alloc() : memref<3xf32> %input2 = memref.alloc() : memref<3x3xf32> %output = memref.alloc() : memref<3x3x3xf32> %0 = arith.constant 0.0 : f32 %3 = arith.constant 3.4 : f32 %4 = arith.constant 4.3 : f32 %input1_casted = memref.cast %input1 : memref<3xf32> to memref %input2_casted = memref.cast %input2 : memref<3x3xf32> to memref %output_casted = memref.cast %output : memref<3x3x3xf32> to memref call @fillF32Buffer1D(%input1_casted, %3) : (memref, f32) -> () call @fillF32Buffer2D(%input2_casted, %4) : (memref, f32) -> () call @fillF32Buffer3D(%output_casted, %0) : (memref, f32) -> () %one = arith.constant 1 : index gpu.launch_func @kernels::@sum blocks in (%one, %one, %one) threads in (%one, %one, %one) args(%input1 : memref<3xf32>, %input2 : memref<3x3xf32>, %output : memref<3x3x3xf32>) %result = memref.cast %output : memref<3x3x3xf32> to memref<*xf32> call @printMemrefF32(%result) : (memref<*xf32>) -> () return } func.func private @fillF32Buffer1D(%arg0 : memref, %arg1 : f32) func.func private @fillF32Buffer2D(%arg0 : memref, %arg1 : f32) func.func private @fillF32Buffer3D(%arg0 : memref, %arg1 : f32) func.func private @printMemrefF32(%arg0 : memref<*xf32>) }"," mlir-spirv-cpu-runner -e main --entry-point-result=void --shared-libs=%mlir_runner_utils,%mlir_test_spirv_cpu_runner_c_wrappers ",1 module attributes { foo.asdf = 0 : i0 } { }, mlir-opt -emit-bytecode | mlir-opt ,1 "module @TestDialectResources attributes { bytecode.test = dense_resource : tensor<2xui32>, bytecode.test2 = dense_resource : tensor<4xf64>, bytecode.test3 = dense_resource : tensor<4xf64> } {} {-# dialect_resources: { builtin: { resource: ""0x08000000010000000000000002000000000000000300000000000000"", resource_2: ""0x08000000010000000000000002000000000000000300000000000000"" } } #-}", mlir-opt -emit-bytecode | mlir-opt ,1 "func.func @map1d(%lb: index, %ub: index, %step: index) { %0:2 = ""new_processor_id_and_range""() : () -> (index, index) return }", mlir-opt -emit-bytecode -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect ,1 """bytecode.test1""() ({ ""unregistered.op""() {test_attr = #test.dynamic_singleton} : () -> () ""bytecode.empty""() : () -> () ""bytecode.attributes""() {attra = 10, attrb = #bytecode.attr} : () -> () %cst = ""bytecode.sparse""() {value = sparse<[[2, 1], [1, 1], [1, 2]], [1.0, 5.0, 6.0]> : tensor<8x7xf32>} : () -> (tensor<8x7xf32>) test.graph_region { ""bytecode.operands""(%results#0, %results#1, %results#2) : (i32, i64, i32) -> () %results:3 = ""bytecode.results""() : () -> (i32, i64, i32) } ""bytecode.branch""()[^secondBlock] : () -> () ^secondBlock(%arg1: i32 loc(unknown), %arg2: !bytecode.int, %arg3: !pdl.operation loc(unknown)): ""bytecode.regions""() ({ ""bytecode.operands""(%arg1, %arg2, %arg3) : (i32, !bytecode.int, !pdl.operation) -> () ""bytecode.return""() : () -> () }) : () -> () ""bytecode.return""() : () -> () }) : () -> ()", mlir-opt -allow-unregistered-dialect -emit-bytecode | mlir-opt -allow-unregistered-dialect ,1 "func.func @op_with_passthrough_region_args() { %0 = arith.constant 10 : index test.isolated_region %0 { ""test.consumer""(%0) : (index) -> () } %result:2 = ""test.op""() : () -> (index, index) test.isolated_region %result#1 { ""test.consumer""(%result#1) : (index) -> () } return }"," mlir-opt --pass-pipeline=""builtin.module(test-lazy-loading)"" -o %t ",1 "func.func @op_with_passthrough_region_args() { %0 = arith.constant 10 : index test.isolated_region %0 { ""test.consumer""(%0) : (index) -> () } %result:2 = ""test.op""() : () -> (index, index) test.isolated_region %result#1 { ""test.consumer""(%result#1) : (index) -> () } return }"," mlir-opt --pass-pipeline=""builtin.module(test-lazy-loading{bytecode-version=1})"" -o %t ",1 "func.func @foo() { return }"," mlir-opt -mlir-debug-counter=unique-tag-for-my-action-skip=-1 -mlir-print-debug-counter --pass-pipeline=""builtin.module(func.func(canonicalize))"" --mlir-disable-threading 2>&1 ",1 "func.func @foo() { return }"," mlir-opt -mlir-debug-counter=pass-execution-skip=1 -mlir-print-debug-counter --pass-pipeline=""builtin.module(func.func(canonicalize))"" --mlir-disable-threading 2>&1 ",1 "func.func @main() { %i0 = arith.constant 0 : index %i1 = arith.constant 1 : index %i2 = arith.constant 2 : index %i3 = arith.constant 3 : index %c0 = arith.constant 0.0 : f32 %c1 = arith.constant 1.0 : f32 %c2 = arith.constant 2.0 : f32 %c3 = arith.constant 3.0 : f32 %c4 = arith.constant 4.0 : f32 %A = memref.alloc() : memref<4xf32> linalg.fill ins(%c0 : f32) outs(%A : memref<4xf32>) %U = memref.cast %A : memref<4xf32> to memref<*xf32> call @printMemrefF32(%U): (memref<*xf32>) -> () memref.store %c1, %A[%i0]: memref<4xf32> call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () call @printMemrefF32(%U): (memref<*xf32>) -> () %outer = async.execute { memref.store %c2, %A[%i1]: memref<4xf32> func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () func.call @printMemrefF32(%U): (memref<*xf32>) -> () %noop = async.execute { func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () async.yield } %inner = async.execute [%noop] { memref.store %c3, %A[%i2]: memref<4xf32> func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () func.call @printMemrefF32(%U): (memref<*xf32>) -> () async.yield } async.await %inner : !async.token memref.store %c4, %A[%i3]: memref<4xf32> func.call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () func.call @printMemrefF32(%U): (memref<*xf32>) -> () async.yield } async.await %outer : !async.token call @mlirAsyncRuntimePrintCurrentThreadId(): () -> () call @printMemrefF32(%U): (memref<*xf32>) -> () memref.dealloc %A : memref<4xf32> return } func.func private @mlirAsyncRuntimePrintCurrentThreadId() -> () func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }"," mlir-opt -pass-pipeline=""builtin.module(async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,finalize-memref-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts)"" ",1 "func.func private @test_roundtrip_parameter_parsers(!test.type_with_format<111, three = #test, two = ""foo"">) -> !test.type_with_format<2147, two = ""hi"", three = ""hi""> attributes { attr0 = #test.attr_with_format<3 : two = ""hello"", four = [1, 2, 3] : 42 : i64 : 0 : [4, 5, 6], [10 : i16]>, attr1 = #test.attr_with_format<5 : two = ""a_string"", four = [4, 5, 6, 7, 8] : 8 : i8 : 255 : [9, 10, 11], [10 : i16]>, attr2 = #test, attr3 = #test.attr_params<42, 24>, attr4 = #test.attr_with_type>, attr5 = #test.attr_self_type_format<5> : i32, attr6 = #test.attr_self_type_struct_format : i32, attr7 = #test.custom_anchor<5>, attr8 = #test.custom_anchor<5, true>, attr9 = #test.attr_with_optional_signed<-12>, attr_10 = #test.attr_with_optional_unsigned<22> } func.func private @test_roundtrip_default_parsers_struct( !test.no_parser<255, [1, 2, 3, 4, 5], ""foobar"", 4> ) -> ( !test.struct_capture_all, !test.optional_param<, 6>, !test.optional_param<5, 6>, !test.optional_param<5, 6, ""foo"">, !test.optional_param<5, 6, {foo = ""bar""}>, !test.optional_params<""a"">, !test.optional_params<5, ""a"">, !test.optional_struct, !test.optional_struct, !test.optional_params_after<""a"">, !test.optional_params_after<""a"", 5>, !test.all_optional_params<>, !test.all_optional_params<5>, !test.all_optional_params<5, 6>, !test.all_optional_struct<>, !test.all_optional_struct, !test.all_optional_struct, !test.optional_group<(5) 6>, !test.optional_group, !test.optional_group_params, !test.optional_group_params<(5)>, !test.optional_group_params<(5, 6)>, !test.optional_group_struct, !test.optional_group_struct<(b = 5)>, !test.optional_group_struct<(b = 5, a = 10)>, !test.spaces<5 ()() 6>, !test.ap_float<5.0>, !test.ap_float<>, !test.default_valued_type<(i64)>, !test.default_valued_type<>, !test.custom_type<-5>, !test.custom_type<2 9 9 5>, !test.custom_type_spacing<1 2>, !test.custom_type_string<""foo"" foo>, !test.custom_type_string<""bar"" bar> )", mlir-opt | mlir-opt ,1 "func.func @correct_int_types_success() { ""test.int_types""() : () -> (i16, si32, ui64, i8) ""test.int_types""() : () -> (si16, si32, ui64, ui64) ""test.int_types""() : () -> (ui16, si32, ui64, si128) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @wrong_int_type_signedness_failure() { ""test.int_types""() : () -> (ui16, ui32, ui64, si8) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @wrong_int_type_signedness_failure() { ""test.int_types""() : () -> (ui16, si32, si64, ui8) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @wrong_int_type_failure() { ""test.int_types""() : () -> (f16, si32, ui64, i16) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @wrong_int_type_failure() { ""test.int_types""() : () -> (i16, si32, ui64, f64) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @complex_f64_success() { ""test.complex_f64""() : () -> (complex) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @complex_f64_tensor_success() { ""test.complex_f64_tensor""() : () -> (tensor>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @complex_f64_failure() { ""test.complex_f64""() : () -> (f64) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @tuple_success() { ""test.tuple_32_bit""() : () -> (tuple) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @tuple_mixed_success() { ""test.tuple_32_bit""() : () -> (tuple) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @tuple_empty_success() { ""test.tuple_32_bit""() : () -> (tuple<>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @tuple_wrong_type_scalar() { ""test.tuple_32_bit""() : () -> (tuple) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @tuple_wrong_type_tensor() { ""test.tuple_32_bit""() : () -> (tuple>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nested_tuple_empty_success() { ""test.nested_tuple_32_bit""() : () -> (tuple<>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nested_tuple_one_level_success() { ""test.nested_tuple_32_bit""() : () -> (tuple) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nested_tuple_multi_level_success() { ""test.nested_tuple_32_bit""() : () -> (tuple>>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nested_tuple_multi_level_mixed_success() { ""test.nested_tuple_32_bit""() : () -> (tuple>>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nested_tuple_multi_level_wrong_type() { ""test.nested_tuple_32_bit""() : () -> (tuple>>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @rank_less_than_2_I8_F32_memref_success() { ""test.rank_less_than_2_I8_F32_memref""() : () -> (memref) ""test.rank_less_than_2_I8_F32_memref""() : () -> (memref<3xi8>) ""test.rank_less_than_2_I8_F32_memref""() : () -> (memref) ""test.rank_less_than_2_I8_F32_memref""() : () -> (memref<1xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @rank_less_than_2_I8_F32_memref_bad_type() { ""test.rank_less_than_2_I8_F32_memref""() : () -> (memref) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @rank_less_than_2_I8_F32_memref_bad_rank() { ""test.rank_less_than_2_I8_F32_memref""() : () -> (memref<1x2xi8>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nd_tensor_of_success(%arg0: tensor, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi16>) { ""test.nd_tensor_of""(%arg0, %arg1, %arg2, %arg3, %arg4) : (tensor, tensor<10xf32>, tensor<20x30xi16>, tensor<40x50x60xi16>, tensor<70x80x90x100xi16>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nd_tensor_of_success_wrong_type_0d(%arg0: tensor, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi32>) { ""test.nd_tensor_of""(%arg1, %arg1, %arg2, %arg3, %arg4) : (tensor<10xf32>, tensor<10xf32>, tensor<20x30xi16>, tensor<40x50x60xi16>, tensor<70x80x90x100xi32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @nd_tensor_of_success_wrong_type_4d(%arg0: tensor, %arg1: tensor<10xf32>, %arg2: tensor<20x30xi16>, %arg3: tensor<40x50x60xi16>, %arg4: tensor<70x80x90x100xi32>) { ""test.nd_tensor_of""(%arg0, %arg1, %arg2, %arg3, %arg3) : (tensor, tensor<10xf32>, tensor<20x30xi16>, tensor<40x50x60xi16>, tensor<40x50x60xi16>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ranked_tensor_success(%arg0: tensor, %arg1: tensor<1xi32>, %arg2: tensor) { ""test.ranked_tensor_op""(%arg0) : (tensor) -> () ""test.ranked_tensor_op""(%arg1) : (tensor<1xi32>) -> () ""test.ranked_tensor_op""(%arg2) : (tensor) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ranked_tensor_success(%arg0: tensor<*xf32>) { ""test.ranked_tensor_op""(%arg0) : (tensor<*xf32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @ranked_tensor_success(%arg0: vector<2xf32>) { ""test.ranked_tensor_op""(%arg0) : (vector<2xf32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @multi_tensor_rank_of_success(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor<1xi8>, %arg4: tensor<1xi32>, %arg5: tensor<1xf32>) { ""test.multi_tensor_rank_of""(%arg0) : (tensor) -> () ""test.multi_tensor_rank_of""(%arg1) : (tensor) -> () ""test.multi_tensor_rank_of""(%arg2) : (tensor) -> () ""test.multi_tensor_rank_of""(%arg3) : (tensor<1xi8>) -> () ""test.multi_tensor_rank_of""(%arg4) : (tensor<1xi32>) -> () ""test.multi_tensor_rank_of""(%arg5) : (tensor<1xf32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @multi_tensor_rank_of_wrong_unranked_type(%arg0: tensor<2x2xi8>) { ""test.multi_tensor_rank_of""(%arg0) : (tensor<2x2xi8>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @multi_tensor_rank_of_wrong_element_type(%arg0: tensor<2xi16>) { ""test.multi_tensor_rank_of""(%arg0) : (tensor<2xi16>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fixed_element_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>, %mi32 : memref<2x3xi32>, %vf32 : vector<2xf32>) { ""test.arg_and_res_have_fixed_element_types""(%ti32, %tf32) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x i16> ""test.arg_and_res_have_fixed_element_types""(%mi32, %vf32) : (memref<2x3xi32>, vector<2xf32>) -> memref<1x2xi16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) { ""test.arg_and_res_have_fixed_element_types""(%arg0, %arg1) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x i32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @fixed_element_types(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) { ""test.arg_and_res_have_fixed_element_types""(%arg1, %arg0) : (tensor<* x f32>, tensor<* x i32>) -> tensor<* x i16> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_element_types_success(%ti32: tensor<* x i32>, %i32 : i32, %mi32 : memref<2x3xi32>) { ""test.operands_have_same_element_type""(%ti32, %ti32): (tensor<* x i32>, tensor<* x i32>) -> () ""test.operands_have_same_element_type""(%i32, %ti32): (i32, tensor<* x i32>) -> () ""test.operands_have_same_element_type""(%i32, %mi32): (i32, memref<2x3xi32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) { ""test.operands_have_same_element_type""(%arg1, %arg0): (tensor<* x f32>, tensor<* x i32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_element_types_success(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) { ""test.operand0_and_result_have_same_element_type""(%tf32, %ti32) : (tensor<* x f32>, tensor<* x i32>) -> tensor<* x f32> ""test.operand0_and_result_have_same_element_type""(%tf32, %ti32) : (tensor<* x f32>, tensor<* x i32>) -> memref<2x3xf32> ""test.operand0_and_result_have_same_element_type""(%tf32, %ti32) : (tensor<* x f32>, tensor<* x i32>) -> f32 return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_element_types_failure(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) { ""test.operand0_and_result_have_same_element_type""(%arg1, %arg0) : (tensor<* x f32>, tensor<* x i32>) -> tensor<* x i32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_types(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) { ""test.operands_have_same_type""(%ti32, %ti32) : (tensor<* x i32>, tensor<* x i32>) -> () ""test.operand0_and_result_have_same_type""(%ti32, %tf32) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x i32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_types_failure(%ti32: tensor<* x i32>, %i32: i32) { ""test.operands_have_same_type""(%ti32, %i32) : (tensor<* x i32>, i32) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_types_element_mismatch(%ti32: tensor<* x i32>, %tf32: tensor<* x f32>) { ""test.operands_have_same_type""(%ti32, %tf32) : (tensor<* x i32>, tensor<* x f32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>) { ""test.operands_have_same_type""(%arg0, %arg1) : (tensor<1x2xi32>, tensor<2x1xi32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_rank_success(%t1xi : tensor<1xi32>, %t2xf : tensor<2xf32>, %m3xi : memref<3xi32>, %t1x2xf : tensor<1x2xf32>, %t1x2xi : tensor<1x2xi32>) { ""test.operands_have_same_rank""(%t1xi, %t2xf) : (tensor<1xi32>, tensor<2xf32>) -> () ""test.operands_have_same_rank""(%t1xi, %m3xi) : (tensor<1xi32>, memref<3xi32>) -> () ""test.operand0_and_result_have_same_rank""(%t1xi, %t1x2xf) : (tensor<1xi32>, tensor<1x2xf32>) -> (tensor<3xf32>) ""test.operand0_and_result_have_same_rank""(%t1x2xi, %t1x2xf) : (tensor<1x2xi32>, tensor<1x2xf32>) -> (tensor<3x3xf64>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) { ""test.operands_have_same_rank""(%arg0, %arg1) : (tensor<1xi32>, tensor<1x2xf32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_rank_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) { ""test.operand0_and_result_have_same_rank""(%arg0, %arg1) : (tensor<1xi32>, tensor<1x2xf32>) -> (tensor) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_rank_failure(%arg0: tensor<1x2xi32>, %arg1: tensor<1x2xf32>) { ""test.operand0_and_result_have_same_rank""(%arg0, %arg1) : (tensor<1x2xi32>, tensor<1x2xf32>) -> (tensor<3xi32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_shape_success(%t2x3: tensor<2x3xi32>, %m2x3: memref<2x3xf32>, %v2x3 : vector<2x3xi32>, %t4x5 : tensor<4x5xi32>) { ""test.operand0_and_result_have_same_shape""(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (tensor<2x3xf32>) ""test.operand0_and_result_have_same_shape""(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (memref<2x3xf32>) ""test.operand0_and_result_have_same_shape""(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (vector<2x3xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_shape_failure(%t2x3: tensor<2x3xi32>, %t4x5 : tensor<4x5xi32>) { ""test.operand0_and_result_have_same_shape""(%t2x3, %t4x5) : (tensor<2x3xi32>, tensor<4x5xi32>) -> (tensor<1x3xf32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_element_count_success(%arg0: tensor<36xi32>, %arg1: tensor<1x2xf32>, %arg3: tensor) { ""test.operand0_and_result_have_same_element_count""(%arg0, %arg1) : (tensor<36xi32>, tensor<1x2xf32>) -> (tensor<3x4x3xf32>) ""test.operand0_and_result_have_same_element_count""(%arg0, %arg1) : (tensor<36xi32>, tensor<1x2xf32>) -> (tensor<3x12xf64>) ""test.operand0_and_result_have_same_element_count""(%arg3, %arg1) : (tensor, tensor<1x2xf32>) -> (memref<1x1x1xi32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_element_count_failure(%arg0: tensor<1xi32>, %arg1: tensor<1x2xf32>) { ""test.operand0_and_result_have_same_element_count""(%arg0, %arg1) : (tensor<1xi32>, tensor<1x2xf32>) -> (tensor<2xi32>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @four_equals_five() { ""test.four_equals_five""() : () -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @operand_rank_equals_result_size_success(%arg : tensor<1x2x3x4xi32>) { ""test.operand_rank_equals_result_size""(%arg) : (tensor<1x2x3x4xi32>) -> tensor<4xi32> ""test.operand_rank_equals_result_size""(%arg) : (tensor<1x2x3x4xi32>) -> memref<2x2xf32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @operand_rank_equals_result_size_failure(%arg : tensor<1x2x3x4xi32>) { ""test.operand_rank_equals_result_size""(%arg) : (tensor<1x2x3x4xi32>) -> tensor<2xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_types_element_mismatch(%arg0: tensor<* x i32>, %arg1: tensor<* x f32>) { ""test.operand0_and_result_have_same_type""(%arg0, %arg1) : (tensor<* x i32>, tensor<* x f32>) -> tensor<* x f32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @same_types_shape_mismatch(%arg0: tensor<1x2xi32>, %arg1: tensor<2x1xi32>) { ""test.operand0_and_result_have_same_type""(%arg0, %arg1) : (tensor<1x2xi32>, tensor<2x1xi32>) -> tensor<2x1xi32> return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @does_not_have_i32(%arg0: tensor<1x2xi32>, %arg1: none) { ""test.if_first_operand_is_none_then_so_is_second""(%arg1, %arg0) : (none, tensor<1x2xi32>) -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @does_not_have_static_memref(%arg0: memref) { ""test.takes_static_memref""(%arg0) : (memref) -> () }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @elements_attr_not_i32_f32() { ""test.i32ElementsAttr""() {attr = dense<[1.0, 20.0]>:tensor<2xf32>} : () -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @elements_attr_not_i32_i64() { ""test.i32ElementsAttr""() {attr = dense<[1, 20]>:tensor<2xi64>} : () -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @elements_attr_i32(%arg0: tensor<1x2xi32>) { ""test.i32ElementsAttr""() {attr = dense<[1, 2]>:tensor<2xi32>} : () -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @elements_attr_index() { ""test.indexElementsAttr""() {attr = dense<[1, 2]>:tensor<2xindex>} : () -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @elements_attr_not_index() { ""test.indexElementsAttr""() {attr = dense<[1, 2]>:tensor<2xi32>} : () -> () return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @struct_success() { ""test.simple_struct""() : () -> (!test.struct<{a, i32}, {b, f64}>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @struct_with_field_names_like_types() { ""test.struct_with_field_names_like_types""() : () -> (!test.struct<{i32, i32}, {f64, f64}>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "func.func @struct_bad_keywords() { ""test.struct_bad_keywords""() : () -> (!test.struct<{42, i32}>) return }", mlir-opt -split-input-file -verify-diagnostics ,1 "%i64 = ""foo.op""() : () -> (i64) %i32 = ""foo.op""() : () -> (i32) %memref = ""foo.op""() : () -> (memref<1xf64>) test.format_literal_op keyword_$. -> :, = <> () []( ) ? + * { } {foo.some_attr} test.format_attr_op 10 test.format_opt_attr_op_a(10) test.format_opt_attr_op_a test.format_opt_attr_op_b 10 test.format_opt_attr_op_b test.format_symbol_name_attr_op @name test.format_symbol_name_attr_op @opt_name test.format_opt_symbol_name_attr_op test.format_opt_symbol_ref_attr_op @foo {test.unit} test.format_opt_symbol_ref_attr_op {test.unit} test.format_attr_dict_w_keyword attributes {attr = 10 : i64} test.format_attr_dict_w_keyword attributes {attr = 10 : i64, opt_attr = 10 : i64} %ignored = test.format_buildable_type_op %i64 test.format_region_a_op { ""test.return""() : () -> () } test.format_region_b_op { ""test.return""() : () -> () } test.format_region_c_op region { ""test.return""() : () -> () } test.format_region_c_op test.format_variadic_region_a_op { ""test.return""() : () -> () }, { ""test.return""() : () -> () } test.format_variadic_region_b_op { ""test.return""() : () -> () }, { ""test.return""() : () -> () } found_regions test.format_variadic_region_b_op test.format_implicit_terminator_region_a_op { ""test.return""() : () -> () } test.format_implicit_terminator_region_a_op { ""test.return""() {foo.attr} : () -> () } test.format_implicit_terminator_region_a_op { ""test.return""(%i64) : (i64) -> () } %ignored_a:2 = test.format_result_a_op memref<1xf64> %ignored_b:2 = test.format_result_b_op i64, memref<1xf64> %ignored_c:2 = test.format_result_c_op (i64) -> memref<1xf64> %ignored_v:3 = test.format_variadic_result : i64, i64, i64 %ignored_mv:5 = test.format_multiple_variadic_results : (i64, i64, i64), (i32, i32) test.format_operand_a_op %i64, %memref : i64, memref<1xf64> test.format_operand_b_op %i64, %memref : memref<1xf64> test.format_operand_c_op %i64, %memref : i64, memref<1xf64> test.format_operand_d_op %i64, %memref : memref<1xf64> test.format_operand_e_op %i64, %memref : i64, memref<1xf64> test.format_variadic_operand %i64, %i64, %i64 : i64, i64, i64 test.format_variadic_of_variadic_operand (%i64, %i64), (), (%i64) : (i64, i64), (), (i64) test.format_multiple_variadic_operands (%i64, %i64, %i64), (%i64, %i32 : i64, i32) ""foo.successor_test_region""() ({ ^bb0: test.format_successor_a_op ^bb1 {attr} ^bb1: test.format_successor_a_op ^bb1, ^bb2 {attr} ^bb2: test.format_successor_a_op {attr} }) { arg_names = [""i"", ""j"", ""k""] } : () -> () test.format_optional_unit_attribute is_optional test.format_optional_unit_attribute test.format_optional_unit_attribute_no_elide unit test.format_optional_enum_attr case5 test.format_optional_enum_attr test.format_optional_default_attrs ""foo"" @foo case10 test.format_optional_default_attrs ""default"" @default case5 test.format_optional_operand_result_a_op(%i64 : i64) : i64 test.format_optional_operand_result_a_op( : ) : i64 test.format_optional_operand_result_a_op(%i64 : i64) : test.format_optional_operand_result_a_op(%i64 : i64) : [%i64, %i64] test.format_optional_operand_result_b_op(%i64 : i64) : i64 test.format_optional_operand_result_b_op( : ) : i64 test.format_optional_operand_result_b_op : i64 test.format_optional_result_a_op test.format_optional_result_a_op : i64 -> i64, i64 test.format_optional_result_b_op test.format_optional_result_b_op : i64 -> i64, i64 test.format_optional_result_c_op : (i64) -> (i64, i64) test.format_optional_else then test.format_optional_else else test.format_compound_attr <1, !test.smpla, [5, 6]> module attributes {test.nested = #test.cmpnd_nested>} { } module attributes {test.nested = #test.cmpnd_nested>} { } test.format_nested_attr #test.cmpnd_nested> test.format_nested_attr #test.cmpnd_nested> module attributes {test.someAttr = #test.cmpnd_nested_inner<42 <1, !test.smpla, [5, 6]>>} { } module attributes {test.someAttr = #test.cmpnd_nested_outer>>} { } test.format_cpmd_nested_attr nested >> test.format_qual_cpmd_nested_attr nested #test.cmpnd_nested_outer>> func.func @qualifiedCompoundNestedExplicit(%arg0: !test.cmpnd_nested_outer>>) -> () { test.format_qual_cpmd_nested_type %arg0 nested !test.cmpnd_nested_outer>> return } test.format_custom_directive_operands %i64, %i64 -> (%i64) test.format_custom_directive_operands %i64 -> (%i64) test.format_custom_directive_operands_and_types %i64, %i64 -> (%i64) : i64, i64 -> (i64) test.format_custom_directive_operands_and_types %i64 -> (%i64) : i64 -> (i64) test.format_custom_directive_attributes 54 : i64 test.format_custom_directive_attributes 54 : i64, 46 : i64 test.format_custom_directive_regions { ""test.return""() : () -> () } test.format_custom_directive_regions { ""test.return""() : () -> () }, { ""test.return""() : () -> () } test.format_custom_directive_results : i64, i64 -> (i64) test.format_custom_directive_results : i64 -> (i64) test.format_custom_directive_results_with_type_refs : i64, i64 -> (i64) type_refs_capture : i64, i64 -> (i64) test.format_custom_directive_results_with_type_refs : i64 -> (i64) type_refs_capture : i64 -> (i64) test.format_custom_directive_with_optional_operand_ref %i64 : 1 test.format_custom_directive_with_optional_operand_ref : 0 func.func @foo() { test.format_custom_directive_successors ^bb1, ^bb2 ^bb1: test.format_custom_directive_successors ^bb2 ^bb2: return } test.format_custom_directive_spacing ""a"" ""b"" test.format_literal_following_optional_group(5 : i32) : i32 {a} func.func @variadic(%a: i32) { test.ellipsis(%a ...) : i32 ... return } test.format_infer_variadic_type_from_non_variadic %i64, %i64 : i64 %ignored_res1 = test.format_all_types_match_var %i64, %i64 : i64 %ignored_res2 = test.format_all_types_match_attr 1 : i64, %i64 %ignored_res3 = test.format_types_match_var %i64 : i64 %ignored_res4:3 = test.format_types_match_variadic %i64, %i64, %i64 : i64, i64, i64 %ignored_res5 = test.format_types_match_attr 1 : i64 %ignored_res6 = test.format_types_match_context %i64 : i64 %ignored_res7a = test.format_infer_type %ignored_res7b = test.format_infer_type2 %ignored_res8:2 = test.format_infer_type_all_operands_and_types(%i64, %i32) : i64, i32 %ignored_res9:2 = test.format_infer_type_all_types_one_operand(%i64, %i32) : i64, i32 %ignored_res10:4 = test.format_infer_type_all_types_two_operands(%i64, %i32) (%i64, %i32) : i64, i32, i64, i32 %ignored_res11:2 = test.format_infer_type_all_types(%i64, %i32) : i64, i32 %ignored_res12:2 = test.format_infer_type_regions { ^bb0(%arg0: i32, %arg1: f32): ""test.terminator""() : () -> () } %ignored_res13:4 = test.format_infer_type_variadic_operands(%i32, %i32 : i32, i32) (%i64, %i64 : i64, i64) test.has_str_value {} func.func @else_anchor_op(%a: !test.else_anchor, %b: !test.else_anchor<5>) { test.else_anchor(?) {a = !test.else_anchor_struct} test.else_anchor(%a : !test.else_anchor) {a = !test.else_anchor_struct} test.else_anchor(%b : !test.else_anchor<5>) {a = !test.else_anchor_struct} return }", mlir-opt -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect -verify-diagnostics ,1 "func.func @testSingleInvolution(%arg0 : i32) -> i32 { %0 = ""test.op_involution_trait_no_operation_fold""(%arg0) : (i32) -> i32 return %0: i32 } func.func @testDoubleInvolution(%arg0: i32) -> i32 { %0 = ""test.op_involution_trait_no_operation_fold""(%arg0) : (i32) -> i32 %1 = ""test.op_involution_trait_no_operation_fold""(%0) : (i32) -> i32 return %1: i32 } func.func @testTripleInvolution(%arg0: i32) -> i32 { %0 = ""test.op_involution_trait_no_operation_fold""(%arg0) : (i32) -> i32 %1 = ""test.op_involution_trait_no_operation_fold""(%0) : (i32) -> i32 %2 = ""test.op_involution_trait_no_operation_fold""(%1) : (i32) -> i32 return %2: i32 } func.func @testFailingOperationFolder(%arg0: i32) -> i32 { %0 = ""test.op_involution_trait_failing_operation_fold""(%arg0) : (i32) -> i32 %1 = ""test.op_involution_trait_failing_operation_fold""(%0) : (i32) -> i32 return %1: i32 } func.func @testInhibitInvolution(%arg0: i32) -> i32 { %0 = ""test.op_involution_trait_succesful_operation_fold""(%arg0) : (i32) -> i32 %1 = ""test.op_involution_trait_succesful_operation_fold""(%0) : (i32) -> i32 return %1: i32 } func.func @testSingleIdempotent(%arg0 : i32) -> i32 { %0 = ""test.op_idempotent_trait""(%arg0) : (i32) -> i32 return %0: i32 } func.func @testDoubleIdempotent(%arg0: i32) -> i32 { %0 = ""test.op_idempotent_trait""(%arg0) : (i32) -> i32 %1 = ""test.op_idempotent_trait""(%0) : (i32) -> i32 return %1: i32 } func.func @testTripleIdempotent(%arg0: i32) -> i32 { %0 = ""test.op_idempotent_trait""(%arg0) : (i32) -> i32 %1 = ""test.op_idempotent_trait""(%0) : (i32) -> i32 %2 = ""test.op_idempotent_trait""(%1) : (i32) -> i32 return %2: i32 } func.func @testBinaryIdempotent(%arg0 : i32) -> i32 { %0 = ""test.op_idempotent_trait_binary""(%arg0, %arg0) : (i32, i32) -> i32 return %0: i32 }", mlir-opt -test-trait-folder ,1 "func.func @verifyDerivedAttributes() { %0 = ""test.derived_type_attr""() : () -> tensor<10xf32> %1 = ""test.derived_type_attr""() : () -> tensor<12xi79> %2 = ""test.derived_type_attr""() : () -> tensor<12xcomplex> return }", mlir-opt -test-derived-attr -verify-diagnostics ,1 "func.func private @compoundA() attributes {foo = #test.cmpnd_a<1, !test.smpla, [5, 6]>} %a = test.result_has_same_type_as_attr #test.attr_with_self_type_param : i32 -> i32 %b = test.result_has_same_type_as_attr #test -> i16 func.func private @qualifiedAttr() attributes {foo = #test.cmpnd_nested_outer_qual>>} func.func private @overriddenAttr() attributes { foo = #test.override_builder<5> }", mlir-opt | mlir-opt -verify-diagnostics ,1 "func.func @simpleA(%A : !test.smpla) -> () { return } func.func @compoundA(%A : !test.cmpnd_a<1, !test.smpla, [5, 6]>)-> () { return } func.func @compoundNested(%arg0: !test.cmpnd_nested_outer>>) -> () { return } func.func @compoundNestedExplicit(%arg0: !test.cmpnd_nested_outer>>) -> () { test.format_cpmd_nested_type %arg0 nested !test.cmpnd_nested_outer>> test.format_cpmd_nested_type %arg0 nested >> return } func.func private @compoundNestedQual(%arg0: !test.cmpnd_nested_outer_qual>>) -> () func.func @testInt(%A : !test.int, %B : !test.int, %C : !test.int) { return } func.func @structTest (%A : !test.struct< {field1, !test.smpla}, {field2, !test.int} > ) { return }", mlir-opt | mlir-opt -verify-diagnostics ,1 "func.func @testCreateFunctions(%arg0 : tensor<10xf32, !test.smpla>, %arg1 : tensor<20xi32>) { %good = ""test.no_attributes""(%arg0, %arg0) : (tensor<10xf32, !test.smpla>, tensor<10xf32, !test.smpla>) -> tensor<10xf32, !test.smpla> return }", mlir-opt -test-return-type -split-input-file -verify-diagnostics ,1 "func.func @testReturnTypeOpInterface(%arg0 : tensor<10xf32>) { %bad = ""test.op_with_infer_type_if""(%arg0, %arg0) : (tensor<10xf32>, tensor<10xf32>) -> tensor<*xf32> return }", mlir-opt -test-return-type -split-input-file -verify-diagnostics ,1 "func.func @testReturnTypeOpInterfaceMismatch(%arg0 : tensor<10xf32>, %arg1 : tensor<20xf32>) { %bad = ""test.op_with_infer_type_if""(%arg0, %arg1) : (tensor<10xf32>, tensor<20xf32>) -> tensor<*xf32> return }", mlir-opt -test-return-type -split-input-file -verify-diagnostics ,1 "func.func @testReturnTypeOpInterface(%arg0 : tensor<10xf32>) { %bad = ""test.op_with_refine_type_if""(%arg0, %arg0) : (tensor<10xf32>, tensor<10xf32>) -> tensor<*xf32> return }", mlir-opt -test-return-type -split-input-file -verify-diagnostics ,1 "func.func @testReifyFunctions(%arg0 : tensor<10xf32>, %arg1 : tensor<20xf32>) { %0 = ""test.op_with_shaped_type_infer_type_if""(%arg0, %arg1) : (tensor<10xf32>, tensor<20xf32>) -> tensor<10xi17> %1 = ""test.op_with_shaped_type_infer_type_if""(%arg1, %arg0) : (tensor<20xf32>, tensor<10xf32>) -> tensor<20xi17> return }", mlir-opt -test-return-type -split-input-file -verify-diagnostics ,1 "func.func @verifyFusedLocs(%arg0 : i32) -> i32 { %0 = ""test.op_a""(%arg0) {attr = 10 : i32} : (i32) -> i32 loc(""a"") %result = ""test.op_a""(%0) {attr = 20 : i32} : (i32) -> i32 loc(""b"") return %result : i32 } func.func @verifyDesignatedLoc(%arg0 : i32) -> i32 { %0 = ""test.loc_src""(%arg0) : (i32) -> i32 loc(""loc3"") %1 = ""test.loc_src""(%0) : (i32) -> i32 loc(""loc2"") %2 = ""test.loc_src""(%1) : (i32) -> i32 loc(""loc1"") ""test.loc_src_no_res""(%2) : (i32) -> () loc(""loc4"") return %1 : i32 } func.func @verifyZeroResult(%arg0 : i32) { ""test.op_h""(%arg0) : (i32) -> () return } func.func @verifyZeroArg() -> i32 { %0 = ""test.op_j""() : () -> i32 return %0 : i32 } func.func @testIgnoreArgMatch(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: f32) { ""test.ignore_arg_match_src""(%arg0, %arg1, %arg2) {d = 42, e = 24, f = 15} : (i32, i32, i32) -> () ""test.ignore_arg_match_src""(%arg0, %arg1, %arg3) {d = 42, e = 24, f = 15} : (i32, i32, f32) -> () ""test.ignore_arg_match_src""(%arg0, %arg1, %arg2) {d = 42 : i32, e = 24, f = 15} : (i32, i32, i32) -> () return } func.func @verifyInterleavedOperandAttribute(%arg0: i32, %arg1: i32) { ""test.interleaved_operand_attr1""(%arg0, %arg1) {attr1 = 15, attr2 = 42} : (i32, i32) -> () return } func.func @verifyBenefit(%arg0 : i32) -> i32 { %0 = ""test.op_d""(%arg0) : (i32) -> i32 %1 = ""test.op_g""(%arg0) : (i32) -> i32 %2 = ""test.op_g""(%1) : (i32) -> i32 return %0 : i32 } func.func @verifyNativeCodeCall(%arg0: i32, %arg1: i32) -> (i32, i32) { %0 = ""test.native_code_call1""(%arg0, %arg1) {choice = true, attr1 = 42, attr2 = 24} : (i32, i32) -> (i32) %1 = ""test.native_code_call1""(%arg0, %arg1) {choice = false, attr1 = 42, attr2 = 24} : (i32, i32) -> (i32) return %0, %1: i32, i32 } func.func @verifyAuxiliaryNativeCodeCall(%arg0: i32) -> (i32) { %0 = ""test.native_code_call3""(%arg0) : (i32) -> (i32) return %0 : i32 } func.func @verifyNativeCodeCallBinding(%arg0 : i32) -> (i32) { %0 = ""test.op_k""() : () -> (i32) %1, %2 = ""test.native_code_call4""(%0) : (i32) -> (i32, i32) %3 = ""test.constant""() {value = 1 : i8} : () -> i8 %4, %5 = ""test.native_code_call4""(%3) : (i8) -> (i32, i32) return %1 : i32 } func.func @verifyMultipleNativeCodeCallBinding(%arg0 : i32) -> (i32) { %0 = ""test.op_k""() : () -> (i32) %1 = ""test.op_k""() : () -> (i32) %2, %3 = ""test.native_code_call6""(%0, %1) : (i32, i32) -> (i32, i32) return %2 : i32 } func.func @verifyAllAttrConstraintOf() -> (i32, i32, i32) { %0 = ""test.all_attr_constraint_of1""() {attr = [0, 1]} : () -> (i32) %1 = ""test.all_attr_constraint_of1""() {attr = [0, 2]} : () -> (i32) %2 = ""test.all_attr_constraint_of1""() {attr = [-1, 1]} : () -> (i32) return %0, %1, %2: i32, i32, i32 } func.func @verifyManyArgs(%arg: i32) { ""test.many_arguments""(%arg, %arg, %arg, %arg, %arg, %arg, %arg, %arg, %arg) { attr1 = 42, attr2 = 42, attr3 = 42, attr4 = 42, attr5 = 42, attr6 = 42, attr7 = 42, attr8 = 42, attr9 = 42 } : (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> () return } func.func @verifyEqualArgs(%arg0: i32, %arg1: i32) { ""test.op_n""(%arg0, %arg0) : (i32, i32) -> (i32) ""test.op_n""(%arg0, %arg1) : (i32, i32) -> (i32) return } func.func @verifyNestedOpEqualArgs( %arg0: i32, %arg1: i32, %arg2 : i32, %arg3 : i32, %arg4 : i32, %arg5 : i32) { %0 = ""test.op_p""(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) : (i32, i32, i32, i32, i32, i32) -> (i32) %1 = ""test.op_n""(%arg1, %0) : (i32, i32) -> (i32) %2 = ""test.op_p""(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) : (i32, i32, i32, i32, i32, i32) -> (i32) %3 = ""test.op_n""(%arg0, %2) : (i32, i32) -> (i32) return } func.func @verifyNestedSameOpAndSameArgEquality(%arg0: i32, %arg1: i32) -> i32 { %0 = ""test.op_n""(%arg1, %arg0) : (i32, i32) -> (i32) %1 = ""test.op_n""(%0, %arg0) : (i32, i32) -> (i32) return %1 : i32 } func.func @verifyMultipleEqualArgs( %arg0: i32, %arg1 : i32, %arg2 : i32, %arg3 : i32, %arg4 : i32) { ""test.op_p""(%arg0, %arg1, %arg0, %arg0, %arg1, %arg2) : (i32, i32, i32, i32 , i32, i32) -> i32 ""test.op_p""(%arg0, %arg1, %arg0, %arg0, %arg0, %arg2) : (i32, i32, i32, i32 , i32, i32) -> i32 ""test.op_p""(%arg0, %arg1, %arg1, %arg0, %arg1, %arg2) : (i32, i32, i32, i32 , i32, i32) -> i32 ""test.op_p""(%arg0, %arg1, %arg2, %arg2, %arg3, %arg4) : (i32, i32, i32, i32 , i32, i32) -> i32 return } func.func @symbolBinding(%arg0: i32) -> i32 { %0 = ""test.symbol_binding_a""(%arg0) {attr = 42} : (i32) -> (i32) %1 = ""test.symbol_binding_a""(%arg0) {attr = 42} : (i32) -> (i32) return %0: i32 } func.func @symbolBindingNoResult(%arg0: i32) { ""test.symbol_binding_no_result""(%arg0) : (i32) -> () return } func.func @succeedMatchOpAttr() -> i32 { %0 = ""test.match_op_attribute1""() {required_attr = 1: i32, optional_attr = 2: i32, default_valued_attr = 3: i32, more_attr = 4: i32} : () -> (i32) return %0: i32 } func.func @succeedMatchMissingOptionalAttr() -> i32 { %0 = ""test.match_op_attribute1""() {required_attr = 1: i32, default_valued_attr = 3: i32, more_attr = 4: i32} : () -> (i32) return %0: i32 } func.func @succeedMatchMissingDefaultValuedAttr() -> i32 { %0 = ""test.match_op_attribute1""() {required_attr = 1: i32, optional_attr = 2: i32, more_attr = 4: i32} : () -> (i32) return %0: i32 } func.func @failedMatchAdditionalConstraintNotSatisfied() -> i32 { %0 = ""test.match_op_attribute1""() {required_attr = 1: i32, optional_attr = 2: i32, more_attr = 5: i32} : () -> (i32) return %0: i32 } func.func @verifyConstantAttr(%arg0 : i32) -> i32 { %0 = ""test.op_c""(%arg0) : (i32) -> i32 loc(""a"") return %0 : i32 } func.func @verifyUnitAttr() -> (i32, i32) { %0 = ""test.match_op_attribute3""() {attr} : () -> i32 %1 = ""test.match_op_attribute3""() : () -> i32 return %0, %1 : i32, i32 } func.func @testConstOp() -> (i32) { %0 = ""test.constant""() {value = 1 : i32} : () -> i32 return %0 : i32 } func.func @testConstOpUsed() -> (i32) { %0 = ""test.constant""() {value = 1 : i32} : () -> i32 %1 = ""test.op_s""(%0) {value = 1 : i32} : (i32) -> i32 return %1 : i32 } func.func @testConstOpReplaced() -> (i32) { %0 = ""test.constant""() {value = 1 : i32} : () -> i32 %1 = ""test.constant""() {value = 2 : i32} : () -> i32 %2 = ""test.op_r""(%0, %1) : (i32, i32) -> i32 return %2 : i32 } func.func @testConstOpMatchFailure() -> (i64) { %0 = ""test.constant""() {value = 1 : i64} : () -> i64 %1 = ""test.constant""() {value = 2 : i64} : () -> i64 %2 = ""test.op_r""(%0, %1) : (i64, i64) -> i64 return %2 : i64 } func.func @testConstOpMatchNonConst(%arg0 : i32) -> (i32) { %0 = ""test.constant""() {value = 1 : i32} : () -> i32 %1 = ""test.op_r""(%0, %arg0) : (i32, i32) -> i32 return %1 : i32 } func.func @verifyI32EnumAttr() -> i32 { %0 = ""test.i32_enum_attr""() {attr = 5: i32} : () -> i32 return %0 : i32 } func.func @verifyI64EnumAttr() -> i32 { %0 = ""test.i64_enum_attr""() {attr = 5: i64} : () -> i32 return %0 : i32 } func.func @rewrite_i32elementsattr() -> () { ""test.i32ElementsAttr""() {attr = dense<[3, 5]>:tensor<2xi32>} : () -> () return } func.func @rewrite_f64elementsattr() -> () { ""test.float_elements_attr""() { scalar_f32_attr = dense<[3.0, 4.0]> : tensor<2xf32>, tensor_f64_attr = dense<6.0> : tensor<4x8xf64> } : () -> () ""test.float_elements_attr""() { scalar_f32_attr = dense<7.0> : tensor<2xf32>, tensor_f64_attr = dense<3.0> : tensor<4x8xf64> } : () -> () return } func.func @useMultiResultOpToReplaceWhole() -> (i32, f32, f32) { %0:3 = ""test.three_result""() {kind = 1} : () -> (i32, f32, f32) return %0#0, %0#1, %0#2 : i32, f32, f32 } func.func @useMultiResultOpToReplacePartial1() -> (i32, f32, f32) { %0:3 = ""test.three_result""() {kind = 2} : () -> (i32, f32, f32) return %0#0, %0#1, %0#2 : i32, f32, f32 } func.func @useMultiResultOpToReplacePartial2() -> (i32, f32, f32) { %0:3 = ""test.three_result""() {kind = 3} : () -> (i32, f32, f32) return %0#0, %0#1, %0#2 : i32, f32, f32 } func.func @useMultiResultOpResultsSeparately() -> (i32, f32, f32) { %0:3 = ""test.three_result""() {kind = 4} : () -> (i32, f32, f32) return %0#0, %0#1, %0#2 : i32, f32, f32 } func.func @constraintOnSourceOpResult() -> (i32, f32, i32) { %0:2 = ""test.two_result""() {kind = 5} : () -> (i32, f32) %1:2 = ""test.two_result""() {kind = 5} : () -> (i32, f32) return %0#0, %0#1, %1#0 : i32, f32, i32 } func.func @useAuxiliaryOpToReplaceMultiResultOp() -> (i32, f32, f32) { %0:3 = ""test.three_result""() {kind = 6} : () -> (i32, f32, f32) return %0#0, %0#1, %0#2 : i32, f32, f32 } func.func @replaceOneVariadicOutOneVariadicInOp(%arg0: i32, %arg1: i32, %arg2: i32) -> (i32, i32, i32, i32, i32, i32) { %0 = ""test.one_variadic_out_one_variadic_in1""(%arg0) : (i32) -> (i32) %1:2 = ""test.one_variadic_out_one_variadic_in1""(%arg0, %arg1) : (i32, i32) -> (i32, i32) %2:3 = ""test.one_variadic_out_one_variadic_in1""(%arg0, %arg1, %arg2) : (i32, i32, i32) -> (i32, i32, i32) return %0, %1#0, %1#1, %2#0, %2#1, %2#2 : i32, i32, i32, i32, i32, i32 } func.func @replaceMixedVariadicInputOp(%arg0: i32, %arg1: f32, %arg2: i32) -> () { ""test.mixed_variadic_in1""(%arg1) : (f32) -> () ""test.mixed_variadic_in1""(%arg0, %arg1, %arg2) : (i32, f32, i32) -> () ""test.mixed_variadic_in1""(%arg0, %arg0, %arg1, %arg2, %arg2) : (i32, i32, f32, i32, i32) -> () return } func.func @replaceMixedVariadicOutputOp() -> (f32, i32, f32, i32, i32, i32, f32, i32, i32) { %0 = ""test.mixed_variadic_out1""() : () -> (f32) %1:3 = ""test.mixed_variadic_out1""() : () -> (i32, f32, i32) %2:5 = ""test.mixed_variadic_out1""() : () -> (i32, i32, f32, i32, i32) return %0, %1#0, %1#1, %1#2, %2#0, %2#1, %2#2, %2#3, %2#4 : f32, i32, f32, i32, i32, i32, f32, i32, i32 } func.func @generateVariadicOutputOpInNestedPattern() -> (i32) { %0 = ""test.one_i32_out""() : () -> (i32) return %0 : i32 } func.func @redundantTest(%arg0: i32) -> i32 { %0 = ""test.op_m""(%arg0) : (i32) -> i32 return %0 : i32 } func.func @either_dag_leaf_only_1(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () { %0 = ""test.either_op_a""(%arg0, %arg1, %arg2) : (i32, i16, i8) -> i32 %1 = ""test.either_op_a""(%arg1, %arg0, %arg2) : (i16, i32, i8) -> i32 return } func.func @either_dag_leaf_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () { %0 = ""test.either_op_b""(%arg0, %arg0) : (i32, i32) -> i32 %1 = ""test.either_op_a""(%0, %arg1, %arg2) : (i32, i16, i8) -> i32 %2 = ""test.either_op_a""(%arg1, %0, %arg2) : (i16, i32, i8) -> i32 return } func.func @either_dag_node_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () { %0 = ""test.either_op_b""(%arg0, %arg0) : (i32, i32) -> i32 %1 = ""test.either_op_b""(%arg1, %arg1) : (i16, i16) -> i32 %2 = ""test.either_op_a""(%0, %1, %arg2) : (i32, i32, i8) -> i32 %3 = ""test.either_op_a""(%1, %0, %arg2) : (i32, i32, i8) -> i32 return } func.func @explicitReturnTypeTest(%arg0 : i64) -> i8 { %0 = ""test.source_op""(%arg0) {tag = 11 : i32} : (i64) -> i8 return %0 : i8 } func.func @returnTypeBuilderTest(%arg0 : i1) -> i8 { %0 = ""test.source_op""(%arg0) {tag = 22 : i32} : (i1) -> i8 return %0 : i8 } func.func @multipleReturnTypeBuildTest(%arg0 : i1) -> i1 { %0 = ""test.source_op""(%arg0) {tag = 33 : i32} : (i1) -> i1 return %0 : i1 } func.func @copyValueType(%arg0 : i8) -> i32 { %0 = ""test.source_op""(%arg0) {tag = 44 : i32} : (i8) -> i32 return %0 : i32 } func.func @multipleReturnTypeDifferent(%arg0 : i1) -> i64 { %0 = ""test.source_op""(%arg0) {tag = 55 : i32} : (i1) -> i64 return %0 : i64 } func.func @returnTypeAndLocation(%arg0 : i32) -> i1 { %0 = ""test.source_op""(%arg0) {tag = 66 : i32} : (i32) -> i1 return %0 : i1 } func.func @testConstantStrAttr() -> () { test.no_str_value {value = ""bar""} return }", mlir-opt -test-patterns -mlir-print-debuginfo -mlir-print-local-scope ,1 "func.func private @orig() func.func private @updated() func.func @test() { call @orig() : () -> () return } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %call = transform.structured.match ops{[""func.call""]} in %arg0 : (!transform.any_op) -> !transform.any_op transform.my.change_call_target %call, ""updated"" : !transform.any_op transform.yield }", transform-opt-ch2 --test-transform-dialect-interpreter ,1 "func.func private @orig() func.func private @updated() func.func @test1() { call @orig() : () -> () return } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %call = transform.structured.match ops{[""func.call""]} in %arg0 : (!transform.any_op) -> !transform.op<""func.call""> transform.my.change_call_target %call, ""updated"" : !transform.op<""func.call""> transform.yield }", transform-opt-ch3 --test-transform-dialect-interpreter --allow-unregistered-dialect --split-input-file ,1 "func.func private @orig() func.func @test2() { call @orig() : () -> () return } transform.sequence failures(propagate) { ^bb0(%arg0: !transform.any_op): %call = transform.structured.match ops{[""func.call""]} in %arg0 : (!transform.any_op) -> !transform.my.call_op_interface transform.my.call_to_op %call : (!transform.my.call_op_interface) -> !transform.any_op transform.yield }", transform-opt-ch3 --test-transform-dialect-interpreter --allow-unregistered-dialect --split-input-file ,1 "toy.func private @multiply_transpose(%arg0: tensor<*xf64>, %arg1: tensor<*xf64>) -> tensor<*xf64> { %0 = toy.transpose(%arg0 : tensor<*xf64>) to tensor<*xf64> %1 = toy.transpose(%arg1 : tensor<*xf64>) to tensor<*xf64> %2 = toy.mul %0, %1 : tensor<*xf64> toy.return %2 : tensor<*xf64> } toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %1 = toy.reshape(%0 : tensor<2x3xf64>) to tensor<2x3xf64> %2 = toy.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00]> : tensor<6xf64> %3 = toy.reshape(%2 : tensor<6xf64>) to tensor<2x3xf64> %4 = toy.generic_call @multiply_transpose(%1, %3) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> %5 = toy.generic_call @multiply_transpose(%3, %1) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> toy.print %5 : tensor<*xf64> toy.return }", toyc-ch5 -emit=mlir -opt 2>&1 ,1 "toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %2 = toy.transpose(%0 : tensor<2x3xf64>) to tensor<3x2xf64> %3 = toy.mul %2, %2 : tensor<3x2xf64> toy.print %3 : tensor<3x2xf64> toy.return }", toyc-ch5 -emit=mlir-affine 2>&1 ,1 "toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %2 = toy.transpose(%0 : tensor<2x3xf64>) to tensor<3x2xf64> %3 = toy.mul %2, %2 : tensor<3x2xf64> toy.print %3 : tensor<3x2xf64> toy.return }", toyc-ch5 -emit=mlir-affine -opt 2>&1 ,1 "toy.func private @multiply_transpose(%arg0: tensor<*xf64>, %arg1: tensor<*xf64>) -> tensor<*xf64> { %0 = toy.transpose(%arg0 : tensor<*xf64>) to tensor<*xf64> %1 = toy.transpose(%arg1 : tensor<*xf64>) to tensor<*xf64> %2 = toy.mul %0, %1 : tensor<*xf64> toy.return %2 : tensor<*xf64> } toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %1 = toy.reshape(%0 : tensor<2x3xf64>) to tensor<2x3xf64> %2 = toy.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00]> : tensor<6xf64> %3 = toy.reshape(%2 : tensor<6xf64>) to tensor<2x3xf64> %4 = toy.generic_call @multiply_transpose(%1, %3) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> %5 = toy.generic_call @multiply_transpose(%3, %1) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> toy.print %5 : tensor<*xf64> toy.return }", toyc-ch6 -emit=mlir -opt 2>&1 ,1 "toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %2 = toy.transpose(%0 : tensor<2x3xf64>) to tensor<3x2xf64> %3 = toy.mul %2, %2 : tensor<3x2xf64> toy.print %3 : tensor<3x2xf64> toy.return }", toyc-ch6 -emit=mlir-affine 2>&1 ,1 "toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %2 = toy.transpose(%0 : tensor<2x3xf64>) to tensor<3x2xf64> %3 = toy.mul %2, %2 : tensor<3x2xf64> toy.print %3 : tensor<3x2xf64> toy.return }", toyc-ch6 -emit=mlir-affine -opt 2>&1 ,1 "toy.func private @multiply_transpose(%arg0: tensor<*xf64>, %arg1: tensor<*xf64>) -> tensor<*xf64> { %0 = toy.transpose(%arg0 : tensor<*xf64>) to tensor<*xf64> %1 = toy.transpose(%arg1 : tensor<*xf64>) to tensor<*xf64> %2 = toy.mul %0, %1 : tensor<*xf64> toy.return %2 : tensor<*xf64> } toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %1 = toy.reshape(%0 : tensor<2x3xf64>) to tensor<2x3xf64> %2 = toy.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00]> : tensor<6xf64> %3 = toy.reshape(%2 : tensor<6xf64>) to tensor<2x3xf64> %4 = toy.generic_call @multiply_transpose(%1, %3) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> %5 = toy.generic_call @multiply_transpose(%3, %1) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> toy.print %5 : tensor<*xf64> toy.return }", toyc-ch4 -emit=mlir -opt 2>&1 ,1 "toy.func @main() { %0 = toy.struct_constant [ [dense<4.000000e+00> : tensor<2x2xf64>], dense<4.000000e+00> : tensor<2x2xf64> ] : !toy.struct>, tensor<*xf64>> %1 = toy.struct_access %0[0] : !toy.struct>, tensor<*xf64>> -> !toy.struct> %2 = toy.struct_access %1[0] : !toy.struct> -> tensor<*xf64> toy.print %2 : tensor<*xf64> toy.return }", toyc-ch7 -emit=mlir -opt 2>&1 ,1 "toy.func private @multiply_transpose(%arg0: tensor<*xf64>, %arg1: tensor<*xf64>) -> tensor<*xf64> { %0 = toy.transpose(%arg0 : tensor<*xf64>) to tensor<*xf64> %1 = toy.transpose(%arg1 : tensor<*xf64>) to tensor<*xf64> %2 = toy.mul %0, %1 : tensor<*xf64> toy.return %2 : tensor<*xf64> } toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %1 = toy.reshape(%0 : tensor<2x3xf64>) to tensor<2x3xf64> %2 = toy.constant dense<[1.000000e+00, 2.000000e+00, 3.000000e+00, 4.000000e+00, 5.000000e+00, 6.000000e+00]> : tensor<6xf64> %3 = toy.reshape(%2 : tensor<6xf64>) to tensor<2x3xf64> %4 = toy.generic_call @multiply_transpose(%1, %3) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> %5 = toy.generic_call @multiply_transpose(%3, %1) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> toy.print %5 : tensor<*xf64> toy.return }", toyc-ch7 -emit=mlir -opt 2>&1 ,1 "toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %2 = toy.transpose(%0 : tensor<2x3xf64>) to tensor<3x2xf64> %3 = toy.mul %2, %2 : tensor<3x2xf64> toy.print %3 : tensor<3x2xf64> toy.return }", toyc-ch7 -emit=mlir-affine 2>&1 ,1 "toy.func @main() { %0 = toy.constant dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> %2 = toy.transpose(%0 : tensor<2x3xf64>) to tensor<3x2xf64> %3 = toy.mul %2, %2 : tensor<3x2xf64> toy.print %3 : tensor<3x2xf64> toy.return }", toyc-ch7 -emit=mlir-affine -opt 2>&1 ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 12]>, #dlti.dl_entry, [""alignment"", 32]>>} { func.func @module_level_layout() { ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> return } }", mlir-opt --test-data-layout-query ,1 "func.func @no_layout_builtin() { ""test.data_layout_query""() : () -> i32 ""test.data_layout_query""() : () -> f64 ""test.data_layout_query""() : () -> complex ""test.data_layout_query""() : () -> complex return } func.func @no_layout_custom() { ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> return } func.func @layout_op_no_layout() { ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<1000> ""test.maybe_terminator""() : () -> () }) : () -> () return } func.func @layout_op() { ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 10]>, #dlti.dl_entry, [""alignment"", 20]> >} : () -> () return } func.func @nested_inner_only() { ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 10]>, #dlti.dl_entry, [""alignment"", 20]> >} : () -> () ""test.maybe_terminator""() : () -> () }) : () -> () return } func.func @nested_outer_only() { ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) : () -> () ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 10]>, #dlti.dl_entry, [""alignment"", 20]> >} : () -> () return } func.func @nested_middle_only() { ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) : () -> () ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 10]>, #dlti.dl_entry, [""alignment"", 20]> >} : () -> () ""test.maybe_terminator""() : () -> () }) : () -> () return } func.func @nested_combine_with_missing() { ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) : () -> () ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 10]>, #dlti.dl_entry, [""alignment"", 20]> >} : () -> () ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 42]>, #dlti.dl_entry, [""preferred"", 30]> >}: () -> () return } func.func @nested_combine_all() { ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 3]>, #dlti.dl_entry, [""preferred"", 30]> >} : () -> () ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 10]>, #dlti.dl_entry, [""alignment"", 20]> >} : () -> () ""test.data_layout_query""() : () -> !test.test_type_with_layout<10> ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, [""size"", 42]>, #dlti.dl_entry, [""preferred"", 30]> >}: () -> () return } func.func @integers() { ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> i32 ""test.data_layout_query""() : () -> i56 ""test.data_layout_query""() : () -> i64 ""test.data_layout_query""() : () -> i128 ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<1xi32>>, #dlti.dl_entry : vector<1xi32>> >} : () -> () ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> i32 ""test.data_layout_query""() : () -> i56 ""test.data_layout_query""() : () -> i64 ""test.data_layout_query""() : () -> i128 ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>> >} : () -> () return } func.func @floats() { ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> f32 ""test.data_layout_query""() : () -> f80 ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<1xi32>>, #dlti.dl_entry : vector<1xi32>> >} : () -> () ""test.op_with_data_layout""() ({ ""test.data_layout_query""() : () -> f32 ""test.data_layout_query""() : () -> f80 ""test.maybe_terminator""() : () -> () }) { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<2xi32>>, #dlti.dl_entry : vector<2xi32>> >} : () -> () return }", mlir-opt --test-data-layout-query ,1 "module attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry>} { }", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<2xi64>>> } {}", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<3xi32>>> } {}", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 "module attributes {dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry : vector<2xi32>>> } {}", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 """test.op_with_data_layout""() { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry, #dlti.dl_entry<""test.foo"", [32]>>} : () -> ()", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 "module @index attributes { dlti.dl_spec = #dlti.dl_spec< #dlti.dl_entry>} { func.func @query() { ""test.data_layout_query""() : () -> index return } }", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 "module @index_default { func.func @query() { ""test.data_layout_query""() : () -> index return } }", mlir-opt --split-input-file --verify-diagnostics --test-data-layout-query ,1 "func.func @gemm_gemm_fusion_yield_both(%lhs0 : tensor, %rhs0 : tensor, %rhs1 : tensor, %init0 : tensor, %init1 : tensor) -> (tensor, tensor) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %d0 = tensor.dim %lhs0, %c0 : tensor %d1 = tensor.dim %rhs0, %c1 : tensor %fill0 = linalg.fill ins(%cst : f32) outs(%init0 : tensor) -> tensor %gemm0 = linalg.matmul ins(%lhs0, %rhs0 : tensor, tensor) outs(%fill0 : tensor) -> tensor %d2 = tensor.dim %rhs1, %c1 : tensor %fill1 = linalg.fill ins(%cst : f32) outs(%init1 : tensor) -> tensor %gemm1 = linalg.matmul {__internal_linalg_transform__ = ""gemm_sequence_fusion_and_yield""} ins(%gemm0, %rhs1 : tensor, tensor) outs(%fill1 : tensor) -> tensor return %gemm0, %gemm1 : tensor, tensor }", mlir-opt -test-tiling-interface=tile-consumer-fuse-and-yield-producer-using-scf-for -cse -split-input-file ,1 "func.func @dynamic_2d_pad_tensor(%input_tensor: tensor, %pad_value: f32) -> tensor { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } {__internal_linalg_transform__ = ""pad_2dtiling""}: tensor to tensor return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -resolve-shaped-type-result-dims -cse -split-input-file ,1 "func.func @dynamic_2d_pad_tensor_inner_tiling(%input_tensor: tensor, %pad_value: f32) -> tensor { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } {__internal_linalg_transform__ = ""pad_inner_tiling""}: tensor to tensor return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -resolve-shaped-type-result-dims -cse -split-input-file ,1 "func.func @static_pad_tensor(%input_tensor: tensor<7x9xf32>, %pad_value: f32) -> tensor<15x16xf32> { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } {__internal_linalg_transform__ = ""pad_2dtiling""} : tensor<7x9xf32> to tensor<15x16xf32> return %0 : tensor<15x16xf32> }", mlir-opt -test-tiling-interface=tile-using-scf-for -resolve-shaped-type-result-dims -cse -split-input-file ,1 "func.func @static_pad_tensor_inner_tiling(%input_tensor: tensor<7x9xf32>, %pad_value: f32) -> tensor<15x16xf32> { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } {__internal_linalg_transform__ = ""pad_inner_tiling""} : tensor<7x9xf32> to tensor<15x16xf32> return %0 : tensor<15x16xf32> }", mlir-opt -test-tiling-interface=tile-using-scf-for -resolve-shaped-type-result-dims -cse -split-input-file ,1 "func.func @dynamic_2d_pad_tensor_outer_tiling(%input_tensor: tensor, %pad_value: f32) -> tensor { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } {__internal_linalg_transform__ = ""pad_outer_tiling""}: tensor to tensor return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -resolve-shaped-type-result-dims -cse -split-input-file ,1 "func.func @static_pad_tensor_outer_tiling(%input_tensor: tensor<7x9xf32>, %pad_value: f32) -> tensor<15x16xf32> { %0 = tensor.pad %input_tensor low[3, 4] high[5, 3] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : f32 } {__internal_linalg_transform__ = ""pad_inner_tiling""} : tensor<7x9xf32> to tensor<15x16xf32> return %0 : tensor<15x16xf32> }", mlir-opt -test-tiling-interface=tile-using-scf-for -resolve-shaped-type-result-dims -cse -split-input-file ,1 "func.func @simple_matmul(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %0 = linalg.matmul {__internal_linalg_transform__ = ""simple_gemm""} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -split-input-file ,1 "func.func @simple_matmul_memref(%arg0 : memref, %arg1 : memref, %arg2 : memref) { linalg.matmul {__internal_linalg_transform__ = ""simple_gemm_memref""} ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) return }", mlir-opt -test-tiling-interface=tile-using-scf-for -split-input-file ,1 "#map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)> #map1 = affine_map<(d0, d1, d2) -> (d0, d2, d1)> #map2 = affine_map<(d0, d1, d2) -> (d2, d0, d1)> func.func @multi_result(%arg0 : tensor<128x200x300xf32>) -> (tensor<128x300x200xf32>, tensor<300x128x200xf32>) { %init0 = tensor.empty() : tensor<128x300x200xf32> %init1 = tensor.empty() : tensor<300x128x200xf32> %0:2 = linalg.generic { indexing_maps = [#map0, #map1, #map2], iterator_types = [""parallel"", ""parallel"", ""parallel""]} {__internal_linalg_transform__ = ""parallel_generic_transpose""} ins(%arg0 : tensor<128x200x300xf32>) outs(%init0, %init1 : tensor<128x300x200xf32>, tensor<300x128x200xf32>) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): linalg.yield %b0, %b0 : f32, f32 } -> (tensor<128x300x200xf32>, tensor<300x128x200xf32>) return %0#0, %0#1 : tensor<128x300x200xf32>, tensor<300x128x200xf32> }", mlir-opt -test-tiling-interface=tile-using-scf-for -split-input-file ,1 "func.func @conv2D(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %0 = linalg.conv_2d_nhwc_hwcf { strides = dense<[2, 3]> : tensor<2xi64>, dilation = dense<[4, 5]> : tensor<2xi64>, __internal_linalg_transform__ = ""simple_conv""} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -split-input-file ,1 "func.func @indexed_semantics(%arg0: tensor, %arg1: tensor) -> tensor { %0 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} {__internal_linalg_transform__ = ""indexed_semantics""} ins(%arg0: tensor) outs(%arg1: tensor) { ^bb0(%arg2: f32, %arg3: f32): %1 = linalg.index 0 : index %2 = linalg.index 1 : index %3 = arith.addi %1, %2 : index %4 = arith.index_cast %3 : index to i64 %5 = arith.uitofp %4 : i64 to f32 %6 = arith.addf %5, %arg2 : f32 linalg.yield %6 : f32 } -> (tensor) return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -split-input-file ,1 "func.func @interchange_matmul(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %0 = linalg.matmul {__internal_linalg_transform__ = ""gemm_interchange""} ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor return %0 : tensor }", mlir-opt -test-tiling-interface=tile-using-scf-for -split-input-file ,1 "func.func @gemm_fill_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg1, %c1 : tensor %init = tensor.empty(%d0, %d1) : tensor %fill = linalg.fill ins(%cst : f32) outs(%init : tensor) -> tensor %gemm = linalg.matmul {__internal_linalg_transform__ = ""fusion""} ins(%arg0, %arg1 : tensor, tensor) outs(%fill : tensor) -> tensor return %gemm : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @gemm_generic_fusion(%arg0 : tensor, %arg1 : tensor, %arg2 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg1, %c1 : tensor %init = tensor.empty(%d0, %d1) : tensor %fill = linalg.fill ins(%cst : f32) outs(%init : tensor) -> tensor %gemm = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%fill : tensor) -> tensor %generic = linalg.generic { __internal_linalg_transform__ = ""fusion"", indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%gemm, %arg2 : tensor, tensor) outs(%init : tensor) { ^bb0(%b0 : f32, %b1 : f32, %b2 : f32): %add = arith.addf %b0, %b1 : f32 linalg.yield %add : f32 } -> tensor return %generic : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @gemm_gemm_fusion(%lhs0 : tensor, %rhs0 : tensor, %rhs1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %d0 = tensor.dim %lhs0, %c0 : tensor %d1 = tensor.dim %rhs0, %c1 : tensor %init0 = tensor.empty(%d0, %d1) : tensor %fill0 = linalg.fill ins(%cst : f32) outs(%init0 : tensor) -> tensor %gemm0 = linalg.matmul ins(%lhs0, %rhs0 : tensor, tensor) outs(%fill0 : tensor) -> tensor %d2 = tensor.dim %rhs1, %c1 : tensor %init1 = tensor.empty(%d0, %d2) : tensor %fill1 = linalg.fill ins(%cst : f32) outs(%init1 : tensor) -> tensor %gemm1 = linalg.matmul {__internal_linalg_transform__ = ""gemm_fusion""} ins(%gemm0, %rhs1 : tensor, tensor) outs(%fill1 : tensor) -> tensor return %gemm1 : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @gemm_transpose_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %cst = arith.constant 0.0 : f32 %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg1, %c1 : tensor %init0 = tensor.empty(%d0, %d1) : tensor %fill = linalg.fill ins(%cst : f32) outs(%init0 : tensor) -> tensor %gemm = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%fill : tensor) -> tensor %init1 = tensor.empty(%d1, %d0) : tensor %transpose = linalg.generic { __internal_linalg_transform__ = ""fusion"", indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel""]} ins(%gemm : tensor) outs(%init1 : tensor) { ^bb0(%b0 : f32, %b1 : f32): linalg.yield %b0 : f32 } -> tensor return %transpose : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @interchange_matmul_fusion(%arg0 : tensor, %arg1 : tensor) -> tensor { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %d0 = tensor.dim %arg0, %c0 : tensor %d1 = tensor.dim %arg1, %c1 : tensor %cst = arith.constant 0.0 : f32 %0 = tensor.empty(%d0, %d1) : tensor %1 = linalg.fill ins(%cst : f32) outs(%0 : tensor) -> tensor %2 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%1 : tensor) -> tensor %3 = linalg.generic { __internal_linalg_transform__ = ""gemm_interchange_fusion"", indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%2 : tensor) outs(%0 : tensor) { ^bb0(%b0 : f32, %b1 : f32): %4 = arith.addf %b0, %b0 : f32 linalg.yield %4 : f32 } -> tensor return %3 : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @matmul_plus_matmul(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor{ %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg2, %c0 : tensor %1 = tensor.dim %arg2, %c1 : tensor %2 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor %3 = tensor.dim %2, %c0 : tensor %4 = tensor.dim %2, %c1 : tensor %5 = tensor.empty(%3, %4) : tensor %6 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""], __internal_linalg_transform__ = ""gemm_plus_gemm_fusion""} ins(%2, %2 : tensor, tensor) outs(%5 : tensor) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5 : f32) : %7 = arith.addf %arg3, %arg4 : f32 linalg.yield %7 : f32 } -> tensor return %6 : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @matmul_plus_transpose_matmul(%arg0: tensor, %arg1: tensor, %arg2: tensor) -> tensor{ %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %0 = tensor.dim %arg2, %c0 : tensor %1 = tensor.dim %arg2, %c1 : tensor %2 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor %3 = tensor.dim %2, %c0 : tensor %4 = tensor.dim %2, %c1 : tensor %5 = tensor.empty(%3, %4) : tensor %6 = linalg.generic {indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1, d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""], __internal_linalg_transform__ = ""gemm_plus_gemm_fusion""} ins(%2, %2 : tensor, tensor) outs(%5 : tensor) { ^bb0(%arg3 : f32, %arg4 : f32, %arg5 : f32) : %7 = arith.addf %arg3, %arg4 : f32 linalg.yield %7 : f32 } -> tensor return %6 : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @matmul_sequence_fusion(%arg0: tensor, %arg1: tensor, %arg2: tensor, %arg3: tensor, %arg4: tensor, %arg5: tensor, %arg6: tensor) -> tensor { %0 = linalg.matmul ins(%arg0, %arg1 : tensor, tensor) outs(%arg2 : tensor) -> tensor %1 = linalg.matmul ins(%0, %arg3 : tensor, tensor) outs(%arg4 : tensor) -> tensor %2 = linalg.matmul {__internal_linalg_transform__ = ""gemm_sequence_fusion""} ins(%1, %arg5 : tensor, tensor) outs(%arg6 : tensor) -> tensor return %2 : tensor }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @reduction_sequence(%arg0: tensor<30x3xf32>) -> tensor<30x3xf32> { %cst = arith.constant 0.000000e+00 : f32 %cst_0 = arith.constant 0xFF800000 : f32 %0 = tensor.empty() : tensor<30xf32> %1 = linalg.fill ins(%cst_0 : f32) outs(%0 : tensor<30xf32>) -> tensor<30xf32> %2 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0 : tensor<30x3xf32>) outs(%1 : tensor<30xf32>) { ^bb0(%arg1: f32, %arg2: f32): %8 = arith.maxf %arg2, %arg1 : f32 linalg.yield %8 : f32 } -> tensor<30xf32> %3 = tensor.empty() : tensor<30x3xf32> %4 = linalg.fill ins(%cst : f32) outs(%0 : tensor<30xf32>) -> tensor<30xf32> %5:2 = linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""reduction""]} ins(%arg0, %2 : tensor<30x3xf32>, tensor<30xf32>) outs(%4, %3 : tensor<30xf32>, tensor<30x3xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32, %arg4: f32): %8 = arith.subf %arg1, %arg2 : f32 %9 = math.exp %8 : f32 %10 = arith.addf %arg3, %9 : f32 linalg.yield %10, %9 : f32, f32 } -> (tensor<30xf32>, tensor<30x3xf32>) %6 = linalg.generic { __internal_linalg_transform__ = ""reduction_sequence_fusion"", indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)>], iterator_types = [""parallel"", ""parallel""]} ins(%5#1, %5#0 : tensor<30x3xf32>, tensor<30xf32>) outs(%3 : tensor<30x3xf32>) { ^bb0(%arg1: f32, %arg2: f32, %arg3: f32): %8 = arith.divf %arg1, %arg2 : f32 linalg.yield %8 : f32 } -> tensor<30x3xf32> return %6 : tensor<30x3xf32> }", mlir-opt -test-tiling-interface=tile-consumer-and-fuse-producer-using-scf-for -cse -split-input-file ,1 "func.func @gemm(%arg0 : memref, %arg1 : memref, %arg2 : memref) { linalg.matmul ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @indexed_generic(%arg0 : memref<200x300xi32>, %arg1 : memref<300xi16>, %arg2 : memref<200xi8>, %arg3 : memref<300x200xi64>) { linalg.generic { indexing_maps = [affine_map<(d0, d1) -> (d0, d1)>, affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d1, d0)>], iterator_types = [""parallel"", ""parallel""]} ins(%arg0, %arg1, %arg2 : memref<200x300xi32>, memref<300xi16>, memref<200xi8>) outs(%arg3 : memref<300x200xi64>) { ^bb0(%b0 : i32, %b1 : i16, %b2 : i8, %b3 : i64): %0 = linalg.index 0 : index %1 = arith.index_cast %0 : index to i16 %2 = arith.muli %b1, %1 : i16 %3 = linalg.index 1 : index %4 = arith.index_cast %3 : index to i8 %5 = arith.muli %b2, %4 : i8 %6 = arith.extsi %2 : i16 to i32 %7 = arith.extsi %5 : i8 to i32 %8 = arith.addi %6, %7 : i32 %9 = arith.addi %8, %b0 : i32 %10 = arith.extsi %9 : i32 to i64 linalg.yield %10 : i64 } return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @conv_strides_and_dilation(%arg0 : memref, %arg1 : memref, %arg2 : memref) { linalg.conv_2d_nhwc_hwcf { strides = dense<[1, 2]> : tensor<2xi64>, dilations = dense<[3, 4]> : tensor<2xi64>} ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @pool_strides_and_dilation(%arg0 : memref, %arg1 : memref, %arg2 : memref) { linalg.pooling_nhwc_max { strides = dense<[1, 2]> : tensor<2xi64>, dilations = dense<[3, 4]> : tensor<2xi64>} ins(%arg0, %arg1 : memref, memref) outs(%arg2 : memref) return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @map(%lhs: memref<64xf32>, %rhs: memref<64xf32>, %out: memref<64xf32>) { linalg.map ins(%lhs, %rhs : memref<64xf32>, memref<64xf32>) outs(%out : memref<64xf32>) (%in: f32, %in_0: f32) { %0 = arith.addf %in, %in_0 : f32 linalg.yield %0 : f32 } return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @transpose(%arg0: memref<16x32x64xf32>, %arg1: memref<32x64x16xf32>) { linalg.transpose ins(%arg0 : memref<16x32x64xf32>) outs(%arg1 : memref<32x64x16xf32>) permutation = [1, 2, 0] return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @reduce(%arg0: memref<16x32x64xf32>, %arg1: memref<16x64xf32>) { linalg.reduce ins(%arg0 : memref<16x32x64xf32>) outs(%arg1 : memref<16x64xf32>) dimensions = [1] (%in: f32, %init: f32) { %0 = arith.addf %in, %init : f32 linalg.yield %0 : f32 } return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "func.func @broadcast(%input: memref<8x32xf32>, %init: memref<8x16x32xf32>) { linalg.broadcast ins(%input:memref<8x32xf32>) outs(%init:memref<8x16x32xf32>) dimensions = [1] func.return }", mlir-opt -test-tiling-interface=lower-to-scalar-using-scf-for -split-input-file ,1 "module { func.func @simple() { func.return } func.func @loopForever() { ^bb0: cf.br ^bb1 ^bb1: cf.br ^bb1 } func.func @loopForever2() { ^bb0: cf.br ^bb1 ^bb1: cf.br ^bb2 ^bb2: cf.br ^bb1 } func.func @noLoop(%arg0: i1) { cf.br ^bb1 ^bb1: cf.cond_br %arg0, ^bb2, ^bb3 ^bb2: func.return ^bb3: func.return } func.func @multipleLoops(%arg0: i1, %arg1: i1) { cf.br ^bb1 ^bb1: cf.br ^bb2 ^bb2: cf.br ^bb3 ^bb3: cf.cond_br %arg0, ^bb4, ^bb2 ^bb4: cf.cond_br %arg1, ^bb1, ^bb5 ^bb5: return } func.func @_QPblockTest0(%arg0: i1, %arg1: i1) { cf.br ^bb1 ^bb1: cf.cond_br %arg0, ^bb2, ^bb5 ^bb2: cf.cond_br %arg1, ^bb3, ^bb4 ^bb3: return ^bb4: cf.br ^bb1 ^bb5: return } func.func @check_alloc_in_loop(%counter : i64) { cf.br ^bb1(%counter: i64) ^bb1(%lv : i64): %cm1 = arith.constant -1 : i64 %rem = arith.addi %lv, %cm1 : i64 %zero = arith.constant 0 : i64 %p = arith.cmpi eq, %rem, %zero : i64 cf.cond_br %p, ^bb3, ^bb2 ^bb2: scf.execute_region -> () { %c1 = arith.constant 1 : i64 scf.yield } cf.br ^bb1(%rem: i64) ^bb3: return } }", mlir-opt --mlir-disable-threading -test-block-is-in-loop 2>&1 ,1 "func.func @result_shape(%arg0 : tensor<2x3x?xf32>, %arg1 : tensor) -> (index, index, index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0:2 = ""test.op_with_result_shape_interface""(%arg0, %arg1) : (tensor<2x3x?xf32>, tensor) -> (tensor, tensor<2x3x?xf32>) %1 = tensor.dim %0#0, %c0 : tensor %2 = tensor.dim %0#0, %c1 : tensor %3 = tensor.dim %0#1, %c0 : tensor<2x3x?xf32> %4 = tensor.dim %0#1, %c1 : tensor<2x3x?xf32> %5 = tensor.dim %0#1, %c2 : tensor<2x3x?xf32> return %1, %2, %3, %4, %5 : index, index, index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @result_shape_per_dim(%arg0 : tensor<2x3x?xf32>, %arg1 : tensor) -> (index, index, index, index, index) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0:2 = ""test.op_with_result_shape_per_dim_interface""(%arg0, %arg1) : (tensor<2x3x?xf32>, tensor) -> (tensor, tensor<2x3x?xf32>) %1 = tensor.dim %0#0, %c0 : tensor %2 = tensor.dim %0#0, %c1 : tensor %3 = tensor.dim %0#1, %c0 : tensor<2x3x?xf32> %4 = tensor.dim %0#1, %c1 : tensor<2x3x?xf32> %5 = tensor.dim %0#1, %c2 : tensor<2x3x?xf32> return %1, %2, %3, %4, %5 : index, index, index, index, index }", mlir-opt -resolve-shaped-type-result-dims -split-input-file ,1 "func.func @constant() -> index { %0 = test.with_bounds { umin = 3 : index, umax = 3 : index, smin = 3 : index, smax = 3 : index} func.return %0 : index } func.func @increment() -> index { %0 = test.with_bounds { umin = 3 : index, umax = 3 : index, smin = 0 : index, smax = 0x7fffffffffffffff : index } %1 = test.increment %0 func.return %1 : index } func.func @maybe_increment(%arg0 : i1) -> index { %0 = test.with_bounds { umin = 3 : index, umax = 3 : index, smin = 3 : index, smax = 3 : index} %1 = scf.if %arg0 -> index { scf.yield %0 : index } else { %2 = test.increment %0 scf.yield %2 : index } %3 = test.reflect_bounds %1 func.return %3 : index } func.func @maybe_increment_br(%arg0 : i1) -> index { %0 = test.with_bounds { umin = 3 : index, umax = 3 : index, smin = 3 : index, smax = 3 : index} cf.cond_br %arg0, ^bb0, ^bb1 ^bb0: %1 = test.increment %0 cf.br ^bb2(%1 : index) ^bb1: cf.br ^bb2(%0 : index) ^bb2(%2 : index): %3 = test.reflect_bounds %2 func.return %3 : index } func.func @for_bounds() -> index { %c0 = test.with_bounds { umin = 0 : index, umax = 0 : index, smin = 0 : index, smax = 0 : index} %c1 = test.with_bounds { umin = 1 : index, umax = 1 : index, smin = 1 : index, smax = 1 : index} %c2 = test.with_bounds { umin = 2 : index, umax = 2 : index, smin = 2 : index, smax = 2 : index} %0 = scf.for %arg0 = %c0 to %c2 step %c1 iter_args(%arg2 = %c0) -> index { scf.yield %arg0 : index } %1 = test.reflect_bounds %0 func.return %1 : index } func.func @no_analysis_of_loop_variants() -> index { %c0 = test.with_bounds { umin = 0 : index, umax = 0 : index, smin = 0 : index, smax = 0 : index} %c1 = test.with_bounds { umin = 1 : index, umax = 1 : index, smin = 1 : index, smax = 1 : index} %c2 = test.with_bounds { umin = 2 : index, umax = 2 : index, smin = 2 : index, smax = 2 : index} %0 = scf.for %arg0 = %c0 to %c2 step %c1 iter_args(%arg2 = %c0) -> index { %1 = test.increment %arg2 scf.yield %1 : index } %2 = test.reflect_bounds %0 func.return %2 : index } func.func @region_args() { test.with_bounds_region { umin = 3 : index, umax = 4 : index, smin = 3 : index, smax = 4 : index } %arg0 { %0 = test.reflect_bounds %arg0 } func.return } func.func @func_args_unbound(%arg0 : index) -> index { %0 = test.reflect_bounds %arg0 func.return %0 : index } func.func @propagate_across_while_loop_false() -> index { %0 = test.with_bounds { umin = 0 : index, umax = 0 : index, smin = 0 : index, smax = 0 : index } %1 = scf.while : () -> index { %false = arith.constant false scf.condition(%false) %0 : index } do { ^bb0(%i1: index): scf.yield } %2 = test.increment %1 return %2 : index } func.func @propagate_across_while_loop(%arg0 : i1) -> index { %0 = test.with_bounds { umin = 0 : index, umax = 0 : index, smin = 0 : index, smax = 0 : index } %1 = scf.while : () -> index { scf.condition(%arg0) %0 : index } do { ^bb0(%i1: index): scf.yield } %2 = test.increment %1 return %2 : index } func.func @dont_propagate_across_infinite_loop() -> index { %0 = test.with_bounds { umin = 0 : index, umax = 0 : index, smin = 0 : index, smax = 0 : index } %1 = scf.while : () -> index { %true = arith.constant true scf.condition(%true) %0 : index } do { ^bb0(%i1: index): scf.yield } %2 = test.reflect_bounds %1 return %2 : index }", mlir-opt -test-int-range-inference ,1 "func.func @simpleTest() { ""test.simple""() : () -> () return } func.func @testImportedInterface() -> i1 { ""test.non_cast""() : () -> () %value = ""builtin.unrealized_conversion_cast""() : () -> (i1) return %value : i1 }", mlir-opt -test-pdll-pass ,1 "func.func @main() { return }", not mlir-opt -pass-pipeline='builtin.module(test-interface-pass)' 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }"," mlir-opt -mlir-disable-threading -pass-pipeline='builtin.module(builtin.module(test-module-pass,func.func(test-function-pass)),func.func(test-function-pass),func.func(cse,canonicalize))' -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 ",1 "func.func @foo() { return } module { func.func @foo() { return } }", mlir-opt -mlir-disable-threading -test-textual-pm-nested-pipeline -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }"," mlir-opt -mlir-disable-threading -pass-pipeline='builtin.module(builtin.module(test-module-pass),any(test-interface-pass),any(test-interface-pass),func.func(test-function-pass),any(canonicalize),func.func(cse))' -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 ",1 "func.func @foo() { return } module { func.func @foo() { return } }"," mlir-opt -mlir-disable-threading -pass-pipeline=' builtin.module ( builtin.module( func.func( test-function-pass, print-op-stats{ json=false } ) ) ) ' -verify-each=false -mlir-timing -mlir-timing-display=tree 2>&1 ",1 "func.func @foo() { return } module { func.func @foo() { return } }", not mlir-opt -pass-pipeline='any(builtin.module(test-module-pass)' 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }", not mlir-opt -pass-pipeline='builtin.module(test-module-pass))' 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }", not mlir-opt -pass-pipeline='any(builtin.module()()' 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }"," not mlir-opt -pass-pipeline='any(,)' 2>&1 ",1 "func.func @foo() { return } module { func.func @foo() { return } }", not mlir-opt -pass-pipeline='func.func(test-module-pass)' 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }", not mlir-opt -pass-pipeline='' -cse 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }", not mlir-opt -pass-pipeline='wrong-op()' 2>&1 ,1 "func.func @foo() { return } module { func.func @foo() { return } }", mlir-opt -pass-pipeline='any(cse)' -dump-pass-pipeline 2>&1 ,1 "func.func @foo() { return } func.func @bar() { return } func.func @baz() { return } func.func @foobar() { return } module { func.func @baz() { return } func.func @foobar() { return } }"," mlir-opt -mlir-disable-threading=true -verify-each=true -pass-pipeline='builtin.module(func.func(cse,canonicalize,cse))' -mlir-timing -mlir-timing-display=list 2>&1 ",1 "func.func @foo() { return } func.func @bar() { return } func.func @baz() { return } func.func @foobar() { return } module { func.func @baz() { return } func.func @foobar() { return } }"," mlir-opt -mlir-disable-threading=true -verify-each=true -pass-pipeline='builtin.module(func.func(cse,canonicalize,cse))' -mlir-timing -mlir-timing-display=tree 2>&1 ",1 "func.func @foo() { return } func.func @bar() { return } func.func @baz() { return } func.func @foobar() { return } module { func.func @baz() { return } func.func @foobar() { return } }"," mlir-opt -mlir-disable-threading=false -verify-each=true -pass-pipeline='builtin.module(func.func(cse,canonicalize,cse))' -mlir-timing -mlir-timing-display=list 2>&1 ",1 "func.func @foo() { return } func.func @bar() { return } func.func @baz() { return } func.func @foobar() { return } module { func.func @baz() { return } func.func @foobar() { return } }"," mlir-opt -mlir-disable-threading=false -verify-each=true -pass-pipeline='builtin.module(func.func(cse,canonicalize,cse))' -mlir-timing -mlir-timing-display=tree 2>&1 ",1 "func.func @foo() { return } func.func @bar() { return } func.func @baz() { return } func.func @foobar() { return } module { func.func @baz() { return } func.func @foobar() { return } }", mlir-opt -mlir-disable-threading=true -verify-each=false -test-pm-nested-pipeline -mlir-timing -mlir-timing-display=tree 2>&1 ,1 "func.func @TestCreateInvalidCallInPass() { return }", not mlir-opt -pass-pipeline='builtin.module(func.func(test-pass-create-invalid-ir{emit-invalid-ir=true signal-pass-failure=true}))' -mlir-print-ir-after-failure 2>&1 ,1 "func.func @TestCreateInvalidCallInPass() { return }", not mlir-opt -pass-pipeline='builtin.module(func.func(test-pass-create-invalid-ir{emit-invalid-ir=true signal-pass-failure=false}))' -mlir-print-ir-after-failure 2>&1 ,1 "func.func @TestCreateInvalidCallInPass() { return }", not mlir-opt -pass-pipeline='builtin.module(func.func(test-pass-create-invalid-ir{emit-invalid-ir=false signal-pass-failure=true}))' -mlir-print-ir-after-failure 2>&1 ,1 "func.func @TestCreateInvalidCallInPass() { return }", mlir-opt -pass-pipeline='builtin.module(func.func(test-pass-create-invalid-ir{emit-invalid-ir=false signal-pass-failure=false}))' -mlir-print-ir-after-failure 2>&1 ,1 "func.func @TestCreateInvalidCallInPass() { return }", not mlir-opt -pass-pipeline='builtin.module(func.func(test-pass-create-invalid-ir{emit-invalid-ir=true signal-pass-failure=true}))' -mlir-print-ir-after-failure 2>&1 -mlir-print-assume-verified ,1 "func.func @TestCreateInvalidCallInPass() { return }", not mlir-opt -pass-pipeline='builtin.module(func.func(test-pass-create-invalid-ir{emit-invalid-ir=true signal-pass-failure=false}))' -mlir-print-ir-after-failure 2>&1 -mlir-print-assume-verified ,1 module {}, not mlir-opt -pass-pipeline='builtin.module(builtin.module(test-module-pass{test-option=a}))' 2>&1 ,1 module {}, not mlir-opt -mlir-print-ir-module-scope -mlir-print-ir-before=cse 2>&1 ,1 "func.func @a() { return } func.func @b() { return } func.func @c() { return }"," mlir-opt --log-actions-to=- -pass-pipeline=""builtin.module(func.func(test-stats-pass))"" -o %t --mlir-disable-threading ",1 "func.func @a() { return } func.func @b() { return } func.func @c() { return }"," mlir-opt --log-mlir-actions-filter= --log-actions-to=- -pass-pipeline=""builtin.module(func.func(test-stats-pass))"" -o %t --mlir-disable-threading ",1 "func.func @a() { return } func.func @b() { return } func.func @c() { return }"," mlir-opt --log-mlir-actions-filter=foo.mlir --log-actions-to=- -pass-pipeline=""builtin.module(func.func(test-stats-pass))"" -o %t --mlir-disable-threading ",1 "func.func @a() { return } func.func @b() { return } func.func @c() { return }"," mlir-opt --log-mlir-actions-filter=:1 --log-actions-to=- -pass-pipeline=""builtin.module(func.func(test-stats-pass))"" -o %t --mlir-disable-threading ",1 "func.func @a() { return } func.func @b() { return } func.func @c() { return }"," mlir-opt --log-mlir-actions-filter=:8 --log-actions-to=- -pass-pipeline=""builtin.module(func.func(test-stats-pass))"" -o %t --mlir-disable-threading ",1 "func.func @a() { return } func.func @b() { return } func.func @c() { return }"," mlir-opt --log-mlir-actions-filter=:4,:12 --log-actions-to=- -pass-pipeline=""builtin.module(func.func(test-stats-pass))"" -o %t --mlir-disable-threading ",1 "func.func @foo() { return } func.func @bar() { return }"," mlir-opt -verify-each=true -pass-pipeline='builtin.module(func.func(test-stats-pass,test-stats-pass))' -mlir-pass-statistics -mlir-pass-statistics-display=list 2>&1 ",1 "func.func @foo() { return } func.func @bar() { return }"," mlir-opt -verify-each=true -pass-pipeline='builtin.module(func.func(test-stats-pass,test-stats-pass))' -mlir-pass-statistics -mlir-pass-statistics-display=pipeline 2>&1 ",1 "module @inner_mod1 { module @foo {} }"," export LSAN_OPTIONS=detect_leaks=0 // Check that local reproducers will also traverse dynamic pass pipelines. // RUN: mlir-opt -pass-pipeline='builtin.module(test-module-pass,test-dynamic-pipeline{op-name=inner_mod1 run-on-nested-operations=1 dynamic-pipeline=test-pass-failure})' -mlir-pass-pipeline-crash-reproducer=%t -verify-diagnostics -mlir-pass-pipeline-local-reproducer --mlir-disable-threading // RUN: cat %t ",1 "func.func @f() { return } module @inner_mod1 { func.func @foo() { return } func.func @baz() { return } } module @inner_mod2 { func.func @foo() { return } }"," mlir-opt -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod1, dynamic-pipeline=func.func(cse,canonicalize)}))' --mlir-disable-threading -mlir-print-ir-before-all 2>&1 ",1 "func.func @f() { return } module @inner_mod1 { func.func @foo() { return } func.func @baz() { return } } module @inner_mod2 { func.func @foo() { return } }"," mlir-opt -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod2, dynamic-pipeline=func.func(cse,canonicalize)}))' --mlir-disable-threading -mlir-print-ir-before-all 2>&1 ",1 "func.func @f() { return } module @inner_mod1 { func.func @foo() { return } func.func @baz() { return } } module @inner_mod2 { func.func @foo() { return } }"," mlir-opt -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod1,inner_mod2, dynamic-pipeline=func.func(cse,canonicalize)}))' --mlir-disable-threading -mlir-print-ir-before-all 2>&1 ",1 "func.func @f() { return } module @inner_mod1 { func.func @foo() { return } func.func @baz() { return } } module @inner_mod2 { func.func @foo() { return } }"," mlir-opt -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{dynamic-pipeline=func.func(cse,canonicalize)}))' --mlir-disable-threading -mlir-print-ir-before-all 2>&1 ",1 "module @inner_mod1 { module @foo {} }"," export LSAN_OPTIONS=detect_leaks=0 // RUN: mlir-opt -pass-pipeline='builtin.module(builtin.module(test-module-pass, test-pass-crash))' -mlir-pass-pipeline-crash-reproducer=%t -verify-diagnostics // RUN: cat %t ",1 "module @inner_mod1 { module @foo {} }"," mlir-opt -pass-pipeline='builtin.module(builtin.module(test-module-pass, test-pass-crash))' -mlir-pass-pipeline-crash-reproducer=%t -verify-diagnostics -mlir-pass-pipeline-local-reproducer -mlir-disable-threading // RUN: cat %t ",1 "module @inner_mod1 { module @foo {} }"," mlir-opt -test-module-pass -test-module-pass -test-module-pass -mlir-pass-pipeline-crash-reproducer=%t -mlir-pass-pipeline-local-reproducer -mlir-disable-threading // RUN: cat %t ",1 "module @inner_mod1 { module @foo {} }"," mlir-opt -pass-pipeline='builtin.module(test-module-pass,test-dynamic-pipeline{op-name=inner_mod1 run-on-nested-operations=1 dynamic-pipeline=test-pass-crash})' -mlir-pass-pipeline-crash-reproducer=%t -verify-diagnostics -mlir-pass-pipeline-local-reproducer --mlir-disable-threading // RUN: cat %t ",1 "func.func @f() { return } module @inner_mod1 { module @foo {} module @baz {} }", mlir-opt -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod1 dynamic-pipeline=cse}))' --mlir-disable-threading -mlir-print-ir-before-all 2>&1 ,1 "func.func @f() { return } module @inner_mod1 { module @foo {} module @baz {} }", mlir-opt -pass-pipeline='builtin.module(builtin.module(test-dynamic-pipeline{op-name=inner_mod1 run-on-nested-operations=1 dynamic-pipeline=cse}))' --mlir-disable-threading -mlir-print-ir-before-all 2>&1 ,1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,canonicalize))' -mlir-print-ir-before=cse -o /dev/null 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,canonicalize))' -mlir-print-ir-before-all -o /dev/null 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,canonicalize))' -mlir-print-ir-after=cse -o /dev/null 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,canonicalize))' -mlir-print-ir-after-all -o /dev/null 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,canonicalize))' -mlir-print-ir-before=cse -mlir-print-ir-module-scope -o /dev/null 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,cse))' -mlir-print-ir-after-all -mlir-print-ir-after-change -o /dev/null 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return }"," not mlir-opt -mlir-disable-threading=true -pass-pipeline='builtin.module(func.func(cse,test-pass-failure))' -mlir-print-ir-after-failure -o /dev/null 2>&1 ",1 "module { module { func.func @foo() { return } } }"," mlir-opt -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=list -mlir-disable-threading 2>&1 ",1 "module { module { func.func @foo() { return } } }"," mlir-opt -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=list 2>&1 ",1 "module { module { func.func @foo() { return } } }"," mlir-opt -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=pipeline -mlir-disable-threading 2>&1 ",1 "module { module { func.func @foo() { return } } }"," mlir-opt -verify-each=true -pass-pipeline='builtin.module(builtin.module(func.func(test-stats-pass,test-stats-pass)))' -mlir-pass-statistics -mlir-pass-statistics-display=pipeline 2>&1 ",1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return } {-# external_resources: { mlir_reproducer: { verify_each: true, pipeline: ""builtin.module(func.func(cse,canonicalize{max-iterations=1 max-num-rewrites=-1 region-simplify=false top-down=false}))"", disable_threading: true } } #-}", mlir-opt --run-reproducer -dump-pass-pipeline 2>&1 ,1 "func.func @foo() { %0 = arith.constant 0 : i32 return } func.func @bar() { return } {-# external_resources: { mlir_reproducer: { verify_each: true, pipeline: ""builtin.module(func.func(cse,canonicalize{max-iterations=1 max-num-rewrites=-1 region-simplify=false top-down=false}))"", disable_threading: true } } #-}", mlir-opt --run-reproducer -mlir-print-ir-before=cse 2>&1 ,1