Skip to content
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

Disable donated_buffer for all ops's backward benchmarking #104

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tritonbench/operators/geglu/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from tritonbench.utils.triton_op import (
BenchmarkOperator,
Mode,
register_benchmark,
register_x_val,
)
Expand Down Expand Up @@ -60,6 +61,12 @@ def liger_geglu(self, input) -> Callable:

@register_benchmark()
def inductor_geglu(self, input) -> Callable:
# TODO: remove this once we have a better way to handle backward benchmarking
# We need to run backward multiple times for proper benchmarking
# so donated buffer have to be disabled
if self.mode == Mode.BWD or self.mode == Mode.FWD_BWD:
import torch._functorch.config

compiled = torch.compile(self.baseline_model)
return lambda: compiled(input)

Expand Down
1 change: 1 addition & 0 deletions tritonbench/operators/layer_norm/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def torch_layer_norm(self, *args):

@register_benchmark()
def torch_compile_layer_norm(self, *args):
# TODO: remove this once we have a better way to handle backward benchmarking
# We need to run backward multiple times for proper benchmarking
# so donated buffer have to be disabled
if self.mode == Mode.BWD or self.mode == Mode.FWD_BWD:
Expand Down
7 changes: 7 additions & 0 deletions tritonbench/operators/swiglu/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from tritonbench.utils.triton_op import (
BenchmarkOperator,
Mode,
register_benchmark,
register_x_val,
)
Expand Down Expand Up @@ -60,6 +61,12 @@ def liger_swiglu(self, input) -> Callable:

@register_benchmark()
def inductor_swiglu(self, input) -> Callable:
# TODO: remove this once we have a better way to handle backward benchmarking
# We need to run backward multiple times for proper benchmarking
# so donated buffer have to be disabled
if self.mode == Mode.BWD or self.mode == Mode.FWD_BWD:
import torch._functorch.config

compiled = torch.compile(self.baseline_op)
return lambda: compiled(input)

Expand Down
Loading