def mem_eff_attention_gen_function(func_attrs: Dict[str, Any]) -> str:
    """the function for generating attention kernel"""
    backend_spec = CUDASpec()
    elem_input_type = backend_spec.dtype_to_lib_type(
        func_attrs["inputs"][0]._attrs["dtype"]
    )
    if func_attrs["use_grouped_fmha"]:
        func_template = FUNC_TEMPLATE_GROUPED_FMHA
    else:
        func_template = FUNC_TEMPLATE_KERNEL_FWD
    # Mem-eff attention relies on cutlass 2 which doesn't yet have SM90 specialization
    arch = func_attrs["arch"]
    if arch == "90":
        arch = "80"
    return func_template.render(
        elem_input_type=elem_input_type,
        head_size=func_attrs["head_size"],
        func_signature=FUNC_SIGNATURE.render(func_name=func_attrs["name"]),
        kIs64x64="true" if func_attrs["head_size"] <= 64 else "false",
        kSingleValueIteration="true" if func_attrs["head_size"] <= 128 else "false",
        cuda_check=CUDA_CHECK,
        arch=arch,
    )
the function for generating attention kernel
python/aitemplate/backend/cuda/attention/mem_eff_attention.py