Skip to content
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

[Arc] Add statistics to the FindInitialVectors pass #7113

Merged
merged 2 commits into from
Jun 1, 2024

Conversation

elhewaty
Copy link
Member

@elhewaty elhewaty commented Jun 1, 2024

No description provided.

Copy link
Member

@maerhart maerhart left a comment

Choose a reason for hiding this comment

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

Really useful statistics, thanks! 🎉
Added a few comments, but looks great otherwise!

@@ -62,6 +62,16 @@ def FindInitialVectors : Pass<"arc-find-initial-vectors", "mlir::ModuleOp"> {
let summary = "Find initial groups of vectorizable ops";
let constructor = "circt::arc::createFindInitialVectorsPass()";
let dependentDialects = ["arc::ArcDialect"];
let statistics = [
Statistic<"numOfVectorizedOps", "vectorOps",
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the name vectorOps suggests the same as numOfVectorsCreated, i'd rename it slightly:

Suggested change
Statistic<"numOfVectorizedOps", "vectorOps",
Statistic<"numOfVectorizedOps", "vectorizedOps",

Comment on lines +68 to +69
Statistic<"numOfSavedOps", "numOfSavedOps",
"Total number of ops saved after FindInitialVectors pass">,
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this always equivalent to vectorOps - numOfVectorsCreated and could, therefore, be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

a = b + c
d = e + f
g = h + i

after vectorization: [a, d, g] = [b, e, h] + [c, f, i]

biggestSeedVector: 3
numOfSavedOps: 2 (we had 3 ops but now we have one)
numOfVectorsCreated: 1
numOfVectorizedOps: 3

Copy link
Member

Choose a reason for hiding this comment

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

Exactly, 3-1=2. I don't mind having it, just wanted to point out the redundancy.

Comment on lines 135 to 138
size_t vecOps = 0;
size_t savedOps = 0;
size_t bigSeedVec = 0;
size_t vecCreated = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Please don't use global variables; it's not thread-safe since multiple instances of FindInitialVectorsPass would access the same variables. You can make them members of the pass class instead (potentially creating a struct that groups them and thus makes it easier to pass them as function arguments).

@elhewaty elhewaty requested a review from maerhart June 1, 2024 10:53
Copy link
Member

@maerhart maerhart left a comment

Choose a reason for hiding this comment

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

Thanks! Do you want me to merge it?

Comment on lines +68 to +69
Statistic<"numOfSavedOps", "numOfSavedOps",
"Total number of ops saved after FindInitialVectors pass">,
Copy link
Member

Choose a reason for hiding this comment

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

Exactly, 3-1=2. I don't mind having it, just wanted to point out the redundancy.

@elhewaty
Copy link
Member Author

elhewaty commented Jun 1, 2024

Exactly, 3-1=2. I don't mind having it, just wanted to point out the redundancy.

I just wanted to make the number clear, what do you think?

Thanks! Do you want me to merge it?

If you think we don't need to remove numOfSavedOps please do.

@maerhart maerhart merged commit 8e47286 into llvm:main Jun 1, 2024
4 checks passed
@elhewaty elhewaty deleted the add-statistics branch June 2, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants