{"record":{"id":"3f5e7c40245409b6","repo":"jax-ml/jax","slug":"scope-self-spec-trace-scope-not-supported","errorCode":null,"errorMessage":"Scope {self.spec.trace_scope} not supported","messagePattern":"Scope (.+?) not supported","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/profiler.py","lineNumber":482,"sourceCode":"    index = ir.IndexType.get()\n    i32 = ir.IntegerType.get_signless(32)\n\n    with self._profiler_ctx() as ctx:\n      gpu.barrier()  # Make sure all warpgroups are done.\n\n      block_idx = c(0, index)\n      for dim in gpu.Dimension:\n        block_idx = arith.addi(\n            arith.muli(block_idx, gpu.grid_dim(dim)), gpu.block_id(dim)\n        )\n      if self.spec.trace_scope == ThreadSubset.WARP:\n        trace_idx = warp_idx(sync=False)\n        traces_per_block = math.prod(block) // WARP_SIZE\n      elif self.spec.trace_scope == ThreadSubset.WARPGROUP:\n        trace_idx = warpgroup_idx(sync=False)\n        traces_per_block = math.prod(block) // WARPGROUP_SIZE\n      else:\n        raise NotImplementedError(f\"Scope {self.spec.trace_scope} not supported\")\n      global_trace_idx = arith.addi(\n          arith.muli(block_idx, c(traces_per_block, index)),\n          arith.index_cast(index, trace_idx),\n      )\n      start_offset = arith.muli(global_trace_idx, c(self.entries_per_wg, index))\n      wg_gmem_buffer = memref_slice(\n          ctx.gmem_buffer, ds(start_offset, self.entries_per_wg)\n      )\n      with when(ctx.is_profiling_thread):\n        memref.store(ctx.start, wg_gmem_buffer, [c(0, index)])\n        memref.store(smid(), wg_gmem_buffer, [c(1, index)])\n        num_traces = arith.index_cast(i32, memref.load(ctx.offset, []))\n        memref.store(num_traces, wg_gmem_buffer, [c(2, index)])\n        traces = vector.load(\n            ir.VectorType.get((self.entries_per_wg - 3,), i32),\n            ctx.smem_buffer,\n            [c(0, index)],\n        )","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/profiler.py#L464-L500","documentation":"During finalize() (called from _launch), the code computes the global trace index from block/warp or warpgroup indices; a scope other than WARP/WARPGROUP has no defined trace layout and raises NotImplementedError before emitting the final copy of traces to global memory.","triggerScenarios":"A spec with an unsupported trace_scope reaching kernel launch/finalize — practically only through attribute mutation after construction.","commonSituations":"Long-lived mutable spec objects reused across launches.","solutions":["Recreate the ProfilerSpec with a supported scope","Treat ProfilerSpec as immutable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not mutate spec.trace_scope; rebuild the spec instead"],"tags":["profiling","mosaic","gpu","immutability"],"backgroundTag":"unsupported-enum-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}