Skip to content

Commit ddc83ad

Browse files
rocm-micinaromero77amd
authored andcommitted
[AUTOGENERATED] [release/2.5][ROCm][TunableOp] Fix TunableOp warmup environment variable. (pytorch#147412) (#2040)
Cherry-pick of #2017 Co-authored-by: Nichols A. Romero <[email protected]>
1 parent 9d5ef33 commit ddc83ad

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

aten/src/ATen/cuda/tunable/TunableOp.h

+8-5
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,23 @@ class TunableOp {
287287
}
288288

289289
// for warmup does user set max duration, max iters, or both?
290-
// warmup is allowed to be skipped by setting either iterations or duration to 0
290+
// warmup is skipped by default, i.e. warmup_iter = 0
291+
// warmup will be set to the non-zero value of max_warmup_duration
292+
// or max_warmup_iter
293+
// if both are non-zero, we take the smaller of the two.
291294
double max_warmup_duration = ctx->GetMaxWarmupDurationMs();
292295
int max_warmup_iter = ctx->GetMaxWarmupIterations();
293-
int warmup_iter = 1; // default
294-
if (max_warmup_duration >= 0) {
296+
int warmup_iter = 0; // default
297+
if (max_warmup_duration > 0) {
295298
int duration_iters = max_warmup_duration / approx_duration;
296-
if (max_warmup_iter >= 0) {
299+
if (max_warmup_iter > 0) {
297300
warmup_iter = std::min(max_warmup_iter, duration_iters);
298301
}
299302
else {
300303
warmup_iter = duration_iters;
301304
}
302305
}
303-
else if (max_warmup_iter >= 0) {
306+
else if (max_warmup_iter > 0) {
304307
warmup_iter = max_warmup_iter;
305308
}
306309

0 commit comments

Comments
 (0)