diff --git "a/dataset.jsonl" "b/dataset.jsonl" new file mode 100644--- /dev/null +++ "b/dataset.jsonl" @@ -0,0 +1,13 @@ +{"python_code": "import torch\nimport torch.nn as nn\n\n\nclass SumAggregator(nn.Module):\n\n def __init__(self):\n super(SumAggregator, self).__init__()\n\n def forward(self, neighbor):\n return torch.sum(neighbor, dim=1)\n\n\n\nbatch_size = 8\ndim = 256\n\ndef get_inputs():\n a = torch.rand(batch_size, dim)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# 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: /tmp/triton_gen_5nv43u63/ko/ckonhbxat5pgzoodnu2vmqzg6njejt45frfz4dhv7q6y2rth7k7i.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_per_fused_sum_0 = async_compile.triton('triton_', '''\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.persistent_reduction(\n size_hints=[8, 256],\n reduction_hint=ReductionHint.INNER,\n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32', 3: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 3), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_sum_0', 'mutated_arg_names': [], 'no_x_dim': True, 'num_load': 1, 'num_reduction': 1, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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)\n@triton.jit\ndef triton_(in_ptr0, out_ptr0, xnumel, rnumel):\n xnumel = 8\n XBLOCK: tl.constexpr = 1\n rnumel = 256\n RBLOCK: tl.constexpr = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = tl.full([1], xoffset, tl.int32)\n xmask = tl.full([RBLOCK], True, tl.int1)\n rindex = tl.arange(0, RBLOCK)[:]\n roffset = 0\n rmask = tl.full([RBLOCK], True, tl.int1)\n r1 = rindex\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (r1 + (256*x0)), None)\n tmp1 = tl.broadcast_to(tmp0, [RBLOCK])\n tmp3 = triton_helpers.promote_to_tensor(tl.sum(tmp1, 0))\n tl.store(out_ptr0 + (x0), tmp3, None)\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, (8, 256), (256, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((8, ), (1, ), torch.float32)\n # Topologically Sorted Source Nodes: [sum_1], Original ATen: [aten.sum]\n stream0 = get_raw_stream(0)\n triton_per_fused_sum_0.run(arg0_1, buf0, 8, 256, grid=grid(8), 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((8, 256), (256, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_per_fused_sum_0(in_ptr0, out_ptr0, xnumel, rnumel):\n xnumel = 8\n XBLOCK: tl.constexpr = 1\n rnumel = 256\n RBLOCK: tl.constexpr = 256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = tl.full([1], xoffset, tl.int32)\n xmask = tl.full([RBLOCK], True, tl.int1)\n rindex = tl.arange(0, RBLOCK)[:]\n roffset = 0\n rmask = tl.full([RBLOCK], True, tl.int1)\n r1 = rindex\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (r1 + (256*x0)), None)\n tmp1 = tl.broadcast_to(tmp0, [RBLOCK])\n tmp3 = triton_helpers.promote_to_tensor(tl.sum(tmp1, 0))\n tl.store(out_ptr0 + (x0), tmp3, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (8, 256), (256, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((8, ), (1, ), torch.float32)\n stream0 = get_raw_stream(0)\n triton_per_fused_sum_0[grid(8)](arg0_1, buf0, 8, 256)\n del arg0_1\n return (buf0, )\n\nclass SumAggregator(nn.Module):\n\n def __init__(self):\n super(SumAggregator, self).__init__()\n\n def forward(self, neighbor):\n return torch.sum(neighbor, dim=1)"} +{"python_code": "import math\nimport torch\nimport torch.utils.data\nimport torch.nn as nn\n\n\nclass LinearEmbedding(nn.Module):\n\n def __init__(self, inp_size, d_model):\n super(LinearEmbedding, self).__init__()\n self.lut = nn.Linear(inp_size, d_model)\n self.d_model = d_model\n\n def forward(self, x):\n return self.lut(x) * math.sqrt(self.d_model)\n\n\n\nbatch_size = 8\nseq_len = 32\nhidden_dim = 768\n\ndef get_inputs():\n a = torch.rand(batch_size, seq_len, hidden_dim)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {'inp_size': 768, 'd_model': 768}]", "original_triton_code": "# AOT ID: ['1_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: /tmp/triton_gen_z1ihxaj8/qa/cqa76jnxi6sdodyvavny4fciof632aze5zjtcaa7v44gxn4zuqgw.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, 27.712812921102035), kwargs = {})\ntriton_poi_fused_mul_0 = async_compile.triton('triton_', '''\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=[262144], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), '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': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 196608\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x2 = xindex\n x0 = xindex % 768\n tmp0 = tl.load(in_out_ptr0 + (x2), None)\n tmp1 = tl.load(in_ptr0 + (x0), None, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 27.712812921102035\n tmp4 = tmp2 * tmp3\n tl.store(in_out_ptr0 + (x2), tmp4, None)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (768, 768), (768, 1))\n assert_size_stride(arg1_1, (768, ), (1, ))\n assert_size_stride(arg2_1, (8, 32, 768), (24576, 768, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((256, 768), (768, 1), torch.float32)\n # Topologically Sorted Source Nodes: [], Original ATen: []\n extern_kernels.mm(reinterpret_tensor(arg2_1, (256, 768), (768, 1), 0), reinterpret_tensor(arg0_1, (768, 768), (1, 768), 0), out=buf0)\n del arg0_1\n del arg2_1\n buf1 = reinterpret_tensor(buf0, (8, 32, 768), (24576, 768, 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, arg1_1, 196608, grid=grid(196608), stream=stream0)\n del arg1_1\n return (buf1, )\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((768, 768), (768, 1), device='cuda:0', dtype=torch.float32)\n arg1_1 = rand_strided((768, ), (1, ), device='cuda:0', dtype=torch.float32)\n arg2_1 = rand_strided((8, 32, 768), (24576, 768, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1, arg1_1, arg2_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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_mul_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 196608\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x2 = xindex\n x0 = xindex % 768\n tmp0 = tl.load(in_out_ptr0 + (x2), None)\n tmp1 = tl.load(in_ptr0 + (x0), None, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 27.712812921102035\n tmp4 = tmp2 * tmp3\n tl.store(in_out_ptr0 + (x2), tmp4, None)\n\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (768, 768), (768, 1))\n assert_size_stride(arg1_1, (768, ), (1, ))\n assert_size_stride(arg2_1, (8, 32, 768), (24576, 768, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((256, 768), (768, 1), torch.float32)\n extern_kernels.mm(reinterpret_tensor(arg2_1, (256, 768), (768, 1), 0), reinterpret_tensor(arg0_1, (768, 768), (1, 768), 0), out=buf0)\n del arg0_1\n del arg2_1\n buf1 = reinterpret_tensor(buf0, (8, 32, 768), (24576, 768, 1), 0); del buf0 # reuse\n stream0 = get_raw_stream(0)\n triton_poi_fused_mul_0[grid(196608)](buf1, arg1_1, 196608, XBLOCK=1024)\n del arg1_1\n return (buf1, )\n\nclass LinearEmbedding(nn.Module):\n\n def __init__(self, inp_size, d_model):\n super(LinearEmbedding, self).__init__()\n self.lut = nn.Linear(inp_size, d_model)\n self.d_model = d_model\n\n def forward(self, x):\n return self.lut(x) * math.sqrt(self.d_model)"} +{"python_code": "import torch\nfrom torch import nn as nn\n\n\nclass BehlerAngular(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(BehlerAngular, self).__init__()\n self.zetas = zetas\n\n def forward(self, cos_theta):\n \"\"\"\n Args:\n cos_theta (torch.Tensor): Cosines between all pairs of neighbors of the central atom.\n\n Returns:\n torch.Tensor: Tensor containing values of the angular filters.\n \"\"\"\n angular_pos = [(2 ** (1 - zeta) * ((1.0 - cos_theta) ** zeta).\n unsqueeze(-1)) for zeta in self.zetas]\n angular_neg = [(2 ** (1 - zeta) * ((1.0 + cos_theta) ** zeta).\n unsqueeze(-1)) for zeta in self.zetas]\n angular_all = angular_pos + angular_neg\n return torch.cat(angular_all, -1)\n\n\n\nbatch_size = 32\ndim = 768\n\ndef get_inputs():\n a = torch.rand(batch_size, dim)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# AOT ID: ['17_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: /tmp/triton_gen_i1zrmqvl/b6/cb6oh7eben5nok7pg65klzv3oz3baxtf2cpqlrhilswo6khcz2sj.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_', '''\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=[65536], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), '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': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 49152\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\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, 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, 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, None)\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, (32, 768), (768, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 768, 2), (1536, 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, 49152, grid=grid(49152), 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((32, 768), (768, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 49152\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\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, 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, 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, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (32, 768), (768, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 768, 2), (1536, 2, 1), torch.float32)\n stream0 = get_raw_stream(0)\n triton_poi_fused_cat_0[grid(49152)](arg0_1, buf0, 49152, XBLOCK=1024)\n del arg0_1\n return (buf0, )\n\nclass BehlerAngular(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(BehlerAngular, self).__init__()\n self.zetas = zetas\n\n def forward(self, cos_theta):\n \"\"\"\n Args:\n cos_theta (torch.Tensor): Cosines between all pairs of neighbors of the central atom.\n\n Returns:\n torch.Tensor: Tensor containing values of the angular filters.\n \"\"\"\n angular_pos = [(2 ** (1 - zeta) * ((1.0 - cos_theta) ** zeta).\n unsqueeze(-1)) for zeta in self.zetas]\n angular_neg = [(2 ** (1 - zeta) * ((1.0 + cos_theta) ** zeta).\n unsqueeze(-1)) for zeta in self.zetas]\n angular_all = angular_pos + angular_neg\n return torch.cat(angular_all, -1)"} +{"python_code": "import torch\nimport torch.nn as nn\n\n\nclass MeanStd(nn.Module):\n\n def __init__(self):\n super(MeanStd, self).__init__()\n\n def forward(self, x):\n x = x.view(x.size(0), x.size(1), -1)\n mean_x = torch.mean(x, dim=2)\n var_x = torch.mean(x ** 2, dim=2) - mean_x * mean_x\n return torch.cat([mean_x, var_x], dim=1)\n\n\n\nbatch_size = 4\nseq_len = 256\nhidden_dim = 512\n\ndef get_inputs():\n a = torch.randn(batch_size, seq_len, hidden_dim)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# AOT ID: ['41_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: /tmp/triton_gen_sr2eiq8i/4c/c4cd5abahk3qr6tksimsello3dtt2z4zxamvtak54gmqv66kgq5o.py\n# Topologically Sorted Source Nodes: [pow_1, mean_1, mean_x, mul, var_x], Original ATen: [aten.pow, aten.mean, aten.mul, aten.sub]\n# Source node to ATen node mapping:\n# mean_1 => mean_1\n# mean_x => mean\n# mul => mul\n# pow_1 => pow_1\n# var_x => sub\n# Graph fragment:\n# %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%view, 2), kwargs = {})\n# %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_1, [2]), kwargs = {})\n# %mean : [num_users=2] = call_function[target=torch.ops.aten.mean.dim](args = (%view, [2]), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mean, %mean), kwargs = {})\n# %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mean_1, %mul), kwargs = {})\ntriton_per_fused_mean_mul_pow_sub_0 = async_compile.triton('triton_', '''\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.persistent_reduction(\n size_hints=[1024, 512],\n reduction_hint=ReductionHint.INNER,\n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_mean_mul_pow_sub_0', 'mutated_arg_names': [], 'no_x_dim': True, 'num_load': 1, 'num_reduction': 2, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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)\n@triton.jit\ndef triton_(in_ptr0, out_ptr2, out_ptr3, xnumel, rnumel):\n xnumel = 1024\n XBLOCK: tl.constexpr = 1\n rnumel = 512\n RBLOCK: tl.constexpr = 512\n xoffset = tl.program_id(0) * XBLOCK\n xindex = tl.full([1], xoffset, tl.int32)\n xmask = tl.full([RBLOCK], True, tl.int1)\n rindex = tl.arange(0, RBLOCK)[:]\n roffset = 0\n rmask = tl.full([RBLOCK], True, tl.int1)\n r1 = rindex\n x0 = xindex\n x2 = xindex % 256\n x3 = (xindex // 256)\n tmp0 = tl.load(in_ptr0 + (r1 + (512*x0)), None)\n tmp1 = tmp0 * tmp0\n tmp2 = tl.broadcast_to(tmp1, [RBLOCK])\n tmp4 = triton_helpers.promote_to_tensor(tl.sum(tmp2, 0))\n tmp5 = tl.broadcast_to(tmp0, [RBLOCK])\n tmp7 = triton_helpers.promote_to_tensor(tl.sum(tmp5, 0))\n tmp8 = 512.0\n tmp9 = tmp7 / tmp8\n tmp10 = tmp4 / tmp8\n tmp11 = tmp9 * tmp9\n tmp12 = tmp10 - tmp11\n tl.store(out_ptr2 + (x2 + (512*x3)), tmp9, None)\n tl.store(out_ptr3 + (x2 + (512*x3)), tmp12, None)\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, 256, 512), (131072, 512, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf4 = empty_strided_cuda((4, 512), (512, 1), torch.float32)\n buf2 = reinterpret_tensor(buf4, (4, 256), (512, 1), 0) # alias\n buf3 = reinterpret_tensor(buf4, (4, 256), (512, 1), 256) # alias\n # Topologically Sorted Source Nodes: [pow_1, mean_1, mean_x, mul, var_x], Original ATen: [aten.pow, aten.mean, aten.mul, aten.sub]\n stream0 = get_raw_stream(0)\n triton_per_fused_mean_mul_pow_sub_0.run(arg0_1, buf2, buf3, 1024, 512, grid=grid(1024), stream=stream0)\n del arg0_1\n return (buf4, )\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, 256, 512), (131072, 512, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_per_fused_mean_mul_pow_sub_0(in_ptr0, out_ptr2, out_ptr3, xnumel, rnumel):\n xnumel = 1024\n XBLOCK: tl.constexpr = 1\n rnumel = 512\n RBLOCK: tl.constexpr = 512\n xoffset = tl.program_id(0) * XBLOCK\n xindex = tl.full([1], xoffset, tl.int32)\n xmask = tl.full([RBLOCK], True, tl.int1)\n rindex = tl.arange(0, RBLOCK)[:]\n roffset = 0\n rmask = tl.full([RBLOCK], True, tl.int1)\n r1 = rindex\n x0 = xindex\n x2 = xindex % 256\n x3 = (xindex // 256)\n tmp0 = tl.load(in_ptr0 + (r1 + (512*x0)), None)\n tmp1 = tmp0 * tmp0\n tmp2 = tl.broadcast_to(tmp1, [RBLOCK])\n tmp4 = triton_helpers.promote_to_tensor(tl.sum(tmp2, 0))\n tmp5 = tl.broadcast_to(tmp0, [RBLOCK])\n tmp7 = triton_helpers.promote_to_tensor(tl.sum(tmp5, 0))\n tmp8 = 512.0\n tmp9 = tmp7 / tmp8\n tmp10 = tmp4 / tmp8\n tmp11 = tmp9 * tmp9\n tmp12 = tmp10 - tmp11\n tl.store(out_ptr2 + (x2 + (512*x3)), tmp9, None)\n tl.store(out_ptr3 + (x2 + (512*x3)), tmp12, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (4, 256, 512), (131072, 512, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf4 = empty_strided_cuda((4, 512), (512, 1), torch.float32)\n buf2 = reinterpret_tensor(buf4, (4, 256), (512, 1), 0) # alias\n buf3 = reinterpret_tensor(buf4, (4, 256), (512, 1), 256) # alias\n stream0 = get_raw_stream(0)\n triton_per_fused_mean_mul_pow_sub_0[grid(1024)](arg0_1, buf2, buf3, 1024, 512)\n del arg0_1\n return (buf4, )\n\nclass MeanStd(nn.Module):\n\n def __init__(self):\n super(MeanStd, self).__init__()\n\n def forward(self, x):\n x = x.view(x.size(0), x.size(1), -1)\n mean_x = torch.mean(x, dim=2)\n var_x = torch.mean(x ** 2, dim=2) - mean_x * mean_x\n return torch.cat([mean_x, var_x], dim=1)"} +{"python_code": "import torch\nimport torch.nn as nn\nimport torch.nn.parallel\nimport torch.optim\nimport torch.utils.data\n\n\nclass SparseDownSampleClose(nn.Module):\n\n def __init__(self, stride):\n super(SparseDownSampleClose, self).__init__()\n self.pooling = nn.MaxPool2d(stride, stride)\n self.large_number = 600\n\n def forward(self, d, mask):\n encode_d = -(1 - mask) * self.large_number - d\n d = -self.pooling(encode_d)\n mask_result = self.pooling(mask)\n d_result = d - (1 - mask_result) * self.large_number\n return d_result, mask_result\n\n\n\nbatch_size = 16\nseq_len = 256\nhidden_dim = 512\n\ndef get_inputs():\n a = torch.rand(batch_size, seq_len, hidden_dim)\n b = torch.rand(batch_size, seq_len, hidden_dim)\n return [a, b]\n\n\ndef get_init_inputs():\n return [[], {'stride': 1}]", "original_triton_code": "# AOT ID: ['62_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: /tmp/triton_gen_4gc33t9k/uf/cufvm6x2igre23wwgcnpknrfezhyu6zm3xiqijocuuhwbw5snw5i.py\n# Topologically Sorted Source Nodes: [sub, neg, mul, encode_d, max_pool2d, mask_result, d, sub_2, mul_1, d_result], Original ATen: [aten.rsub, aten.neg, aten.mul, aten.sub, aten.max_pool2d_with_indices]\n# Source node to ATen node mapping:\n# d => neg_1\n# d_result => sub_3\n# encode_d => sub_1\n# mask_result => getitem_2\n# max_pool2d => _low_memory_max_pool2d_with_offsets\n# mul => mul\n# mul_1 => mul_1\n# neg => neg\n# sub => sub\n# sub_2 => sub_2\n# Graph fragment:\n# %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (1, %arg0_1), kwargs = {})\n# %neg : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%sub,), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%neg, 600), kwargs = {})\n# %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul, %arg1_1), kwargs = {})\n# %_low_memory_max_pool2d_with_offsets : [num_users=1] = call_function[target=torch.ops.prims._low_memory_max_pool2d_with_offsets.default](args = (%sub_1, [1, 1], [1, 1], [0, 0], [1, 1], False), kwargs = {})\n# %getitem_2 : [num_users=2] = call_function[target=operator.getitem](args = (%_low_memory_max_pool2d_with_offsets_1, 0), kwargs = {})\n# %neg_1 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%getitem,), kwargs = {})\n# %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (1, %getitem_2), kwargs = {})\n# %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_2, 600), kwargs = {})\n# %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%neg_1, %mul_1), kwargs = {})\ntriton_poi_fused_max_pool2d_with_indices_mul_neg_rsub_sub_0 = async_compile.triton('triton_', '''\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=[2097152], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), '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_max_pool2d_with_indices_mul_neg_rsub_sub_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_out_ptr0, in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 2097152\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), None)\n tmp6 = tl.load(in_ptr1 + (x0), None)\n tmp1 = 1.0\n tmp2 = tmp1 - tmp0\n tmp3 = -tmp2\n tmp4 = 600.0\n tmp5 = tmp3 * tmp4\n tmp7 = tmp5 - tmp6\n tmp8 = -tmp7\n tmp9 = tmp2 * tmp4\n tmp10 = tmp8 - tmp9\n tl.store(out_ptr0 + (x0), tmp0, None)\n tl.store(in_out_ptr0 + (x0), tmp10, None)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, arg1_1 = args\n args.clear()\n assert_size_stride(arg0_1, (16, 256, 512), (131072, 512, 1))\n assert_size_stride(arg1_1, (16, 256, 512), (131072, 512, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((16, 256, 512), (131072, 512, 1), torch.float32)\n buf1 = empty_strided_cuda((16, 256, 512), (131072, 512, 1), torch.float32)\n buf2 = buf0; del buf0 # reuse\n # Topologically Sorted Source Nodes: [sub, neg, mul, encode_d, max_pool2d, mask_result, d, sub_2, mul_1, d_result], Original ATen: [aten.rsub, aten.neg, aten.mul, aten.sub, aten.max_pool2d_with_indices]\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_pool2d_with_indices_mul_neg_rsub_sub_0.run(buf2, arg0_1, arg1_1, buf1, 2097152, grid=grid(2097152), stream=stream0)\n del arg0_1\n del arg1_1\n return (buf2, buf1, )\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((16, 256, 512), (131072, 512, 1), device='cuda:0', dtype=torch.float32)\n arg1_1 = rand_strided((16, 256, 512), (131072, 512, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1, arg1_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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_max_pool2d_with_indices_mul_neg_rsub_sub_0(in_out_ptr0, in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 2097152\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), None)\n tmp6 = tl.load(in_ptr1 + (x0), None)\n tmp1 = 1.0\n tmp2 = tmp1 - tmp0\n tmp3 = -tmp2\n tmp4 = 600.0\n tmp5 = tmp3 * tmp4\n tmp7 = tmp5 - tmp6\n tmp8 = -tmp7\n tmp9 = tmp2 * tmp4\n tmp10 = tmp8 - tmp9\n tl.store(out_ptr0 + (x0), tmp0, None)\n tl.store(in_out_ptr0 + (x0), tmp10, None)\n\n\ndef call(args):\n arg0_1, arg1_1 = args\n args.clear()\n assert_size_stride(arg0_1, (16, 256, 512), (131072, 512, 1))\n assert_size_stride(arg1_1, (16, 256, 512), (131072, 512, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((16, 256, 512), (131072, 512, 1), torch.float32)\n buf1 = empty_strided_cuda((16, 256, 512), (131072, 512, 1), torch.float32)\n buf2 = buf0; del buf0 # reuse\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_pool2d_with_indices_mul_neg_rsub_sub_0[grid(2097152)](buf2, arg0_1, arg1_1, buf1, 2097152, XBLOCK=1024)\n del arg0_1\n del arg1_1\n return (buf2, buf1, )\n\nclass SparseDownSampleClose(nn.Module):\n\n def __init__(self, stride):\n super(SparseDownSampleClose, self).__init__()\n self.pooling = nn.MaxPool2d(stride, stride)\n self.large_number = 600\n\n def forward(self, d, mask):\n encode_d = -(1 - mask) * self.large_number - d\n d = -self.pooling(encode_d)\n mask_result = self.pooling(mask)\n d_result = d - (1 - mask_result) * self.large_number\n return d_result, mask_result"} +{"python_code": "import torch\nfrom torch import nn\n\n\ndef upscale2d(x, factor=2, gain=1):\n assert x.dim() == 4\n if gain != 1:\n x = x * gain\n if factor != 1:\n shape = x.shape\n x = x.view(shape[0], shape[1], shape[2], 1, shape[3], 1).expand(-1,\n -1, -1, factor, -1, factor)\n x = x.contiguous().view(shape[0], shape[1], factor * shape[2], \n factor * shape[3])\n return x\n\n\nclass Upscale2d(nn.Module):\n\n def __init__(self, factor=2, gain=1):\n super().__init__()\n assert isinstance(factor, int) and factor >= 1\n self.gain = gain\n self.factor = factor\n\n def forward(self, x):\n return upscale2d(x, factor=self.factor, gain=self.gain)\n\n\n\nbatch_size = 16\nchannels = 32\nheight = 128\nwidth = 32\n\ndef get_inputs():\n a = torch.rand(batch_size, channels, height, width)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# AOT ID: ['73_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: /tmp/triton_gen_b7ljik6t/sd/csdk4syuvkpchxa3damw5nssnk3osvzlcokmkddsln3q3xivtzap.py\n# Topologically Sorted Source Nodes: [contiguous], Original ATen: [aten.clone]\n# Source node to ATen node mapping:\n# contiguous => clone\n# Graph fragment:\n# %clone : [num_users=1] = call_function[target=torch.ops.aten.clone.default](args = (%expand,), kwargs = {memory_format: torch.contiguous_format})\ntriton_poi_fused_clone_0 = async_compile.triton('triton_', '''\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=[8388608], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_clone_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 8388608\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x1 = (xindex // 2) % 32\n x3 = (xindex // 128)\n x4 = xindex\n tmp0 = tl.load(in_ptr0 + (x1 + (32*x3)), None, eviction_policy='evict_last')\n tl.store(out_ptr0 + (x4), tmp0, None)\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, (16, 32, 128, 32), (131072, 4096, 32, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((16, 32, 128, 2, 32, 2), (524288, 16384, 128, 64, 2, 1), torch.float32)\n # Topologically Sorted Source Nodes: [contiguous], Original ATen: [aten.clone]\n stream0 = get_raw_stream(0)\n triton_poi_fused_clone_0.run(arg0_1, buf0, 8388608, grid=grid(8388608), stream=stream0)\n del arg0_1\n return (reinterpret_tensor(buf0, (16, 32, 256, 64), (524288, 16384, 64, 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 arg0_1 = rand_strided((16, 32, 128, 32), (131072, 4096, 32, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_clone_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 8388608\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x1 = (xindex // 2) % 32\n x3 = (xindex // 128)\n x4 = xindex\n tmp0 = tl.load(in_ptr0 + (x1 + (32*x3)), None, eviction_policy='evict_last')\n tl.store(out_ptr0 + (x4), tmp0, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (16, 32, 128, 32), (131072, 4096, 32, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((16, 32, 128, 2, 32, 2), (524288, 16384, 128, 64, 2, 1), torch.float32)\n stream0 = get_raw_stream(0)\n triton_poi_fused_clone_0[grid(8388608)](arg0_1, buf0, 8388608, XBLOCK=1024)\n del arg0_1\n return (reinterpret_tensor(buf0, (16, 32, 256, 64), (524288, 16384, 64, 1), 0), )\n\nclass Upscale2d(nn.Module):\n\n def __init__(self, factor=2, gain=1):\n super().__init__()\n assert isinstance(factor, int) and factor >= 1\n self.gain = gain\n self.factor = factor\n\n def forward(self, x):\n return upscale2d(x, factor=self.factor, gain=self.gain)"} +{"python_code": "import torch\nimport torch.nn as nn\nimport torch.utils.data\n\n\nclass maxout(nn.Module):\n \"\"\"\n maxout network\n \"\"\"\n\n def __init__(self, in_feature, out_feature, pool_size):\n super(maxout, self).__init__()\n self.in_feature = in_feature\n self.out_feature = out_feature\n self.pool_size = pool_size\n self.linear = nn.Linear(in_feature, out_feature * pool_size)\n\n def forward(self, x):\n output = self.linear(x)\n output = output.view(-1, self.out_feature, self.pool_size)\n output = output.max(2)[0]\n return output\n\n\n\nbatch_size = 16\ndim = 512\n\ndef get_inputs():\n a = torch.randn(batch_size, dim)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {'in_feature': 512, 'out_feature': 4, 'pool_size': 4}]", "original_triton_code": "# AOT ID: ['74_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: /tmp/triton_gen_5dx9089x/il/cilmhzu7w4pcnhrjajlkbqc7jq2ycyb4ju3rooiiuinfgclerja7.py\n# Topologically Sorted Source Nodes: [max_1], Original ATen: [aten.max]\n# Source node to ATen node mapping:\n# max_1 => getitem\n# Graph fragment:\n# %getitem : [num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})\ntriton_poi_fused_max_0 = async_compile.triton('triton_', '''\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=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 4, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(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\n tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')\n tmp2 = triton_helpers.maximum(tmp0, tmp1)\n tmp4 = triton_helpers.maximum(tmp2, tmp3)\n tmp6 = triton_helpers.maximum(tmp4, tmp5)\n tl.store(out_ptr0 + (x0), tmp6, xmask)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (16, 512), (512, 1))\n assert_size_stride(arg1_1, (16, ), (1, ))\n assert_size_stride(arg2_1, (16, 512), (512, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((16, 16), (16, 1), torch.float32)\n # Topologically Sorted Source Nodes: [output], Original ATen: [aten.addmm]\n extern_kernels.addmm(arg1_1, arg2_1, reinterpret_tensor(arg0_1, (512, 16), (1, 512), 0), alpha=1, beta=1, out=buf0)\n del arg0_1\n del arg1_1\n del arg2_1\n buf1 = empty_strided_cuda((16, 4), (4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [max_1], Original ATen: [aten.max]\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_0.run(buf0, buf1, 64, grid=grid(64), stream=stream0)\n del buf0\n return (buf1, )\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((16, 512), (512, 1), device='cuda:0', dtype=torch.float32)\n arg1_1 = rand_strided((16, ), (1, ), device='cuda:0', dtype=torch.float32)\n arg2_1 = rand_strided((16, 512), (512, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1, arg1_1, arg2_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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_max_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\n tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')\n tmp1 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')\n tmp3 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')\n tmp5 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')\n tmp2 = triton_helpers.maximum(tmp0, tmp1)\n tmp4 = triton_helpers.maximum(tmp2, tmp3)\n tmp6 = triton_helpers.maximum(tmp4, tmp5)\n tl.store(out_ptr0 + (x0), tmp6, xmask)\n\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (16, 512), (512, 1))\n assert_size_stride(arg1_1, (16, ), (1, ))\n assert_size_stride(arg2_1, (16, 512), (512, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((16, 16), (16, 1), torch.float32)\n extern_kernels.addmm(arg1_1, arg2_1, reinterpret_tensor(arg0_1, (512, 16), (1, 512), 0), alpha=1, beta=1, out=buf0)\n del arg0_1\n del arg1_1\n del arg2_1\n buf1 = empty_strided_cuda((16, 4), (4, 1), torch.float32)\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_0[grid(64)](buf0, buf1, 64, XBLOCK=1024)\n del buf0\n return (buf1, )\n\nclass maxout(nn.Module):\n \"\"\"\n maxout network\n \"\"\"\n\n def __init__(self, in_feature, out_feature, pool_size):\n super(maxout, self).__init__()\n self.in_feature = in_feature\n self.out_feature = out_feature\n self.pool_size = pool_size\n self.linear = nn.Linear(in_feature, out_feature * pool_size)\n\n def forward(self, x):\n output = self.linear(x)\n output = output.view(-1, self.out_feature, self.pool_size)\n output = output.max(2)[0]\n return output"} +{"python_code": "import torch\nimport torch.nn as nn\nimport torch.nn.parallel\nimport torch.optim\nimport torch.utils.data\n\n\nclass GeometryFeature(nn.Module):\n\n def __init__(self):\n super(GeometryFeature, self).__init__()\n\n def forward(self, z, vnorm, unorm, h, w, ch, cw, fh, fw):\n x = z * (0.5 * h * (vnorm + 1) - ch) / fh\n y = z * (0.5 * w * (unorm + 1) - cw) / fw\n return torch.cat((x, y, z), 1)\n\n\n\nbatch_size = 32\nseq_len = 256\nhidden_dim = 128\n\ndef get_inputs():\n x0 = torch.randn(batch_size, seq_len, hidden_dim)\n x1 = torch.randn(batch_size, seq_len, hidden_dim)\n x2 = torch.randn(batch_size, seq_len, hidden_dim)\n x3 = torch.randn(batch_size, seq_len, hidden_dim)\n x4 = torch.randn(batch_size, seq_len, hidden_dim)\n x5 = torch.randn(batch_size, seq_len, hidden_dim)\n x6 = torch.randn(batch_size, seq_len, hidden_dim)\n x7 = torch.randn(batch_size, seq_len, hidden_dim)\n x8 = torch.randn(batch_size, seq_len, hidden_dim)\n return [x0, x1, x2, x3, x4, x5, x6, x7, x8]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# AOT ID: ['83_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: /tmp/triton_gen_d2gek7tc/5o/c5ojo3momw7665c7t3pz674g6l4h73sggtkwcusslvqxymz6so6q.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 = ([%div, %div_1, %arg3_1], 1), kwargs = {})\ntriton_poi_fused_cat_0 = async_compile.triton('triton_', '''\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=[4194304], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: '*fp32', 7: '*fp32', 8: '*fp32', 9: '*fp32', 10: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 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': 11, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 3145728\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x1 = (xindex // 128) % 768\n x0 = xindex % 128\n x2 = (xindex // 98304)\n x3 = xindex\n tmp0 = x1\n tmp1 = tl.full([1], 0, tl.int64)\n tmp2 = tmp0 >= tmp1\n tmp3 = tl.full([1], 256, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = tl.load(in_ptr0 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp6 = tl.load(in_ptr1 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp7 = 0.5\n tmp8 = tmp6 * tmp7\n tmp9 = tl.load(in_ptr2 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp10 = 1.0\n tmp11 = tmp9 + tmp10\n tmp12 = tmp8 * tmp11\n tmp13 = tl.load(in_ptr3 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp14 = tmp12 - tmp13\n tmp15 = tmp5 * tmp14\n tmp16 = tl.load(in_ptr4 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp17 = tmp15 / tmp16\n tmp18 = tl.full(tmp17.shape, 0.0, tmp17.dtype)\n tmp19 = tl.where(tmp4, tmp17, tmp18)\n tmp20 = tmp0 >= tmp3\n tmp21 = tl.full([1], 512, tl.int64)\n tmp22 = tmp0 < tmp21\n tmp23 = tmp20 & tmp22\n tmp24 = tl.load(in_ptr0 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp25 = tl.load(in_ptr5 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp26 = tmp25 * tmp7\n tmp27 = tl.load(in_ptr6 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp28 = tmp27 + tmp10\n tmp29 = tmp26 * tmp28\n tmp30 = tl.load(in_ptr7 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp31 = tmp29 - tmp30\n tmp32 = tmp24 * tmp31\n tmp33 = tl.load(in_ptr8 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp34 = tmp32 / tmp33\n tmp35 = tl.full(tmp34.shape, 0.0, tmp34.dtype)\n tmp36 = tl.where(tmp23, tmp34, tmp35)\n tmp37 = tmp0 >= tmp21\n tmp38 = tl.full([1], 768, tl.int64)\n tmp39 = tmp0 < tmp38\n tmp40 = tl.load(in_ptr0 + (x0 + (128*((-512) + x1)) + (32768*x2)), tmp37, other=0.0)\n tmp41 = tl.where(tmp23, tmp36, tmp40)\n tmp42 = tl.where(tmp4, tmp19, tmp41)\n tl.store(out_ptr0 + (x3), tmp42, None)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1 = args\n args.clear()\n assert_size_stride(arg0_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg1_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg2_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg3_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg4_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg5_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg6_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg7_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg8_1, (32, 256, 128), (32768, 128, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 768, 128), (98304, 128, 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(arg3_1, arg0_1, arg1_1, arg2_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, buf0, 3145728, grid=grid(3145728), stream=stream0)\n del arg0_1\n del arg1_1\n del arg2_1\n del arg3_1\n del arg4_1\n del arg5_1\n del arg6_1\n del arg7_1\n del arg8_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((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg1_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg2_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg3_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg4_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg5_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg6_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg7_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n arg8_1 = rand_strided((32, 256, 128), (32768, 128, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_cat_0(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 3145728\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x1 = (xindex // 128) % 768\n x0 = xindex % 128\n x2 = (xindex // 98304)\n x3 = xindex\n tmp0 = x1\n tmp1 = tl.full([1], 0, tl.int64)\n tmp2 = tmp0 >= tmp1\n tmp3 = tl.full([1], 256, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = tl.load(in_ptr0 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp6 = tl.load(in_ptr1 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp7 = 0.5\n tmp8 = tmp6 * tmp7\n tmp9 = tl.load(in_ptr2 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp10 = 1.0\n tmp11 = tmp9 + tmp10\n tmp12 = tmp8 * tmp11\n tmp13 = tl.load(in_ptr3 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp14 = tmp12 - tmp13\n tmp15 = tmp5 * tmp14\n tmp16 = tl.load(in_ptr4 + (x0 + (128*x1) + (32768*x2)), tmp4, other=0.0)\n tmp17 = tmp15 / tmp16\n tmp18 = tl.full(tmp17.shape, 0.0, tmp17.dtype)\n tmp19 = tl.where(tmp4, tmp17, tmp18)\n tmp20 = tmp0 >= tmp3\n tmp21 = tl.full([1], 512, tl.int64)\n tmp22 = tmp0 < tmp21\n tmp23 = tmp20 & tmp22\n tmp24 = tl.load(in_ptr0 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp25 = tl.load(in_ptr5 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp26 = tmp25 * tmp7\n tmp27 = tl.load(in_ptr6 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp28 = tmp27 + tmp10\n tmp29 = tmp26 * tmp28\n tmp30 = tl.load(in_ptr7 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp31 = tmp29 - tmp30\n tmp32 = tmp24 * tmp31\n tmp33 = tl.load(in_ptr8 + (x0 + (128*((-256) + x1)) + (32768*x2)), tmp23, other=0.0)\n tmp34 = tmp32 / tmp33\n tmp35 = tl.full(tmp34.shape, 0.0, tmp34.dtype)\n tmp36 = tl.where(tmp23, tmp34, tmp35)\n tmp37 = tmp0 >= tmp21\n tmp38 = tl.full([1], 768, tl.int64)\n tmp39 = tmp0 < tmp38\n tmp40 = tl.load(in_ptr0 + (x0 + (128*((-512) + x1)) + (32768*x2)), tmp37, other=0.0)\n tmp41 = tl.where(tmp23, tmp36, tmp40)\n tmp42 = tl.where(tmp4, tmp19, tmp41)\n tl.store(out_ptr0 + (x3), tmp42, None)\n\n\ndef call(args):\n arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1 = args\n args.clear()\n assert_size_stride(arg0_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg1_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg2_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg3_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg4_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg5_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg6_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg7_1, (32, 256, 128), (32768, 128, 1))\n assert_size_stride(arg8_1, (32, 256, 128), (32768, 128, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 768, 128), (98304, 128, 1), torch.float32)\n stream0 = get_raw_stream(0)\n triton_poi_fused_cat_0[grid(3145728)](arg3_1, arg0_1, arg1_1, arg2_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, buf0, 3145728, XBLOCK=1024)\n del arg0_1\n del arg1_1\n del arg2_1\n del arg3_1\n del arg4_1\n del arg5_1\n del arg6_1\n del arg7_1\n del arg8_1\n return (buf0, )\n\nclass GeometryFeature(nn.Module):\n\n def __init__(self):\n super(GeometryFeature, self).__init__()\n\n def forward(self, z, vnorm, unorm, h, w, ch, cw, fh, fw):\n x = z * (0.5 * h * (vnorm + 1) - ch) / fh\n y = z * (0.5 * w * (unorm + 1) - cw) / fw\n return torch.cat((x, y, z), 1)"} +{"python_code": "import torch\nimport torch.onnx\n\n\nclass ToHalf(torch.nn.Module):\n\n def forward(self, tensor):\n return tensor.half()\n\n\n\nbatch_size = 32\ndim = 768\n\ndef get_inputs():\n a = torch.randn(batch_size, dim)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# AOT ID: ['85_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: /tmp/triton_gen_pzq9jic7/aa/caaqcdf4etrj3b3st42vqb5fi6zrum3cr334rr4x6gkhx44c5vle.py\n# Topologically Sorted Source Nodes: [half], Original ATen: [aten._to_copy]\n# Source node to ATen node mapping:\n# half => convert_element_type\n# Graph fragment:\n# %convert_element_type : [num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg0_1, torch.float16), kwargs = {})\ntriton_poi_fused__to_copy_0 = async_compile.triton('triton_', '''\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=[32768], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 24576\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), None)\n tmp1 = tmp0.to(tl.float32)\n tl.store(out_ptr0 + (x0), tmp1, None)\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, (32, 768), (768, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 768), (768, 1), torch.float16)\n # Topologically Sorted Source Nodes: [half], Original ATen: [aten._to_copy]\n stream0 = get_raw_stream(0)\n triton_poi_fused__to_copy_0.run(arg0_1, buf0, 24576, grid=grid(24576), 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((32, 768), (768, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused__to_copy_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 24576\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), None)\n tmp1 = tmp0.to(tl.float32)\n tl.store(out_ptr0 + (x0), tmp1, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (32, 768), (768, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 768), (768, 1), torch.float16)\n stream0 = get_raw_stream(0)\n triton_poi_fused__to_copy_0[grid(24576)](arg0_1, buf0, 24576, XBLOCK=1024)\n del arg0_1\n return (buf0, )\n\nclass ToHalf(torch.nn.Module):\n\n def forward(self, tensor):\n return tensor.half()"} +{"python_code": "import torch\nimport torch.nn as nn\n\n\nclass MultiLevelPooling(nn.Module):\n\n def __init__(self, levels=[1, 2, 4]):\n super(MultiLevelPooling, self).__init__()\n self.Pools = nn.ModuleList([nn.MaxPool2d(i) for i in levels])\n\n def forward(self, x):\n assert len(x.size()) == 4, '\u8f93\u5165\u5f62\u72b6\u4e0d\u6ee1\u8db3(n,c,w,w)'\n n = x.size(0)\n c = x.size(1)\n features = []\n for pool in self.Pools:\n features.append(pool(x))\n return features[0].view(n, c, -1)\n\n\n\nbatch_size = 32\nchannels = 3\nheight = 64\nwidth = 224\n\ndef get_inputs():\n a = torch.randn(batch_size, channels, height, width)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {}]", "original_triton_code": "# AOT ID: ['90_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: /tmp/triton_gen_gosffzqi/xc/cxci22wt2yksf3wp77tp5oqo45xup5m3dvpfxayy3rl2t7p3mnb2.py\n# Topologically Sorted Source Nodes: [max_pool2d], Original ATen: [aten.max_pool2d_with_indices]\n# Source node to ATen node mapping:\n# max_pool2d => _low_memory_max_pool2d_with_offsets\n# Graph fragment:\n# %_low_memory_max_pool2d_with_offsets : [num_users=1] = call_function[target=torch.ops.prims._low_memory_max_pool2d_with_offsets.default](args = (%arg0_1, [1, 1], [1, 1], [0, 0], [1, 1], False), kwargs = {})\ntriton_poi_fused_max_pool2d_with_indices_0 = async_compile.triton('triton_', '''\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=[2097152], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_pool2d_with_indices_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 1376256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), None)\n tl.store(out_ptr0 + (x0), tmp0, None)\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, (32, 3, 64, 224), (43008, 14336, 224, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 3, 64, 224), (43008, 14336, 224, 1), torch.float32)\n # Topologically Sorted Source Nodes: [max_pool2d], Original ATen: [aten.max_pool2d_with_indices]\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_pool2d_with_indices_0.run(arg0_1, buf0, 1376256, grid=grid(1376256), stream=stream0)\n del arg0_1\n return (reinterpret_tensor(buf0, (32, 3, 14336), (43008, 14336, 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 arg0_1 = rand_strided((32, 3, 64, 224), (43008, 14336, 224, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_max_pool2d_with_indices_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 1376256\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x0 = xindex\n tmp0 = tl.load(in_ptr0 + (x0), None)\n tl.store(out_ptr0 + (x0), tmp0, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (32, 3, 64, 224), (43008, 14336, 224, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 3, 64, 224), (43008, 14336, 224, 1), torch.float32)\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_pool2d_with_indices_0[grid(1376256)](arg0_1, buf0, 1376256, XBLOCK=1024)\n del arg0_1\n return (reinterpret_tensor(buf0, (32, 3, 14336), (43008, 14336, 1), 0), )\n\nclass MultiLevelPooling(nn.Module):\n\n def __init__(self, levels=[1, 2, 4]):\n super(MultiLevelPooling, self).__init__()\n self.Pools = nn.ModuleList([nn.MaxPool2d(i) for i in levels])\n\n def forward(self, x):\n assert len(x.size()) == 4, '\u8f93\u5165\u5f62\u72b6\u4e0d\u6ee1\u8db3(n,c,w,w)'\n n = x.size(0)\n c = x.size(1)\n features = []\n for pool in self.Pools:\n features.append(pool(x))\n return features[0].view(n, c, -1)"} +{"python_code": "import torch\nimport torch.nn as nn\n\n\nclass Linear_leaky_relu(nn.Module):\n\n def __init__(self, dim_in, dim_out, bias=True):\n super().__init__()\n self.linear = nn.Linear(dim_in, dim_out, bias=bias)\n self.activation = nn.LeakyReLU()\n\n def forward(self, x):\n out = self.linear(x)\n out = self.activation(out)\n return out\n\n\n\nbatch_size = 16\nchannels = 16\ndepth = 16\nheight = 16\nwidth = 32\n\ndef get_inputs():\n a = torch.rand(batch_size, channels, depth, height, width)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {'dim_in': 32, 'dim_out': 4}]", "original_triton_code": "# AOT ID: ['103_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: /tmp/triton_gen_nscouca8/64/c64oyynwwxoo3hrdzfzj4miban7phbs6sbwkiydlbt7csuwkfv57.py\n# Topologically Sorted Source Nodes: [out_1], Original ATen: [aten.leaky_relu]\n# Source node to ATen node mapping:\n# out_1 => gt, mul, where\n# Graph fragment:\n# %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%view_1, 0), kwargs = {})\n# %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_1, 0.01), kwargs = {})\n# %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %view_1, %mul), kwargs = {})\ntriton_poi_fused_leaky_relu_0 = async_compile.triton('triton_', '''\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=[262144], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_leaky_relu_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 262144\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + (x2), None)\n tmp1 = tl.load(in_ptr0 + (x0), None, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 0.0\n tmp4 = tmp2 > tmp3\n tmp5 = 0.01\n tmp6 = tmp2 * tmp5\n tmp7 = tl.where(tmp4, tmp2, tmp6)\n tl.store(in_out_ptr0 + (x2), tmp7, None)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (4, 32), (32, 1))\n assert_size_stride(arg1_1, (4, ), (1, ))\n assert_size_stride(arg2_1, (16, 16, 16, 16, 32), (131072, 8192, 512, 32, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((65536, 4), (4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [], Original ATen: []\n extern_kernels.mm(reinterpret_tensor(arg2_1, (65536, 32), (32, 1), 0), reinterpret_tensor(arg0_1, (32, 4), (1, 32), 0), out=buf0)\n del arg0_1\n del arg2_1\n buf1 = reinterpret_tensor(buf0, (16, 16, 16, 16, 4), (16384, 1024, 64, 4, 1), 0); del buf0 # reuse\n # Topologically Sorted Source Nodes: [out_1], Original ATen: [aten.leaky_relu]\n stream0 = get_raw_stream(0)\n triton_poi_fused_leaky_relu_0.run(buf1, arg1_1, 262144, grid=grid(262144), stream=stream0)\n del arg1_1\n return (buf1, )\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, 32), (32, 1), device='cuda:0', dtype=torch.float32)\n arg1_1 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n arg2_1 = rand_strided((16, 16, 16, 16, 32), (131072, 8192, 512, 32, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1, arg1_1, arg2_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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_leaky_relu_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 262144\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + (x2), None)\n tmp1 = tl.load(in_ptr0 + (x0), None, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = 0.0\n tmp4 = tmp2 > tmp3\n tmp5 = 0.01\n tmp6 = tmp2 * tmp5\n tmp7 = tl.where(tmp4, tmp2, tmp6)\n tl.store(in_out_ptr0 + (x2), tmp7, None)\n\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (4, 32), (32, 1))\n assert_size_stride(arg1_1, (4, ), (1, ))\n assert_size_stride(arg2_1, (16, 16, 16, 16, 32), (131072, 8192, 512, 32, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((65536, 4), (4, 1), torch.float32)\n extern_kernels.mm(reinterpret_tensor(arg2_1, (65536, 32), (32, 1), 0), reinterpret_tensor(arg0_1, (32, 4), (1, 32), 0), out=buf0)\n del arg0_1\n del arg2_1\n buf1 = reinterpret_tensor(buf0, (16, 16, 16, 16, 4), (16384, 1024, 64, 4, 1), 0); del buf0 # reuse\n stream0 = get_raw_stream(0)\n triton_poi_fused_leaky_relu_0[grid(262144)](buf1, arg1_1, 262144, XBLOCK=1024)\n del arg1_1\n return (buf1, )\n\nclass Linear_leaky_relu(nn.Module):\n\n def __init__(self, dim_in, dim_out, bias=True):\n super().__init__()\n self.linear = nn.Linear(dim_in, dim_out, bias=bias)\n self.activation = nn.LeakyReLU()\n\n def forward(self, x):\n out = self.linear(x)\n out = self.activation(out)\n return out"} +{"python_code": "import torch\nimport torch.nn as nn\n\n\nclass Linear_sigmoid(nn.Module):\n\n def __init__(self, dim_in, dim_out, bias=True):\n super().__init__()\n self.linear = nn.Linear(dim_in, dim_out, bias=bias)\n self.activation = nn.Sigmoid()\n\n def forward(self, x):\n out = self.linear(x)\n out = self.activation(out)\n return out\n\n\n\nbatch_size = 16\nchannels = 64\nheight = 32\nwidth = 224\n\ndef get_inputs():\n a = torch.rand(batch_size, channels, height, width)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {'dim_in': 224, 'dim_out': 4}]", "original_triton_code": "# AOT ID: ['106_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: /tmp/triton_gen_ene3tz6k/65/c65p3yzml4ui3ycsbwqqybc6cm7fyx45f6zo2j4dbvpohi4cjrqx.py\n# Topologically Sorted Source Nodes: [out_1], Original ATen: [aten.sigmoid]\n# Source node to ATen node mapping:\n# out_1 => sigmoid\n# Graph fragment:\n# %sigmoid : [num_users=1] = call_function[target=torch.ops.aten.sigmoid.default](args = (%view_1,), kwargs = {})\ntriton_poi_fused_sigmoid_0 = async_compile.triton('triton_', '''\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=[131072], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_sigmoid_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 131072\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + (x2), None)\n tmp1 = tl.load(in_ptr0 + (x0), None, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = tl.sigmoid(tmp2)\n tl.store(in_out_ptr0 + (x2), tmp3, None)\n''', device_str='cuda')\n\n\nasync_compile.wait(globals())\ndel async_compile\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (4, 224), (224, 1))\n assert_size_stride(arg1_1, (4, ), (1, ))\n assert_size_stride(arg2_1, (16, 64, 32, 224), (458752, 7168, 224, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32768, 4), (4, 1), torch.float32)\n # Topologically Sorted Source Nodes: [], Original ATen: []\n extern_kernels.mm(reinterpret_tensor(arg2_1, (32768, 224), (224, 1), 0), reinterpret_tensor(arg0_1, (224, 4), (1, 224), 0), out=buf0)\n del arg0_1\n del arg2_1\n buf1 = reinterpret_tensor(buf0, (16, 64, 32, 4), (8192, 128, 4, 1), 0); del buf0 # reuse\n # Topologically Sorted Source Nodes: [out_1], Original ATen: [aten.sigmoid]\n stream0 = get_raw_stream(0)\n triton_poi_fused_sigmoid_0.run(buf1, arg1_1, 131072, grid=grid(131072), stream=stream0)\n del arg1_1\n return (buf1, )\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, 224), (224, 1), device='cuda:0', dtype=torch.float32)\n arg1_1 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)\n arg2_1 = rand_strided((16, 64, 32, 224), (458752, 7168, 224, 1), device='cuda:0', dtype=torch.float32)\n fn = lambda: call([arg0_1, arg1_1, arg2_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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_sigmoid_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 131072\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x2 = xindex\n x0 = xindex % 4\n tmp0 = tl.load(in_out_ptr0 + (x2), None)\n tmp1 = tl.load(in_ptr0 + (x0), None, eviction_policy='evict_last')\n tmp2 = tmp0 + tmp1\n tmp3 = tl.sigmoid(tmp2)\n tl.store(in_out_ptr0 + (x2), tmp3, None)\n\n\ndef call(args):\n arg0_1, arg1_1, arg2_1 = args\n args.clear()\n assert_size_stride(arg0_1, (4, 224), (224, 1))\n assert_size_stride(arg1_1, (4, ), (1, ))\n assert_size_stride(arg2_1, (16, 64, 32, 224), (458752, 7168, 224, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32768, 4), (4, 1), torch.float32)\n extern_kernels.mm(reinterpret_tensor(arg2_1, (32768, 224), (224, 1), 0), reinterpret_tensor(arg0_1, (224, 4), (1, 224), 0), out=buf0)\n del arg0_1\n del arg2_1\n buf1 = reinterpret_tensor(buf0, (16, 64, 32, 4), (8192, 128, 4, 1), 0); del buf0 # reuse\n stream0 = get_raw_stream(0)\n triton_poi_fused_sigmoid_0[grid(131072)](buf1, arg1_1, 131072, XBLOCK=1024)\n del arg1_1\n return (buf1, )\n\nclass Linear_sigmoid(nn.Module):\n\n def __init__(self, dim_in, dim_out, bias=True):\n super().__init__()\n self.linear = nn.Linear(dim_in, dim_out, bias=bias)\n self.activation = nn.Sigmoid()\n\n def forward(self, x):\n out = self.linear(x)\n out = self.activation(out)\n return out"} +{"python_code": "import math\nimport torch\nfrom torch import nn\nimport torch.nn.functional as F\n\n\nclass MaxPool2dDynamicSamePadding(nn.MaxPool2d):\n \"\"\"2D MaxPooling like TensorFlow's 'SAME' mode, with a dynamic image size.\n The padding is operated in forward function by calculating dynamically.\n \"\"\"\n\n def __init__(self, kernel_size, stride, padding=0, dilation=1,\n return_indices=False, ceil_mode=False):\n super().__init__(kernel_size, stride, padding, dilation,\n return_indices, ceil_mode)\n self.stride = [self.stride] * 2 if isinstance(self.stride, int\n ) else self.stride\n self.kernel_size = [self.kernel_size] * 2 if isinstance(self.\n kernel_size, int) else self.kernel_size\n self.dilation = [self.dilation] * 2 if isinstance(self.dilation, int\n ) else self.dilation\n\n def forward(self, x):\n ih, iw = x.size()[-2:]\n kh, kw = self.kernel_size\n sh, sw = self.stride\n oh, ow = math.ceil(ih / sh), math.ceil(iw / sw)\n pad_h = max((oh - 1) * self.stride[0] + (kh - 1) * self.dilation[0] +\n 1 - ih, 0)\n pad_w = max((ow - 1) * self.stride[1] + (kw - 1) * self.dilation[1] +\n 1 - iw, 0)\n if pad_h > 0 or pad_w > 0:\n x = F.pad(x, [pad_w // 2, pad_w - pad_w // 2, pad_h // 2, pad_h -\n pad_h // 2])\n return F.max_pool2d(x, self.kernel_size, self.stride, self.padding,\n self.dilation, self.ceil_mode, self.return_indices)\n\n\n\nbatch_size = 32\nchannels = 16\nheight = 128\nwidth = 16\n\ndef get_inputs():\n a = torch.rand(batch_size, channels, height, width)\n return [a]\n\n\ndef get_init_inputs():\n return [[], {'kernel_size': 4, 'stride': 1}]", "original_triton_code": "# AOT ID: ['111_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: /tmp/triton_gen_2d_soaf1/xd/cxdqj6tarww7awlygbxeglfufduxm6n5mnyncnhr7fmf2xgyzn62.py\n# Topologically Sorted Source Nodes: [max_pool2d], Original ATen: [aten.max_pool2d_with_indices]\n# Source node to ATen node mapping:\n# max_pool2d => getitem\n# Graph fragment:\n# %getitem : [num_users=1] = call_function[target=operator.getitem](args = (%_low_memory_max_pool2d_with_offsets, 0), kwargs = {})\ntriton_poi_fused_max_pool2d_with_indices_0 = async_compile.triton('triton_', '''\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=[1048576], \n filename=__file__,\n triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},\n inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_pool2d_with_indices_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 16, 'num_reduction': 0, 'backend_hash': 'ACB470BEFDE58A90F00079B5434325E87B6B4313CA4901D1EAFBC23641D24150', '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_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 1048576\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x1 = (xindex // 16) % 128\n x0 = xindex % 16\n x4 = xindex\n tmp0 = (-1) + x1\n tmp1 = tl.full([1], 0, tl.int64)\n tmp2 = tmp0 >= tmp1\n tmp3 = tl.full([1], 128, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = (-1) + x0\n tmp6 = tmp5 >= tmp1\n tmp7 = tl.full([1], 16, tl.int64)\n tmp8 = tmp5 < tmp7\n tmp9 = tmp2 & tmp4\n tmp10 = tmp9 & tmp6\n tmp11 = tmp10 & tmp8\n tmp12 = tl.load(in_ptr0 + ((-17) + x4), tmp11, other=0.0)\n tmp13 = x0\n tmp14 = tmp13 >= tmp1\n tmp15 = tmp13 < tmp7\n tmp16 = tmp9 & tmp14\n tmp17 = tmp16 & tmp15\n tmp18 = tl.load(in_ptr0 + ((-16) + x4), tmp17, other=0.0)\n tmp19 = triton_helpers.maximum(tmp18, tmp12)\n tmp20 = 1 + x0\n tmp21 = tmp20 >= tmp1\n tmp22 = tmp20 < tmp7\n tmp23 = tmp9 & tmp21\n tmp24 = tmp23 & tmp22\n tmp25 = tl.load(in_ptr0 + ((-15) + x4), tmp24, other=0.0)\n tmp26 = triton_helpers.maximum(tmp25, tmp19)\n tmp27 = 2 + x0\n tmp28 = tmp27 >= tmp1\n tmp29 = tmp27 < tmp7\n tmp30 = tmp9 & tmp28\n tmp31 = tmp30 & tmp29\n tmp32 = tl.load(in_ptr0 + ((-14) + x4), tmp31, other=0.0)\n tmp33 = triton_helpers.maximum(tmp32, tmp26)\n tmp34 = x1\n tmp35 = tmp34 >= tmp1\n tmp36 = tmp34 < tmp3\n tmp37 = tmp35 & tmp36\n tmp38 = tmp37 & tmp6\n tmp39 = tmp38 & tmp8\n tmp40 = tl.load(in_ptr0 + ((-1) + x4), tmp39, other=0.0)\n tmp41 = triton_helpers.maximum(tmp40, tmp33)\n tmp42 = tmp37 & tmp14\n tmp43 = tmp42 & tmp15\n tmp44 = tl.load(in_ptr0 + (x4), tmp43, other=0.0)\n tmp45 = triton_helpers.maximum(tmp44, tmp41)\n tmp46 = tmp37 & tmp21\n tmp47 = tmp46 & tmp22\n tmp48 = tl.load(in_ptr0 + (1 + x4), tmp47, other=0.0)\n tmp49 = triton_helpers.maximum(tmp48, tmp45)\n tmp50 = tmp37 & tmp28\n tmp51 = tmp50 & tmp29\n tmp52 = tl.load(in_ptr0 + (2 + x4), tmp51, other=0.0)\n tmp53 = triton_helpers.maximum(tmp52, tmp49)\n tmp54 = 1 + x1\n tmp55 = tmp54 >= tmp1\n tmp56 = tmp54 < tmp3\n tmp57 = tmp55 & tmp56\n tmp58 = tmp57 & tmp6\n tmp59 = tmp58 & tmp8\n tmp60 = tl.load(in_ptr0 + (15 + x4), tmp59, other=0.0)\n tmp61 = triton_helpers.maximum(tmp60, tmp53)\n tmp62 = tmp57 & tmp14\n tmp63 = tmp62 & tmp15\n tmp64 = tl.load(in_ptr0 + (16 + x4), tmp63, other=0.0)\n tmp65 = triton_helpers.maximum(tmp64, tmp61)\n tmp66 = tmp57 & tmp21\n tmp67 = tmp66 & tmp22\n tmp68 = tl.load(in_ptr0 + (17 + x4), tmp67, other=0.0)\n tmp69 = triton_helpers.maximum(tmp68, tmp65)\n tmp70 = tmp57 & tmp28\n tmp71 = tmp70 & tmp29\n tmp72 = tl.load(in_ptr0 + (18 + x4), tmp71, other=0.0)\n tmp73 = triton_helpers.maximum(tmp72, tmp69)\n tmp74 = 2 + x1\n tmp75 = tmp74 >= tmp1\n tmp76 = tmp74 < tmp3\n tmp77 = tmp75 & tmp76\n tmp78 = tmp77 & tmp6\n tmp79 = tmp78 & tmp8\n tmp80 = tl.load(in_ptr0 + (31 + x4), tmp79, other=0.0)\n tmp81 = triton_helpers.maximum(tmp80, tmp73)\n tmp82 = tmp77 & tmp14\n tmp83 = tmp82 & tmp15\n tmp84 = tl.load(in_ptr0 + (32 + x4), tmp83, other=0.0)\n tmp85 = triton_helpers.maximum(tmp84, tmp81)\n tmp86 = tmp77 & tmp21\n tmp87 = tmp86 & tmp22\n tmp88 = tl.load(in_ptr0 + (33 + x4), tmp87, other=0.0)\n tmp89 = triton_helpers.maximum(tmp88, tmp85)\n tmp90 = tmp77 & tmp28\n tmp91 = tmp90 & tmp29\n tmp92 = tl.load(in_ptr0 + (34 + x4), tmp91, other=0.0)\n tmp93 = triton_helpers.maximum(tmp92, tmp89)\n tl.store(out_ptr0 + (x4), tmp93, None)\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, (32, 16, 128, 16), (32768, 2048, 16, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 16, 128, 16), (32768, 2048, 16, 1), torch.float32)\n # Topologically Sorted Source Nodes: [max_pool2d], Original ATen: [aten.max_pool2d_with_indices]\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_pool2d_with_indices_0.run(arg0_1, buf0, 1048576, grid=grid(1048576), 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((32, 16, 128, 16), (32768, 2048, 16, 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", "triton_code": "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\nfrom torch._inductor.runtime import triton_helpers\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@triton.jit\ndef triton_poi_fused_max_pool2d_with_indices_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):\n xnumel = 1048576\n xoffset = tl.program_id(0) * XBLOCK\n xindex = xoffset + tl.arange(0, XBLOCK)[:]\n xmask = tl.full([XBLOCK], True, tl.int1)\n x1 = (xindex // 16) % 128\n x0 = xindex % 16\n x4 = xindex\n tmp0 = (-1) + x1\n tmp1 = tl.full([1], 0, tl.int64)\n tmp2 = tmp0 >= tmp1\n tmp3 = tl.full([1], 128, tl.int64)\n tmp4 = tmp0 < tmp3\n tmp5 = (-1) + x0\n tmp6 = tmp5 >= tmp1\n tmp7 = tl.full([1], 16, tl.int64)\n tmp8 = tmp5 < tmp7\n tmp9 = tmp2 & tmp4\n tmp10 = tmp9 & tmp6\n tmp11 = tmp10 & tmp8\n tmp12 = tl.load(in_ptr0 + ((-17) + x4), tmp11, other=0.0)\n tmp13 = x0\n tmp14 = tmp13 >= tmp1\n tmp15 = tmp13 < tmp7\n tmp16 = tmp9 & tmp14\n tmp17 = tmp16 & tmp15\n tmp18 = tl.load(in_ptr0 + ((-16) + x4), tmp17, other=0.0)\n tmp19 = triton_helpers.maximum(tmp18, tmp12)\n tmp20 = 1 + x0\n tmp21 = tmp20 >= tmp1\n tmp22 = tmp20 < tmp7\n tmp23 = tmp9 & tmp21\n tmp24 = tmp23 & tmp22\n tmp25 = tl.load(in_ptr0 + ((-15) + x4), tmp24, other=0.0)\n tmp26 = triton_helpers.maximum(tmp25, tmp19)\n tmp27 = 2 + x0\n tmp28 = tmp27 >= tmp1\n tmp29 = tmp27 < tmp7\n tmp30 = tmp9 & tmp28\n tmp31 = tmp30 & tmp29\n tmp32 = tl.load(in_ptr0 + ((-14) + x4), tmp31, other=0.0)\n tmp33 = triton_helpers.maximum(tmp32, tmp26)\n tmp34 = x1\n tmp35 = tmp34 >= tmp1\n tmp36 = tmp34 < tmp3\n tmp37 = tmp35 & tmp36\n tmp38 = tmp37 & tmp6\n tmp39 = tmp38 & tmp8\n tmp40 = tl.load(in_ptr0 + ((-1) + x4), tmp39, other=0.0)\n tmp41 = triton_helpers.maximum(tmp40, tmp33)\n tmp42 = tmp37 & tmp14\n tmp43 = tmp42 & tmp15\n tmp44 = tl.load(in_ptr0 + (x4), tmp43, other=0.0)\n tmp45 = triton_helpers.maximum(tmp44, tmp41)\n tmp46 = tmp37 & tmp21\n tmp47 = tmp46 & tmp22\n tmp48 = tl.load(in_ptr0 + (1 + x4), tmp47, other=0.0)\n tmp49 = triton_helpers.maximum(tmp48, tmp45)\n tmp50 = tmp37 & tmp28\n tmp51 = tmp50 & tmp29\n tmp52 = tl.load(in_ptr0 + (2 + x4), tmp51, other=0.0)\n tmp53 = triton_helpers.maximum(tmp52, tmp49)\n tmp54 = 1 + x1\n tmp55 = tmp54 >= tmp1\n tmp56 = tmp54 < tmp3\n tmp57 = tmp55 & tmp56\n tmp58 = tmp57 & tmp6\n tmp59 = tmp58 & tmp8\n tmp60 = tl.load(in_ptr0 + (15 + x4), tmp59, other=0.0)\n tmp61 = triton_helpers.maximum(tmp60, tmp53)\n tmp62 = tmp57 & tmp14\n tmp63 = tmp62 & tmp15\n tmp64 = tl.load(in_ptr0 + (16 + x4), tmp63, other=0.0)\n tmp65 = triton_helpers.maximum(tmp64, tmp61)\n tmp66 = tmp57 & tmp21\n tmp67 = tmp66 & tmp22\n tmp68 = tl.load(in_ptr0 + (17 + x4), tmp67, other=0.0)\n tmp69 = triton_helpers.maximum(tmp68, tmp65)\n tmp70 = tmp57 & tmp28\n tmp71 = tmp70 & tmp29\n tmp72 = tl.load(in_ptr0 + (18 + x4), tmp71, other=0.0)\n tmp73 = triton_helpers.maximum(tmp72, tmp69)\n tmp74 = 2 + x1\n tmp75 = tmp74 >= tmp1\n tmp76 = tmp74 < tmp3\n tmp77 = tmp75 & tmp76\n tmp78 = tmp77 & tmp6\n tmp79 = tmp78 & tmp8\n tmp80 = tl.load(in_ptr0 + (31 + x4), tmp79, other=0.0)\n tmp81 = triton_helpers.maximum(tmp80, tmp73)\n tmp82 = tmp77 & tmp14\n tmp83 = tmp82 & tmp15\n tmp84 = tl.load(in_ptr0 + (32 + x4), tmp83, other=0.0)\n tmp85 = triton_helpers.maximum(tmp84, tmp81)\n tmp86 = tmp77 & tmp21\n tmp87 = tmp86 & tmp22\n tmp88 = tl.load(in_ptr0 + (33 + x4), tmp87, other=0.0)\n tmp89 = triton_helpers.maximum(tmp88, tmp85)\n tmp90 = tmp77 & tmp28\n tmp91 = tmp90 & tmp29\n tmp92 = tl.load(in_ptr0 + (34 + x4), tmp91, other=0.0)\n tmp93 = triton_helpers.maximum(tmp92, tmp89)\n tl.store(out_ptr0 + (x4), tmp93, None)\n\n\ndef call(args):\n arg0_1, = args\n args.clear()\n assert_size_stride(arg0_1, (32, 16, 128, 16), (32768, 2048, 16, 1))\n with torch.cuda._DeviceGuard(0):\n torch.cuda.set_device(0)\n buf0 = empty_strided_cuda((32, 16, 128, 16), (32768, 2048, 16, 1), torch.float32)\n stream0 = get_raw_stream(0)\n triton_poi_fused_max_pool2d_with_indices_0[grid(1048576)](arg0_1, buf0, 1048576, XBLOCK=1024)\n del arg0_1\n return (buf0, )"}