-
Notifications
You must be signed in to change notification settings - Fork 780
[DT] Implement MaterializeInterfaceBindingEncoding with interface methods. #22467
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
Conversation
…hods. Signed-off-by: hanhanW <[email protected]>
|
I'll delete |
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.
Pull Request Overview
This PR refactors the encoding materialization infrastructure to consolidate type conversion logic from MaterializeEncodingIntoPadding.cpp into the external models in GPUEncodingExternalModels.cpp. The main goal is to implement the convertType interface method directly in the GPU padding resolver attribute, eliminating the need for a separate custom type converter and pattern for padding-specific encoding.
- Moves
getPadLayoutandgetPaddedTypehelper functions fromMaterializeEncodingIntoPadding.cpptoGPUEncodingExternalModels.cpp - Implements
convertTypemethod inGPUPadEncodingLayoutMaterializerAttrto handle type conversion for padding encodings - Simplifies
MaterializeEncodingTypeConverterby removing padding-specific special cases - Updates
MaterializeInterfaceBindingEncodingpattern to use the unified type conversion approach
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
GPUEncodingExternalModels.cpp |
Adds getPadLayout and getPaddedType helper functions and implements convertType method for GPUPadEncodingLayoutMaterializerAttr |
materialize_encoding_into_padding.mlir |
Updates test expectations to include dynamic dimensions in dispatch tensor types |
MaterializeEncodingPatterns.cpp |
Refactors MaterializeInterfaceBindingEncoding to use generic type converter interface and compute dynamic dimensions via getOffsetsSizesStrides |
MaterializeEncodingIntoPadding.cpp |
Removes custom type converter and pattern implementations that are now handled by the external model |
EncodingUtils.cpp |
Removes padding-specific special cases from type converter, delegating all type conversion to the layout attribute's convertType method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
compiler/src/iree/compiler/Codegen/ExternalInterfaces/GPUEncodingExternalModels.cpp
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/ExternalInterfaces/GPUEncodingExternalModels.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/Codegen/ExternalInterfaces/GPUEncodingExternalModels.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: hanhanW <[email protected]>
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.
LGTM
Signed-off-by: hanhanW <[email protected]>
| return IREE::TensorExt::DispatchTensorType::get( | ||
| dispatchTensorType.getAccess(), type); | ||
| }) | ||
| .Default([&](Type type) { return type; }); |
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.
| .Default([&](Type type) { return type; }); | |
| .Default([](Type type) { return type; }); |
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.
oh thanks, somehow I missed it.
| Type convertType(Attribute attr, Type type) const { | ||
| auto layoutAttr = cast<IREE::Encoding::LayoutResolverAttr>(attr); | ||
| return TypeSwitch<Type, Type>(type) | ||
| .Case([&](RankedTensorType type) { |
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.
| .Case([&](RankedTensorType type) { | |
| .Case([](RankedTensorType type) { |
Signed-off-by: hanhanW <[email protected]>
The revision implements
LayoutMaterializerAttr::convertTypefor GPUPaddingResolverAttr; updates theMaterializeInterfaceBindingEncodingpattern to use interface methods to materialize the bindings.It also fixes a bug in
@dynamic_set_zero_pad_encoding_and_storetest that misses dynamic dimensions in binding ops.It is a step towards #20160