-
Notifications
You must be signed in to change notification settings - Fork 64
[Benchmark] kl_div kernel and test #615
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
stack-info: PR: #615, branch: Sibylau/stack/1
dc48a33 to
384353d
Compare
| elif reduction == "mean": | ||
| final_loss = torch.sum(loss) / (BT * V) | ||
| else: # reduction == "none" | ||
| final_loss = loss |
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 we test all reductions in the unit tests / main function? or maybe simplify it to just one case that's being used by tritonbench?
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.
tritonbench only tests the reduction = "batchmean" case: https://github.com/meta-pytorch/tritonbench/blob/main/tritonbench/operators/kl_div/operator.py#L28
while liger_kernel implements all cases. I mirrored liger_kernel implementation: https://github.com/linkedin/Liger-Kernel/blob/main/src/liger_kernel/ops/kl_div.py#L150
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.
would you suggest I add all unit tests for all reductions, or only implement reduction = "batchmean" ?
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 see, let's just keep it as-is now.
yf225
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.
thanks @Sibylau ! rebasing should clear the CI errors
stack-info: PR: #615, branch: Sibylau/stack/1
3878bf5 to
ad5be78
Compare
|
I took the liberty to rebase the PR. Will merge it after the CI clears. |


Stacked PRs:
[Benchmark] kl_div kernel and test