Upload folder using huggingface_hub (part 3)
Browse files- .inductor_cache/ym/cymwujume2azuvh7fbujnaekdocxf6szi57kpkkwcmuszidxouzv.py +29 -0
- .inductor_cache/yt/cytkblpmxtiyttie4sb6q24fmxvz3keyhvpd7ohvwhco6atydhtq.py +24 -0
- .inductor_cache/yu/cyulr2ljflwhtei5asluhqjh5vawyptyitwiqbkohzzxhkthatlm.py +29 -0
- .inductor_cache/z4/cz4ihhmoiu4l5unvbgrsavh73dkatd6zjj7dj77vlmsov6yj6cdy.py +137 -0
- .inductor_cache/zb/czbs2fm46j6qhtd2znnofgeavkuhyl72vdcahggz7dhvxp5zvnma.py +24 -0
- .inductor_cache/ze/1124bb1f7f39db53a57e49f4d36648a0d2fb0d8c5d95047e9e79c4f5ff6aa834.best_config +1 -0
- .inductor_cache/ze/czeardixathkscotfnp37pocvapthzwtdabgtpsto2evnxhd2wi7.py +26 -0
- .inductor_cache/zi/czi2gebq2ez4fkm4twycyxki3nxsr5q5asfo44xgpsj5txniaoey.py +29 -0
- .inductor_cache/zm/czmqgy6soqztyipifu6p2jfwi4je2rv5dgpxsqvvy3vdykavyemd.py +24 -0
- .inductor_cache/zm/faeba8505e0ed9390c51709b1a4837ad201756af55501c251609791851cf944b.best_config +1 -0
- .inductor_cache/zp/czpgtwy5of2i6b7aikxrgrez66yzismukpkcmrttlp5pnenqldlz.py +150 -0
- .inductor_cache/zv/czvm6uj6zs2duwbjqoq4cmqrfz7ejc3igihrhqvth7uov36wgnuo.py +289 -0
.inductor_cache/ym/cymwujume2azuvh7fbujnaekdocxf6szi57kpkkwcmuszidxouzv.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = tl.load(in_ptr1 + (0))
|
| 26 |
+
tmp3 = tl.broadcast_to(tmp2, [XBLOCK])
|
| 27 |
+
tmp4 = tmp1 * tmp3
|
| 28 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp4, None)
|
| 29 |
+
tl.store(out_ptr1 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp4, None)
|
.inductor_cache/yt/cytkblpmxtiyttie4sb6q24fmxvz3keyhvpd7ohvwhco6atydhtq.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=6, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = ks0
|
| 24 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32)), tmp0, None)
|
.inductor_cache/yu/cyulr2ljflwhtei5asluhqjh5vawyptyitwiqbkohzzxhkthatlm.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = tl.load(in_ptr1 + (0))
|
| 26 |
+
tmp3 = tl.broadcast_to(tmp2, [XBLOCK])
|
| 27 |
+
tmp4 = tmp1 * tmp3
|
| 28 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp4, None)
|
| 29 |
+
tl.store(out_ptr1 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp4, None)
|
.inductor_cache/z4/cz4ihhmoiu4l5unvbgrsavh73dkatd6zjj7dj77vlmsov6yj6cdy.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['10_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/yg/cygzxmweoklnvoy2z6e7xc72jmpynqu5ckcmk766j2dvm5llk3js.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, mul], Original ATen: [aten.unsqueeze, aten.mul]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# mul => mul_2
|
| 41 |
+
# unsqueeze => unsqueeze
|
| 42 |
+
# Graph fragment:
|
| 43 |
+
# %arg1_1 : Tensor "f32[1, s3][s3, 1]cuda:6" = PlaceHolder[target=arg1_1]
|
| 44 |
+
# %arg2_1 : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:6" = PlaceHolder[target=arg2_1]
|
| 45 |
+
# %arg3_1 : Tensor "f64[][]cpu" = PlaceHolder[target=arg3_1]
|
| 46 |
+
# %unsqueeze : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:6"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg1_1, -1), kwargs = {})
|
| 47 |
+
# %mul_2 : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:6"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %arg2_1), kwargs = {})
|
| 48 |
+
# %convert_element_type_default_1 : Tensor "f32[][]cpu"[num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg3_1, torch.float32), kwargs = {})
|
| 49 |
+
# %mul_tensor : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:6"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_2, %convert_element_type_default_1), kwargs = {})
|
| 50 |
+
# return %mul_tensor
|
| 51 |
+
triton_poi_fused_mul_unsqueeze_0 = async_compile.triton('triton_poi_fused_mul_unsqueeze_0', '''
|
| 52 |
+
import triton
|
| 53 |
+
import triton.language as tl
|
| 54 |
+
|
| 55 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 56 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 57 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 58 |
+
triton_helpers.set_driver_to_gpu()
|
| 59 |
+
|
| 60 |
+
@triton_heuristics.pointwise(
|
| 61 |
+
size_hints={'x': 32},
|
| 62 |
+
filename=__file__,
|
| 63 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=6, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 64 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 512}},
|
| 65 |
+
min_elem_per_thread=0
|
| 66 |
+
)
|
| 67 |
+
@triton.jit
|
| 68 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 69 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 70 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 71 |
+
xmask = xindex < xnumel
|
| 72 |
+
x0 = xindex
|
| 73 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 74 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 75 |
+
tmp3 = in_ptr2
|
| 76 |
+
tmp2 = tmp0 * tmp1
|
| 77 |
+
tmp4 = tmp3.to(tl.float32)
|
| 78 |
+
tmp5 = tmp2 * tmp4
|
| 79 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
| 80 |
+
''', device_str='cuda')
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
async_compile.wait(globals())
|
| 84 |
+
del async_compile
|
| 85 |
+
|
| 86 |
+
class Runner:
|
| 87 |
+
def __init__(self, partitions):
|
| 88 |
+
self.partitions = partitions
|
| 89 |
+
|
| 90 |
+
def recursively_apply_fns(self, fns):
|
| 91 |
+
new_callables = []
|
| 92 |
+
for fn, c in zip(fns, self.partitions):
|
| 93 |
+
new_callables.append(fn(c))
|
| 94 |
+
self.partitions = new_callables
|
| 95 |
+
|
| 96 |
+
def call(self, args):
|
| 97 |
+
arg0_1, arg1_1, arg2_1, arg3_1 = args
|
| 98 |
+
args.clear()
|
| 99 |
+
s3 = arg0_1
|
| 100 |
+
assert_size_stride(arg1_1, (1, s3), (s3, 1))
|
| 101 |
+
assert_size_stride(arg2_1, (1, s3, 1), (s3, 1, 1))
|
| 102 |
+
assert_size_stride(arg3_1, (), ())
|
| 103 |
+
with torch.cuda._DeviceGuard(6):
|
| 104 |
+
torch.cuda.set_device(6)
|
| 105 |
+
buf0 = empty_strided_cuda((1, s3, 1), (s3, 1, 1), torch.float32)
|
| 106 |
+
# Topologically Sorted Source Nodes: [unsqueeze, mul], Original ATen: [aten.unsqueeze, aten.mul]
|
| 107 |
+
stream6 = get_raw_stream(6)
|
| 108 |
+
triton_poi_fused_mul_unsqueeze_0.run(arg1_1, arg2_1, arg3_1.item(), buf0, s3, stream=stream6)
|
| 109 |
+
del arg1_1
|
| 110 |
+
del arg2_1
|
| 111 |
+
del arg3_1
|
| 112 |
+
return (buf0, )
|
| 113 |
+
|
| 114 |
+
runner = Runner(partitions=[])
|
| 115 |
+
call = runner.call
|
| 116 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def get_args():
|
| 120 |
+
from torch._dynamo.testing import rand_strided
|
| 121 |
+
arg0_1 = 32
|
| 122 |
+
arg1_1 = rand_strided((1, 32), (32, 1), device='cuda:6', dtype=torch.float32)
|
| 123 |
+
arg2_1 = rand_strided((1, 32, 1), (32, 1, 1), device='cuda:6', dtype=torch.float32)
|
| 124 |
+
arg3_1 = rand_strided((), (), device='cpu', dtype=torch.float64)
|
| 125 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1]
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 129 |
+
from torch._inductor.utils import print_performance
|
| 130 |
+
fn = lambda: call(list(args))
|
| 131 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
if __name__ == "__main__":
|
| 135 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 136 |
+
args = get_args()
|
| 137 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/zb/czbs2fm46j6qhtd2znnofgeavkuhyl72vdcahggz7dhvxp5zvnma.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 8},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
.inductor_cache/ze/1124bb1f7f39db53a57e49f4d36648a0d2fb0d8c5d95047e9e79c4f5ff6aa834.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 128, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 82, "triton_cache_hash": "LBOXSWDAX2GIZFOXRIZQ4S3246ZSKZAMDEVIL3FUHRGF3W6BJYLQ"}
|
.inductor_cache/ze/czeardixathkscotfnp37pocvapthzwtdabgtpsto2evnxhd2wi7.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 256},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 3072}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_0(in_out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 25 |
+
tmp2 = tmp0 * tmp1
|
| 26 |
+
tl.store(in_out_ptr0 + (x0), tmp2, xmask)
|
.inductor_cache/zi/czi2gebq2ez4fkm4twycyxki3nxsr5q5asfo44xgpsj5txniaoey.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 32},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 512}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 25 |
+
tmp3 = in_ptr2
|
| 26 |
+
tmp2 = tmp0 * tmp1
|
| 27 |
+
tmp4 = tmp3.to(tl.float32)
|
| 28 |
+
tmp5 = tmp2 * tmp4
|
| 29 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
.inductor_cache/zm/czmqgy6soqztyipifu6p2jfwi4je2rv5dgpxsqvvy3vdykavyemd.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 65536},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 294912}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x2 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 24 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
.inductor_cache/zm/faeba8505e0ed9390c51709b1a4837ad201756af55501c251609791851cf944b.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "7cced77f371acaa5aa7d90332a90e0c907727cfefb71d9cc9d997c24557fc44f", "found_by_coordesc": false, "time_taken_ms": 22, "triton_cache_hash": "QLXJTPJWIG7LHGEN76P7EYFUJIJLXLDECRO3I6NRHSQ4NBZC2KMA"}
|
.inductor_cache/zp/czpgtwy5of2i6b7aikxrgrez66yzismukpkcmrttlp5pnenqldlz.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['3_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/4l/c4ljp5q37q7ktbyo35672uzle4llt4iwt4be37ikkwlit6j7fnco.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [weights_1, unsqueeze, mul_1], Original ATen: [aten.mul, aten.unsqueeze]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# mul_1 => mul_7
|
| 41 |
+
# unsqueeze => unsqueeze
|
| 42 |
+
# weights_1 => mul_2
|
| 43 |
+
# Graph fragment:
|
| 44 |
+
# %mm : Tensor "f32[s0, 32][32, 1]cuda:7" = PlaceHolder[target=mm]
|
| 45 |
+
# %arg3_1 : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:7" = PlaceHolder[target=arg3_1]
|
| 46 |
+
# %arg4_1 : Tensor "f64[][]cpu" = PlaceHolder[target=arg4_1]
|
| 47 |
+
# %mul_2 : Tensor "f32[s0, 32][32, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mm, 0.1767766952966369), kwargs = {})
|
| 48 |
+
# %unsqueeze : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%mul_2, -1), kwargs = {})
|
| 49 |
+
# %mul_7 : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %arg3_1), kwargs = {})
|
| 50 |
+
# %convert_element_type_default_1 : Tensor "f32[][]cpu"[num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg4_1, torch.float32), kwargs = {})
|
| 51 |
+
# %mul_tensor : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_7, %convert_element_type_default_1), kwargs = {})
|
| 52 |
+
# return %mul_tensor
|
| 53 |
+
triton_poi_fused_mul_unsqueeze_0 = async_compile.triton('triton_poi_fused_mul_unsqueeze_0', '''
|
| 54 |
+
import triton
|
| 55 |
+
import triton.language as tl
|
| 56 |
+
|
| 57 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 58 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 59 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 60 |
+
triton_helpers.set_driver_to_gpu()
|
| 61 |
+
|
| 62 |
+
@triton_heuristics.pointwise(
|
| 63 |
+
size_hints={'x': 2048},
|
| 64 |
+
filename=__file__,
|
| 65 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 66 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 28672}},
|
| 67 |
+
min_elem_per_thread=0
|
| 68 |
+
)
|
| 69 |
+
@triton.jit
|
| 70 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 71 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 72 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 73 |
+
xmask = xindex < xnumel
|
| 74 |
+
x0 = xindex
|
| 75 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 76 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 77 |
+
tmp5 = in_ptr1
|
| 78 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 79 |
+
tmp2 = tmp0 * tmp1
|
| 80 |
+
tmp4 = tmp2 * tmp3
|
| 81 |
+
tmp6 = tmp5.to(tl.float32)
|
| 82 |
+
tmp7 = tmp4 * tmp6
|
| 83 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
| 84 |
+
''', device_str='cuda')
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
async_compile.wait(globals())
|
| 88 |
+
del async_compile
|
| 89 |
+
|
| 90 |
+
class Runner:
|
| 91 |
+
def __init__(self, partitions):
|
| 92 |
+
self.partitions = partitions
|
| 93 |
+
|
| 94 |
+
def recursively_apply_fns(self, fns):
|
| 95 |
+
new_callables = []
|
| 96 |
+
for fn, c in zip(fns, self.partitions):
|
| 97 |
+
new_callables.append(fn(c))
|
| 98 |
+
self.partitions = new_callables
|
| 99 |
+
|
| 100 |
+
def call(self, args):
|
| 101 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1 = args
|
| 102 |
+
args.clear()
|
| 103 |
+
s77 = arg1_1
|
| 104 |
+
arg2_1_size = arg2_1.size()
|
| 105 |
+
s0 = arg2_1_size[0]
|
| 106 |
+
assert_size_stride(arg0_1, (32, 6144), (6144, 1))
|
| 107 |
+
assert_size_stride(arg2_1, (s0, 6144), (6144, 1))
|
| 108 |
+
assert_size_stride(arg3_1, (s0, 32, 1), (32, 1, 1))
|
| 109 |
+
assert_size_stride(arg4_1, (), ())
|
| 110 |
+
with torch.cuda._DeviceGuard(7):
|
| 111 |
+
torch.cuda.set_device(7)
|
| 112 |
+
buf0 = empty_strided_cuda((s0, 32), (32, 1), torch.float32)
|
| 113 |
+
# Topologically Sorted Source Nodes: [t, weights], Original ATen: [aten.t, aten.mm]
|
| 114 |
+
extern_kernels.mm_dtype(arg2_1, reinterpret_tensor(arg0_1, (6144, 32), (1, 6144), 0), out_dtype=torch.float32, out=buf0)
|
| 115 |
+
del arg0_1
|
| 116 |
+
del arg2_1
|
| 117 |
+
buf1 = reinterpret_tensor(buf0, (s0, 32, 1), (32, 1, 1), 0); del buf0 # reuse
|
| 118 |
+
# Topologically Sorted Source Nodes: [weights_1, unsqueeze, mul_1], Original ATen: [aten.mul, aten.unsqueeze]
|
| 119 |
+
triton_poi_fused_mul_unsqueeze_0_xnumel = 32*s0
|
| 120 |
+
stream7 = get_raw_stream(7)
|
| 121 |
+
triton_poi_fused_mul_unsqueeze_0.run(buf1, arg3_1, arg4_1.item(), triton_poi_fused_mul_unsqueeze_0_xnumel, stream=stream7)
|
| 122 |
+
del arg3_1
|
| 123 |
+
del arg4_1
|
| 124 |
+
return (buf1, )
|
| 125 |
+
|
| 126 |
+
runner = Runner(partitions=[])
|
| 127 |
+
call = runner.call
|
| 128 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def get_args():
|
| 132 |
+
from torch._dynamo.testing import rand_strided
|
| 133 |
+
arg0_1 = rand_strided((32, 6144), (6144, 1), device='cuda:7', dtype=torch.bfloat16)
|
| 134 |
+
arg1_1 = 56
|
| 135 |
+
arg2_1 = rand_strided((56, 6144), (6144, 1), device='cuda:7', dtype=torch.bfloat16)
|
| 136 |
+
arg3_1 = rand_strided((56, 32, 1), (32, 1, 1), device='cuda:7', dtype=torch.float32)
|
| 137 |
+
arg4_1 = rand_strided((), (), device='cpu', dtype=torch.float64)
|
| 138 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1]
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 142 |
+
from torch._inductor.utils import print_performance
|
| 143 |
+
fn = lambda: call(list(args))
|
| 144 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
if __name__ == "__main__":
|
| 148 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 149 |
+
args = get_args()
|
| 150 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/zv/czvm6uj6zs2duwbjqoq4cmqrfz7ejc3igihrhqvth7uov36wgnuo.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['6_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/r3/cr333mq2yzr7rixiiwaacpyfykcrh3oe4bimo3cngi42juonzohi.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_3
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg2_1 : Tensor "f32[s97, 1][1, 1]cuda:1" = PlaceHolder[target=arg2_1]
|
| 47 |
+
# %arg3_1 : Tensor "f32[s97, 1][1, 1]cuda:1" = PlaceHolder[target=arg3_1]
|
| 48 |
+
# %mul_3 : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:1" = PlaceHolder[target=mul_3]
|
| 49 |
+
# %unsqueeze : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg3_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_3 : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:1"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_3,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 8},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=1, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 75 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 76 |
+
xmask = xindex < xnumel
|
| 77 |
+
x0 = xindex
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 79 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 80 |
+
tmp2 = tmp0 * tmp1
|
| 81 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 82 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
| 83 |
+
''', device_str='cuda')
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/un/cun3h5xetskkgqj652kojes6opfqbaexbkzn5bq2lhsitna2pl4x.py
|
| 87 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 88 |
+
# Source node to ATen node mapping:
|
| 89 |
+
# flatten => view_1
|
| 90 |
+
# gather => gather
|
| 91 |
+
# max_1 => max_1
|
| 92 |
+
# Graph fragment:
|
| 93 |
+
# %arg4_1 : Tensor "i64[s97, 1][1, 1]cuda:1" = PlaceHolder[target=arg4_1]
|
| 94 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 95 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 96 |
+
# %gather : Tensor "i64[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg4_1, 1, %getitem_1), kwargs = {})
|
| 97 |
+
# return %gather
|
| 98 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 99 |
+
import triton
|
| 100 |
+
import triton.language as tl
|
| 101 |
+
|
| 102 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 103 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 104 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 105 |
+
triton_helpers.set_driver_to_gpu()
|
| 106 |
+
|
| 107 |
+
@triton_heuristics.pointwise(
|
| 108 |
+
size_hints={'x': 8},
|
| 109 |
+
filename=__file__,
|
| 110 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=1, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 111 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 112 |
+
min_elem_per_thread=0
|
| 113 |
+
)
|
| 114 |
+
@triton.jit
|
| 115 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 116 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 117 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 118 |
+
xmask = xindex < xnumel
|
| 119 |
+
x0 = xindex
|
| 120 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 121 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 122 |
+
''', device_str='cuda')
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/f4/cf4amfzddy5edtg5hhvqyznxzmqz3sy5hooeuillcupuqjry5zoh.py
|
| 126 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 127 |
+
# Source node to ATen node mapping:
|
| 128 |
+
# batch_offsets => iota
|
| 129 |
+
# flat_cs => view_4
|
| 130 |
+
# flatten => view_1
|
| 131 |
+
# floordiv => div
|
| 132 |
+
# hidden_states => index
|
| 133 |
+
# max_1 => max_1
|
| 134 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 135 |
+
# selected_input_index => add_47
|
| 136 |
+
# Graph fragment:
|
| 137 |
+
# %arg6_1 : Tensor "bf16[s97, s87][s87, 1]cuda:1" = PlaceHolder[target=arg6_1]
|
| 138 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 139 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 140 |
+
# %view_4 : Tensor "i64[s97][1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [%arg1_1]), kwargs = {})
|
| 141 |
+
# %div : Tensor "i64[s97][1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 142 |
+
# %iota : Tensor "i64[s97][1]cuda:1"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (%arg1_1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:1, requires_grad: False})
|
| 143 |
+
# %unsqueeze_1 : Tensor "i64[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 144 |
+
# %view_5 : Tensor "i64[s97][1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [%arg1_1]), kwargs = {})
|
| 145 |
+
# %add_47 : Tensor "i64[s97][1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 146 |
+
# %index : Tensor "bf16[s97, s87][s87, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg6_1, [%add_47]), kwargs = {})
|
| 147 |
+
# return %index
|
| 148 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 149 |
+
import triton
|
| 150 |
+
import triton.language as tl
|
| 151 |
+
|
| 152 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 153 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 154 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 155 |
+
triton_helpers.set_driver_to_gpu()
|
| 156 |
+
|
| 157 |
+
@triton_heuristics.pointwise(
|
| 158 |
+
size_hints={'x': 65536},
|
| 159 |
+
filename=__file__,
|
| 160 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=1, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 161 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 294912}},
|
| 162 |
+
min_elem_per_thread=0
|
| 163 |
+
)
|
| 164 |
+
@triton.jit
|
| 165 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 166 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 167 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 168 |
+
xmask = xindex < xnumel
|
| 169 |
+
x2 = xindex
|
| 170 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 171 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
| 172 |
+
''', device_str='cuda')
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/tk/ctkv5ncbcvcsa2sqv7fy6waloep7rvxvcgauk5pfktnei5g2ypuk.py
|
| 176 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 177 |
+
# Source node to ATen node mapping:
|
| 178 |
+
# add_2 => add_53
|
| 179 |
+
# flatten => view_1
|
| 180 |
+
# max_1 => max_1
|
| 181 |
+
# Graph fragment:
|
| 182 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 183 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 184 |
+
# %add_53 : Tensor "i64[s97, 1][1, 1]cuda:1"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg7_1), kwargs = {})
|
| 185 |
+
# return %add_53
|
| 186 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 187 |
+
import triton
|
| 188 |
+
import triton.language as tl
|
| 189 |
+
|
| 190 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 191 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 192 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 193 |
+
triton_helpers.set_driver_to_gpu()
|
| 194 |
+
|
| 195 |
+
@triton_heuristics.pointwise(
|
| 196 |
+
size_hints={'x': 8},
|
| 197 |
+
filename=__file__,
|
| 198 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=1, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 199 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', '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, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 128}},
|
| 200 |
+
min_elem_per_thread=0
|
| 201 |
+
)
|
| 202 |
+
@triton.jit
|
| 203 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 204 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 205 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 206 |
+
xmask = xindex < xnumel
|
| 207 |
+
x0 = xindex
|
| 208 |
+
tmp0 = ks0
|
| 209 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 210 |
+
''', device_str='cuda')
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
async_compile.wait(globals())
|
| 214 |
+
del async_compile
|
| 215 |
+
|
| 216 |
+
class Runner:
|
| 217 |
+
def __init__(self, partitions):
|
| 218 |
+
self.partitions = partitions
|
| 219 |
+
|
| 220 |
+
def recursively_apply_fns(self, fns):
|
| 221 |
+
new_callables = []
|
| 222 |
+
for fn, c in zip(fns, self.partitions):
|
| 223 |
+
new_callables.append(fn(c))
|
| 224 |
+
self.partitions = new_callables
|
| 225 |
+
|
| 226 |
+
def call(self, args):
|
| 227 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1 = args
|
| 228 |
+
args.clear()
|
| 229 |
+
s53 = arg0_1
|
| 230 |
+
s97 = arg1_1
|
| 231 |
+
s87 = arg5_1
|
| 232 |
+
s77 = arg7_1
|
| 233 |
+
assert_size_stride(arg2_1, (s97, 1), (1, 1))
|
| 234 |
+
assert_size_stride(arg3_1, (s97, 1), (1, 1))
|
| 235 |
+
assert_size_stride(arg4_1, (s97, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg6_1, (s97, s87), (s87, 1))
|
| 237 |
+
with torch.cuda._DeviceGuard(1):
|
| 238 |
+
torch.cuda.set_device(1)
|
| 239 |
+
buf0 = empty_strided_cuda((s97, 1, 1), (1, 1, 1), torch.float32)
|
| 240 |
+
buf1 = empty_strided_cuda((s97, 1), (1, 1), torch.float32)
|
| 241 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 242 |
+
stream1 = get_raw_stream(1)
|
| 243 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg2_1, arg3_1, buf0, buf1, s97, stream=stream1)
|
| 244 |
+
del arg2_1
|
| 245 |
+
del arg3_1
|
| 246 |
+
buf2 = empty_strided_cuda((s97, 1), (1, 1), torch.int64)
|
| 247 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 248 |
+
stream1 = get_raw_stream(1)
|
| 249 |
+
triton_poi_fused_gather_max_view_1.run(arg4_1, buf2, s97, stream=stream1)
|
| 250 |
+
buf3 = empty_strided_cuda((s97, s87), (s87, 1), torch.bfloat16)
|
| 251 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 252 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel = s87*s97
|
| 253 |
+
stream1 = get_raw_stream(1)
|
| 254 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg6_1, buf3, triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel, stream=stream1)
|
| 255 |
+
del arg6_1
|
| 256 |
+
buf4 = empty_strided_cuda((s97, 1), (1, 1), torch.int64)
|
| 257 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 258 |
+
stream1 = get_raw_stream(1)
|
| 259 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, s97, stream=stream1)
|
| 260 |
+
return (reinterpret_tensor(buf2, (s97, ), (1, ), 0), buf3, buf1, buf0, arg4_1, buf4, )
|
| 261 |
+
|
| 262 |
+
runner = Runner(partitions=[])
|
| 263 |
+
call = runner.call
|
| 264 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def get_args():
|
| 268 |
+
from torch._dynamo.testing import rand_strided
|
| 269 |
+
arg0_1 = 1
|
| 270 |
+
arg1_1 = 8
|
| 271 |
+
arg2_1 = rand_strided((8, 1), (1, 1), device='cuda:1', dtype=torch.float32)
|
| 272 |
+
arg3_1 = rand_strided((8, 1), (1, 1), device='cuda:1', dtype=torch.float32)
|
| 273 |
+
arg4_1 = rand_strided((8, 1), (1, 1), device='cuda:1', dtype=torch.int64)
|
| 274 |
+
arg5_1 = 6144
|
| 275 |
+
arg6_1 = rand_strided((8, 6144), (6144, 1), device='cuda:1', dtype=torch.bfloat16)
|
| 276 |
+
arg7_1 = 1
|
| 277 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1]
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 281 |
+
from torch._inductor.utils import print_performance
|
| 282 |
+
fn = lambda: call(list(args))
|
| 283 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
if __name__ == "__main__":
|
| 287 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 288 |
+
args = get_args()
|
| 289 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|