-
-
Save shunting314/6a670a818e63533479399c4dbea5b29a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from triton.testing import do_bench | |
import functools | |
from torch._inductor import config | |
from torch._dynamo.decorators import mark_dynamic | |
import os | |
@torch.compile | |
def f(x): | |
return x.sum(dim=0) | |
N = 50 | |
C = functools.partial(torch.randn, device="cuda") | |
x_large = C(4096, N) | |
f(x_large) | |
ms = do_bench(lambda: f(x_large)) | |
# 0.01 v.s. 0.009 | |
print(ms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment