Skip to content

Commit e857f27

Browse files
spcypptfacebook-github-bot
authored andcommitted
Replace with powf (#2896)
Summary: Replace `pow` with `powf` for better performance Differential Revision: D58560455
1 parent 04fcabf commit e857f27

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fbgemm_gpu/codegen/genscript/jinja_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def compute_global_weight_decay(is_global_weight_decay_kernel: bool) -> str:
338338
if is_global_weight_decay_kernel:
339339
return """
340340
const auto prev_iter = prev_iter_dev[linear_index];
341-
const auto global_weight_decay = prev_iter == 0 ? 1 : max(gwd_lower_bound, std::pow(weight_decay_base, iter - prev_iter - 1));
341+
const auto global_weight_decay = prev_iter == 0 ? 1 : max(gwd_lower_bound, powf(weight_decay_base, iter - prev_iter - 1));
342342
if (threadIdx.x == 0) {
343343
prev_iter_dev[linear_index] = iter;
344344
}

fbgemm_gpu/codegen/training/forward/embedding_forward_split_kernel_template.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ using namespace fbgemm_gpu;
188188
{%- if is_gwd_kernel %}
189189
// if l > L or prev_iter == 0, global_weight_decay = 1
190190
const auto prev_it = prev_iter[idx];
191-
const auto global_weight_decay = (l > L || prev_it == 0) ? 1 : max(gwd_lower_bound, std::pow(weight_decay_base, iter - prev_it - 1));
191+
const auto global_weight_decay = (l > L || prev_it == 0) ? 1 : max(gwd_lower_bound, powf(weight_decay_base, iter - prev_it - 1));
192192
{%- endif %}
193193

194194
{%- if weighted %}

0 commit comments

Comments
 (0)