Skip to content

Commit b645c23

Browse files
codyohlpytorchmergebot
authored andcommitted
make g2p ~30% faster on mobile by suppressing a log (pytorch#85907)
Summary: using the tool from D39559248 i was able to make g2p faster on mobile by taking a look at profiles on stella frames. It turned out that the pytorch interpreter code does some logging that ends up being a pretty big bottleneck. Differential Revision: D39901455 Pull Request resolved: pytorch#85907 Approved by: https://github.com/dzdang
1 parent bac2615 commit b645c23

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

aten/src/ATen/native/quantized/cpu/qlinear_dynamic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ at::Tensor PackedLinearWeightsQnnp::apply_dynamic_impl(
236236
at::Tensor input,
237237
bool reduce_range) {
238238
if (reduce_range) {
239-
TORCH_WARN("Currently, qnnpack incorrectly ignores reduce_range when it is set to true; this may change in a future release.");
239+
TORCH_WARN_ONCE("Currently, qnnpack incorrectly ignores reduce_range when it is set to true; this may change in a future release.");
240240
}
241241

242242
using at::Tensor;

torch/csrc/jit/mobile/interpreter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ bool InterpreterState::run(Stack& stack) {
110110
// Check with iliacher if has been done.
111111
// Plus this is not safe as if you throw exception record function will be
112112
// left enabled. That is a TODO
113+
// NOTE: this recordFunction logic takes up ~2-3% of cpu cycles in some
114+
// workflows. do we need it and/or can we opt-out of
115+
// isRecordFunctionEnabled with a macro? if we delete it, things appear to
116+
// work just fine.
113117
bool prev_value = isRecordFunctionEnabled();
114118
if (!prev_value) {
115119
// enable only for the RecordFunction

0 commit comments

Comments
 (0)