import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4 % 4
    x0 = xindex % 4
    x2 = xindex // 16
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 16 * x2), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp9 = triton_helpers.maximum(tmp7, tmp8)
    tmp10 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp12 = tl.full(tmp11.shape, 0.0, tmp11.dtype)
    tmp13 = tl.where(tmp4, tmp11, tmp12)
    tmp14 = tmp0 >= tmp3
    tmp15 = tl.full([1], 2, tl.int64)
    tmp16 = tmp0 < tmp15
    tmp17 = tmp14 & tmp16
    tmp18 = tl.load(in_ptr0 + (64 + x0 + 16 * x2), tmp17 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp19 = tl.load(in_ptr0 + (68 + x0 + 16 * x2), tmp17 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp20 = triton_helpers.maximum(tmp18, tmp19)
    tmp21 = tl.load(in_ptr0 + (72 + x0 + 16 * x2), tmp17 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp22 = triton_helpers.maximum(tmp20, tmp21)
    tmp23 = tl.load(in_ptr0 + (76 + x0 + 16 * x2), tmp17 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp24 = triton_helpers.maximum(tmp22, tmp23)
    tmp25 = tl.full(tmp24.shape, 0.0, tmp24.dtype)
    tmp26 = tl.where(tmp17, tmp24, tmp25)
    tmp27 = tmp0 >= tmp15
    tmp28 = tl.full([1], 3, tl.int64)
    tmp29 = tmp0 < tmp28
    tmp30 = tmp27 & tmp29
    tmp31 = tl.load(in_ptr0 + (128 + x0 + 16 * x2), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp32 = tl.load(in_ptr0 + (132 + x0 + 16 * x2), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp33 = triton_helpers.maximum(tmp31, tmp32)
    tmp34 = tl.load(in_ptr0 + (136 + x0 + 16 * x2), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp35 = triton_helpers.maximum(tmp33, tmp34)
    tmp36 = tl.load(in_ptr0 + (140 + x0 + 16 * x2), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp37 = triton_helpers.maximum(tmp35, tmp36)
    tmp38 = tl.full(tmp37.shape, 0.0, tmp37.dtype)
    tmp39 = tl.where(tmp30, tmp37, tmp38)
    tmp40 = tmp0 >= tmp28
    tl.full([1], 4, tl.int64)
    tmp43 = tl.load(in_ptr0 + (192 + x0 + 16 * x2), tmp40 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp44 = tl.load(in_ptr0 + (196 + x0 + 16 * x2), tmp40 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp45 = triton_helpers.maximum(tmp43, tmp44)
    tmp46 = tl.load(in_ptr0 + (200 + x0 + 16 * x2), tmp40 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp47 = triton_helpers.maximum(tmp45, tmp46)
    tmp48 = tl.load(in_ptr0 + (204 + x0 + 16 * x2), tmp40 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp49 = triton_helpers.maximum(tmp47, tmp48)
    tmp50 = tl.full(tmp49.shape, 0.0, tmp49.dtype)
    tmp51 = tl.where(tmp40, tmp49, tmp50)
    tmp52 = tl.where(tmp30, tmp39, tmp51)
    tmp53 = tl.where(tmp17, tmp26, tmp52)
    tmp54 = tl.where(tmp4, tmp13, tmp53)
    tl.store(out_ptr0 + x3, tmp54, xmask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(64)](arg0_1, buf0, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        del arg0_1
    return buf0,


class MonotonicMaxNew(nn.Module):

    def __init__(self):
        super().__init__()

    def forward(self, input_0):
        arg0_1 = input_0
        output = call([arg0_1])
        return output[0]


Measured latency_ms: 0.014761