code: def upcast_emulated(
      src,
      dst,
      BLOCK_SIZE: tl.constexpr,
      exponent_bits: tl.constexpr,
      mantissa_bits: tl.constexpr,
      exponent_bias: tl.constexpr,
  ):
      exponent_compensator: tl.constexpr = 2.0 ** (127 - exponent_bias)
  
      numbits_src: tl.constexpr = 1 + exponent_bits + mantissa_bits
      tl.static_assert(
          (numbits_src == 8) or (numbits_src == 16),
          "numbits_src must be 8 or 16",
      )
      tl.static_assert(
          dst.dtype.element_ty == tl.float32,
          "dst dtype must be float32",
      )
  
      idxs = tl.program_id(0) * BLOCK_SIZE + tl.arange(0, BLOCK_SIZE)
  
      x = tl.load(src + idxs)
  
      if numbits_src == 8:
          x = x.to(tl.uint8, bitcast=True)
      elif numbits_src == 16:
          x = x.to(tl.uint16, bitcast=True)
  
      x = x.to(tl.uint32)
  
      mantissa_mask: tl.constexpr = (1 << mantissa_bits) - 1
      exponent_mask: tl.constexpr = (1 << exponent_bits) - 1
  
      mantissa = x & mantissa_mask
      exponent = (x >> mantissa_bits) & exponent_mask
      sign = x >> (numbits_src - 1)
  
      y = (
          (sign << 31)
          | (exponent << 23)
          | (mantissa << (23 - mantissa_bits))
      )
      y = y.to(tl.float32, bitcast=True)
      y = y * exponent_compensator
  
      tl.store(dst + idxs, y)
  
file_path: triton/python/test/unit/language/test_conversions.py
imports: import numpy
  import torch
  import pytest
  import triton
  import triton.language
label_desc: Use image node_id 9 for calling a global function with example usage: upcast_emulated(src, dst, BLOCK_SIZE, exponent_bits, mantissa_bits, exponent_bias) without return types