Skip to content

Commit

Permalink
ASAN fix of failing tests
Browse files Browse the repository at this point in the history
This PR introduces some changes #1566, but it seems that it
doesn't fix the majority of failing tests. Both bugs are result of
dangling reference of `ArrayRef` objects, because they receive temporary
`SmallVector` objects.

I've rebased this branch on #1562, for the ability to build with ASAN flag.

Fixes #1565
  • Loading branch information
azecevicTT committed Dec 12, 2024
1 parent 63a8f1f commit abf39e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/Dialect/TTNN/Transforms/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class TTNNDecomposeLayouts
ttnn::Layout layoutEnum;
DataType dataType;
ttnn::TensorMemoryLayoutAttr tensorMemoryLayout;
llvm::ArrayRef<int64_t> shardShape;
llvm::SmallVector<int64_t> shardShape;

ttnn::MemoryConfigAttr createMemoryConfigAttr(MLIRContext *context) const {
return ttnn::MemoryConfigAttr::get(
Expand Down Expand Up @@ -233,7 +233,8 @@ class TTNNDecomposeLayouts
output.tensorMemoryLayout = outputMemoryConfig.getTensorMemoryLayout();

input.shardShape = inputLayoutAttr.getShardShape();
output.shardShape = outputMemoryConfig.getShardShapeArray();
output.shardShape =
llvm::SmallVector<int64_t>{outputMemoryConfig.getShardShapeArray()};
return {input, output};
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/TTNN/Utils/TransformUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Value getOrInsertDevice(PatternRewriter &rewriter, Operation *op) {
DeviceAttr deviceAttr = getCurrentScopeDevice(op);
auto currentInsertionPoint = rewriter.saveInsertionPoint();
rewriter.setInsertionPoint(block, block->begin());
auto meshShape = deviceAttr.getMeshShape();
llvm::SmallVector<int64_t> meshShape{deviceAttr.getMeshShape()};
if (meshShape.empty()) {
meshShape = llvm::SmallVector<int64_t, 2>{1, 1};
}
Expand Down

0 comments on commit abf39e2

Please sign in to comment.