code: def dynamic_ducc_fft_hlo(
      result_type: ir.Type,
      input: ir.Value,
      *,
      input_dtype: np.dtype,
      ndims: int,
      input_shape: ir.Value,
      strides_in: ir.Value,
      strides_out: ir.Value,
      scale: ir.Value,
      fft_type: FftType,
      fft_lengths: list[int],
      result_shape: ir.Value,
  ):
      """DUCC FFT kernel for CPU, with support for dynamic shapes."""
      a_type = ir.RankedTensorType(input.type)
  
      fft_lengths = list(fft_lengths)
      descriptor_bytes = _dynamic_ducc_fft_descriptor(
          input_dtype, ndims, fft_type, fft_lengths
      )
  
      # PocketFft does not allow size 0 dimensions, but we handled this in fft.py
      assert 0 not in a_type.shape
  
      u8_type = ir.IntegerType.get_unsigned(8)
      descriptor = hlo.constant(
          ir.DenseElementsAttr.get(
              np.frombuffer(descriptor_bytes, dtype=np.uint8),
              type=u8_type,
          )
      )
      layout = tuple(range(ndims - 1, -1, -1))
      return custom_call(
          "dynamic_ducc_fft",
          result_types=[result_type],
          operands=[
              descriptor,
              input,
              input_shape,
              strides_in,
              strides_out,
              scale,
          ],
          operand_layouts=[[0], layout, [0], [0], [0], [0]],
          result_layouts=[layout],
          result_shapes=[result_shape],
      ).results
  
file_path: jax/jaxlib/ducc_fft.py
imports: import jaxlib.mlir.ir
  import jaxlib.mlir.dialects.stablehlo
  from .hlo_helpers import custom_call
  from .cpu import _ducc_fft
  import numpy
  from jaxlib import xla_client
label_desc: Use image node_id 2 for calling a global function with example usage: dynamic_ducc_fft_hlo(result_type, input) and returns: custom_call