jax-ml/jax · error · RuntimeError

Allocated too many names

Error message

Allocated too many names

What it means

intern_name assigns sequential IDs to profiled region names and uses the top bit (EXIT = 1<<31) as a marker flag. Once 2^31 names have been interned the ID space collides with that flag, so it refuses to continue.

Source

Thrown at jax/experimental/mosaic/gpu/profiler.py:249

    return jax.ShapeDtypeStruct(
        (self._num_traces(grid, block) * self.entries_per_warpgroup,),
        jnp.uint32,
    )

  def smem_i32_elements(self, block: tuple[int, ...]):
    num_traces = self._num_traces((), block)
    return int(num_traces * self.entries_per_warpgroup)

  def smem_bytes(self, block: tuple[int, ...]):
    bytes_per_entry = 4
    return self.smem_i32_elements(block) * bytes_per_entry

  def intern_name(self, name: str) -> int:
    if (name_id := self.interned_names.get(name, None)) is not None:
      return name_id
    name_id = self.interned_names[name] = len(self.interned_names)
    if name_id & self.EXIT:
      raise RuntimeError("Allocated too many names")
    return name_id

  def dump(self, buffer, f, grid: tuple[int, ...], block: tuple[int, ...]):
    buffer = np.asarray(buffer)
    num_blocks = math.prod(grid)
    traces_per_block = self._num_traces((), block)
    entries = buffer.reshape(
        num_blocks, traces_per_block, self.entries_per_warpgroup
    )
    start_times = entries[..., 0]
    sm_ids = entries[..., 1]
    traces_used = entries[..., 2]
    entries_used = traces_used + 3
    if np.any(entries_used > self.entries_per_warpgroup):
      raise RuntimeError("Insufficient space to capture a full trace")
    traces = entries[..., 3:]

    # Estimate the overhead of profiling.

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Reuse/limit the set of region names rather than generating unbounded unique ones
  2. Restart the profiling session with a fresh collector
Defensive patterns

Strategy: validation

Validate before calling

if len(collector.interned_names) + 1 >= (1 << 31):
    raise RuntimeError('name space exhausted')

Prevention

When it happens

Trigger: Interning more than 2,147,483,648 distinct names into a single ProfilerSpec/collector instance.

Common situations: Effectively unreachable in practice — a runaway loop interning dynamically generated names (e.g. f'region_{i}' for billions of i) in a long-running session.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/5238274618ecaa81. Report an issue: GitHub.