diff --git a/mlir-assigner/include/mlir-assigner/memory/memref.hpp b/mlir-assigner/include/mlir-assigner/memory/memref.hpp index 4d670b0..9dc5553 100644 --- a/mlir-assigner/include/mlir-assigner/memory/memref.hpp +++ b/mlir-assigner/include/mlir-assigner/memory/memref.hpp @@ -66,6 +66,16 @@ namespace nil { } return data[offset]; } + + const VarType &get(const llvm::SmallVector &indices) const { + assert(indices.size() == dims.size()); + uint32_t offset = 0; + for (int i = 0; i < indices.size(); i++) { + assert(indices[i] < dims[i]); + offset += indices[i] * strides[i]; + } + return data[offset]; + } // VarType &get(const std::vector &indices) const { // assert(indices.size() == dims.size()); // uint32_t offset = 0; @@ -86,6 +96,16 @@ namespace nil { data[offset] = value; } + void put(const llvm::SmallVector &indices, const VarType &value) { + assert(indices.size() == dims.size()); + uint32_t offset = 0; + for (int i = 0; i < indices.size(); i++) { + assert(indices[i] < dims[i]); + offset += indices[i] * strides[i]; + } + data[offset] = value; + } + void put_flat(const int64_t idx, const VarType &value) { assert(idx >= 0 && idx < data.size()); data[idx] = value; diff --git a/mlir-assigner/include/mlir-assigner/parser/evaluator.hpp b/mlir-assigner/include/mlir-assigner/parser/evaluator.hpp index e3a0998..0177c79 100644 --- a/mlir-assigner/include/mlir-assigner/parser/evaluator.hpp +++ b/mlir-assigner/include/mlir-assigner/parser/evaluator.hpp @@ -289,7 +289,6 @@ namespace zk_ml_toolchain { assert(lhs != frames.back().constant_values.end()); assert(rhs != frames.back().constant_values.end()); auto result = lhs->second + rhs->second; - // llvm::outs() << "from " << *operation << " got " << result << "\n"; frames.back().constant_values[mlir::hash_value(operation.getResult())] = result; } else if (arith::SubIOp operation = llvm::dyn_cast(op)) { assert(operation.getLhs().getType().isa()); @@ -302,7 +301,6 @@ namespace zk_ml_toolchain { assert(lhs != frames.back().constant_values.end()); assert(rhs != frames.back().constant_values.end()); auto result = lhs->second - rhs->second; - // llvm::outs() << "from " << *operation << " got " << result << "\n"; frames.back().constant_values[mlir::hash_value(operation.getResult())] = result; } else if (arith::MulIOp operation = llvm::dyn_cast(op)) { @@ -316,7 +314,6 @@ namespace zk_ml_toolchain { assert(lhs != frames.back().constant_values.end()); assert(rhs != frames.back().constant_values.end()); auto result = lhs->second * rhs->second; - // llvm::outs() << "from " << *operation << " got " << result << "\n"; frames.back().constant_values[mlir::hash_value(operation.getResult())] = result; } else if (arith::ConstantOp operation = llvm::dyn_cast(op)) { @@ -374,7 +371,7 @@ namespace zk_ml_toolchain { frames.back().locals[mlir::hash_value(operation.getResult())] = frames.back().locals[mlir::hash_value(operation.getLhs())]; } else if (math::SqrtOp operation = llvm::dyn_cast(op)) { - UNREACHABLE("TODO: sqrt"); + UNREACHABLE("TODO: component for sqrt not ready"); } else if (math::ErfOp operation = llvm::dyn_cast(op)) { UNREACHABLE("TODO: component for erf not ready"); } else { @@ -402,8 +399,6 @@ namespace zk_ml_toolchain { auto operandsToV = llvm::SmallVector(operandsTo.begin(), operandsTo.end()); int64_t from = evaluateForParameter(fromMap, operandsFromV, true); int64_t to = evaluateForParameter(toMap, operandsToV, false); - // llvm::outs() << "starting for with: " << from << "->" << to << " (step) - // " << step << "\n"; doAffineFor(operation, from, to, step); } else if (affine::AffineLoadOp operation = llvm::dyn_cast(op)) { auto memref = frames.back().memrefs.find(mlir::hash_value(operation.getMemref())); @@ -411,15 +406,16 @@ namespace zk_ml_toolchain { // grab the indices and build index vector auto indices = operation.getIndices(); - std::vector indicesV; - indicesV.reserve(indices.size()); + std::vector mapDims; + mapDims.reserve(indices.size()); for (auto a : indices) { // look for indices in constant_values auto res = frames.back().constant_values.find(mlir::hash_value(a)); assert(res != frames.back().constant_values.end()); - indicesV.push_back(res->second); + mapDims.push_back(res->second); } - auto value = memref->second.get(indicesV); + auto affineMap = castFromAttr(operation->getAttr(affine::AffineLoadOp::getMapAttrStrName())).getAffineMap(); + auto value = memref->second.get(evalAffineMap(affineMap, mapDims)); frames.back().locals[mlir::hash_value(operation.getResult())] = value; } else if (affine::AffineStoreOp operation = llvm::dyn_cast(op)) { // affine.store @@ -430,18 +426,19 @@ namespace zk_ml_toolchain { // grab the indices and build index vector auto indices = operation.getIndices(); - std::vector indicesV; - indicesV.reserve(indices.size()); + std::vector mapDims; + mapDims.reserve(indices.size()); for (auto a : indices) { auto res = frames.back().constant_values.find(mlir::hash_value(a)); assert(res != frames.back().constant_values.end()); - indicesV.push_back(res->second); + mapDims.push_back(res->second); } // grab the element from the locals array auto value = frames.back().locals.find(mlir::hash_value(operation.getValue())); assert(value != frames.back().locals.end()); // put the element from the memref using index vector - memref->second.put(indicesV, value->second); + auto affineMap = castFromAttr(operation->getAttr(affine::AffineStoreOp::getMapAttrStrName())).getAffineMap(); + memref->second.put(evalAffineMap(affineMap, mapDims), value->second); } else if (affine::AffineYieldOp operation = llvm::dyn_cast(op)) { // Affine Yields are Noops for us @@ -474,7 +471,6 @@ namespace zk_ml_toolchain { AffineMap applyMap = castFromAttr(op->getAttrs()[0].getValue()).getAffineMap(); llvm::SmallVector operands(op->getOperands().begin(), op->getOperands().end()); int64_t result = evaluateForParameter(applyMap, operands, false); - // llvm::outs() << "from " << *op << " got result " << result << "\n"; frames.back().constant_values[mlir::hash_value(op->getResults()[0])] = result; } else if (opName == "affine.max") { logger.debug("got affine.max"); @@ -483,7 +479,6 @@ namespace zk_ml_toolchain { AffineMap applyMap = castFromAttr(op->getAttrs()[0].getValue()).getAffineMap(); llvm::SmallVector operands(op->getOperands().begin(), op->getOperands().end()); int64_t result = evaluateForParameter(applyMap, operands, true); - // llvm::outs() << "from " << *op << " got result " << result << "\n"; frames.back().constant_values[mlir::hash_value(op->getResults()[0])] = result; } else { UNREACHABLE(std::string("unhandled affine operation: ") + opName); @@ -642,7 +637,6 @@ namespace zk_ml_toolchain { auto index = frames.back().constant_values.find(mlir::hash_value(operands[dynamicCounter++])); assert(index != frames.back().constant_values.end()); dims.emplace_back(index->second); - // llvm::outs() << "dynamic size is: " << index->second << "\n"; } else { dims.emplace_back(dim); } @@ -701,7 +695,6 @@ namespace zk_ml_toolchain { auto res = frames.back().constant_values.find(mlir::hash_value(a)); assert(res != frames.back().constant_values.end()); indicesV.push_back(res->second); - // llvm::outs() << "found " << res->second << "\n"; } // grab the element from the locals array auto value = frames.back().locals.find(mlir::hash_value(operation.getValue())); diff --git a/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.json b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.json new file mode 100644 index 0000000..cc99a43 --- /dev/null +++ b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.44464111328125, 0.722412109375, 0.1399993896484375, 0.3859405517578125, 0.4351654052734375, 0.1930694580078125, 0.1060943603515625, 0.3092041015625, 0.4474029541015625, 0.7837677001953125], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.mlir b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.mlir new file mode 100644 index 0000000..138cef3 --- /dev/null +++ b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.mlir @@ -0,0 +1,39 @@ +module attributes {llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-pc-linux-gnu", "onnx-mlir.symbol-postfix" = "reducel2simple.mlir"} { + func.func @main_graph(%arg0: memref<1x10xf32>) -> memref<1x1xf32> attributes {input_names = ["in_a"], llvm.emit_c_interface, output_names = ["out_a"]} { + %cst = arith.constant 0.000000e+00 : f32 + %c0 = arith.constant 0 : index + %alloc = memref.alloc() {alignment = 16 : i64} : memref<1x10xf32> + affine.for %arg1 = 0 to 1 { + affine.for %arg2 = 0 to 10 { + %0 = affine.load %arg0[%c0, %arg2] : memref<1x10xf32> + %1 = affine.load %arg0[%c0, %arg2] : memref<1x10xf32> + %2 = arith.mulf %0, %1 : f32 + affine.store %2, %alloc[%arg1, %arg2] : memref<1x10xf32> + } + } + %alloc_0 = memref.alloc() {alignment = 16 : i64} : memref<1x1xf32> + affine.for %arg1 = 0 to 1 { + affine.for %arg2 = 0 to 1 { + affine.store %cst, %alloc_0[%arg1, %arg2] : memref<1x1xf32> + } + } + affine.for %arg1 = 0 to 1 { + affine.for %arg2 = 0 to 10 { + %0 = affine.load %alloc[%arg1, %arg2] : memref<1x10xf32> + %1 = affine.load %alloc_0[%arg1, %c0] : memref<1x1xf32> + %2 = arith.addf %1, %0 : f32 + affine.store %2, %alloc_0[%arg1, %c0] : memref<1x1xf32> + } + } + %alloc_1 = memref.alloc() {alignment = 16 : i64} : memref<1x1xf32> + affine.for %arg1 = 0 to 1 { + affine.for %arg2 = 0 to 1 { + %0 = affine.load %alloc_0[%arg1, %arg2] : memref<1x1xf32> + %1 = math.sqrt %0 : f32 + affine.store %1, %alloc_1[%arg1, %arg2] : memref<1x1xf32> + } + } + return %alloc_1 : memref<1x1xf32> + } + "krnl.entry_point"() {func = @main_graph, numInputs = 1 : i32, numOutputs = 1 : i32, signature = "[ { \22type\22 : \22f32\22 , \22dims\22 : [1 , 10] , \22name\22 : \22in_a\22 }\0A\0A]\00@[ { \22type\22 : \22f32\22 , \22dims\22 : [1 , 1] , \22name\22 : \22out_a\22 }\0A\0A]\00"} : () -> () +} diff --git a/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.onnx b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.onnx new file mode 100644 index 0000000..488f53a --- /dev/null +++ b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.onnx @@ -0,0 +1,13 @@ + :o + +in_a +in_bout_a"ReduceL2ReduceL2Simple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.res b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.res new file mode 100644 index 0000000..e53f0bc --- /dev/null +++ b/mlir-assigner/tests/Ops/NeedsBlueprintComponent/ReduceL2/ReduceL2Simple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[1.4269211292266846] +21 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.json b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.json new file mode 100644 index 0000000..6d802d5 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.5316009521484375, 0.771148681640625, 0.7549896240234375, 0.00177001953125, 0.8040618896484375, 0.6228179931640625, 0.8080291748046875, 0.7175140380859375, 0.3006744384765625, 0.7958221435546875, 0.2895660400390625, 0.6257171630859375, 0.7779541015625, 0.2160797119140625, 0.886260986328125, 0.46527099609375, 0.224029541015625, 0.426666259765625, 0.7244873046875, 0.25927734375, 0.85498046875, 0.5196533203125, 0.3891143798828125, 0.277099609375, 0.0838470458984375, 0.06463623046875, 0.560943603515625, 0.9423065185546875, 0.12188720703125, 0.1664276123046875, 0.4301300048828125, 0.4993133544921875, 0.0058746337890625, 0.42437744140625, 0.51446533203125, 0.794189453125, 0.9392242431640625, 0.454254150390625, 0.1020050048828125, 0.5545806884765625, 0.8192138671875, 0.9871826171875, 0.12567138671875, 0.955535888671875, 0.0265045166015625, 0.563629150390625, 0.1708831787109375, 0.199951171875, 0.246795654296875, 0.9832305908203125, 0.7613525390625, 0.4416656494140625, 0.6462554931640625, 0.8548583984375, 0.345672607421875, 0.20172119140625, 0.7459716796875, 0.3435211181640625, 0.807159423828125, 0.2892913818359375, 0.6972198486328125, 0.866607666015625, 0.340545654296875, 0.1118011474609375, 0.881439208984375, 0.9730682373046875, 0.5344696044921875, 0.01611328125, 0.0105133056640625, 0.5793304443359375, 0.4836578369140625, 0.8841705322265625, 0.527740478515625, 0.9219512939453125, 0.8319549560546875, 0.8092041015625, 0.0500335693359375, 0.8453826904296875, 0.1137847900390625, 0.628753662109375, 0.847320556640625, 0.08111572265625, 0.6227264404296875, 0.496917724609375, 0.74072265625, 0.213226318359375, 0.3129425048828125, 0.9722900390625, 0.594940185546875, 0.5207672119140625, 0.798370361328125, 0.646820068359375, 0.102294921875, 0.4672088623046875, 0.2514495849609375, 0.5641021728515625, 0.457611083984375, 0.6670684814453125, 0.54400634765625, 0.943328857421875], "dims": [1, 10, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.onnx new file mode 100644 index 0000000..56d7222 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.onnx @@ -0,0 +1,17 @@ + :t + +in_a +in_bout_a"ReduceL1 +ReduceL12D*:Bin_bZ +in_a + + + + + +b +out_a + + + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.res b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.res new file mode 100644 index 0000000..339a95f --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12D.res @@ -0,0 +1,3 @@ +Result: +memref<1x1x1xf32>[52.172088623046875] +200 rows diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.json b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.json new file mode 100644 index 0000000..7793ee4 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.907958984375, 0.197296142578125, 0.274932861328125, 0.7010650634765625, 0.831512451171875, 0.00579833984375, 0.2776641845703125, 0.255767822265625, 0.0640106201171875, 0.1799468994140625, 0.121917724609375, 0.624969482421875, 0.6061553955078125, 0.1122589111328125, 0.67132568359375, 0.479736328125, 0.3151092529296875, 0.4059600830078125, 0.969146728515625, 0.1484832763671875, 0.803192138671875, 0.56060791015625, 0.80560302734375, 0.438690185546875, 0.9733123779296875, 0.5877227783203125, 0.0193634033203125, 0.398193359375, 0.3353118896484375, 0.2707366943359375, 0.4082794189453125, 0.7901763916015625, 0.2892303466796875, 0.9901123046875, 0.7431793212890625, 0.5735931396484375, 0.4205322265625, 0.590728759765625, 0.274322509765625, 0.6052398681640625, 0.0029296875, 0.05548095703125, 0.6415557861328125, 0.6295928955078125, 0.286590576171875, 0.2318878173828125, 0.7197418212890625, 0.578399658203125, 0.8871002197265625, 0.4137115478515625, 0.379852294921875, 0.5147857666015625, 0.8922119140625, 0.1077880859375, 0.342071533203125, 0.384521484375, 0.322235107421875, 0.5508880615234375, 0.676239013671875, 0.025604248046875, 0.0616912841796875, 0.7592926025390625, 0.6242523193359375, 0.104766845703125, 0.6704864501953125, 0.83856201171875, 0.7960357666015625, 0.514495849609375, 0.9562835693359375, 0.891204833984375, 0.1709747314453125, 0.946258544921875, 0.358917236328125, 0.65179443359375, 0.6244354248046875, 0.48388671875, 0.244140625, 0.923248291015625, 0.613250732421875, 0.3749542236328125, 0.376861572265625, 0.2886962890625, 0.5413665771484375, 0.809600830078125, 0.82452392578125, 0.5217742919921875, 0.2724151611328125, 0.2464447021484375, 0.6473846435546875, 0.144256591796875, 0.701416015625, 0.1503448486328125, 0.8818206787109375, 0.032745361328125, 0.5528564453125, 0.0033721923828125, 0.532989501953125, 0.989013671875, 0.8312835693359375, 0.1944732666015625], "dims": [1, 10, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.onnx new file mode 100644 index 0000000..fea1211 Binary files /dev/null and b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.onnx differ diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.res b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.res new file mode 100644 index 0000000..aca3b40 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL12DNoKeepDims.res @@ -0,0 +1,3 @@ +Result: +memref<1xf32>[48.82490539550781] +200 rows diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.json b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.json new file mode 100644 index 0000000..491b4c4 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.43212890625, 0.4479827880859375, 0.19281005859375, 0.09112548828125, 0.7779998779296875, 0.6609344482421875, 0.303619384765625, 0.273406982421875, 0.314208984375, 0.6693115234375], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.onnx new file mode 100644 index 0000000..1eaf14b --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.onnx @@ -0,0 +1,13 @@ + :o + +in_a +in_bout_a"ReduceL1ReduceL1Simple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.res b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.res new file mode 100644 index 0000000..c459ee1 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceL1/ReduceL1Simple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[4.1635284423828125] +20 rows diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.json new file mode 100644 index 0000000..0830ee6 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.111480712890625, 0.7744903564453125, 0.6857147216796875, 0.3732147216796875, 0.023529052734375, 0.4350738525390625, 0.0581207275390625, 0.4693756103515625, 0.339111328125, 0.4113311767578125], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.onnx new file mode 100644 index 0000000..e55e116 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.onnx @@ -0,0 +1,13 @@ + :w +! +in_a +in_bout_a" ReduceLogSumReduceLogSumSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.res new file mode 100644 index 0000000..9f464a1 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceLogSum/ReduceLogSumSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[1.3033045530319214] +17 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.json new file mode 100644 index 0000000..dda468e --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.4797821044921875, 0.9048919677734375, 0.6749114990234375, 0.18011474609375, 0.4658966064453125, 0.5195465087890625, 0.996673583984375, 0.790252685546875, 0.948822021484375, 0.69696044921875], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.onnx new file mode 100644 index 0000000..9d5ced2 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.onnx @@ -0,0 +1,13 @@ + :} +$ +in_a +in_bout_a"ReduceLogSumExpReduceLogSumExpSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.res new file mode 100644 index 0000000..f198437 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceLogSumExp/ReduceLogSumExpSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[2.997072458267212] +58 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.json new file mode 100644 index 0000000..1b37fbd --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.486663818359375, 0.076171875, 0.8419036865234375, 0.3363494873046875, 0.053070068359375, 0.1689453125, 0.9307098388671875, 0.3600311279296875, 0.0389862060546875, 0.0422821044921875], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.onnx new file mode 100644 index 0000000..f7499f1 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.onnx @@ -0,0 +1,13 @@ + :q + +in_a +in_bout_a" ReduceMaxReduceMaxSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.res new file mode 100644 index 0000000..f9e86bc --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMax/ReduceMaxSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[0.9307098388671875] +20 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.json b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.json new file mode 100644 index 0000000..3ccde4c --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.8568878173828125, 0.1202239990234375, 0.91839599609375, 0.7568511962890625, 0.2068023681640625, 0.2118682861328125, 0.682952880859375, 0.607269287109375, 0.4605712890625, 0.9705810546875, 0.9650115966796875, 0.1146240234375, 0.3098907470703125, 0.2905731201171875, 0.329986572265625, 0.280059814453125, 0.0103912353515625, 0.7331695556640625, 0.426910400390625, 0.041961669921875, 0.20196533203125, 0.65582275390625, 0.3361968994140625, 0.7577972412109375, 0.2241363525390625, 0.5425872802734375, 0.1729736328125, 0.7314910888671875, 0.6883697509765625, 0.88494873046875, 0.7875213623046875, 0.7908935546875, 0.2242279052734375, 0.8392486572265625, 0.214874267578125, 0.88702392578125, 0.2572021484375, 0.16156005859375, 0.0554656982421875, 0.5114288330078125, 0.875762939453125, 0.95074462890625, 0.773223876953125, 0.755035400390625, 0.4380950927734375, 0.8548431396484375, 0.3909912109375, 0.6981201171875, 0.796966552734375, 0.545501708984375, 0.8203277587890625, 0.3695831298828125, 0.874420166015625, 0.875701904296875, 0.559478759765625, 0.0601806640625, 0.624725341796875, 0.37554931640625, 0.7270965576171875, 0.2436065673828125, 0.6870880126953125, 0.637451171875, 0.63201904296875, 0.4983062744140625, 0.078765869140625, 0.67926025390625, 0.752655029296875, 0.00982666015625, 0.195404052734375, 0.5293731689453125, 0.18634033203125, 0.2686004638671875, 0.789337158203125, 0.4116363525390625, 0.7089691162109375, 0.4565582275390625, 0.6157989501953125, 0.0911865234375, 0.0789947509765625, 0.5979156494140625, 0.1395111083984375, 0.68408203125, 0.034637451171875, 0.6453399658203125, 0.1017303466796875, 0.680389404296875, 0.788970947265625, 0.7945556640625, 0.8411102294921875, 0.3185272216796875, 0.5118408203125, 0.1500091552734375, 0.460723876953125, 0.5629119873046875, 0.125762939453125, 0.9395751953125, 0.2630157470703125, 0.966522216796875, 0.550506591796875, 0.0209197998046875], "dims": [1, 10, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.onnx new file mode 100644 index 0000000..7e43609 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.onnx @@ -0,0 +1,17 @@ + :x + +in_a +in_bout_a" +ReduceMean ReduceMean2D*:Bin_bZ +in_a + + + + + +b +out_a + + + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.res b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.res new file mode 100644 index 0000000..bf1e0c0 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D.res @@ -0,0 +1,3 @@ +Result: +memref<1x1x1xf32>[0.5031680464744568] +105 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.json b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.json new file mode 100644 index 0000000..5bea226 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.7798004150390625, 0.750701904296875, 0.46783447265625, 0.350799560546875, 0.61322021484375, 0.7772216796875, 0.4051513671875, 0.2594757080078125, 0.909149169921875, 0.801910400390625, 0.8707275390625, 0.6853485107421875, 0.1585845947265625, 0.6829071044921875, 0.6245574951171875, 0.8623046875, 0.503875732421875, 0.86639404296875, 0.1247100830078125, 0.8927154541015625, 0.125762939453125, 0.817901611328125, 0.566314697265625, 0.1723480224609375, 0.828216552734375, 0.9313812255859375, 0.1966094970703125, 0.4444427490234375, 0.2832489013671875, 0.3730316162109375, 0.9785308837890625, 0.44708251953125, 0.52197265625, 0.84173583984375, 0.930908203125, 0.0176849365234375, 0.9320526123046875, 0.7763519287109375, 0.1771697998046875, 0.2516021728515625, 0.0600738525390625, 0.5712432861328125, 0.2690887451171875, 0.266448974609375, 0.4567413330078125, 0.248260498046875, 0.35186767578125, 0.6233978271484375, 0.46612548828125, 0.4403228759765625, 0.3950042724609375, 0.813690185546875, 0.178009033203125, 0.3786773681640625, 0.7363128662109375, 0.072998046875, 0.4883270263671875, 0.5819549560546875, 0.9857177734375, 0.2920989990234375, 0.040985107421875, 0.5815277099609375, 0.1041717529296875, 0.0087432861328125, 0.0502777099609375, 0.25482177734375, 0.9883880615234375, 0.3704833984375, 0.218780517578125, 0.5051422119140625, 0.22613525390625, 0.311981201171875, 0.20965576171875, 0.0774993896484375, 0.0211944580078125, 0.1636810302734375, 0.099151611328125, 0.8297576904296875, 0.593048095703125, 0.1248626708984375, 0.1694183349609375, 0.7293548583984375, 0.38458251953125, 0.1809844970703125, 0.2814788818359375, 0.084564208984375, 0.379364013671875, 0.6024627685546875, 0.4813385009765625, 0.268035888671875, 0.90606689453125, 0.1229095458984375, 0.5024871826171875, 0.3934173583984375, 0.152008056640625, 0.69268798828125, 0.09197998046875, 0.4733428955078125, 0.1723175048828125, 0.091217041015625], "dims": [1, 10, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.onnx new file mode 100644 index 0000000..6cbaf4a --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.onnx @@ -0,0 +1,18 @@ + :y + +in_a +in_bout_a" +ReduceMeanReduceMean2D1D* :Bin_bZ +in_a + + + + + +b +out_a + + + + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.res b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.res new file mode 100644 index 0000000..02fb2b5 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMean2D1D.res @@ -0,0 +1,3 @@ +Result: +memref<1x10x1xf32>[0.6115264892578125, 0.6272125244140625, 0.47392576932907104, 0.5875091552734375, 0.375357061624527, 0.492279052734375, 0.3123321533203125, 0.2656967043876648, 0.35615843534469604, 0.3598434329032898] +120 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.json new file mode 100644 index 0000000..64cee0b --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.033935546875, 0.3909149169921875, 0.16265869140625, 0.0218353271484375, 0.6053314208984375, 0.9636688232421875, 0.8033599853515625, 0.31622314453125, 0.18231201171875, 0.6182403564453125], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.onnx new file mode 100644 index 0000000..2951d54 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.onnx @@ -0,0 +1,14 @@ + :s + +in_a +in_bout_a" +ReduceMeanReduceMeanSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.res new file mode 100644 index 0000000..e9b1a9d --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMean/ReduceMeanSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[0.40984803438186646] +15 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.json new file mode 100644 index 0000000..1e8dd64 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.0801544189453125, 0.3762359619140625, 0.9114532470703125, 0.458526611328125, 0.35125732421875, 0.72467041015625, 0.6722869873046875, 0.054962158203125, 0.02655029296875, 0.9073333740234375], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.onnx new file mode 100644 index 0000000..706ddcd --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.onnx @@ -0,0 +1,13 @@ + :q + +in_a +in_bout_a" ReduceMinReduceMinSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.res new file mode 100644 index 0000000..fc3f228 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceMin/ReduceMinSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[0.02655029296875] +20 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.json new file mode 100644 index 0000000..53f9d03 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.1544189453125, 0.894073486328125, 0.5672760009765625, 0.995697021484375, 0.934661865234375, 0.716949462890625, 0.19598388671875, 0.0099334716796875, 0.43280029296875, 0.7750701904296875], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.onnx new file mode 100644 index 0000000..d7b9da6 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.onnx @@ -0,0 +1,14 @@ + :s + +in_a +in_bout_a" +ReduceProdReduceProdSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.res new file mode 100644 index 0000000..18889f9 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceProd/ReduceProdSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[3.412624209886417e-05] +14 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.json new file mode 100644 index 0000000..96b2a8e --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.9491424560546875, 0.3555145263671875, 0.69769287109375, 0.345306396484375, 0.1726837158203125, 0.89996337890625, 0.703338623046875, 0.8527069091796875, 0.9705352783203125, 0.591339111328125], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.onnx new file mode 100644 index 0000000..bb8fc95 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.onnx @@ -0,0 +1,13 @@ + :q + +in_a +in_bout_a" ReduceSumReduceSumSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.res new file mode 100644 index 0000000..4277b71 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceSum/ReduceSumSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[6.5382232666015625] +14 diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.json b/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.json new file mode 100644 index 0000000..fa060da --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.json @@ -0,0 +1 @@ +[{"memref": {"data": [0.2340850830078125, 0.1363983154296875, 0.088653564453125, 0.3112640380859375, 0.415557861328125, 0.5983123779296875, 0.6885986328125, 0.0498199462890625, 0.712249755859375, 0.8282012939453125], "dims": [1, 10], "type": "f32"}}] diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.onnx b/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.onnx new file mode 100644 index 0000000..76e880e --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.onnx @@ -0,0 +1,13 @@ + :} +$ +in_a +in_bout_a"ReduceSumSquareReduceSumSquareSimple* :Bin_bZ +in_a +  + + +b +out_a +  + +B \ No newline at end of file diff --git a/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.res b/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.res new file mode 100644 index 0000000..d6330f3 --- /dev/null +++ b/mlir-assigner/tests/Ops/Onnx/ReduceSumSquare/ReduceSumSquareSimple.res @@ -0,0 +1,3 @@ +Result: +memref<1x1xf32>[2.378678321838379] +20