{"record":{"id":"5238274618ecaa81","repo":"jax-ml/jax","slug":"allocated-too-many-names","errorCode":null,"errorMessage":"Allocated too many names","messagePattern":"Allocated too many names","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/profiler.py","lineNumber":249,"sourceCode":"    return jax.ShapeDtypeStruct(\n        (self._num_traces(grid, block) * self.entries_per_warpgroup,),\n        jnp.uint32,\n    )\n\n  def smem_i32_elements(self, block: tuple[int, ...]):\n    num_traces = self._num_traces((), block)\n    return int(num_traces * self.entries_per_warpgroup)\n\n  def smem_bytes(self, block: tuple[int, ...]):\n    bytes_per_entry = 4\n    return self.smem_i32_elements(block) * bytes_per_entry\n\n  def intern_name(self, name: str) -> int:\n    if (name_id := self.interned_names.get(name, None)) is not None:\n      return name_id\n    name_id = self.interned_names[name] = len(self.interned_names)\n    if name_id & self.EXIT:\n      raise RuntimeError(\"Allocated too many names\")\n    return name_id\n\n  def dump(self, buffer, f, grid: tuple[int, ...], block: tuple[int, ...]):\n    buffer = np.asarray(buffer)\n    num_blocks = math.prod(grid)\n    traces_per_block = self._num_traces((), block)\n    entries = buffer.reshape(\n        num_blocks, traces_per_block, self.entries_per_warpgroup\n    )\n    start_times = entries[..., 0]\n    sm_ids = entries[..., 1]\n    traces_used = entries[..., 2]\n    entries_used = traces_used + 3\n    if np.any(entries_used > self.entries_per_warpgroup):\n      raise RuntimeError(\"Insufficient space to capture a full trace\")\n    traces = entries[..., 3:]\n\n    # Estimate the overhead of profiling.","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/profiler.py#L231-L267","documentation":"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.","triggerScenarios":"Interning more than 2,147,483,648 distinct names into a single ProfilerSpec/collector instance.","commonSituations":"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.","solutions":["Reuse/limit the set of region names rather than generating unbounded unique ones","Restart the profiling session with a fresh collector"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if len(collector.interned_names) + 1 >= (1 << 31):\n    raise RuntimeError('name space exhausted')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a fixed vocabulary of region names","Never intern unbounded generated names"],"tags":["profiling","mosaic","gpu","resource-exhaustion"],"backgroundTag":"identifier-space-exhausted","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}