-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[FIX,AUTOTVM] Add flop counts to cublas #7297
Conversation
Also print which op was missing flops.
@@ -44,6 +44,8 @@ def dense_cublas(cfg, data, weight, bias=None, out_dtype=None): | |||
matmul = cublas.matmul(data, weight, False, True) | |||
if isinstance(batch, int): | |||
cfg.add_flop(batch * in_dim * out_dim * 2) | |||
else: | |||
cfg.add_flop(batch.value * in_dim * out_dim * 2) |
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.
Should have an assertion to make sure batch is a TVM container 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.
I've added a check that it is int or IntImm, would any other types show up here?
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 think so. Let's use the current version to make sure we could catch any exception.
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.
Ah it turns out that you may get Var in the case of dynamic shape. For other TOPI templates, many of them just ignore the flops when the shape is dynamic. You could do the same.
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
3d98306
to
6fc1fa0
Compare
@@ -44,6 +44,8 @@ def dense_cublas(cfg, data, weight, bias=None, out_dtype=None): | |||
matmul = cublas.matmul(data, weight, False, True) | |||
if isinstance(batch, int): | |||
cfg.add_flop(batch * in_dim * out_dim * 2) | |||
else: | |||
cfg.add_flop(batch.value * in_dim * out_dim * 2) |
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 think so. Let's use the current version to make sure we could catch any exception.
Thanks @tkonolige |
Fixes a bug when trying to autotune with cublas enabled. I've also added the op name to the error messages.
@comaniac @merrymercy