Skip to content

Commit

Permalink
new tests, reduce arena size
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpoluektov committed Mar 21, 2024
1 parent 6fa913d commit ce364eb
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 11 deletions.
2 changes: 2 additions & 0 deletions integration_tests/models/16x8/test_concatenate/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def representative_dataset_gen():
generate_concatenate_model([(64), (64)], 0)
generate_concatenate_model([(2, 3), (2, 3)], 1)
generate_concatenate_model([(2, 3, 5), (2, 3, 5)], -1)
generate_concatenate_model([(2, 3, 5), (2, 3, 7)], -1)
generate_concatenate_model([(2, 6, 5, 2), (2, 6, 5, 2)], 1)
generate_concatenate_model([(2, 6, 5, 2), (2, 2, 5, 2)], -3)
generate_concatenate_model([(2, 6, 5, 2), (2, 6, 5, 2)], 3)

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions xformer/IR/XCoreOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ def XC_ConcatOp : XC_Op<"concat", [Pure]> {
TensorOf<[QI8, QI16, F32, I8, I32]>:$input2,

I32ArrayAttr:$end1,
I32ArrayAttr:$input_offset1,
I32ArrayAttr:$input_offset,
I32ArrayAttr:$output_offset1,
I32Attr:$begin,
I32ArrayAttr:$end2,
I32ArrayAttr:$input_offset2,
I32ArrayAttr:$output_offset2
);

Expand Down
2 changes: 1 addition & 1 deletion xformer/Transforms/ReplaceConcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct ReplaceConcatPattern : public OpRewritePattern<TFL::ConcatenationOp> {
// begin2 is always 0 apart from last element:
rewriter.getI32IntegerAttr(begin_dst2[4]),
rewriter.getI32ArrayAttr(end_dst2),
rewriter.getI32ArrayAttr(in_offsets2),
// in_offsets2 == in_offsets1
rewriter.getI32ArrayAttr(out_offsets2));

rewriter.replaceOp(concatOp, binaryObjectConcatOp.getOutput());
Expand Down
11 changes: 3 additions & 8 deletions xformer/Transforms/TranslateToCustomOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ std::vector<uint8_t> ConcatOp::buildCustomOptions() {
fbb.Int((int32_t)e.cast<IntegerAttr>().getInt());
}
fbb.EndVector(endVec1, false, false);
auto inOffsetVec1 = fbb.StartVector("i1");
for (auto i : getInputOffset1()) {
auto inOffsetVec = fbb.StartVector("i");
for (auto i : getInputOffset()) {
fbb.Int((int32_t)i.cast<IntegerAttr>().getInt());
}
fbb.EndVector(inOffsetVec1, false, false);
fbb.EndVector(inOffsetVec, false, false);
auto outOffsetVec1 = fbb.StartVector("o1");
for (auto o : getOutputOffset1()) {
fbb.Int((int32_t)o.cast<IntegerAttr>().getInt());
Expand All @@ -155,11 +155,6 @@ std::vector<uint8_t> ConcatOp::buildCustomOptions() {
fbb.Int((int32_t)e.cast<IntegerAttr>().getInt());
}
fbb.EndVector(endVec2, false, false);
auto inOffsetVec2 = fbb.StartVector("i2");
for (auto i : getInputOffset2()) {
fbb.Int((int32_t)i.cast<IntegerAttr>().getInt());
}
fbb.EndVector(inOffsetVec2, false, false);
auto outOffsetVec2 = fbb.StartVector("o2");
for (auto o : getOutputOffset2()) {
fbb.Int((int32_t)o.cast<IntegerAttr>().getInt());
Expand Down

0 comments on commit ce364eb

Please sign in to comment.