Skip to content

[Transform][Vector] Lower operation to tile (virtual) vector #252

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

Merged
merged 11 commits into from
Aug 20, 2024

Conversation

BRUCE11111
Copy link
Contributor

@BRUCE11111 BRUCE11111 commented Aug 15, 2024

Part of issue148.
This is just a pass that lower operation to vector. It is just a simple part of the physical register pass.

We separate this PR to facilitate further testing and running of other PRs.

#define SAFE_EXPAND(X) X
#define LDBG(X) LLVM_DEBUG(DBGS() << SAFE_EXPAND(X) << "\n")

#define IMPLEMENTED_MATMUL \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to skip all matmul/conv ops, maybe we can check ContractionOpInterfaceand ConvolutionOpInterface or use the helper provide in: https://github.com/intel/graph-compiler/pull/187/files#r1714656991.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we migrate to generic matmuls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will add it! Thanks for advice~

if (isCollapseOp) {
reshapeHelper.srcVectorizedShape.emplace_back(ss);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary white spaces, add comments or squash them if self explanatory.

<< concatOp << "\n");
}
// check input operand shape type
if (not llvm::all_of(concatOp.getOperandTypes(), [](Type x) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check any_of shape is dynamic maybe faster than all_of must be static?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure~ Will change it to anyof!

};
} // namespace

std::unique_ptr<Pass> createLowerTileVectorPass() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this will be auto generated by .td?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createLowerToTileVectorPass()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the names for this pass and unify them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's redundant. Need to remove it.

struct ReshapeVectorizeHelper {
/// The transfer_read operation read result. We calculate this shape based on
/// the specified input vector size.
SmallVector<int64_t> srcVectorizedShape;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The srcVectorizedShape and srcShape seems unused and please remove them if they are useless

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually in getReshapeOperationVectorizeShape function is using this struct to avoid pass too many parameters. All the data is required by it.

SmallVector<int64_t> associateIndices;

for (const Attribute &attr : reshapeOp.getReassociation()) {
llvm::transform(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See~

@ZhennanQin ZhennanQin merged commit 61e90af into main Aug 20, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants