def METHOD_NAME(dtype, signless=False):
    if hcl_mlir.is_hcl_mlir_type(dtype):
        return dtype
    if isinstance(dtype, Index):
        return hcl_mlir.IndexType.get()
    if isinstance(dtype, Int):
        return IntegerType.get_signless(dtype.bits)
    if isinstance(dtype, UInt):
        if signless:
            return IntegerType.get_signless(dtype.bits)
        return IntegerType.get_unsigned(dtype.bits)
    if isinstance(dtype, Fixed):
        return hcl_d.FixedType.get(dtype.bits, dtype.fracs)
    if isinstance(dtype, UFixed):
        return hcl_d.UFixedType.get(dtype.bits, dtype.fracs)
    if isinstance(dtype, Float):
        if dtype.bits == 16:
            return F16Type.get()
        if dtype.bits == 32:
            return F32Type.get()
        if dtype.bits == 64:
            return F64Type.get()
    if isinstance(dtype, Struct):
        types = [METHOD_NAME(t, signless) for t in dtype.dtype_dict.values()]
        return hcl_d.StructType.get(types)
    raise DTypeError(
        f"unknown type in hcl_dtype_to_mlir: {dtype} of type {type(dtype)}"
    )