-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add reduction_unroll_factor to autotuning script #3487
base: main
Are you sure you want to change the base?
Conversation
Support Gelu-Bias, Silu-Mul, Bcast-Add, Mul Fusions
7817368
to
e7ffb29
Compare
15bc05e
to
fdcf6a5
Compare
) | ||
|
||
# number of reduction elements not handled by a CTA | ||
remaining_reduction = ceil_div( | ||
num_reductions, | ||
(scheduler_config.bdimx * scheduler_config.vectorize_factor), | ||
(scheduler_config.bdimx * vectorize_factor * reduction_unroll_factor), |
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 be ceil_div(ceil_div(num_reductions/vectorize_factor, bdimx), reduction_unroll_factor)
) | ||
|
||
if unroll_factor == 1 and remaining_reduction > 1: | ||
if iteration_unroll_factor == 1 and remaining_reduction > 1: |
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.
This looks strange to me. Why grdim = remaining_reduction
? We can do serial reduction instread of grid reduction.
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.
nvFuser's default heuristic does:
// When iteration dim is small, may have unused SMs, to increase SM usage
// needs to shift from block reduction to grid reduction.
int64_t grdim = 1;
while (godim * grdim * 2 <= sm_count && getInnerRemainder() / grdim >= 2) {
grdim *= 2;
}
!build |
This PR renames
unroll_factor
toiteration_unroll_factor
and addsreduction_unroll_factor
.reduction_unroll_factor
adds unroll factor on top of vectorization factor for the inner reduction domain.