    def emit(self) -> str:
        template = jinja2.Template(
            """
using {{name}} = {{xdl_op_type}}<
{% if xdl_op_type_value==1 %}
    {{ALayout}},
    {{BLayout}},
    {{CLayout}},
    {{ADType}},
    {{BDType}},
    {{CDType}},
    {{AccDType}},
    {{CShuffleDType}},
{% elif xdl_op_type_value==2 %}
    {{ALayout}},
    {{BLayout}},
    ck::Tuple<{{DsLayout}}>, // DsLayout
    {{CLayout}},
    {{ADType}},
    {{BDType}},
    {{AccDType}},
    {{CShuffleDType}},
    ck::Tuple<{{DsDType}}>, // DsType
    {{CDType}},
{% elif xdl_op_type_value==3 %}
    {{ADType}},
    {{BDType}},
    {{CDType}},
    {{AccDType}},
    {{ALayout}},
    {{BLayout}},
    {{CLayout}},
{% elif xdl_op_type_value==4 %}
    {{ALayout}},
    {{BLayout}},
    {{CLayout}},
    {{ADType}},
    {{BDType}},
    {{AccDType}},
    {{CShuffleDType}},
    {{CDType}},
{% elif xdl_op_type_value==5 %}
    {{ALayout}},
    {{BLayout}},
    {{CLayout}},
    {{ADType}},
    {{BDType}},
    {{AccDType}},
    float, // CShuffleDType
    ck::half_t,
    ck::half_t,
{% elif xdl_op_type_value==6 %}
    {% if gemm_kind == "gemm_permute_m2n3" %}
    1, 2, 3, 1, // permute m2n3
    {% elif gemm_kind == "gemm_permute_m3n2" %}
    1, 3, 2, 1, // permute m3n2
    {% endif %}
    {{ADType}},
    {{BDType}},
    {{AccDType}},
    ck::half_t,
    {% if "PassThrough" in C_elem_op %}
    ck::Tuple<>,
    {% else %}
    ck::Tuple<ck::half_t>,
    {% endif %}
    ck::half_t,
{% elif xdl_op_type_value == 7 %}
    {{ALayout}},
    {{BLayout}},
    {{CLayout}},
    {{CLayout}},
    {{ADType}},
    {{BDType}},
    {{BDType}},
    {{CDType}},
    {{AccDType}},
    float, // CShuffleDType,
{% elif xdl_op_type_value == 8 %}
    2, 1, 1, 1, 1,
    {{ADType}},
    {{BDType}},
    {{BDType}},
    {{CDType}},
    ck::Tuple<>,
    ck::Tuple<>,
    {{AccDType}},
    float, // CShuffleDType,
{% elif xdl_op_type_value == 9 %}
    {{ALayout}},
    {{BLayout}},
    ck::Tuple<{{DsLayout}}>, // DsLayout
    {{CLayout}},
    {{ADType}},
    {{BDType}},
    {{AccDType}},
    {{CShuffleDType}},
    ck::Tuple<{{DsDType}}>, // DsType
    {{EDType}},
{% endif %}
{% if xdl_op_type_value in [7, 8] %}
    {{A_elem_op}},
    {{B_elem_op}},
    ck::tensor_operation::element_wise::ScaleAndResetNaNToMinusInfinity,
{% else %}
    {{A_elem_op}},
{% endif %}
    {{B_elem_op}},
    {{C_elem_op}},
{% if xdl_op_type_value!=3 %}
    {{GemmSpecialization}},
    {% if xdl_op_type_value==6 %}
    ck::tensor_operation::device::TensorSpecialization::Packed,
    ck::tensor_operation::device::TensorSpecialization::Packed,
    ck::tensor_operation::device::TensorSpecialization::Default,
    {% elif xdl_op_type_value==8 %}
    ck::tensor_operation::device::TensorSpecialization::Default,
    ck::tensor_operation::device::TensorSpecialization::Default,
    ck::tensor_operation::device::TensorSpecialization::Default,
    ck::tensor_operation::device::TensorSpecialization::Default,
    {% endif %}
    1,
{% endif %}
    {{tile_config}}
    {{a_block_transfer}}
    {{b_block_transfer}}
{% if xdl_op_type_value in [7, 8] %}
    {{b1_block_transfer}}
{% endif %}
{% if xdl_op_type_value!=3 %}
    {{c_block_transfer}}
{% else %}
    7, // src_dst_vector_dim
    1 // dst_scalar_per_vector
{% endif %}
    >;
"""
        )
        return template.render(
            name=self.__str__(),
            gemm_kind=library.GemmKindNames[self.operation_kind],
            xdl_op_type=XdlOpTag[self.xdl_op_type],
            xdl_op_type_value=self.xdl_op_type.value,  # This sucks
            ALayout=library.LayoutTag[self.A.layout],
            BLayout=library.LayoutTag[self.B.layout],
            CLayout=library.LayoutTag[self.C.layout],
            ADType=library.DataTypeTag[self.A.element],
            BDType=library.DataTypeTag[self.B.element],
            CDType=library.DataTypeTag[self.C.element],
            AccDType=library.DataTypeTag[library.DataType.f32],
            CShuffleDType=library.DataTypeTag[self.C.element],
            A_elem_op=library.TensorOperationTag[self.a_elem_op],
            B_elem_op=library.TensorOperationTag[self.b_elem_op],
            C_elem_op=library.TensorOperationTag[self.epilogue_functor],
            GemmSpecialization=GemmSpecializationTag[self.gemm_specialization],
            epilogue_func=library.ShortTensorOperationNames[self.epilogue_functor],
            tile_config=self.tile_desc.emit(),
            a_block_transfer=self.a_block_transfer.emit(),
            b_block_transfer=self.b_block_transfer.emit(),
            b1_block_transfer=(
                "" if self.b1_block_transfer is None else self.b1_block_transfer.emit()
            ),
            c_block_transfer=(
                self.c_block_transfer.emit()
                if self.c_block_transfer is not None
                else ""
            ),
            DsDType=(
                ",".join([library.DataTypeTag[d_dtype] for d_dtype in self.ds_dtype])
                if self.ds_dtype is not None
                else ""
            ),
            DsLayout=(
                ",".join([library.LayoutTag[d_layout] for d_layout in self.ds_layout])
                if self.ds_layout is not None
                else ""
            ),
            EDType=(
                library.DataTypeTag[self.e_dtype] if self.e_dtype is not None else ""
            ),
        )
