Skip to content

Commit

Permalink
This commit partially addresses issue #29.
Browse files Browse the repository at this point in the history
  When one or more tensors are transposed before a contraction (C=A*B), the shape of the contraction result
  might be different than the expected output C. Thus this intermediate results is stored in a temporary tensor,
  which will later be tranposed in the C, taking the expected shape.
  However, instead of just allocating this intermediate tensor we would also transpose tensor C into it, making
  a redundant trasposition. This commit removes this extra transposition.
  • Loading branch information
pthomadakis committed Sep 27, 2023
1 parent fe7276d commit a6c415c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Dialect/TensorAlgebra/Transforms/TCtoTTGT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,11 @@ namespace
MemRefType::get(lhsDims, lhsMemrefType.getElementType()), loc,
rewriter);
useLHSTranspose = true;
Value constantOp = rewriter.create<ConstantOp>(loc, rewriter.getF64FloatAttr(0.0));

rewriter.create<linalg::FillOp>(loc, constantOp, lhsAlloc);
// TODO(gkestor): we might need this copy if we support update C[] += A[] * B[]
rewriter.create<linalg::TransposeOp>(loc, lhsMemref, lhsAlloc, llvm::ArrayRef<int64_t>(lhsOutPerm_int64));
// rewriter.create<linalg::TransposeOp>(loc, lhsMemref, lhsAlloc, llvm::ArrayRef<int64_t>(lhsOutPerm_int64));
}

RankedTensorType collapsedTensorType;
Expand Down

0 comments on commit a6c415c

Please sign in to comment.