# AOT ID: ['31_inference'] from ctypes import c_void_p, c_long import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _align as align from torch import device, empty_strided from torch._inductor.async_compile import AsyncCompile from torch._inductor.select_algorithm import extern_kernels from torch._inductor.codegen.multi_kernel import MultiKernelCall aten = torch.ops.aten inductor_ops = torch.ops.inductor _quantized = torch.ops._quantized assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda alloc_from_pool = torch.ops.inductor._alloc_from_pool reinterpret_tensor = torch.ops.inductor._reinterpret_tensor async_compile = AsyncCompile() # kernel path: /tmp/torchinductor_root/5i/c5iiyuz6yimhxo3jsepvzvjf3kmwyitpdney3pptjpisurro3nvo.py # Source Nodes: [_tgt, add, linear, tgt], Original ATen: [aten._to_copy, aten.add, aten.native_layer_norm] # _tgt => add_2, add_3, mul, mul_1, rsqrt, sub, var_mean # add => add # linear => convert_element_type_2 # tgt => add_1 triton_per_fused__to_copy_add_native_layer_norm_0 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.persistent_reduction( size_hints=[8192, 256], reduction_hint=ReductionHint.INNER, filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: '*fp16', 3: '*fp32', 4: '*fp32', 5: '*fp16', 6: 'i32', 7: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 7), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused__to_copy_add_native_layer_norm_0', 'mutated_arg_names': [], 'no_x_dim': True, 'num_load': 5, 'num_reduction': 4, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, '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} ) @triton.jit def triton_(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, out_ptr2, xnumel, rnumel): XBLOCK: tl.constexpr = 1 rnumel = 256 RBLOCK: tl.constexpr = 256 xoffset = tl.program_id(0) * XBLOCK xindex = tl.full([1], xoffset, tl.int32) xmask = xindex < xnumel rindex = tl.arange(0, RBLOCK)[:] roffset = 0 rmask = rindex < rnumel r1 = rindex x0 = xindex tmp0 = tl.load(in_ptr0 + (r1 + (256*x0)), rmask & xmask, other=0.0) tmp1 = tl.load(in_ptr1 + (r1 + (256*x0)), rmask & xmask, other=0.0).to(tl.float32) tmp2 = tl.load(in_ptr2 + (r1 + (256*x0)), rmask & xmask, other=0.0).to(tl.float32) tmp29 = tl.load(in_ptr3 + (r1), rmask, eviction_policy='evict_last', other=0.0) tmp31 = tl.load(in_ptr4 + (r1), rmask, eviction_policy='evict_last', other=0.0) tmp3 = tmp1 + tmp2 tmp4 = tmp3.to(tl.float32) tmp5 = tmp0 + tmp4 tmp6 = tl.broadcast_to(tmp5, [RBLOCK]) tmp8 = tl.where(rmask & xmask, tmp6, 0) tmp9 = tl.broadcast_to(tmp6, [RBLOCK]) tmp11 = tl.where(rmask & xmask, tmp9, 0) tmp12 = triton_helpers.promote_to_tensor(tl.sum(tmp11, 0)) tmp13 = tl.full([1], 256, tl.int32) tmp14 = tmp13.to(tl.float32) tmp15 = tmp12 / tmp14 tmp16 = tmp6 - tmp15 tmp17 = tmp16 * tmp16 tmp18 = tl.broadcast_to(tmp17, [RBLOCK]) tmp20 = tl.where(rmask & xmask, tmp18, 0) tmp21 = triton_helpers.promote_to_tensor(tl.sum(tmp20, 0)) tmp22 = tmp5 - tmp15 tmp23 = 256.0 tmp24 = tmp21 / tmp23 tmp25 = 1e-05 tmp26 = tmp24 + tmp25 tmp27 = libdevice.rsqrt(tmp26) tmp28 = tmp22 * tmp27 tmp30 = tmp28 * tmp29 tmp32 = tmp30 + tmp31 tmp33 = tmp32.to(tl.float32) tl.store(out_ptr2 + (r1 + (256*x0)), tmp33, rmask & xmask) ''', device_str='cuda') import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, start_graph, end_graph from torch._C import _cuda_getCurrentRawStream as get_raw_stream # kernel path: /tmp/torchinductor_root/as/caslnaz5ovc2w4ytfnlr2jibrkfgmcp4e7e42dxcuygano3oelsl.py # Source Nodes: [linear], Original ATen: [aten._to_copy] # linear => convert_element_type_1 triton_poi_fused__to_copy_1 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[262144], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 262144 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex tmp0 = tl.load(in_ptr0 + (x0), None) tmp1 = tmp0.to(tl.float32) tl.store(out_ptr0 + (x0), tmp1, None) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/u5/cu5mqd37qiakh7ggv4hzgacxushskn45zxzaqsbu6gldtmqfkl4o.py # Source Nodes: [linear], Original ATen: [aten._to_copy] # linear => convert_element_type triton_poi_fused__to_copy_2 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[1024], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 1024 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex tmp0 = tl.load(in_ptr0 + (x0), xmask) tmp1 = tmp0.to(tl.float32) tl.store(out_ptr0 + (x0), tmp1, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/5r/c5rqir3b4ummvp3dbax5kpsr4hulfxafycpod4dkheor3erpp5e6.py # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] # x_1 => var_mean_1 triton_red_fused_native_group_norm_3 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.reduction( size_hints=[32768, 256], reduction_hint=ReductionHint.INNER, filename=__file__, triton_meta={'signature': {0: '*fp16', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32', 5: 'i32', 6: 'i32', 7: 'i32', 8: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 7), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_red_fused_native_group_norm_3', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 3, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, '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} ) @triton.jit def triton_(in_ptr0, out_ptr0, out_ptr1, out_ptr2, ks0, ks1, ks2, xnumel, rnumel, XBLOCK : tl.constexpr, RBLOCK : tl.constexpr): xnumel = 29088 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:, None] xmask = xindex < xnumel rbase = tl.arange(0, RBLOCK)[None, :] x1 = (xindex // 32) % 101 x2 = (xindex // 3232) x0 = xindex % 32 tmp26_mean = tl.zeros([XBLOCK, RBLOCK], tl.float32) tmp26_m2 = tl.zeros([XBLOCK, RBLOCK], tl.float32) tmp26_weight = tl.zeros([XBLOCK, RBLOCK], tl.float32) x4 = xindex for roffset in range(0, rnumel, RBLOCK): rindex = roffset + rbase rmask = rindex < rnumel r3 = rindex tmp0 = r3 + (x1*((100 + ((8 + (32*ks1*(ks0 // ks1))) // 9)) // 101)) tmp1 = ((8 + (32*ks1*(ks0 // ks1))) // 9) tmp2 = tmp0 < tmp1 tmp3 = r3 + (x1*((100 + ((8 + (32*ks1*(ks0 // ks1))) // 9)) // 101)) + (x2*((8 + (32*ks1*(ks0 // ks1))) // 9)) tmp4 = tl.broadcast_to(32*ks1*(ks0 // ks1), [XBLOCK, RBLOCK]) tmp5 = tmp3 < tmp4 tmp6 = tmp5 & tmp2 tmp7 = tl.load(in_ptr0 + ((32*x0) + (1024*(((r3 + (x1*((100 + ((8 + (32*ks1*(ks0 // ks1))) // 9)) // 101)) + (x2*((8 + (32*ks1*(ks0 // ks1))) // 9))) % (ks1*(ks0 // ks1))) % (ks1*ks2))) + (((r3 + (x1*((100 + ((8 + (32*ks1*(ks0 // ks1))) // 9)) // 101)) + (x2*((8 + (32*ks1*(ks0 // ks1))) // 9))) // (ks1*(ks0 // ks1))) % 32)), rmask & tmp6 & xmask, eviction_policy='evict_last', other=0.0).to(tl.float32) tmp8 = tmp7.to(tl.float32) tmp9 = tl.full(tmp8.shape, 0, tmp8.dtype) tmp10 = tl.where(tmp6, tmp8, tmp9) tmp11 = tl.full(tmp10.shape, 0, tmp10.dtype) tmp12 = tl.where(tmp2, tmp10, tmp11) tmp13 = 0.0 tmp14 = tl.full(tmp13.shape, 0, tmp13.dtype) tmp15 = tl.where(tmp6, tmp13, tmp14) tmp16 = tl.full(tmp15.shape, 0, tmp15.dtype) tmp17 = tl.where(tmp2, tmp15, tmp16) tmp18 = 1.0 tmp19 = tl.full(tmp18.shape, 0, tmp18.dtype) tmp20 = tl.where(tmp6, tmp18, tmp19) tmp21 = tl.full(tmp20.shape, 0, tmp20.dtype) tmp22 = tl.where(tmp2, tmp20, tmp21) tmp23 = tl.broadcast_to(tmp12, [XBLOCK, RBLOCK]) tmp24 = tl.broadcast_to(tmp17, [XBLOCK, RBLOCK]) tmp25 = tl.broadcast_to(tmp22, [XBLOCK, RBLOCK]) tmp26_mean_next, tmp26_m2_next, tmp26_weight_next = triton_helpers.welford_combine( tmp26_mean, tmp26_m2, tmp26_weight, tmp23, tmp24, tmp25 ) tmp26_mean = tl.where(rmask & xmask, tmp26_mean_next, tmp26_mean) tmp26_m2 = tl.where(rmask & xmask, tmp26_m2_next, tmp26_m2) tmp26_weight = tl.where(rmask & xmask, tmp26_weight_next, tmp26_weight) tmp26_tmp, tmp27_tmp, tmp28_tmp = triton_helpers.welford( tmp26_mean, tmp26_m2, tmp26_weight, 1 ) tmp26 = tmp26_tmp[:, None] tmp27 = tmp27_tmp[:, None] tmp28 = tmp28_tmp[:, None] tl.store(out_ptr0 + (x4), tmp26, xmask) tl.store(out_ptr1 + (x4), tmp27, xmask) tl.store(out_ptr2 + (x4), tmp28, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/ks/cksxkhgnvmc6ccwqfioq3t2x63adqm3fhur47kdsxwoby3o4lzkm.py # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] # x_1 => var_mean_1 triton_per_fused_native_group_norm_4 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.persistent_reduction( size_hints=[512, 128], reduction_hint=ReductionHint.INNER, filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: 'i32', 7: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 6), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_native_group_norm_4', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 3, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, '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} ) @triton.jit def triton_(in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1, out_ptr2, xnumel, rnumel, XBLOCK : tl.constexpr): xnumel = 288 rnumel = 101 RBLOCK: tl.constexpr = 128 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:, None] xmask = xindex < xnumel rindex = tl.arange(0, RBLOCK)[None, :] roffset = 0 rmask = rindex < rnumel r2 = rindex x0 = xindex % 32 x1 = (xindex // 32) x3 = xindex tmp0 = tl.load(in_ptr0 + (x0 + (32*r2) + (3232*x1)), rmask & xmask, other=0.0) tmp1 = tl.load(in_ptr1 + (x0 + (32*r2) + (3232*x1)), rmask & xmask, other=0.0) tmp2 = tl.load(in_ptr2 + (x0 + (32*r2) + (3232*x1)), rmask & xmask, other=0.0) tmp3 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK]) tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK]) tmp5 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK]) tmp7 = tl.where(rmask & xmask, tmp3, 0) tmp8 = tl.where(rmask & xmask, tmp4, 0) tmp9 = tl.where(rmask & xmask, tmp5, 0) tmp10, tmp11, tmp12 = triton_helpers.welford(tmp7, tmp8, tmp9, 1) tmp13 = tmp10[:, None] tmp14 = tmp11[:, None] tmp15 = tmp12[:, None] tl.store(out_ptr0 + (x3), tmp13, xmask) tl.store(out_ptr1 + (x3), tmp14, xmask) tl.store(out_ptr2 + (x3), tmp15, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/ww/cwwibayh32mzv6evkfclh2nkvq4lvkbltjy5isuqogmaqhq62oxb.py # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] # x_1 => var_mean_1 triton_per_fused_native_group_norm_5 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.persistent_reduction( size_hints=[32, 16], reduction_hint=ReductionHint.INNER, filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: 'i32', 6: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_native_group_norm_5', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 2, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, '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} ) @triton.jit def triton_(in_ptr0, in_ptr1, in_ptr2, out_ptr0, out_ptr1, xnumel, rnumel, XBLOCK : tl.constexpr): xnumel = 32 rnumel = 9 RBLOCK: tl.constexpr = 16 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:, None] xmask = xindex < xnumel rindex = tl.arange(0, RBLOCK)[None, :] roffset = 0 rmask = rindex < rnumel r1 = rindex x0 = xindex tmp0 = tl.load(in_ptr0 + (x0 + (32*r1)), rmask & xmask, other=0.0) tmp1 = tl.load(in_ptr1 + (x0 + (32*r1)), rmask & xmask, other=0.0) tmp2 = tl.load(in_ptr2 + (x0 + (32*r1)), rmask & xmask, other=0.0) tmp3 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK]) tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK]) tmp5 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK]) tmp7 = tl.where(rmask & xmask, tmp3, 0) tmp8 = tl.where(rmask & xmask, tmp4, 0) tmp9 = tl.where(rmask & xmask, tmp5, 0) tmp10, tmp11, tmp12 = triton_helpers.welford(tmp7, tmp8, tmp9, 1) tmp13 = tmp10[:, None] tmp14 = tmp11[:, None] tmp15 = tmp12[:, None] tl.store(out_ptr0 + (x0), tmp13, xmask) tl.store(out_ptr1 + (x0), tmp14, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/lc/clcelukvshbghkivgbfkrtkllhfbqsximpu4gxwvqarqeqogapek.py # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] # x_1 => add_5, mul_4 triton_poi_fused_native_group_norm_6 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[8388608], filename=__file__, triton_meta={'signature': {0: '*fp16', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: 'i32', 7: 'i32', 8: 'i32', 9: 'i32', 10: 'i32', 11: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 7, 11), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_native_group_norm_6', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, 'num_reduction': 0, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, out_ptr0, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr): xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex % 1024 x1 = (xindex // 1024) % ks0 x2 = (xindex // ks1) x4 = xindex tmp0 = tl.load(in_ptr0 + (x0 + (1024*((x1 + (x2*(ks2 // ks3))) % (ks3*ks4)))), xmask, eviction_policy='evict_last').to(tl.float32) tmp2 = tl.load(in_ptr1 + ((x0 // 32)), xmask, eviction_policy='evict_last') tmp4 = tl.load(in_ptr2 + ((x0 // 32)), xmask, eviction_policy='evict_last') tmp12 = tl.load(in_ptr3 + (x0), xmask, eviction_policy='evict_last') tmp14 = tl.load(in_ptr4 + (x0), xmask, eviction_policy='evict_last') tmp1 = tmp0.to(tl.float32) tmp3 = tmp1 - tmp2 tmp5 = tl.maximum(0.0, 32*ks3*ks0) tmp6 = tmp5.to(tl.float32) tmp7 = tmp4 / tmp6 tmp8 = 1e-05 tmp9 = tmp7 + tmp8 tmp10 = libdevice.rsqrt(tmp9) tmp11 = tmp3 * tmp10 tmp13 = tmp11 * tmp12 tmp15 = tmp13 + tmp14 tl.store(out_ptr0 + (x4), tmp15, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/pi/cpiu3nuk7cgh3s6xvfo2lwlnlg3ff2rbobfsvpvnwb3prrjrchzu.py # Source Nodes: [x_2, x_3], Original ATen: [aten._to_copy, aten.convolution, aten.gelu] # x_2 => add_6, erf, mul_5, mul_6, mul_7 # x_3 => convert_element_type_7, convert_element_type_8, convolution triton_poi_fused__to_copy_convolution_gelu_7 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[1024, 8192], tile_hint=TileHint.DEFAULT, filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: 'i32', 3: 'i32', 4: 'i32', 5: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 4), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy_convolution_gelu_7', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_(in_ptr0, out_ptr0, ks0, ks1, ynumel, xnumel, YBLOCK : tl.constexpr, XBLOCK : tl.constexpr): ynumel = 1024 yoffset = (tl.program_id(1) + tl.program_id(2) * tl.num_programs(1)) * YBLOCK yindex = yoffset + tl.arange(0, YBLOCK)[None, :] ymask = yindex < ynumel xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:, None] xmask = xindex < xnumel x1 = xindex y0 = yindex tmp0 = tl.load(in_ptr0 + (y0 + (1024*x1)), xmask, eviction_policy='evict_last') tmp1 = 0.5 tmp2 = tmp0 * tmp1 tmp3 = 0.7071067811865476 tmp4 = tmp0 * tmp3 tmp5 = libdevice.erf(tmp4) tmp6 = 1.0 tmp7 = tmp5 + tmp6 tmp8 = tmp2 * tmp7 tmp9 = tmp8.to(tl.float32) tl.store(out_ptr0 + (x1 + (ks1*ks0*y0)), tmp9, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/lr/clrufemzzqgb3hgkvhlnyqecelmlg66hi27x4m6nrnw3ogibcq62.py # Source Nodes: [x_2, x_3], Original ATen: [aten._to_copy, aten.convolution, aten.gelu] # x_2 => add_6, erf, mul_5, mul_6, mul_7 # x_3 => convert_element_type_7, convert_element_type_8, convolution triton_poi_fused__to_copy_convolution_gelu_8 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[32768], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy_convolution_gelu_8', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr): xnumel = 25600 xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x0 = xindex tmp0 = tl.load(in_ptr0 + (x0), xmask) tmp1 = tmp0.to(tl.float32) tl.store(out_ptr0 + (x0), tmp1, xmask) ''', device_str='cuda') # kernel path: /tmp/torchinductor_root/u3/cu3sqlrojnrdpuind5nputsswkiqbt7qq7maj4e5avuupwbe7qgq.py # Source Nodes: [add, tgt, tgt2, tgt_1], Original ATen: [aten._to_copy, aten.add] # add => add # tgt => add_1 # tgt2 => add_7, convert_element_type_9 # tgt_1 => add_8 triton_poi_fused__to_copy_add_9 = async_compile.triton('triton_', ''' import triton import triton.language as tl from triton.compiler.compiler import AttrsDescriptor from torch._inductor.runtime import triton_helpers, triton_heuristics from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties @triton_heuristics.pointwise( size_hints=[2097152], filename=__file__, triton_meta={'signature': {0: '*fp32', 1: '*fp16', 2: '*fp16', 3: '*fp16', 4: '*fp32', 5: '*fp32', 6: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=89, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=1536, multi_processor_count=58), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 6), equal_to_1=())]}, inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__to_copy_add_9', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, 'num_reduction': 0, 'backend_hash': '72c34bdb145549777ca2f0838f26abe42bb446cf528c78d229508b5a55e67a78', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': False, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}, min_elem_per_thread=0 ) @triton.jit def triton_(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK : tl.constexpr): xoffset = tl.program_id(0) * XBLOCK xindex = xoffset + tl.arange(0, XBLOCK)[:] xmask = xindex < xnumel x2 = xindex x0 = xindex % 256 tmp0 = tl.load(in_ptr0 + (x2), xmask) tmp1 = tl.load(in_ptr1 + (x2), xmask).to(tl.float32) tmp2 = tl.load(in_ptr2 + (x2), xmask).to(tl.float32) tmp6 = tl.load(in_ptr3 + (x2), xmask).to(tl.float32) tmp7 = tl.load(in_ptr4 + (x0), xmask, eviction_policy='evict_last') tmp3 = tmp1 + tmp2 tmp4 = tmp3.to(tl.float32) tmp5 = tmp0 + tmp4 tmp8 = tmp7.to(tl.float32) tmp9 = tmp6 + tmp8 tmp10 = tmp9.to(tl.float32) tmp11 = tmp5 + tmp10 tl.store(out_ptr0 + (x2), tmp11, xmask) ''', device_str='cuda') async_compile.wait(globals()) del async_compile def call(args): arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, arg9_1, arg10_1, arg11_1, arg12_1, arg13_1, arg14_1 = args args.clear() s0 = arg0_1 s3 = arg8_1 s4 = arg9_1 assert_size_stride(arg1_1, (s0, 1, 256), (256, 256, 1)) assert_size_stride(arg2_1, (s0, 1, 256), (256, 256, 1)) assert_size_stride(arg3_1, (s0, 1, 256), (256, 256, 1)) assert_size_stride(arg4_1, (256, ), (1, )) assert_size_stride(arg5_1, (256, ), (1, )) assert_size_stride(arg6_1, (1024, 256), (256, 1)) assert_size_stride(arg7_1, (1024, ), (1, )) assert_size_stride(arg10_1, (1024, ), (1, )) assert_size_stride(arg11_1, (1024, ), (1, )) assert_size_stride(arg12_1, (1024, 1, 5, 5), (25, 25, 5, 1)) assert_size_stride(arg13_1, (256, 1024), (1024, 1)) assert_size_stride(arg14_1, (256, ), (1, )) with torch.cuda._DeviceGuard(0): torch.cuda.set_device(0) buf3 = empty_strided_cuda((s0, 1, 256), (256, 256, 1), torch.float16) # Source Nodes: [_tgt, add, linear, tgt], Original ATen: [aten._to_copy, aten.add, aten.native_layer_norm] stream0 = get_raw_stream(0) triton_per_fused__to_copy_add_native_layer_norm_0.run(arg3_1, arg2_1, arg1_1, arg4_1, arg5_1, buf3, s0, 256, grid=grid(s0), stream=stream0) del arg4_1 del arg5_1 buf4 = empty_strided_cuda((1024, 256), (256, 1), torch.float16) # Source Nodes: [linear], Original ATen: [aten._to_copy] triton_poi_fused__to_copy_1.run(arg6_1, buf4, 262144, grid=grid(262144), stream=stream0) del arg6_1 buf5 = empty_strided_cuda((1024, ), (1, ), torch.float16) # Source Nodes: [linear], Original ATen: [aten._to_copy] triton_poi_fused__to_copy_2.run(arg7_1, buf5, 1024, grid=grid(1024), stream=stream0) del arg7_1 buf6 = empty_strided_cuda((s0, 1024), (1024, 1), torch.float16) # Source Nodes: [linear], Original ATen: [aten._to_copy, aten.addmm] extern_kernels.addmm(buf5, reinterpret_tensor(buf3, (s0, 256), (256, 1), 0), reinterpret_tensor(buf4, (256, 1024), (1, 256), 0), alpha=1, beta=1, out=buf6) del buf3 del buf5 buf7 = empty_strided_cuda((1, 32, 1, 1, 9, 101), (29088, 1, 29088, 29088, 3232, 32), torch.float32) buf8 = empty_strided_cuda((1, 32, 1, 1, 9, 101), (29088, 1, 29088, 29088, 3232, 32), torch.float32) buf9 = empty_strided_cuda((1, 32, 1, 1, 9, 101), (29088, 1, 29088, 29088, 3232, 32), torch.float32) # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] triton_red_fused_native_group_norm_3_rnumel = ((100 + ((8 + (32*s3*(s0 // s3))) // 9)) // 101) triton_red_fused_native_group_norm_3.run(buf6, buf7, buf8, buf9, s0, s3, s4, 29088, triton_red_fused_native_group_norm_3_rnumel, grid=grid(29088), stream=stream0) buf10 = empty_strided_cuda((1, 32, 1, 1, 9), (288, 1, 288, 288, 32), torch.float32) buf11 = empty_strided_cuda((1, 32, 1, 1, 9), (288, 1, 288, 288, 32), torch.float32) buf12 = empty_strided_cuda((1, 32, 1, 1, 9), (288, 1, 288, 288, 32), torch.float32) # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] triton_per_fused_native_group_norm_4.run(buf7, buf8, buf9, buf10, buf11, buf12, 288, 101, grid=grid(288), stream=stream0) del buf7 del buf8 del buf9 buf13 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.float32) buf14 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.float32) # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] triton_per_fused_native_group_norm_5.run(buf10, buf11, buf12, buf13, buf14, 32, 9, grid=grid(32), stream=stream0) del buf10 del buf11 del buf12 ps0 = (s0 // s3) ps1 = 1024*(s0 // s3) buf16 = empty_strided_cuda((1, 1024, s3, (s0 // s3)), (1024*s3*(s0 // s3), 1, 1024*(s0 // s3), 1024), torch.float32) # Source Nodes: [x_1], Original ATen: [aten.native_group_norm] triton_poi_fused_native_group_norm_6_xnumel = 1024*s3*(s0 // s3) triton_poi_fused_native_group_norm_6.run(buf6, buf13, buf14, arg10_1, arg11_1, buf16, ps0, ps1, s0, s3, s4, triton_poi_fused_native_group_norm_6_xnumel, grid=grid(triton_poi_fused_native_group_norm_6_xnumel), stream=stream0) del arg10_1 del arg11_1 del buf13 del buf14 del buf6 buf17 = empty_strided_cuda((1, 1024, s3, (s0 // s3)), (1024*s3*(s0 // s3), s3*(s0 // s3), (s0 // s3), 1), torch.float16) # Source Nodes: [x_2, x_3], Original ATen: [aten._to_copy, aten.convolution, aten.gelu] triton_poi_fused__to_copy_convolution_gelu_7_xnumel = s3*(s0 // s3) triton_poi_fused__to_copy_convolution_gelu_7.run(buf16, buf17, ps0, s3, 1024, triton_poi_fused__to_copy_convolution_gelu_7_xnumel, grid=grid(1024, triton_poi_fused__to_copy_convolution_gelu_7_xnumel), stream=stream0) del buf16 buf18 = empty_strided_cuda((1024, 1, 5, 5), (25, 25, 5, 1), torch.float16) # Source Nodes: [x_2, x_3], Original ATen: [aten._to_copy, aten.convolution, aten.gelu] triton_poi_fused__to_copy_convolution_gelu_8.run(arg12_1, buf18, 25600, grid=grid(25600), stream=stream0) del arg12_1 # Source Nodes: [x_2, x_3], Original ATen: [aten._to_copy, aten.convolution, aten.gelu] buf19 = extern_kernels.convolution(buf17, buf18, stride=(1, 1), padding=(2, 2), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1024, bias=None) assert_size_stride(buf19, (1, 1024, s3, (s0 // s3)), (1024*s3*(s0 // s3), s3*(s0 // s3), (s0 // s3), 1)) del buf17 del buf18 buf20 = reinterpret_tensor(buf4, (256, 1024), (1024, 1), 0); del buf4 # reuse # Source Nodes: [tgt2], Original ATen: [aten._to_copy] triton_poi_fused__to_copy_1.run(arg13_1, buf20, 262144, grid=grid(262144), stream=stream0) del arg13_1 buf21 = empty_strided_cuda((s3*(s0 // s3), 1, 256), (256, 256, 1), torch.float16) # Source Nodes: [tgt2], Original ATen: [aten.bmm] extern_kernels.bmm(reinterpret_tensor(buf19, (s3*(s0 // s3), 1, 1024), (1, 0, s3*s4), 0), reinterpret_tensor(buf20, (s3*(s0 // s3), 1024, 256), (0, 1, 1024), 0), out=buf21) del buf19 del buf20 buf22 = empty_strided_cuda((s0, 1, 256), (256, 256, 1), torch.float32) # Source Nodes: [add, tgt, tgt2, tgt_1], Original ATen: [aten._to_copy, aten.add] triton_poi_fused__to_copy_add_9_xnumel = 256*s0 triton_poi_fused__to_copy_add_9.run(arg3_1, arg2_1, arg1_1, buf21, arg14_1, buf22, triton_poi_fused__to_copy_add_9_xnumel, grid=grid(triton_poi_fused__to_copy_add_9_xnumel), stream=stream0) del arg14_1 del arg1_1 del arg2_1 del arg3_1 del buf21 return (buf22, ) def benchmark_compiled_module(times=10, repeat=10): from torch._dynamo.testing import rand_strided from torch._inductor.utils import print_performance arg0_1 = 4624 arg1_1 = rand_strided((4624, 1, 256), (256, 256, 1), device='cuda:0', dtype=torch.float16) arg2_1 = rand_strided((4624, 1, 256), (256, 256, 1), device='cuda:0', dtype=torch.float16) arg3_1 = rand_strided((4624, 1, 256), (256, 256, 1), device='cuda:0', dtype=torch.float32) arg4_1 = rand_strided((256, ), (1, ), device='cuda:0', dtype=torch.float32) arg5_1 = rand_strided((256, ), (1, ), device='cuda:0', dtype=torch.float32) arg6_1 = rand_strided((1024, 256), (256, 1), device='cuda:0', dtype=torch.float32) arg7_1 = rand_strided((1024, ), (1, ), device='cuda:0', dtype=torch.float32) arg8_1 = 68 arg9_1 = 68 arg10_1 = rand_strided((1024, ), (1, ), device='cuda:0', dtype=torch.float32) arg11_1 = rand_strided((1024, ), (1, ), device='cuda:0', dtype=torch.float32) arg12_1 = rand_strided((1024, 1, 5, 5), (25, 25, 5, 1), device='cuda:0', dtype=torch.float32) arg13_1 = rand_strided((256, 1024), (1024, 1), device='cuda:0', dtype=torch.float32) arg14_1 = rand_strided((256, ), (1, ), device='cuda:0', dtype=torch.float32) fn = lambda: call([arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, arg9_1, arg10_1, arg11_1, arg12_1, arg13_1, arg14_1]) return print_performance(fn, times=times, repeat=repeat) if __name__ == "__main__": from torch._inductor.wrapper_benchmark import compiled_module_main compiled_module_main('None', benchmark_compiled_module)