-
Notifications
You must be signed in to change notification settings - Fork 668
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
[Encoding][Codegen] Add initial pad encoding layout attrs #19865
Conversation
ad3c070
to
f66bba0
Compare
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.
Nice, happy to see that it in a better organization!
if (ArrayAttr layoutsAttr = getLayouts()) { | ||
if (!llvm::all_of(layoutsAttr.getValue(), | ||
llvm::IsaPred<SerializedEncodingLayoutAttrInterface>)) { | ||
return nullptr; | ||
} | ||
|
||
auto layoutsAttrArray = | ||
llvm::to_vector_of<IREE::Encoding::EncodingLayoutAttrInterface>( | ||
layoutsAttr.getValue()); | ||
Value res; | ||
for (auto attr : layoutsAttrArray) { | ||
for (auto attr : | ||
layoutsAttr.getAsRange<SerializedEncodingLayoutAttrInterface>()) { |
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.
Nice cleanup, thanks!
#include <cassert> | ||
#include <cfloat> | ||
#include <cstdint> | ||
#include <numeric> |
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 don't remember which include style we are following. LLVM puts the system headers at the end, while Google puts them in the middle. IREE is following the mixed styles. It looks okay to me because our Codegen codebase is very close to MLIR codebase.
@benvanik @MaheshRavishankar which style should we follow?
https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
https://llvm.org/docs/CodingStandards.html#include-style
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.
We should write it down somewhere on iree.dev. I remember the include order is something that we explicitly tweaked when switching to the llvm clang-format style: https://github.com/iree-org/iree/blob/main/compiler/.clang-format
I need to rebase this on top of #19879 |
These allow us to pad allocations without changing the logical tensor sizes or data layouts. Split the encoding layout attribute interface into two: * One with target-specific information that allows us to decide layouts. * One with serialized target-agnostic padding information. Signed-off-by: Jakub Kuderski <jakub@nod-labs.com>
91a09e7
to
b7af694
Compare
…9865) These allow us to pad allocations without changing the logical tensor sizes or data layouts. Split the encoding layout attribute interface into two: * One with target-specific information that allows us to decide layouts. * One with serialized target-agnostic padding information. Signed-off-by: Jakub Kuderski <jakub@nod-labs.com> Signed-off-by: Hyunsung Lee <ita9naiwa@gmail.com>
These allow us to pad allocations without changing the logical tensor sizes or data layouts.
Split the encoding layout attribute interface into two: