File size: 664 Bytes
aa3ac98 81fff32 aa3ac98 81fff32 aa3ac98 05bebc1 dac61af aa3ac98 dac61af aa3ac98 05bebc1 3b25788 dac61af 05bebc1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# "torch==2.8.0",
# "kernels-benchmark-tools",
# ]
#
# [tool.uv.sources]
# kernels-benchmark-tools = { path = "../../../../../tools", editable = true }
# ///
import torch
import sys
from kernels_benchmark_tools import KernelTypeEnum, run_benchmark
import torch, torch.nn.functional as F
def swiglu_eager(x):
d = x.shape[-1] // 2
return F.silu(x[..., :d]) * x[..., d:]
run_benchmark(
kernel_type=KernelTypeEnum.ACTIVATION,
impl_name="torch_eager_darwin",
impl_tags={"family":"pytorch", "backend":"eager", "platform": "darwin"},
impl_func=swiglu_eager,
) |