-
Notifications
You must be signed in to change notification settings - Fork 16
Flop counting #623
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
base: main
Are you sure you want to change the base?
Flop counting #623
Conversation
31da603 to
83629d9
Compare
|
@inducer I think this is ready for a first look, apart from some basedpyright errors that I don't understand. Probably best to go commit by commit. |
|
@inducer I ran into a complication with the flop counting for conditionals. When mirgecom projects something from interior/boundary faces to all faces, meshmode's direct connection code creates an Since the flop counting currently evaluates flops for |
5236448 to
72b69ac
Compare
|
@inducer Do you know what's causing these basedpyright errors for Also, about the |
72b69ac to
f6d34b8
Compare
789e7ac to
f077dd1
Compare
f077dd1 to
61aed37
Compare
pytato/utils.py
Outdated
| return ( | ||
| isinstance(expr, Array) | ||
| and not isinstance(expr, ( | ||
| # FIXME: Is there a nice way to generalize this? |
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 sure I understand the intent of this.
For example, DistributedRecv is always materialized (it ends up in a buffer after all).
What is this function trying to accomplish?
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 using this in the flop counting code to tell me a couple of things:
- Am I allowed to materialize/unmaterialize this expression? (Can't for things like
NamedArrayandDistributedSendRefHolder.) - Can this expression be lowered to an index lambda? (Can't for things like
InputArgumentBaseandDistributedRecv.)
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.
Is 5e30e95 any better? It still has some isinstance() checks that seem kind of fragile, but I'm not sure how to avoid them.
8164074 to
75e5dbe
Compare
|
@inducer This is ready for a look again when you have a chance. |
inducer
left a 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.
Just the enum thing and then this is good to go from my perspective. 🎉
| return {expr.name} | ||
|
|
||
|
|
||
| class FlopCounter(FlopCounterBase): |
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.
Let's do a separate node type for nflops.
| var_names: set[str] = set(ScalarInputGatherer()(nflops)) | ||
| var_names.discard("nflops") | ||
| if var_names: | ||
| raise UndefinedOpFlopCountError(next(iter(var_names))) from None |
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.
| raise UndefinedOpFlopCountError(next(iter(var_names))) from None | |
| raise UndefinedOpFlopCountError(next(iter(var_names))) |
| if var_names: | ||
| raise UndefinedOpFlopCountError(next(iter(var_names))) from None | ||
| else: | ||
| raise AssertionError from None |
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.
| raise AssertionError from None | |
| raise AssertionError |

Very WIP right now.
cc @majosm