Dataset Viewer
Auto-converted to Parquet Duplicate
entry_point
stringlengths
1
65
original_triton_code
stringlengths
4.5k
619k
python_code
stringlengths
208
60.9k
triton_code
stringlengths
1.15k
275k
repo_name
stringlengths
7
115
module_name
stringlengths
1
65
synthetic
bool
1 class
uuid
int64
0
18.5k
licenses
listlengths
1
6
stars
int64
0
19.8k
sha
stringlengths
40
40
repo_link
stringlengths
72
180
messages
stringlengths
8.63k
1.48M
SumAggregator
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/7o/c7otc5ij6whexgxcr56vlxp2l7hzg3oc4onljp557uc6wncu5gvg.py # Topologically Sorted Source Nodes: [sum_1], Original ATen: [aten.sum] # Source node to ATen node mapping: # sum_1 => sum_1 # Graph fragment: # %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%arg0_1, [1]), kwargs = {}) triton_poi_fused_sum_0 = async_compile.triton('triton_poi_fused_sum_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[64], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_sum_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 4, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 64 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 16 x1 = (xindex // 16) x2 = xindex tmp0 = tl.load(in_ptr0 + (x0 + (64*x1)), xmask) tmp1 = tl.load(in_ptr0 + (16 + x0 + (64*x1)), xmask) tmp3 = tl.load(in_ptr0 + (32 + x0 + (64*x1)), xmask) tmp5 = tl.load(in_ptr0 + (48 + x0 + (64*x1)), xmask) tmp2 = tmp0 + tmp1 tmp4 = tmp2 + tmp3 tmp6 = tmp4 + tmp5 tl.store(out_ptr0 + (x2), tmp6, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): arg0_1, = args args.clear() assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32) # Topologically Sorted Source Nodes: [sum_1], Original ATen: [aten.sum] stream0 = get_raw_stream(0) triton_poi_fused_sum_0.run(arg0_1, buf0, 64, grid=grid(64), stream=stream0) del arg0_1 return (buf0, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) fn = lambda: call([arg0_1]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import torch import torch.nn as nn class SumAggregator(nn.Module): def __init__(self): super(SumAggregator, self).__init__() def forward(self, neighbor): return torch.sum(neighbor, dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.jit def triton_poi_fused_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 64 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 16 x1 = xindex // 16 x2 = xindex tmp0 = tl.load(in_ptr0 + (x0 + 64 * x1), xmask) tmp1 = tl.load(in_ptr0 + (16 + x0 + 64 * x1), xmask) tmp3 = tl.load(in_ptr0 + (32 + x0 + 64 * x1), xmask) tmp5 = tl.load(in_ptr0 + (48 + x0 + 64 * x1), xmask) tmp2 = tmp0 + tmp1 tmp4 = tmp2 + tmp3 tmp6 = tmp4 + tmp5 tl.store(out_ptr0 + x2, tmp6, xmask) def call(args): arg0_1, = args args.clear() assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32) get_raw_stream(0) triton_poi_fused_sum_0[grid(64)](arg0_1, buf0, 64, XBLOCK=64, num_warps=1, num_stages=1) del arg0_1 return buf0, class SumAggregatorNew(nn.Module): def __init__(self): super(SumAggregatorNew, self).__init__() def forward(self, input_0): arg0_1 = input_0 output = call([arg0_1]) return output[0]
AlexMinhao/NAS_GNN
SumAggregator
false
0
[ "Apache-2.0" ]
0
89183988a96e1d6baed910ab3843c13282f8b077
https://github.com/AlexMinhao/NAS_GNN/tree/89183988a96e1d6baed910ab3843c13282f8b077
[ { "content": "entry_point: SumAggregator\n\n# AOT ID: ['0_inference']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/7o/c7otc5ij6whexgxcr56vlxp2l7hzg3oc4onljp557uc6wncu5gvg.py\n# Topologically Sorted Source Nodes: [sum_1], Original ATen: [aten.sum]\n# Source node to ATen node mapping:\n# sum_1 => sum_1\n# Graph fragment:\n# %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%arg0_1, [1]), kwargs = {})\ntriton_poi_fused_sum_0 = async_compile.triton('triton_poi_fused_sum_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[64], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_sum_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 4, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 64\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 16\n x1 = (xindex // 16)\n x2 = xindex\n tmp0 = tl.load(in_ptr0 + (x0 + (64*x1)), xmask)\n tmp1 = tl.load(in_ptr0 + (16 + x0 + (64*x1)), xmask)\n tmp3 = tl.load(in_ptr0 + (32 + x0 + (64*x1)), xmask)\n tmp5 = tl.load(in_ptr0 + (48 + x0 + (64*x1)), xmask)\n tmp2 = tmp0 + tmp1\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tl.store(out_ptr0 + (x2), tmp6, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [sum_1], Original ATen: [aten.sum]\n stream0 = get_raw_stream(0)\n triton_poi_fused_sum_0.run(arg0_1, buf0, 64, grid=grid(64), stream=stream0)\n del arg0_1\n return (buf0, )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 64\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 16\n x1 = xindex // 16\n x2 = xindex\n tmp0 = tl.load(in_ptr0 + (x0 + 64 * x1), xmask)\n tmp1 = tl.load(in_ptr0 + (16 + x0 + 64 * x1), xmask)\n tmp3 = tl.load(in_ptr0 + (32 + x0 + 64 * x1), xmask)\n tmp5 = tl.load(in_ptr0 + (48 + x0 + 64 * x1), xmask)\n tmp2 = tmp0 + tmp1\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tl.store(out_ptr0 + x2, tmp6, xmask)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_sum_0[grid(64)](arg0_1, buf0, 64, XBLOCK=64,\n num_warps=1, num_stages=1)\n del arg0_1\n return buf0,\n\n\nclass SumAggregatorNew(nn.Module):\n\n def __init__(self):\n super(SumAggregatorNew, self).__init__()\n\n def forward(self, input_0):\n arg0_1 = input_0\n output = call([arg0_1])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 64\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 16\n x1 = xindex // 16\n x2 = xindex\n tmp0 = tl.load(in_ptr0 + (x0 + 64 * x1), xmask)\n tmp1 = tl.load(in_ptr0 + (16 + x0 + 64 * x1), xmask)\n tmp3 = tl.load(in_ptr0 + (32 + x0 + 64 * x1), xmask)\n tmp5 = tl.load(in_ptr0 + (48 + x0 + 64 * x1), xmask)\n tmp2 = tmp0 + tmp1\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tl.store(out_ptr0 + x2, tmp6, xmask)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_sum_0[grid(64)](arg0_1, buf0, 64, XBLOCK=64,\n num_warps=1, num_stages=1)\n del arg0_1\n return buf0,\n\n\nclass SumAggregatorNew(nn.Module):\n\n def __init__(self):\n super(SumAggregatorNew, self).__init__()\n\n def forward(self, input_0):\n arg0_1 = input_0\n output = call([arg0_1])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 64\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 16\n x1 = xindex // 16\n x2 = xindex\n tmp0 = tl.load(in_ptr0 + (x0 + 64 * x1), xmask)\n tmp1 = tl.load(in_ptr0 + (16 + x0 + 64 * x1), xmask)\n tmp3 = tl.load(in_ptr0 + (32 + x0 + 64 * x1), xmask)\n tmp5 = tl.load(in_ptr0 + (48 + x0 + 64 * x1), xmask)\n tmp2 = tmp0 + tmp1\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tl.store(out_ptr0 + x2, tmp6, xmask)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_sum_0[grid(64)](arg0_1, buf0, 64, XBLOCK=64,\n num_warps=1, num_stages=1)\n del arg0_1\n return buf0,\n\n\nclass SumAggregatorNew(nn.Module):\n\n def __init__(self):\n super(SumAggregatorNew, self).__init__()\n\n def forward(self, input_0):\n arg0_1 = input_0\n output = call([arg0_1])\n return output[0]\n" } ]
LinearEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/xz/cxz7i3qbiizfbbzvas22bbwy5nxzvmtfdg5vhhiye56dk4hdonst.py # Topologically Sorted Source Nodes: [mul], Original ATen: [aten.mul] # Source node to ATen node mapping: # mul => mul # Graph fragment: # %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_1, 2.0), kwargs = {}) triton_poi_fused_mul_0 = async_compile.triton('triton_poi_fused_mul_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[256], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x0 = xindex % 4 tmp0 = tl.load(in_out_ptr0 + (x2), xmask) tmp1 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last') tmp2 = tmp0 + tmp1 tmp3 = 2.0 tmp4 = tmp2 * tmp3 tl.store(in_out_ptr0 + (x2), tmp4, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4), (4, 1)) assert_size_stride(primals_2, (4, ), (1, )) assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32) # Topologically Sorted Source Nodes: [], Original ATen: [] extern_kernels.mm(reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), out=buf0) del primals_1 buf1 = reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0); del buf0 # reuse # Topologically Sorted Source Nodes: [mul], Original ATen: [aten.mul] stream0 = get_raw_stream(0) triton_poi_fused_mul_0.run(buf1, primals_2, 256, grid=grid(256), stream=stream0) del primals_2 return (buf1, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance primals_1 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32) primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) primals_3 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) fn = lambda: call([primals_1, primals_2, primals_3]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import math import torch import torch.utils.data import torch.nn as nn class LinearEmbedding(nn.Module): def __init__(self, inp_size, d_model): super(LinearEmbedding, self).__init__() self.lut = nn.Linear(inp_size, d_model) self.d_model = d_model def forward(self, x): return self.lut(x) * math.sqrt(self.d_model) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'inp_size': 4, 'd_model': 4}]
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor @triton.jit def triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x0 = xindex % 4 tmp0 = tl.load(in_out_ptr0 + x2, xmask) tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last') tmp2 = tmp0 + tmp1 tmp3 = 2.0 tmp4 = tmp2 * tmp3 tl.store(in_out_ptr0 + x2, tmp4, xmask) def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4), (4, 1)) assert_size_stride(primals_2, (4,), (1,)) assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32) extern_kernels.mm(reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), out=buf0) del primals_1 buf1 = reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0) del buf0 get_raw_stream(0) triton_poi_fused_mul_0[grid(256)](buf1, primals_2, 256, XBLOCK=256, num_warps=4, num_stages=1) del primals_2 return buf1, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0) class LinearEmbeddingNew(nn.Module): def __init__(self, inp_size, d_model): super(LinearEmbeddingNew, self).__init__() self.lut = nn.Linear(inp_size, d_model) self.d_model = d_model def forward(self, input_0): primals_1 = self.lut.weight primals_2 = self.lut.bias primals_3 = input_0 output = call([primals_1, primals_2, primals_3]) return output[0]
Akhil-Raj/Trajectory-Transformer
LinearEmbedding
false
1
[ "MIT" ]
0
dd09fda99443f6afb59d962026573162219ea6a9
https://github.com/Akhil-Raj/Trajectory-Transformer/tree/dd09fda99443f6afb59d962026573162219ea6a9
[ { "content": "entry_point: LinearEmbedding\n\n# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/xz/cxz7i3qbiizfbbzvas22bbwy5nxzvmtfdg5vhhiye56dk4hdonst.py\n# Topologically Sorted Source Nodes: [mul], Original ATen: [aten.mul]\n# Source node to ATen node mapping:\n# mul => mul\n# Graph fragment:\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_1, 2.0), kwargs = {})\ntriton_poi_fused_mul_0 = async_compile.triton('triton_poi_fused_mul_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[256], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + (x2), xmask)\n tmp1 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 2.0\n tmp4 = tmp2 * tmp3\n tl.store(in_out_ptr0 + (x2), tmp4, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4), (4, 1))\n assert_size_stride(primals_2, (4, ), (1, ))\n assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [], Original ATen: []\n extern_kernels.mm(reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), out=buf0)\n del primals_1\n buf1 = reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0); del buf0 # reuse\n # Topologically Sorted Source Nodes: [mul], Original ATen: [aten.mul]\n stream0 = get_raw_stream(0)\n triton_poi_fused_mul_0.run(buf1, primals_2, 256, grid=grid(256), stream=stream0)\n del primals_2\n return (buf1, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n primals_1 = rand_strided((4, 4), (4, 1), device='cuda:0', dtype=torch.float32)\n primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n primals_3 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([primals_1, primals_2, primals_3])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nfrom torch._inductor.select_algorithm import extern_kernels\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nimport torch.utils.data\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\n\n\n@triton.jit\ndef triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 2.0\n tmp4 = tmp2 * tmp3\n tl.store(in_out_ptr0 + x2, tmp4, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4), (4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32)\n extern_kernels.mm(reinterpret_tensor(primals_3, (64, 4), (4, 1), 0),\n reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), out=buf0)\n del primals_1\n buf1 = reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0)\n del buf0\n get_raw_stream(0)\n triton_poi_fused_mul_0[grid(256)](buf1, primals_2, 256, XBLOCK=256,\n num_warps=4, num_stages=1)\n del primals_2\n return buf1, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0)\n\n\nclass LinearEmbeddingNew(nn.Module):\n\n def __init__(self, inp_size, d_model):\n super(LinearEmbeddingNew, self).__init__()\n self.lut = nn.Linear(inp_size, d_model)\n self.d_model = d_model\n\n def forward(self, input_0):\n primals_1 = self.lut.weight\n primals_2 = self.lut.bias\n primals_3 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nfrom torch._inductor.select_algorithm import extern_kernels\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nimport torch.utils.data\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\n\n\n@triton.jit\ndef triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 2.0\n tmp4 = tmp2 * tmp3\n tl.store(in_out_ptr0 + x2, tmp4, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4), (4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32)\n extern_kernels.mm(reinterpret_tensor(primals_3, (64, 4), (4, 1), 0),\n reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), out=buf0)\n del primals_1\n buf1 = reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0)\n del buf0\n get_raw_stream(0)\n triton_poi_fused_mul_0[grid(256)](buf1, primals_2, 256, XBLOCK=256,\n num_warps=4, num_stages=1)\n del primals_2\n return buf1, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0)\n\n\nclass LinearEmbeddingNew(nn.Module):\n\n def __init__(self, inp_size, d_model):\n super(LinearEmbeddingNew, self).__init__()\n self.lut = nn.Linear(inp_size, d_model)\n self.d_model = d_model\n\n def forward(self, input_0):\n primals_1 = self.lut.weight\n primals_2 = self.lut.bias\n primals_3 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nfrom torch._inductor.select_algorithm import extern_kernels\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nimport torch.utils.data\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\n\n\n@triton.jit\ndef triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 2.0\n tmp4 = tmp2 * tmp3\n tl.store(in_out_ptr0 + x2, tmp4, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4), (4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((64, 4), (4, 1), torch.float32)\n extern_kernels.mm(reinterpret_tensor(primals_3, (64, 4), (4, 1), 0),\n reinterpret_tensor(primals_1, (4, 4), (1, 4), 0), out=buf0)\n del primals_1\n buf1 = reinterpret_tensor(buf0, (4, 4, 4, 4), (64, 16, 4, 1), 0)\n del buf0\n get_raw_stream(0)\n triton_poi_fused_mul_0[grid(256)](buf1, primals_2, 256, XBLOCK=256,\n num_warps=4, num_stages=1)\n del primals_2\n return buf1, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0)\n\n\nclass LinearEmbeddingNew(nn.Module):\n\n def __init__(self, inp_size, d_model):\n super(LinearEmbeddingNew, self).__init__()\n self.lut = nn.Linear(inp_size, d_model)\n self.d_model = d_model\n\n def forward(self, input_0):\n primals_1 = self.lut.weight\n primals_2 = self.lut.bias\n primals_3 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n" } ]
CustomizeLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/ne/cnem3ewvyvy2ry3vceibv7j67edhj5jen3qlzvzibg5tpkhxkwsq.py # Topologically Sorted Source Nodes: [pow_1, sum_1, norm, x, mul, add], Original ATen: [aten.pow, aten.sum, aten.sqrt, aten.div, aten.mul, aten.add] # Source node to ATen node mapping: # add => add # mul => mul # norm => sqrt # pow_1 => pow_1 # sum_1 => sum_1 # x => div # Graph fragment: # %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%primals_1, 2), kwargs = {}) # %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%pow_1, [1], True), kwargs = {}) # %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%sum_1,), kwargs = {}) # %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%primals_1, %sqrt), kwargs = {}) # %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%div, %primals_2), kwargs = {}) # %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul, %primals_3), kwargs = {}) triton_poi_fused_add_div_mul_pow_sqrt_sum_0 = async_compile.triton('triton_poi_fused_add_div_mul_pow_sqrt_sum_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[256], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_mul_pow_sqrt_sum_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_add_div_mul_pow_sqrt_sum_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x4 = xindex x3 = (xindex // 64) x5 = xindex % 16 x0 = xindex % 4 tmp0 = tl.load(in_ptr0 + (x4), xmask) tmp1 = tl.load(in_ptr0 + (x5 + (64*x3)), xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr0 + (16 + x5 + (64*x3)), xmask, eviction_policy='evict_last') tmp6 = tl.load(in_ptr0 + (32 + x5 + (64*x3)), xmask, eviction_policy='evict_last') tmp9 = tl.load(in_ptr0 + (48 + x5 + (64*x3)), xmask, eviction_policy='evict_last') tmp14 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last') tmp16 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last') tmp2 = tmp1 * tmp1 tmp4 = tmp3 * tmp3 tmp5 = tmp2 + tmp4 tmp7 = tmp6 * tmp6 tmp8 = tmp5 + tmp7 tmp10 = tmp9 * tmp9 tmp11 = tmp8 + tmp10 tmp12 = libdevice.sqrt(tmp11) tmp13 = tmp0 / tmp12 tmp15 = tmp13 * tmp14 tmp17 = tmp15 + tmp16 tl.store(out_ptr0 + (x4), tmp17, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4, ), (1, )) assert_size_stride(primals_3, (4, ), (1, )) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) # Topologically Sorted Source Nodes: [pow_1, sum_1, norm, x, mul, add], Original ATen: [aten.pow, aten.sum, aten.sqrt, aten.div, aten.mul, aten.add] stream0 = get_raw_stream(0) triton_poi_fused_add_div_mul_pow_sqrt_sum_0.run(primals_1, primals_2, primals_3, buf0, 256, grid=grid(256), stream=stream0) del primals_2 del primals_3 return (buf0, primals_1, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) fn = lambda: call([primals_1, primals_2, primals_3]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import torch import torch.nn as nn class CustomizeLayer(nn.Module): def __init__(self, in_dim): super().__init__() self.in_dim = in_dim self.scale = nn.Parameter(torch.Tensor(self.in_dim)) self.bias = nn.Parameter(torch.Tensor(self.in_dim)) def forward(self, x): norm = x.pow(2).sum(dim=1, keepdim=True).sqrt() x = torch.div(x, norm) return x * self.scale + self.bias def __repr__(self): return 'CustomizedLayer(in_dim=%d)' % self.in_dim def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'in_dim': 4}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.jit def triton_poi_fused_add_div_mul_pow_sqrt_sum_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x4 = xindex x3 = xindex // 64 x5 = xindex % 16 x0 = xindex % 4 tmp0 = tl.load(in_ptr0 + x4, xmask) tmp1 = tl.load(in_ptr0 + (x5 + 64 * x3), xmask, eviction_policy= 'evict_last') tmp3 = tl.load(in_ptr0 + (16 + x5 + 64 * x3), xmask, eviction_policy= 'evict_last') tmp6 = tl.load(in_ptr0 + (32 + x5 + 64 * x3), xmask, eviction_policy= 'evict_last') tmp9 = tl.load(in_ptr0 + (48 + x5 + 64 * x3), xmask, eviction_policy= 'evict_last') tmp14 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last') tmp16 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last') tmp2 = tmp1 * tmp1 tmp4 = tmp3 * tmp3 tmp5 = tmp2 + tmp4 tmp7 = tmp6 * tmp6 tmp8 = tmp5 + tmp7 tmp10 = tmp9 * tmp9 tmp11 = tmp8 + tmp10 tmp12 = libdevice.sqrt(tmp11) tmp13 = tmp0 / tmp12 tmp15 = tmp13 * tmp14 tmp17 = tmp15 + tmp16 tl.store(out_ptr0 + x4, tmp17, xmask) def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4,), (1,)) assert_size_stride(primals_3, (4,), (1,)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) get_raw_stream(0) triton_poi_fused_add_div_mul_pow_sqrt_sum_0[grid(256)](primals_1, primals_2, primals_3, buf0, 256, XBLOCK=128, num_warps=4, num_stages=1) del primals_2 del primals_3 return buf0, primals_1 class CustomizeLayerNew(nn.Module): def __init__(self, in_dim): super().__init__() self.in_dim = in_dim self.scale = nn.Parameter(torch.Tensor(self.in_dim)) self.bias = nn.Parameter(torch.Tensor(self.in_dim)) def __repr__(self): return 'CustomizedLayer(in_dim=%d)' % self.in_dim def forward(self, input_0): primals_2 = self.scale primals_3 = self.bias primals_1 = input_0 output = call([primals_1, primals_2, primals_3]) return output[0]
Abhishekvats1997/Torch-Pruning
CustomizeLayer
false
2
[ "MIT" ]
0
b322a42d1c9032cc9644332d33a9662ca6ed44ac
https://github.com/Abhishekvats1997/Torch-Pruning/tree/b322a42d1c9032cc9644332d33a9662ca6ed44ac
[ { "content": "entry_point: CustomizeLayer\n\n# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/ne/cnem3ewvyvy2ry3vceibv7j67edhj5jen3qlzvzibg5tpkhxkwsq.py\n# Topologically Sorted Source Nodes: [pow_1, sum_1, norm, x, mul, add], Original ATen: [aten.pow, aten.sum, aten.sqrt, aten.div, aten.mul, aten.add]\n# Source node to ATen node mapping:\n# add => add\n# mul => mul\n# norm => sqrt\n# pow_1 => pow_1\n# sum_1 => sum_1\n# x => div\n# Graph fragment:\n# %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%primals_1, 2), kwargs = {})\n# %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%pow_1, [1], True), kwargs = {})\n# %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%sum_1,), kwargs = {})\n# %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%primals_1, %sqrt), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%div, %primals_2), kwargs = {})\n# %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul, %primals_3), kwargs = {})\ntriton_poi_fused_add_div_mul_pow_sqrt_sum_0 = async_compile.triton('triton_poi_fused_add_div_mul_pow_sqrt_sum_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[256], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_mul_pow_sqrt_sum_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_add_div_mul_pow_sqrt_sum_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x4 = xindex\n x3 = (xindex // 64)\n x5 = xindex % 16\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + (x4), xmask)\n tmp1 = tl.load(in_ptr0 + (x5 + (64*x3)), xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (16 + x5 + (64*x3)), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (32 + x5 + (64*x3)), xmask, eviction_policy='evict_last')\n tmp9 = tl.load(in_ptr0 + (48 + x5 + (64*x3)), xmask, eviction_policy='evict_last')\n tmp14 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')\n tmp16 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = libdevice.sqrt(tmp11)\n tmp13 = tmp0 / tmp12\n tmp15 = tmp13 * tmp14\n tmp17 = tmp15 + tmp16\n tl.store(out_ptr0 + (x4), tmp17, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4, ), (1, ))\n assert_size_stride(primals_3, (4, ), (1, ))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [pow_1, sum_1, norm, x, mul, add], Original ATen: [aten.pow, aten.sum, aten.sqrt, aten.div, aten.mul, aten.add]\n stream0 = get_raw_stream(0)\n triton_poi_fused_add_div_mul_pow_sqrt_sum_0.run(primals_1, primals_2, primals_3, buf0, 256, grid=grid(256), stream=stream0)\n del primals_2\n del primals_3\n return (buf0, primals_1, )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([primals_1, primals_2, primals_3])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mul_pow_sqrt_sum_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x4 = xindex\n x3 = xindex // 64\n x5 = xindex % 16\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + x4, xmask)\n tmp1 = tl.load(in_ptr0 + (x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp3 = tl.load(in_ptr0 + (16 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp6 = tl.load(in_ptr0 + (32 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp9 = tl.load(in_ptr0 + (48 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp14 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')\n tmp16 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = libdevice.sqrt(tmp11)\n tmp13 = tmp0 / tmp12\n tmp15 = tmp13 * tmp14\n tmp17 = tmp15 + tmp16\n tl.store(out_ptr0 + x4, tmp17, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mul_pow_sqrt_sum_0[grid(256)](primals_1,\n primals_2, primals_3, buf0, 256, XBLOCK=128, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass CustomizeLayerNew(nn.Module):\n\n def __init__(self, in_dim):\n super().__init__()\n self.in_dim = in_dim\n self.scale = nn.Parameter(torch.Tensor(self.in_dim))\n self.bias = nn.Parameter(torch.Tensor(self.in_dim))\n\n def __repr__(self):\n return 'CustomizedLayer(in_dim=%d)' % self.in_dim\n\n def forward(self, input_0):\n primals_2 = self.scale\n primals_3 = self.bias\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mul_pow_sqrt_sum_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x4 = xindex\n x3 = xindex // 64\n x5 = xindex % 16\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + x4, xmask)\n tmp1 = tl.load(in_ptr0 + (x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp3 = tl.load(in_ptr0 + (16 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp6 = tl.load(in_ptr0 + (32 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp9 = tl.load(in_ptr0 + (48 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp14 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')\n tmp16 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = libdevice.sqrt(tmp11)\n tmp13 = tmp0 / tmp12\n tmp15 = tmp13 * tmp14\n tmp17 = tmp15 + tmp16\n tl.store(out_ptr0 + x4, tmp17, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mul_pow_sqrt_sum_0[grid(256)](primals_1,\n primals_2, primals_3, buf0, 256, XBLOCK=128, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass CustomizeLayerNew(nn.Module):\n\n def __init__(self, in_dim):\n super().__init__()\n self.in_dim = in_dim\n self.scale = nn.Parameter(torch.Tensor(self.in_dim))\n self.bias = nn.Parameter(torch.Tensor(self.in_dim))\n\n def __repr__(self):\n return 'CustomizedLayer(in_dim=%d)' % self.in_dim\n\n def forward(self, input_0):\n primals_2 = self.scale\n primals_3 = self.bias\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mul_pow_sqrt_sum_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x4 = xindex\n x3 = xindex // 64\n x5 = xindex % 16\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + x4, xmask)\n tmp1 = tl.load(in_ptr0 + (x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp3 = tl.load(in_ptr0 + (16 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp6 = tl.load(in_ptr0 + (32 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp9 = tl.load(in_ptr0 + (48 + x5 + 64 * x3), xmask, eviction_policy=\n 'evict_last')\n tmp14 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')\n tmp16 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = libdevice.sqrt(tmp11)\n tmp13 = tmp0 / tmp12\n tmp15 = tmp13 * tmp14\n tmp17 = tmp15 + tmp16\n tl.store(out_ptr0 + x4, tmp17, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mul_pow_sqrt_sum_0[grid(256)](primals_1,\n primals_2, primals_3, buf0, 256, XBLOCK=128, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass CustomizeLayerNew(nn.Module):\n\n def __init__(self, in_dim):\n super().__init__()\n self.in_dim = in_dim\n self.scale = nn.Parameter(torch.Tensor(self.in_dim))\n self.bias = nn.Parameter(torch.Tensor(self.in_dim))\n\n def __repr__(self):\n return 'CustomizedLayer(in_dim=%d)' % self.in_dim\n\n def forward(self, input_0):\n primals_2 = self.scale\n primals_3 = self.bias\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n" } ]
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/yq/cyqficfzvi7m26ugfmcjnrvh3fwc36rw64jccffjyl3m2zuwe2to.py # Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div] # Source node to ATen node mapping: # add => add # add_1 => add_1 # mean => mean # mul => mul # std => sqrt, var # sub => sub # truediv => div # Graph fragment: # %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%primals_1, [-1], True), kwargs = {}) # %var : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%primals_1, [-1]), kwargs = {correction: 1.0, keepdim: True}) # %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%var,), kwargs = {}) # %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%primals_1, %mean), kwargs = {}) # %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%primals_2, %sub), kwargs = {}) # %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sqrt, 1e-05), kwargs = {}) # %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%mul, %add), kwargs = {}) # %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %primals_3), kwargs = {}) triton_poi_fused_add_div_mean_mul_std_sub_0 = async_compile.triton('triton_poi_fused_add_div_mean_mul_std_sub_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[256], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_mean_mul_std_sub_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 4 x2 = xindex x1 = (xindex // 4) tmp0 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last') tmp1 = tl.load(in_ptr1 + (x2), xmask) tmp2 = tl.load(in_ptr1 + (4*x1), xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr1 + (1 + (4*x1)), xmask, eviction_policy='evict_last') tmp5 = tl.load(in_ptr1 + (2 + (4*x1)), xmask, eviction_policy='evict_last') tmp7 = tl.load(in_ptr1 + (3 + (4*x1)), xmask, eviction_policy='evict_last') tmp30 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last') tmp4 = tmp2 + tmp3 tmp6 = tmp4 + tmp5 tmp8 = tmp6 + tmp7 tmp9 = 4.0 tmp10 = tmp8 / tmp9 tmp11 = tmp1 - tmp10 tmp12 = tmp0 * tmp11 tmp13 = tmp2 - tmp10 tmp14 = tmp13 * tmp13 tmp15 = tmp3 - tmp10 tmp16 = tmp15 * tmp15 tmp17 = tmp14 + tmp16 tmp18 = tmp5 - tmp10 tmp19 = tmp18 * tmp18 tmp20 = tmp17 + tmp19 tmp21 = tmp7 - tmp10 tmp22 = tmp21 * tmp21 tmp23 = tmp20 + tmp22 tmp24 = 3.0 tmp25 = tmp23 / tmp24 tmp26 = libdevice.sqrt(tmp25) tmp27 = 1e-05 tmp28 = tmp26 + tmp27 tmp29 = tmp12 / tmp28 tmp31 = tmp29 + tmp30 tl.store(out_ptr0 + (x2), tmp31, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4, ), (1, )) assert_size_stride(primals_3, (4, ), (1, )) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) # Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div] stream0 = get_raw_stream(0) triton_poi_fused_add_div_mean_mul_std_sub_0.run(primals_2, primals_1, primals_3, buf0, 256, grid=grid(256), stream=stream0) del primals_2 del primals_3 return (buf0, primals_1, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) fn = lambda: call([primals_1, primals_2, primals_3]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, weights, eps=1e-05): super().__init__() self.gamma = nn.Parameter(torch.ones(weights)) self.beta = nn.Parameter(torch.zeros(weights)) self.eps = eps def forward(self, x): mean = x.mean(-1, keepdim=True) std = x.std(-1, keepdim=True) return self.gamma * (x - mean) / (std + self.eps) + self.beta def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'weights': 4}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.jit def triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 4 x2 = xindex x1 = xindex // 4 tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last') tmp1 = tl.load(in_ptr1 + x2, xmask) tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last') tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last') tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last') tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last') tmp4 = tmp2 + tmp3 tmp6 = tmp4 + tmp5 tmp8 = tmp6 + tmp7 tmp9 = 4.0 tmp10 = tmp8 / tmp9 tmp11 = tmp1 - tmp10 tmp12 = tmp0 * tmp11 tmp13 = tmp2 - tmp10 tmp14 = tmp13 * tmp13 tmp15 = tmp3 - tmp10 tmp16 = tmp15 * tmp15 tmp17 = tmp14 + tmp16 tmp18 = tmp5 - tmp10 tmp19 = tmp18 * tmp18 tmp20 = tmp17 + tmp19 tmp21 = tmp7 - tmp10 tmp22 = tmp21 * tmp21 tmp23 = tmp20 + tmp22 tmp24 = 3.0 tmp25 = tmp23 / tmp24 tmp26 = libdevice.sqrt(tmp25) tmp27 = 1e-05 tmp28 = tmp26 + tmp27 tmp29 = tmp12 / tmp28 tmp31 = tmp29 + tmp30 tl.store(out_ptr0 + x2, tmp31, xmask) def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4,), (1,)) assert_size_stride(primals_3, (4,), (1,)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) get_raw_stream(0) triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2, primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4, num_stages=1) del primals_2 del primals_3 return buf0, primals_1 class LayerNormNew(nn.Module): def __init__(self, weights, eps=1e-05): super().__init__() self.gamma = nn.Parameter(torch.ones(weights)) self.beta = nn.Parameter(torch.zeros(weights)) self.eps = eps def forward(self, input_0): primals_2 = self.gamma primals_3 = self.beta primals_1 = input_0 output = call([primals_1, primals_2, primals_3]) return output[0]
AWilcke/Dissertation
LayerNorm
false
3
[ "MIT" ]
0
b85ad38a7f336ee290d5883f5e942f54e140d0d0
https://github.com/AWilcke/Dissertation/tree/b85ad38a7f336ee290d5883f5e942f54e140d0d0
[ { "content": "entry_point: LayerNorm\n\n# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/yq/cyqficfzvi7m26ugfmcjnrvh3fwc36rw64jccffjyl3m2zuwe2to.py\n# Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div]\n# Source node to ATen node mapping:\n# add => add\n# add_1 => add_1\n# mean => mean\n# mul => mul\n# std => sqrt, var\n# sub => sub\n# truediv => div\n# Graph fragment:\n# %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%primals_1, [-1], True), kwargs = {})\n# %var : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%primals_1, [-1]), kwargs = {correction: 1.0, keepdim: True})\n# %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%var,), kwargs = {})\n# %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%primals_1, %mean), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%primals_2, %sub), kwargs = {})\n# %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sqrt, 1e-05), kwargs = {})\n# %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%mul, %add), kwargs = {})\n# %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %primals_3), kwargs = {})\ntriton_poi_fused_add_div_mean_mul_std_sub_0 = async_compile.triton('triton_poi_fused_add_div_mean_mul_std_sub_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[256], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_mean_mul_std_sub_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = (xindex // 4)\n tmp0 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + (x2), xmask)\n tmp2 = tl.load(in_ptr1 + (4*x1), xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-05\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + (x2), tmp31, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4, ), (1, ))\n assert_size_stride(primals_3, (4, ), (1, ))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div]\n stream0 = get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0.run(primals_2, primals_1, primals_3, buf0, 256, grid=grid(256), stream=stream0)\n del primals_2\n del primals_3\n return (buf0, primals_1, )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([primals_1, primals_2, primals_3])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + x2, xmask)\n tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-05\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + x2, tmp31, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2,\n primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass LayerNormNew(nn.Module):\n\n def __init__(self, weights, eps=1e-05):\n super().__init__()\n self.gamma = nn.Parameter(torch.ones(weights))\n self.beta = nn.Parameter(torch.zeros(weights))\n self.eps = eps\n\n def forward(self, input_0):\n primals_2 = self.gamma\n primals_3 = self.beta\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + x2, xmask)\n tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-05\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + x2, tmp31, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2,\n primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass LayerNormNew(nn.Module):\n\n def __init__(self, weights, eps=1e-05):\n super().__init__()\n self.gamma = nn.Parameter(torch.ones(weights))\n self.beta = nn.Parameter(torch.zeros(weights))\n self.eps = eps\n\n def forward(self, input_0):\n primals_2 = self.gamma\n primals_3 = self.beta\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + x2, xmask)\n tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-05\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + x2, tmp31, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2,\n primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass LayerNormNew(nn.Module):\n\n def __init__(self, weights, eps=1e-05):\n super().__init__()\n self.gamma = nn.Parameter(torch.ones(weights))\n self.beta = nn.Parameter(torch.zeros(weights))\n self.eps = eps\n\n def forward(self, input_0):\n primals_2 = self.gamma\n primals_3 = self.beta\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n" } ]
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/df/cdfcie57v6pcdd6oeaz4mvlgksxgyuxzmlv5bklwemyulqhtcxta.py # Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div] # Source node to ATen node mapping: # add => add # add_1 => add_1 # mean => mean # mul => mul # std => sqrt, var # sub => sub # truediv => div # Graph fragment: # %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%primals_1, [-1], True), kwargs = {}) # %var : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%primals_1, [-1]), kwargs = {correction: 1.0, keepdim: True}) # %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%var,), kwargs = {}) # %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%primals_1, %mean), kwargs = {}) # %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%primals_2, %sub), kwargs = {}) # %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sqrt, 1e-06), kwargs = {}) # %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%mul, %add), kwargs = {}) # %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %primals_3), kwargs = {}) triton_poi_fused_add_div_mean_mul_std_sub_0 = async_compile.triton('triton_poi_fused_add_div_mean_mul_std_sub_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[256], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_mean_mul_std_sub_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 4 x2 = xindex x1 = (xindex // 4) tmp0 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last') tmp1 = tl.load(in_ptr1 + (x2), xmask) tmp2 = tl.load(in_ptr1 + (4*x1), xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr1 + (1 + (4*x1)), xmask, eviction_policy='evict_last') tmp5 = tl.load(in_ptr1 + (2 + (4*x1)), xmask, eviction_policy='evict_last') tmp7 = tl.load(in_ptr1 + (3 + (4*x1)), xmask, eviction_policy='evict_last') tmp30 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last') tmp4 = tmp2 + tmp3 tmp6 = tmp4 + tmp5 tmp8 = tmp6 + tmp7 tmp9 = 4.0 tmp10 = tmp8 / tmp9 tmp11 = tmp1 - tmp10 tmp12 = tmp0 * tmp11 tmp13 = tmp2 - tmp10 tmp14 = tmp13 * tmp13 tmp15 = tmp3 - tmp10 tmp16 = tmp15 * tmp15 tmp17 = tmp14 + tmp16 tmp18 = tmp5 - tmp10 tmp19 = tmp18 * tmp18 tmp20 = tmp17 + tmp19 tmp21 = tmp7 - tmp10 tmp22 = tmp21 * tmp21 tmp23 = tmp20 + tmp22 tmp24 = 3.0 tmp25 = tmp23 / tmp24 tmp26 = libdevice.sqrt(tmp25) tmp27 = 1e-06 tmp28 = tmp26 + tmp27 tmp29 = tmp12 / tmp28 tmp31 = tmp29 + tmp30 tl.store(out_ptr0 + (x2), tmp31, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4, ), (1, )) assert_size_stride(primals_3, (4, ), (1, )) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) # Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div] stream0 = get_raw_stream(0) triton_poi_fused_add_div_mean_mul_std_sub_0.run(primals_2, primals_1, primals_3, buf0, 256, grid=grid(256), stream=stream0) del primals_2 del primals_3 return (buf0, primals_1, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) fn = lambda: call([primals_1, primals_2, primals_3]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import torch import torch.utils.data import torch.nn as nn class LayerNorm(nn.Module): """ Construct a layernorm module (See citation for details). """ def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) self.eps = eps def forward(self, x): mean = x.mean(dim=-1, keepdim=True) std = x.std(dim=-1, keepdim=True) return self.a_2 * (x - mean) / (std + self.eps) + self.b_2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'features': 4}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.jit def triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 4 x2 = xindex x1 = xindex // 4 tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last') tmp1 = tl.load(in_ptr1 + x2, xmask) tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last') tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last') tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last') tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last') tmp4 = tmp2 + tmp3 tmp6 = tmp4 + tmp5 tmp8 = tmp6 + tmp7 tmp9 = 4.0 tmp10 = tmp8 / tmp9 tmp11 = tmp1 - tmp10 tmp12 = tmp0 * tmp11 tmp13 = tmp2 - tmp10 tmp14 = tmp13 * tmp13 tmp15 = tmp3 - tmp10 tmp16 = tmp15 * tmp15 tmp17 = tmp14 + tmp16 tmp18 = tmp5 - tmp10 tmp19 = tmp18 * tmp18 tmp20 = tmp17 + tmp19 tmp21 = tmp7 - tmp10 tmp22 = tmp21 * tmp21 tmp23 = tmp20 + tmp22 tmp24 = 3.0 tmp25 = tmp23 / tmp24 tmp26 = libdevice.sqrt(tmp25) tmp27 = 1e-06 tmp28 = tmp26 + tmp27 tmp29 = tmp12 / tmp28 tmp31 = tmp29 + tmp30 tl.store(out_ptr0 + x2, tmp31, xmask) def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4,), (1,)) assert_size_stride(primals_3, (4,), (1,)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) get_raw_stream(0) triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2, primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4, num_stages=1) del primals_2 del primals_3 return buf0, primals_1 class LayerNormNew(nn.Module): """ Construct a layernorm module (See citation for details). """ def __init__(self, features, eps=1e-06): super(LayerNormNew, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) self.eps = eps def forward(self, input_0): primals_2 = self.a_2 primals_3 = self.b_2 primals_1 = input_0 output = call([primals_1, primals_2, primals_3]) return output[0]
Akhil-Raj/Trajectory-Transformer
LayerNorm
false
4
[ "MIT" ]
0
dd09fda99443f6afb59d962026573162219ea6a9
https://github.com/Akhil-Raj/Trajectory-Transformer/tree/dd09fda99443f6afb59d962026573162219ea6a9
[ { "content": "entry_point: LayerNorm\n\n# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/df/cdfcie57v6pcdd6oeaz4mvlgksxgyuxzmlv5bklwemyulqhtcxta.py\n# Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div]\n# Source node to ATen node mapping:\n# add => add\n# add_1 => add_1\n# mean => mean\n# mul => mul\n# std => sqrt, var\n# sub => sub\n# truediv => div\n# Graph fragment:\n# %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%primals_1, [-1], True), kwargs = {})\n# %var : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%primals_1, [-1]), kwargs = {correction: 1.0, keepdim: True})\n# %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%var,), kwargs = {})\n# %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%primals_1, %mean), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%primals_2, %sub), kwargs = {})\n# %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sqrt, 1e-06), kwargs = {})\n# %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%mul, %add), kwargs = {})\n# %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %primals_3), kwargs = {})\ntriton_poi_fused_add_div_mean_mul_std_sub_0 = async_compile.triton('triton_poi_fused_add_div_mean_mul_std_sub_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[256], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_mean_mul_std_sub_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = (xindex // 4)\n tmp0 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + (x2), xmask)\n tmp2 = tl.load(in_ptr1 + (4*x1), xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-06\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + (x2), tmp31, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4, ), (1, ))\n assert_size_stride(primals_3, (4, ), (1, ))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [mean, std, sub, mul, add, truediv, add_1], Original ATen: [aten.mean, aten.std, aten.sub, aten.mul, aten.add, aten.div]\n stream0 = get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0.run(primals_2, primals_1, primals_3, buf0, 256, grid=grid(256), stream=stream0)\n del primals_2\n del primals_3\n return (buf0, primals_1, )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([primals_1, primals_2, primals_3])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.utils.data\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + x2, xmask)\n tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-06\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + x2, tmp31, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2,\n primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass LayerNormNew(nn.Module):\n \"\"\"\n Construct a layernorm module (See citation for details).\n \"\"\"\n\n def __init__(self, features, eps=1e-06):\n super(LayerNormNew, self).__init__()\n self.a_2 = nn.Parameter(torch.ones(features))\n self.b_2 = nn.Parameter(torch.zeros(features))\n self.eps = eps\n\n def forward(self, input_0):\n primals_2 = self.a_2\n primals_3 = self.b_2\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.utils.data\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + x2, xmask)\n tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-06\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + x2, tmp31, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2,\n primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass LayerNormNew(nn.Module):\n \"\"\"\n Construct a layernorm module (See citation for details).\n \"\"\"\n\n def __init__(self, features, eps=1e-06):\n super(LayerNormNew, self).__init__()\n self.a_2 = nn.Parameter(torch.ones(features))\n self.b_2 = nn.Parameter(torch.zeros(features))\n self.eps = eps\n\n def forward(self, input_0):\n primals_2 = self.a_2\n primals_3 = self.b_2\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.utils.data\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_add_div_mean_mul_std_sub_0(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 4\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr1 + x2, xmask)\n tmp2 = tl.load(in_ptr1 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr1 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr1 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp7 = tl.load(in_ptr1 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp30 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp4 = tmp2 + tmp3\n tmp6 = tmp4 + tmp5\n tmp8 = tmp6 + tmp7\n tmp9 = 4.0\n tmp10 = tmp8 / tmp9\n tmp11 = tmp1 - tmp10\n tmp12 = tmp0 * tmp11\n tmp13 = tmp2 - tmp10\n tmp14 = tmp13 * tmp13\n tmp15 = tmp3 - tmp10\n tmp16 = tmp15 * tmp15\n tmp17 = tmp14 + tmp16\n tmp18 = tmp5 - tmp10\n tmp19 = tmp18 * tmp18\n tmp20 = tmp17 + tmp19\n tmp21 = tmp7 - tmp10\n tmp22 = tmp21 * tmp21\n tmp23 = tmp20 + tmp22\n tmp24 = 3.0\n tmp25 = tmp23 / tmp24\n tmp26 = libdevice.sqrt(tmp25)\n tmp27 = 1e-06\n tmp28 = tmp26 + tmp27\n tmp29 = tmp12 / tmp28\n tmp31 = tmp29 + tmp30\n tl.store(out_ptr0 + x2, tmp31, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_add_div_mean_mul_std_sub_0[grid(256)](primals_2,\n primals_1, primals_3, buf0, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del primals_2\n del primals_3\n return buf0, primals_1\n\n\nclass LayerNormNew(nn.Module):\n \"\"\"\n Construct a layernorm module (See citation for details).\n \"\"\"\n\n def __init__(self, features, eps=1e-06):\n super(LayerNormNew, self).__init__()\n self.a_2 = nn.Parameter(torch.ones(features))\n self.b_2 = nn.Parameter(torch.zeros(features))\n self.eps = eps\n\n def forward(self, input_0):\n primals_2 = self.a_2\n primals_3 = self.b_2\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n" } ]
Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/dg/cdgw6x7nju4bzp2wyuwgeanbco7zcjis6yiusovvnpz6zw3yjd3l.py # Topologically Sorted Source Nodes: [u, sub], Original ATen: [aten.mean, aten.sub] # Source node to ATen node mapping: # sub => sub # u => mean # Graph fragment: # %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%primals_1, [-1], True), kwargs = {}) # %sub : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%primals_1, %mean), kwargs = {}) triton_poi_fused_mean_sub_0 = async_compile.triton('triton_poi_fused_mean_sub_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[256], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mean_sub_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x1 = (xindex // 4) tmp0 = tl.load(in_ptr0 + (x2), xmask) tmp1 = tl.load(in_ptr0 + (4*x1), xmask, eviction_policy='evict_last') tmp2 = tl.load(in_ptr0 + (1 + (4*x1)), xmask, eviction_policy='evict_last') tmp4 = tl.load(in_ptr0 + (2 + (4*x1)), xmask, eviction_policy='evict_last') tmp6 = tl.load(in_ptr0 + (3 + (4*x1)), xmask, eviction_policy='evict_last') tmp3 = tmp1 + tmp2 tmp5 = tmp3 + tmp4 tmp7 = tmp5 + tmp6 tmp8 = 4.0 tmp9 = tmp7 / tmp8 tmp10 = tmp0 - tmp9 tl.store(out_ptr0 + (x2), tmp10, xmask) ''', device_str='cuda') # kernel path: runs/run_shard_6/inductor_cache/v3/cv3kidzozprmsfiixppams3wqi7ij566hegofbo3ur5gfdrhxiik.py # Topologically Sorted Source Nodes: [square, s, add, rsqrt, x, mul_1, x_1], Original ATen: [aten.pow, aten.mean, aten.add, aten.rsqrt, aten.mul] # Source node to ATen node mapping: # add => add # mul_1 => mul_1 # rsqrt => rsqrt # s => mean_1 # square => pow_1 # x => mul # x_1 => add_1 # Graph fragment: # %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub, 2), kwargs = {}) # %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_1, [-1], True), kwargs = {}) # %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_1, 1e-05), kwargs = {}) # %rsqrt : [num_users=1] = call_function[target=torch.ops.aten.rsqrt.default](args = (%add,), kwargs = {}) # %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub, %rsqrt), kwargs = {}) # %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul, %primals_2), kwargs = {}) # %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_1, %primals_3), kwargs = {}) triton_poi_fused_add_mean_mul_pow_rsqrt_1 = async_compile.triton('triton_poi_fused_add_mean_mul_pow_rsqrt_1', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[256], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_mean_mul_pow_rsqrt_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x1 = (xindex // 4) x0 = xindex % 4 tmp0 = tl.load(in_ptr0 + (x2), xmask) tmp1 = tl.load(in_ptr0 + (4*x1), xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr0 + (1 + (4*x1)), xmask, eviction_policy='evict_last') tmp6 = tl.load(in_ptr0 + (2 + (4*x1)), xmask, eviction_policy='evict_last') tmp9 = tl.load(in_ptr0 + (3 + (4*x1)), xmask, eviction_policy='evict_last') tmp18 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last') tmp20 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last') tmp2 = tmp1 * tmp1 tmp4 = tmp3 * tmp3 tmp5 = tmp2 + tmp4 tmp7 = tmp6 * tmp6 tmp8 = tmp5 + tmp7 tmp10 = tmp9 * tmp9 tmp11 = tmp8 + tmp10 tmp12 = 4.0 tmp13 = tmp11 / tmp12 tmp14 = 1e-05 tmp15 = tmp13 + tmp14 tmp16 = libdevice.rsqrt(tmp15) tmp17 = tmp0 * tmp16 tmp19 = tmp17 * tmp18 tmp21 = tmp19 + tmp20 tl.store(out_ptr0 + (x2), tmp21, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4, ), (1, )) assert_size_stride(primals_3, (4, ), (1, )) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) # Topologically Sorted Source Nodes: [u, sub], Original ATen: [aten.mean, aten.sub] stream0 = get_raw_stream(0) triton_poi_fused_mean_sub_0.run(primals_1, buf0, 256, grid=grid(256), stream=stream0) buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) # Topologically Sorted Source Nodes: [square, s, add, rsqrt, x, mul_1, x_1], Original ATen: [aten.pow, aten.mean, aten.add, aten.rsqrt, aten.mul] triton_poi_fused_add_mean_mul_pow_rsqrt_1.run(buf0, primals_2, primals_3, buf1, 256, grid=grid(256), stream=stream0) del buf0 del primals_2 del primals_3 return (buf1, primals_1, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32) fn = lambda: call([primals_1, primals_2, primals_3]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import torch import torch.nn as nn class Norm(nn.Module): def __init__(self, n_state, axis=-1, epsilon=1e-05): super().__init__() self.n_state = n_state self.g = nn.Parameter(torch.ones([self.n_state])) self.b = nn.Parameter(torch.zeros([self.n_state])) self.axis = axis self.epsilon = epsilon def forward(self, x): u = torch.mean(x, dim=self.axis, keepdim=True) s = torch.mean(torch.square(x - u), dim=self.axis, keepdim=True) x = (x - u) * torch.rsqrt(s + self.epsilon) x = x * self.g + self.b return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'n_state': 4}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.jit def triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr ): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x1 = xindex // 4 tmp0 = tl.load(in_ptr0 + x2, xmask) tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last') tmp2 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last') tmp4 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last') tmp6 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last') tmp3 = tmp1 + tmp2 tmp5 = tmp3 + tmp4 tmp7 = tmp5 + tmp6 tmp8 = 4.0 tmp9 = tmp7 / tmp8 tmp10 = tmp0 - tmp9 tl.store(out_ptr0 + x2, tmp10, xmask) @triton.jit def triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 256 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x1 = xindex // 4 x0 = xindex % 4 tmp0 = tl.load(in_ptr0 + x2, xmask) tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last') tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last') tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last') tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last') tmp18 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last') tmp20 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last') tmp2 = tmp1 * tmp1 tmp4 = tmp3 * tmp3 tmp5 = tmp2 + tmp4 tmp7 = tmp6 * tmp6 tmp8 = tmp5 + tmp7 tmp10 = tmp9 * tmp9 tmp11 = tmp8 + tmp10 tmp12 = 4.0 tmp13 = tmp11 / tmp12 tmp14 = 1e-05 tmp15 = tmp13 + tmp14 tmp16 = libdevice.rsqrt(tmp15) tmp17 = tmp0 * tmp16 tmp19 = tmp17 * tmp18 tmp21 = tmp19 + tmp20 tl.store(out_ptr0 + x2, tmp21, xmask) def call(args): primals_1, primals_2, primals_3 = args args.clear() assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1)) assert_size_stride(primals_2, (4,), (1,)) assert_size_stride(primals_3, (4,), (1,)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) get_raw_stream(0) triton_poi_fused_mean_sub_0[grid(256)](primals_1, buf0, 256, XBLOCK =128, num_warps=4, num_stages=1) buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32) triton_poi_fused_add_mean_mul_pow_rsqrt_1[grid(256)](buf0, primals_2, primals_3, buf1, 256, XBLOCK=256, num_warps=4, num_stages=1) del buf0 del primals_2 del primals_3 return buf1, primals_1 class NormNew(nn.Module): def __init__(self, n_state, axis=-1, epsilon=1e-05): super().__init__() self.n_state = n_state self.g = nn.Parameter(torch.ones([self.n_state])) self.b = nn.Parameter(torch.zeros([self.n_state])) self.axis = axis self.epsilon = epsilon def forward(self, input_0): primals_2 = self.g primals_3 = self.b primals_1 = input_0 output = call([primals_1, primals_2, primals_3]) return output[0]
Aalanli/MusicGeneration
Norm
false
5
[ "MIT" ]
0
7d268322d692013d8ac6e70be31741cea519fa28
https://github.com/Aalanli/MusicGeneration/tree/7d268322d692013d8ac6e70be31741cea519fa28
[ { "content": "entry_point: Norm\n\n# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/dg/cdgw6x7nju4bzp2wyuwgeanbco7zcjis6yiusovvnpz6zw3yjd3l.py\n# Topologically Sorted Source Nodes: [u, sub], Original ATen: [aten.mean, aten.sub]\n# Source node to ATen node mapping:\n# sub => sub\n# u => mean\n# Graph fragment:\n# %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%primals_1, [-1], True), kwargs = {})\n# %sub : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%primals_1, %mean), kwargs = {})\ntriton_poi_fused_mean_sub_0 = async_compile.triton('triton_poi_fused_mean_sub_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[256], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mean_sub_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = (xindex // 4)\n tmp0 = tl.load(in_ptr0 + (x2), xmask)\n tmp1 = tl.load(in_ptr0 + (4*x1), xmask, eviction_policy='evict_last')\n tmp2 = tl.load(in_ptr0 + (1 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp4 = tl.load(in_ptr0 + (2 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (3 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp3 = tmp1 + tmp2\n tmp5 = tmp3 + tmp4\n tmp7 = tmp5 + tmp6\n tmp8 = 4.0\n tmp9 = tmp7 / tmp8\n tmp10 = tmp0 - tmp9\n tl.store(out_ptr0 + (x2), tmp10, xmask)\n''', device_str='cuda')\n\n\n# kernel path: runs/run_shard_6/inductor_cache/v3/cv3kidzozprmsfiixppams3wqi7ij566hegofbo3ur5gfdrhxiik.py\n# Topologically Sorted Source Nodes: [square, s, add, rsqrt, x, mul_1, x_1], Original ATen: [aten.pow, aten.mean, aten.add, aten.rsqrt, aten.mul]\n# Source node to ATen node mapping:\n# add => add\n# mul_1 => mul_1\n# rsqrt => rsqrt\n# s => mean_1\n# square => pow_1\n# x => mul\n# x_1 => add_1\n# Graph fragment:\n# %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub, 2), kwargs = {})\n# %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_1, [-1], True), kwargs = {})\n# %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_1, 1e-05), kwargs = {})\n# %rsqrt : [num_users=1] = call_function[target=torch.ops.aten.rsqrt.default](args = (%add,), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub, %rsqrt), kwargs = {})\n# %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul, %primals_2), kwargs = {})\n# %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_1, %primals_3), kwargs = {})\ntriton_poi_fused_add_mean_mul_pow_rsqrt_1 = async_compile.triton('triton_poi_fused_add_mean_mul_pow_rsqrt_1', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[256], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_mean_mul_pow_rsqrt_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 7, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = (xindex // 4)\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + (x2), xmask)\n tmp1 = tl.load(in_ptr0 + (4*x1), xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (1 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (2 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp9 = tl.load(in_ptr0 + (3 + (4*x1)), xmask, eviction_policy='evict_last')\n tmp18 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')\n tmp20 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = 4.0\n tmp13 = tmp11 / tmp12\n tmp14 = 1e-05\n tmp15 = tmp13 + tmp14\n tmp16 = libdevice.rsqrt(tmp15)\n tmp17 = tmp0 * tmp16\n tmp19 = tmp17 * tmp18\n tmp21 = tmp19 + tmp20\n tl.store(out_ptr0 + (x2), tmp21, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4, ), (1, ))\n assert_size_stride(primals_3, (4, ), (1, ))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [u, sub], Original ATen: [aten.mean, aten.sub]\n stream0 = get_raw_stream(0)\n triton_poi_fused_mean_sub_0.run(primals_1, buf0, 256, grid=grid(256), stream=stream0)\n buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [square, s, add, rsqrt, x, mul_1, x_1], Original ATen: [aten.pow, aten.mean, aten.add, aten.rsqrt, aten.mul]\n triton_poi_fused_add_mean_mul_pow_rsqrt_1.run(buf0, primals_2, primals_3, buf1, 256, grid=grid(256), stream=stream0)\n del buf0\n del primals_2\n del primals_3\n return (buf1, primals_1, )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n primals_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n primals_2 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n primals_3 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([primals_1, primals_2, primals_3])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr\n ):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp2 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp4 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp3 = tmp1 + tmp2\n tmp5 = tmp3 + tmp4\n tmp7 = tmp5 + tmp6\n tmp8 = 4.0\n tmp9 = tmp7 / tmp8\n tmp10 = tmp0 - tmp9\n tl.store(out_ptr0 + x2, tmp10, xmask)\n\n\n@triton.jit\ndef triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = xindex // 4\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp18 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')\n tmp20 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = 4.0\n tmp13 = tmp11 / tmp12\n tmp14 = 1e-05\n tmp15 = tmp13 + tmp14\n tmp16 = libdevice.rsqrt(tmp15)\n tmp17 = tmp0 * tmp16\n tmp19 = tmp17 * tmp18\n tmp21 = tmp19 + tmp20\n tl.store(out_ptr0 + x2, tmp21, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_mean_sub_0[grid(256)](primals_1, buf0, 256, XBLOCK\n =128, num_warps=4, num_stages=1)\n buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n triton_poi_fused_add_mean_mul_pow_rsqrt_1[grid(256)](buf0,\n primals_2, primals_3, buf1, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del buf0\n del primals_2\n del primals_3\n return buf1, primals_1\n\n\nclass NormNew(nn.Module):\n\n def __init__(self, n_state, axis=-1, epsilon=1e-05):\n super().__init__()\n self.n_state = n_state\n self.g = nn.Parameter(torch.ones([self.n_state]))\n self.b = nn.Parameter(torch.zeros([self.n_state]))\n self.axis = axis\n self.epsilon = epsilon\n\n def forward(self, input_0):\n primals_2 = self.g\n primals_3 = self.b\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr\n ):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp2 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp4 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp3 = tmp1 + tmp2\n tmp5 = tmp3 + tmp4\n tmp7 = tmp5 + tmp6\n tmp8 = 4.0\n tmp9 = tmp7 / tmp8\n tmp10 = tmp0 - tmp9\n tl.store(out_ptr0 + x2, tmp10, xmask)\n\n\n@triton.jit\ndef triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = xindex // 4\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp18 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')\n tmp20 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = 4.0\n tmp13 = tmp11 / tmp12\n tmp14 = 1e-05\n tmp15 = tmp13 + tmp14\n tmp16 = libdevice.rsqrt(tmp15)\n tmp17 = tmp0 * tmp16\n tmp19 = tmp17 * tmp18\n tmp21 = tmp19 + tmp20\n tl.store(out_ptr0 + x2, tmp21, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_mean_sub_0[grid(256)](primals_1, buf0, 256, XBLOCK\n =128, num_warps=4, num_stages=1)\n buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n triton_poi_fused_add_mean_mul_pow_rsqrt_1[grid(256)](buf0,\n primals_2, primals_3, buf1, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del buf0\n del primals_2\n del primals_3\n return buf1, primals_1\n\n\nclass NormNew(nn.Module):\n\n def __init__(self, n_state, axis=-1, epsilon=1e-05):\n super().__init__()\n self.n_state = n_state\n self.g = nn.Parameter(torch.ones([self.n_state]))\n self.b = nn.Parameter(torch.zeros([self.n_state]))\n self.axis = axis\n self.epsilon = epsilon\n\n def forward(self, input_0):\n primals_2 = self.g\n primals_3 = self.b\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch._inductor.runtime.triton_helpers import libdevice\nimport torch.nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_mean_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr\n ):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = xindex // 4\n tmp0 = tl.load(in_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp2 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp4 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp3 = tmp1 + tmp2\n tmp5 = tmp3 + tmp4\n tmp7 = tmp5 + tmp6\n tmp8 = 4.0\n tmp9 = tmp7 / tmp8\n tmp10 = tmp0 - tmp9\n tl.store(out_ptr0 + x2, tmp10, xmask)\n\n\n@triton.jit\ndef triton_poi_fused_add_mean_mul_pow_rsqrt_1(in_ptr0, in_ptr1, in_ptr2,\n out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x2 = xindex\n x1 = xindex // 4\n x0 = xindex % 4\n tmp0 = tl.load(in_ptr0 + x2, xmask)\n tmp1 = tl.load(in_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')\n tmp18 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')\n tmp20 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')\n tmp2 = tmp1 * tmp1\n tmp4 = tmp3 * tmp3\n tmp5 = tmp2 + tmp4\n tmp7 = tmp6 * tmp6\n tmp8 = tmp5 + tmp7\n tmp10 = tmp9 * tmp9\n tmp11 = tmp8 + tmp10\n tmp12 = 4.0\n tmp13 = tmp11 / tmp12\n tmp14 = 1e-05\n tmp15 = tmp13 + tmp14\n tmp16 = libdevice.rsqrt(tmp15)\n tmp17 = tmp0 * tmp16\n tmp19 = tmp17 * tmp18\n tmp21 = tmp19 + tmp20\n tl.store(out_ptr0 + x2, tmp21, xmask)\n\n\ndef call(args):\n primals_1, primals_2, primals_3 = args\n args.clear()\n assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))\n assert_size_stride(primals_2, (4,), (1,))\n assert_size_stride(primals_3, (4,), (1,))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n get_raw_stream(0)\n triton_poi_fused_mean_sub_0[grid(256)](primals_1, buf0, 256, XBLOCK\n =128, num_warps=4, num_stages=1)\n buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)\n triton_poi_fused_add_mean_mul_pow_rsqrt_1[grid(256)](buf0,\n primals_2, primals_3, buf1, 256, XBLOCK=256, num_warps=4,\n num_stages=1)\n del buf0\n del primals_2\n del primals_3\n return buf1, primals_1\n\n\nclass NormNew(nn.Module):\n\n def __init__(self, n_state, axis=-1, epsilon=1e-05):\n super().__init__()\n self.n_state = n_state\n self.g = nn.Parameter(torch.ones([self.n_state]))\n self.b = nn.Parameter(torch.zeros([self.n_state]))\n self.axis = axis\n self.epsilon = epsilon\n\n def forward(self, input_0):\n primals_2 = self.g\n primals_3 = self.b\n primals_1 = input_0\n output = call([primals_1, primals_2, primals_3])\n return output[0]\n" } ]
BehlerAngular
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor alloc_from_pool = torch.ops.inductor._alloc_from_pool async_compile = AsyncCompile() # kernel path: runs/run_shard_6/inductor_cache/u6/cu6io2odujubs4jc63atgai7gg2fi2mzfw74zg77lxaq5wh3dsrx.py # Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat] # Source node to ATen node mapping: # cat => cat # Graph fragment: # %cat : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%mul, %mul_1], -1), kwargs = {}) triton_poi_fused_cat_0 = async_compile.triton('triton_poi_fused_cat_0', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[512], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_cat_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 512 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 2 x1 = (xindex // 2) x2 = xindex tmp0 = x0 tmp1 = tl.full([1], 0, tl.int64) tmp2 = tmp0 >= tmp1 tmp3 = tl.full([1], 1, tl.int64) tmp4 = tmp0 < tmp3 tmp5 = tl.load(in_ptr0 + (x1), tmp4 & xmask, eviction_policy='evict_last', other=0.0) tmp6 = 1.0 tmp7 = tmp6 - tmp5 tmp8 = tmp7 * tmp6 tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype) tmp10 = tl.where(tmp4, tmp8, tmp9) tmp11 = tmp0 >= tmp3 tmp12 = tl.full([1], 2, tl.int64) tmp13 = tmp0 < tmp12 tmp14 = tl.load(in_ptr0 + (x1), tmp11 & xmask, eviction_policy='evict_last', other=0.0) tmp15 = tmp14 + tmp6 tmp16 = tmp15 * tmp6 tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype) tmp18 = tl.where(tmp11, tmp16, tmp17) tmp19 = tl.where(tmp4, tmp10, tmp18) tl.store(out_ptr0 + (x2), tmp19, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): arg0_1, = args args.clear() assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4, 2), (128, 32, 8, 2, 1), torch.float32) # Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat] stream0 = get_raw_stream(0) triton_poi_fused_cat_0.run(arg0_1, buf0, 512, grid=grid(512), stream=stream0) del arg0_1 return (buf0, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32) fn = lambda: call([arg0_1]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)
import torch from torch import nn as nn class BehlerAngular(nn.Module): """ Compute Behler type angular contribution of the angle spanned by three atoms: :math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta` Sets of zetas with lambdas of -1 and +1 are generated automatically. Args: zetas (set of int): Set of exponents used to compute angular Behler term (default={1}) """ def __init__(self, zetas={1}): super(BehlerAngular, self).__init__() self.zetas = zetas def forward(self, cos_theta): """ Args: cos_theta (torch.Tensor): Cosines between all pairs of neighbors of the central atom. Returns: torch.Tensor: Tensor containing values of the angular filters. """ angular_pos = [(2 ** (1 - zeta) * ((1.0 - cos_theta) ** zeta). unsqueeze(-1)) for zeta in self.zetas] angular_neg = [(2 ** (1 - zeta) * ((1.0 + cos_theta) ** zeta). unsqueeze(-1)) for zeta in self.zetas] angular_all = angular_pos + angular_neg return torch.cat(angular_all, -1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.jit def triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr): xnumel = 512 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 2 x1 = xindex // 2 x2 = xindex tmp0 = x0 tl.full([1], 0, tl.int64) tmp3 = tl.full([1], 1, tl.int64) tmp4 = tmp0 < tmp3 tmp5 = tl.load(in_ptr0 + x1, tmp4 & xmask, eviction_policy='evict_last', other=0.0) tmp6 = 1.0 tmp7 = tmp6 - tmp5 tmp8 = tmp7 * tmp6 tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype) tmp10 = tl.where(tmp4, tmp8, tmp9) tmp11 = tmp0 >= tmp3 tl.full([1], 2, tl.int64) tmp14 = tl.load(in_ptr0 + x1, tmp11 & xmask, eviction_policy= 'evict_last', other=0.0) tmp15 = tmp14 + tmp6 tmp16 = tmp15 * tmp6 tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype) tmp18 = tl.where(tmp11, tmp16, tmp17) tmp19 = tl.where(tmp4, tmp10, tmp18) tl.store(out_ptr0 + x2, tmp19, xmask) def call(args): arg0_1, = args args.clear() assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1)) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf0 = empty_strided_cuda((4, 4, 4, 4, 2), (128, 32, 8, 2, 1), torch.float32) get_raw_stream(0) triton_poi_fused_cat_0[grid(512)](arg0_1, buf0, 512, XBLOCK=128, num_warps=4, num_stages=1) del arg0_1 return buf0, class BehlerAngularNew(nn.Module): """ Compute Behler type angular contribution of the angle spanned by three atoms: :math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta` Sets of zetas with lambdas of -1 and +1 are generated automatically. Args: zetas (set of int): Set of exponents used to compute angular Behler term (default={1}) """ def __init__(self, zetas={1}): super(BehlerAngularNew, self).__init__() self.zetas = zetas def forward(self, input_0): arg0_1 = input_0 output = call([arg0_1]) return output[0]
AlexanderDKazakov/schnetpack
BehlerAngular
false
6
[ "MIT" ]
0
97b82469d977981b500e439a6c93696d8dac8a3f
https://github.com/AlexanderDKazakov/schnetpack/tree/97b82469d977981b500e439a6c93696d8dac8a3f
[ { "content": "entry_point: BehlerAngular\n\n# AOT ID: ['0_inference']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimport random\nimport os\nimport tempfile\nfrom math import inf, nan\nfrom torch._inductor.hooks import run_intermediate_hooks\nfrom torch._inductor.utils import maybe_profile\nfrom torch._inductor.codegen.memory_planning import _align as align\nfrom torch import device, empty_strided\nfrom torch._inductor.async_compile import AsyncCompile\nfrom torch._inductor.select_algorithm import extern_kernels\nfrom torch._inductor.codegen.multi_kernel import MultiKernelCall\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\n\naten = torch.ops.aten\ninductor_ops = torch.ops.inductor\n_quantized = torch.ops._quantized\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\nempty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu\nreinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor\nalloc_from_pool = torch.ops.inductor._alloc_from_pool\nasync_compile = AsyncCompile()\n\n\n# kernel path: runs/run_shard_6/inductor_cache/u6/cu6io2odujubs4jc63atgai7gg2fi2mzfw74zg77lxaq5wh3dsrx.py\n# Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat]\n# Source node to ATen node mapping:\n# cat => cat\n# Graph fragment:\n# %cat : [num_users=1] = call_function[target=torch.ops.aten.cat.default](args = ([%mul, %mul_1], -1), kwargs = {})\ntriton_poi_fused_cat_0 = async_compile.triton('triton_poi_fused_cat_0', '''\nimport triton\nimport triton.language as tl\nfrom triton.compiler.compiler import AttrsDescriptor\n\nfrom torch._inductor.runtime import triton_helpers, triton_heuristics\nfrom torch._inductor.runtime.triton_helpers import libdevice, math as tl_math\nfrom torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties\n\n@triton_heuristics.pointwise(\n size_hints=[512], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_cat_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},\n min_elem_per_thread=0\n)\n@triton.jit\ndef triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 512\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 2\n x1 = (xindex // 2)\n x2 = xindex\n tmp0 = x0\n tmp1 = tl.full([1], 0, tl.int64)\n tmp2 = tmp0 >= tmp1\n tmp3 = tl.full([1], 1, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = tl.load(in_ptr0 + (x1), tmp4 & xmask, eviction_policy='evict_last', other=0.0)\n tmp6 = 1.0\n tmp7 = tmp6 - tmp5\n tmp8 = tmp7 * tmp6\n tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype)\n tmp10 = tl.where(tmp4, tmp8, tmp9)\n tmp11 = tmp0 >= tmp3\n tmp12 = tl.full([1], 2, tl.int64)\n tmp13 = tmp0 < tmp12\n tmp14 = tl.load(in_ptr0 + (x1), tmp11 & xmask, eviction_policy='evict_last', other=0.0)\n tmp15 = tmp14 + tmp6\n tmp16 = tmp15 * tmp6\n tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)\n tmp18 = tl.where(tmp11, tmp16, tmp17)\n tmp19 = tl.where(tmp4, tmp10, tmp18)\n tl.store(out_ptr0 + (x2), tmp19, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4, 2), (128, 32, 8, 2, 1), torch.float32)\n # Topologically Sorted Source Nodes: [cat], Original ATen: [aten.cat]\n stream0 = get_raw_stream(0)\n triton_poi_fused_cat_0.run(arg0_1, buf0, 512, grid=grid(512), stream=stream0)\n del arg0_1\n return (buf0, )\n\n\ndef benchmark_compiled_module(times=10, repeat=10):\n from torch._dynamo.testing import rand_strided\n from torch._inductor.utils import print_performance\n arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1])\n return print_performance(fn, times=times, repeat=repeat)\n\n\nif __name__ == \"__main__\":\n from torch._inductor.wrapper_benchmark import compiled_module_main\n compiled_module_main('None', benchmark_compiled_module)\n", "role": "system", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch import nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 512\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 2\n x1 = xindex // 2\n x2 = xindex\n tmp0 = x0\n tl.full([1], 0, tl.int64)\n tmp3 = tl.full([1], 1, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = tl.load(in_ptr0 + x1, tmp4 & xmask, eviction_policy='evict_last',\n other=0.0)\n tmp6 = 1.0\n tmp7 = tmp6 - tmp5\n tmp8 = tmp7 * tmp6\n tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype)\n tmp10 = tl.where(tmp4, tmp8, tmp9)\n tmp11 = tmp0 >= tmp3\n tl.full([1], 2, tl.int64)\n tmp14 = tl.load(in_ptr0 + x1, tmp11 & xmask, eviction_policy=\n 'evict_last', other=0.0)\n tmp15 = tmp14 + tmp6\n tmp16 = tmp15 * tmp6\n tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)\n tmp18 = tl.where(tmp11, tmp16, tmp17)\n tmp19 = tl.where(tmp4, tmp10, tmp18)\n tl.store(out_ptr0 + x2, tmp19, xmask)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4, 2), (128, 32, 8, 2, 1),\n torch.float32)\n get_raw_stream(0)\n triton_poi_fused_cat_0[grid(512)](arg0_1, buf0, 512, XBLOCK=128,\n num_warps=4, num_stages=1)\n del arg0_1\n return buf0,\n\n\nclass BehlerAngularNew(nn.Module):\n \"\"\"\n Compute Behler type angular contribution of the angle spanned by three atoms:\n\n :math:`2^{(1-\\\\zeta)} (1 + \\\\lambda \\\\cos( {\\\\theta}_{ijk} ) )^\\\\zeta`\n\n Sets of zetas with lambdas of -1 and +1 are generated automatically.\n\n Args:\n zetas (set of int): Set of exponents used to compute angular Behler term (default={1})\n\n \"\"\"\n\n def __init__(self, zetas={1}):\n super(BehlerAngularNew, self).__init__()\n self.zetas = zetas\n\n def forward(self, input_0):\n arg0_1 = input_0\n output = call([arg0_1])\n return output[0]\n", "role": "user", "thinking": null }, { "content": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch import nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 512\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 2\n x1 = xindex // 2\n x2 = xindex\n tmp0 = x0\n tl.full([1], 0, tl.int64)\n tmp3 = tl.full([1], 1, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = tl.load(in_ptr0 + x1, tmp4 & xmask, eviction_policy='evict_last',\n other=0.0)\n tmp6 = 1.0\n tmp7 = tmp6 - tmp5\n tmp8 = tmp7 * tmp6\n tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype)\n tmp10 = tl.where(tmp4, tmp8, tmp9)\n tmp11 = tmp0 >= tmp3\n tl.full([1], 2, tl.int64)\n tmp14 = tl.load(in_ptr0 + x1, tmp11 & xmask, eviction_policy=\n 'evict_last', other=0.0)\n tmp15 = tmp14 + tmp6\n tmp16 = tmp15 * tmp6\n tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)\n tmp18 = tl.where(tmp11, tmp16, tmp17)\n tmp19 = tl.where(tmp4, tmp10, tmp18)\n tl.store(out_ptr0 + x2, tmp19, xmask)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4, 2), (128, 32, 8, 2, 1),\n torch.float32)\n get_raw_stream(0)\n triton_poi_fused_cat_0[grid(512)](arg0_1, buf0, 512, XBLOCK=128,\n num_warps=4, num_stages=1)\n del arg0_1\n return buf0,\n\n\nclass BehlerAngularNew(nn.Module):\n \"\"\"\n Compute Behler type angular contribution of the angle spanned by three atoms:\n\n :math:`2^{(1-\\\\zeta)} (1 + \\\\lambda \\\\cos( {\\\\theta}_{ijk} ) )^\\\\zeta`\n\n Sets of zetas with lambdas of -1 and +1 are generated automatically.\n\n Args:\n zetas (set of int): Set of exponents used to compute angular Behler term (default={1})\n\n \"\"\"\n\n def __init__(self, zetas={1}):\n super(BehlerAngularNew, self).__init__()\n self.zetas = zetas\n\n def forward(self, input_0):\n arg0_1 = input_0\n output = call([arg0_1])\n return output[0]\n", "role": "assistant", "thinking": "import torch\nimport triton\nimport triton.language as tl\nfrom torch._inductor.runtime.triton_heuristics import grid\nfrom torch._C import _cuda_getCurrentRawStream as get_raw_stream\nfrom torch import nn as nn\nassert_size_stride = torch._C._dynamo.guards.assert_size_stride\nempty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda\n\n\n@triton.jit\ndef triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):\n xnumel = 512\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = xindex < xnumel\n x0 = xindex % 2\n x1 = xindex // 2\n x2 = xindex\n tmp0 = x0\n tl.full([1], 0, tl.int64)\n tmp3 = tl.full([1], 1, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = tl.load(in_ptr0 + x1, tmp4 & xmask, eviction_policy='evict_last',\n other=0.0)\n tmp6 = 1.0\n tmp7 = tmp6 - tmp5\n tmp8 = tmp7 * tmp6\n tmp9 = tl.full(tmp8.shape, 0.0, tmp8.dtype)\n tmp10 = tl.where(tmp4, tmp8, tmp9)\n tmp11 = tmp0 >= tmp3\n tl.full([1], 2, tl.int64)\n tmp14 = tl.load(in_ptr0 + x1, tmp11 & xmask, eviction_policy=\n 'evict_last', other=0.0)\n tmp15 = tmp14 + tmp6\n tmp16 = tmp15 * tmp6\n tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)\n tmp18 = tl.where(tmp11, tmp16, tmp17)\n tmp19 = tl.where(tmp4, tmp10, tmp18)\n tl.store(out_ptr0 + x2, tmp19, xmask)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((4, 4, 4, 4, 2), (128, 32, 8, 2, 1),\n torch.float32)\n get_raw_stream(0)\n triton_poi_fused_cat_0[grid(512)](arg0_1, buf0, 512, XBLOCK=128,\n num_warps=4, num_stages=1)\n del arg0_1\n return buf0,\n\n\nclass BehlerAngularNew(nn.Module):\n \"\"\"\n Compute Behler type angular contribution of the angle spanned by three atoms:\n\n :math:`2^{(1-\\\\zeta)} (1 + \\\\lambda \\\\cos( {\\\\theta}_{ijk} ) )^\\\\zeta`\n\n Sets of zetas with lambdas of -1 and +1 are generated automatically.\n\n Args:\n zetas (set of int): Set of exponents used to compute angular Behler term (default={1})\n\n \"\"\"\n\n def __init__(self, zetas={1}):\n super(BehlerAngularNew, self).__init__()\n self.zetas = zetas\n\n def forward(self, input_0):\n arg0_1 = input_0\n output = call([arg0_1])\n return output[0]\n" } ]
BottleneckBlock
"# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimp(...TRUNCATED)
"import math\nimport torch\nimport torch.nn as nn\nimport torch.utils.data\nimport torch.nn.parallel(...TRUNCATED)
"import torch\nfrom torch._inductor.select_algorithm import extern_kernels\nimport triton\nimport tr(...TRUNCATED)
Aamer98/FeatureNorm
BottleneckBlock
false
7
[ "MIT" ]
0
fbf3d3b4cef81b3351347d272eb51b6cdd9f0cc5
https://github.com/Aamer98/FeatureNorm/tree/fbf3d3b4cef81b3351347d272eb51b6cdd9f0cc5
"[\n {\n \"content\": \"entry_point: BottleneckBlock\\n\\n# AOT ID: ['0_forward']\\nfrom ctypes (...TRUNCATED)
Mlp
"# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimp(...TRUNCATED)
"import torch\nimport torch.nn as nn\n\n\nclass Conv1d(nn.Module):\n\n def __init__(self, nf, nx,(...TRUNCATED)
"import torch\nfrom torch._inductor.select_algorithm import extern_kernels\nimport triton\nimport tr(...TRUNCATED)
Aalanli/MusicGeneration
Mlp
false
9
[ "MIT" ]
0
7d268322d692013d8ac6e70be31741cea519fa28
https://github.com/Aalanli/MusicGeneration/tree/7d268322d692013d8ac6e70be31741cea519fa28
"[\n {\n \"content\": \"entry_point: Mlp\\n\\n# AOT ID: ['0_forward']\\nfrom ctypes import c_voi(...TRUNCATED)
GCN
"# AOT ID: ['0_forward']\nfrom ctypes import c_void_p, c_long, c_int\nimport torch\nimport math\nimp(...TRUNCATED)
"from torch.nn import Module\nimport math\nimport torch\nimport torch.nn.functional as F\nimport tor(...TRUNCATED)
"import torch\nfrom torch._inductor.select_algorithm import extern_kernels\nimport triton\nimport tr(...TRUNCATED)
AlexMinhao/NAS_GNN
GCN
false
10
[ "Apache-2.0" ]
0
89183988a96e1d6baed910ab3843c13282f8b077
https://github.com/AlexMinhao/NAS_GNN/tree/89183988a96e1d6baed910ab3843c13282f8b077
"[\n {\n \"content\": \"entry_point: GCN\\n\\n# AOT ID: ['0_forward']\\nfrom ctypes import c_voi(...TRUNCATED)
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
8

Models trained or fine-tuned on Nadiveedishravanreddy/KernelBook-messages