parameters: (udf, type_signature)
return_statement: return res
docstring: Compile ``udf`` with `numba`
  
      Compile a python callable function ``udf`` with
      `numba.cuda.compile_ptx_for_current_device(device=True)` using
      ``type_signature`` into CUDA PTX together with the generated output type.
  
      The output is expected to be passed to the PTX parser in `libcudf`
      to generate a CUDA device function to be inlined into CUDA kernels,
      compiled at runtime and launched.
  
      Parameters
      --------
      udf:
        a python callable function
  
      type_signature:
        a tuple that specifies types of each of the input parameters of ``udf``.
        The types should be one in `numba.types` and could be converted from
        numpy types with `numba.numpy_support.from_dtype(...)`.
  
      Returns
      --------
      ptx_code:
        The compiled CUDA PTX
  
      output_type:
        An numpy type
docstring_summary: Compile ``udf`` with `numba`
docstring_tokens: Compile udf with numba
function: def compile_udf(udf, type_signature):
      """Compile ``udf`` with `numba`
  
      Compile a python callable function ``udf`` with
      `numba.cuda.compile_ptx_for_current_device(device=True)` using
      ``type_signature`` into CUDA PTX together with the generated output type.
  
      The output is expected to be passed to the PTX parser in `libcudf`
      to generate a CUDA device function to be inlined into CUDA kernels,
      compiled at runtime and launched.
  
      Parameters
      --------
      udf:
        a python callable function
  
      type_signature:
        a tuple that specifies types of each of the input parameters of ``udf``.
        The types should be one in `numba.types` and could be converted from
        numpy types with `numba.numpy_support.from_dtype(...)`.
  
      Returns
      --------
      ptx_code:
        The compiled CUDA PTX
  
      output_type:
        An numpy type
  
      """
      import cudf.core.udf
  
      key = make_cache_key(udf, type_signature)
      res = _udf_code_cache.get(key)
      if res:
          return res
  
      # We haven't compiled a function like this before, so need to fall back to
      # compilation with Numba
      ptx_code, return_type = cuda.compile_ptx_for_current_device(
          udf, type_signature, device=True
      )
      if not isinstance(return_type, cudf.core.udf.typing.MaskedType):
          output_type = numpy_support.as_dtype(return_type).type
      else:
          output_type = return_type
  
      # Populate the cache for this function
      res = (ptx_code, output_type)
      _udf_code_cache[key] = res
  
      return res
function_tokens: def compile_udf ( udf , type_signature ) : import cudf . core . udf key = make_cache_key ( udf , type_signature ) res = _udf_code_cache . get ( key ) if res : return res # We haven't compiled a function like this before, so need to fall back to # compilation with Numba ptx_code , return_type = cuda . compile_ptx_for_current_device ( udf , type_signature , device = True ) if not isinstance ( return_type , cudf . core . udf . typing . MaskedType ) : output_type = numpy_support . as_dtype ( return_type ) . type else : output_type = return_type # Populate the cache for this function res = ( ptx_code , output_type ) _udf_code_cache [ key ] = res return res