-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor API fixes for TTNN encoding ettribute #1390
Conversation
Here is how tensor will look like after layout tensor<32x32x64xf32, #ttnn.ttnn_layout<linear, grid, memref, mem_layout>> | ||
Lets break down what each parameter means: | ||
- affine_map: An affine map that defines how the logical tensor dimensions map to physical space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linear
vs affine_map
lib/Dialect/TTNN/IR/TTNNOps.cpp
Outdated
@@ -190,25 +190,13 @@ ::mlir::LogicalResult mlir::tt::ttnn::EmptyOp::verify() { | |||
|
|||
// DataType and Layout | |||
// | |||
mlir::MemRefType memref = layoutAttr.getMemref(); | |||
Type elementType = memref.getElementType(); | |||
// Type elementType = layoutAttr.getElementType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.. Tnx for noticing
lib/Dialect/TTNN/IR/TTNNOpsAttrs.cpp
Outdated
if (isTiled()) { | ||
return Layout::Tile; | ||
} | ||
|
||
return Layout::RowMajor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider packing into a one-liner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/Dialect/TTNN/IR/TTNNOpsAttrs.cpp
Outdated
// Example: memref<128x128xf32> -> { 128, 128 } | ||
// Example: memref<2x3!tt.tile<32x32xf32>> -> { 64, 96 } | ||
// | ||
// /return The scalar shape of the shard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this /return
, is it a docs thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I now see that I ill formed comments. Doxygen requires ///
for comments in order to generate documentation.
Also return
param
should be prefixed with \
not /
.
This PR adds couple convenience methods to TTNN tensor encoding attribute and also removes redundant utils functions.
Renaming/Adding some new functions...
getDataType
to get scalar data type:memref<2x2x!tt.tile<32x32xf32>>
returns float data typememref<128x128xi32>
returns int data typegetElementType
to get type from memref:memref<2x2x!tt.tile<32x32xf32>>
returns TileTypememref<128x128xi32>
returns IntegerTypegetLayout
- gets layout of encoding i.e Tile/RowMajorgetShardShape
:memref<2x2x!tt.tile<32x32xf32>>
returns(2, 2)
memref<128x128xi32>
returns(128, 128)
getScalarShardShape
:memref<2x2x!tt.tile<32x32xf32>>
returns(64, 64)
memref<128x128xi32>
returns(128, 128)