-
-
Save shunting314/f12f20099126130b953e55ad325c0f62 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=-1) | |
N = 50 | |
C = functools.partial(torch.randn, device="cuda") | |
x_large = C(N, 4096 * 4) | |
f(x_large) | |
ms = do_bench(lambda: f(x_large)) | |
# 0.011ms v.s. 0.011ms | |
print(ms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment