def gen_profiler(
    func_attrs: Dict[str, Any], workdir: str, header_files: str, backend_spec
) -> None:
    """generate and build code for NMS profiling"""
    op_type = func_attrs["op"]
    file_pairs = []
    blockSize = 1024
    t_size = int((func_attrs["preNmsTop"] + blockSize - 1) / blockSize)

    if backend_spec.backend_name == "cuda":
        cuda_hmaxmin = True
    else:
        cuda_hmaxmin = False

    elem_rois_type = backend_spec.dtype_to_backend_type(
        func_attrs["inputs"][0]._attrs["dtype"]
    )
    elem_scores_type = backend_spec.dtype_to_backend_type(
        func_attrs["inputs"][1]._attrs["dtype"]
    )
    code = PROFILER_TEMPLATE.render(
        T_SIZE=t_size,
        elem_scores_type=elem_scores_type,
        elem_rois_type=elem_rois_type,
        header_files=header_files,
        kernel=KERNEL_TEMPLATE.render(
            prefix=backend_spec.prefix, cub=backend_spec.cub, cuda_hmaxmin=cuda_hmaxmin
        ),
        func_signature=FUNC_SIGNATURE.render(
            func_name=func_attrs["name"],
            prefix=backend_spec.prefix,
            index_type=backend_spec.index_type,
        ),
    )
    op_name = func_attrs["op"]
    add_profiler(file_pairs, workdir, op_type, op_name, code)
    return file_pairs
generate and build code for NMS profiling
python/aitemplate/backend/common/vision_ops/nms_common.py