[PyTorch] Adopt faster Tuple::create (#65381)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65381

The previous diff adds a way to make Tuples of size 3 or less
more efficiently. This diff makes it easier to hit that path and
updates a bunch of callsites to hit it.
ghstack-source-id: 142065832

Test Plan: CI

Reviewed By: ezyang

Differential Revision: D31069538

fbshipit-source-id: d04da3709594ed68ab1c0a1471f8cffd8d001628
This commit is contained in:
Scott Wolchok
2021-11-02 10:08:49 -07:00
committed by Facebook GitHub Bot
parent 9e71ea292d
commit 7cd62621fb
10 changed files with 161 additions and 62 deletions

View File

@ -419,8 +419,8 @@ struct InterpreterStateImpl : c10::intrusive_ptr_target {
if (num_outputs == 1) {
future_->markCompleted(stack.back());
} else {
future_->markCompleted(c10::ivalue::Tuple::create(
jit::last(stack, num_outputs).vec()));
future_->markCompleted(
c10::ivalue::Tuple::create(jit::last(stack, num_outputs)));
}
}
// destroy the last frame and call RecordFunction's end callbacks