using {{name}} = {{xdl_op_type}}<
{% if xdl_op_type_value==1 %}
{{ALayout}},
{{BLayout}},
{{CLayout}},
{{ADType}},
{{BDType}},
{{CDType}},
{{AccDType}},
{{CShuffleDType}},
{% elif xdl_op_type_value==2 %}
{{ALayout}},
{{BLayout}},
ck::Tuple<{{DsLayout}}>, // DsLayout
{{CLayout}},
{{ADType}},
{{BDType}},
{{AccDType}},
{{CShuffleDType}},
ck::Tuple<{{DsDType}}>, // DsType
{{CDType}},
{% elif xdl_op_type_value==3 %}
{{ADType}},
{{BDType}},
{{CDType}},
{{AccDType}},
{{ALayout}},
{{BLayout}},
{{CLayout}},
{% elif xdl_op_type_value==4 %}
{{ALayout}},
{{BLayout}},
{{CLayout}},
{{ADType}},
{{BDType}},
{{AccDType}},
{{CShuffleDType}},
{{CDType}},
{% elif xdl_op_type_value==5 %}
{{ALayout}},
{{BLayout}},
{{CLayout}},
{{ADType}},
{{BDType}},
{{AccDType}},
float, // CShuffleDType
ck::half_t,
ck::half_t,
{% elif xdl_op_type_value==6 %}
{% if gemm_kind == "gemm_permute_m2n3" %}
1, 2, 3, 1, // permute m2n3
{% elif gemm_kind == "gemm_permute_m3n2" %}
1, 3, 2, 1, // permute m3n2
{% endif %}
{{ADType}},
{{BDType}},
{{AccDType}},
ck::half_t,
{% if "PassThrough" in C_elem_op %}
ck::Tuple<>,
{% else %}
ck::Tuple<ck::half_t>,
{% endif %}
ck::half_t,
{% elif xdl_op_type_value == 7 %}
{{ALayout}},
{{BLayout}},
{{CLayout}},
{{CLayout}},
{{ADType}},
{{BDType}},
{{BDType}},
{{CDType}},
{{AccDType}},
float, // CShuffleDType,
{% elif xdl_op_type_value == 8 %}
2, 1, 1, 1, 1,
{{ADType}},
{{BDType}},
{{BDType}},
{{CDType}},
ck::Tuple<>,
ck::Tuple<>,
{{AccDType}},
float, // CShuffleDType,
{% elif xdl_op_type_value == 9 %}
{{ALayout}},
{{BLayout}},
ck::Tuple<{{DsLayout}}>, // DsLayout
{{CLayout}},
{{ADType}},
{{BDType}},
{{AccDType}},
{{CShuffleDType}},
ck::Tuple<{{DsDType}}>, // DsType
{{EDType}},
{% endif %}
{% if xdl_op_type_value in [7, 8] %}
{{A_elem_op}},
{{B_elem_op}},
ck::tensor_operation::element_wise::ScaleAndResetNaNToMinusInfinity,
{% else %}
{{A_elem_op}},
{% endif %}
{{B_elem_op}},
{{C_elem_op}},
{% if xdl_op_type_value!=3 %}
{{GemmSpecialization}},
{% if xdl_op_type_value==6 %}
ck::tensor_operation::device::TensorSpecialization::Packed,
ck::tensor_operation::device::TensorSpecialization::Packed,
ck::tensor_operation::device::TensorSpecialization::Default,
{% elif xdl_op_type_value==8 %}
ck::tensor_operation::device::TensorSpecialization::Default,
ck::tensor_operation::device::TensorSpecialization::Default,
ck::tensor_operation::device::TensorSpecialization::Default,
ck::tensor_operation::device::TensorSpecialization::Default,
{% endif %}
1,
{% endif %}
{{tile_config}}
{{a_block_transfer}}
{{b_block_transfer}}
{% if xdl_op_type_value in [7, 8] %}
{{b1_block_transfer}}
{% endif %}
{% if xdl_op_type_value!=3 %}
{{c_block_transfer}}
{% else %}
7, // src_dst_vector_dim
1 // dst_scalar_per_vector
{% endif %}
>;
python/aitemplate/utils/mk_ck_lib/gemm_operation.py