{"record":{"id":"6d4c39cc4f01c0c0","repo":"jax-ml/jax","slug":"scope-spec-trace-scope-not-supported","errorCode":null,"errorMessage":"Scope {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":378,"sourceCode":"      self,\n      spec: ProfilerSpec,\n      smem_buffer: ir.Value,\n      gmem_buffer: ir.Value,\n      wrap_in_custom_primitive: bool,\n  ):\n    i32 = ir.IntegerType.get_signless(32)\n    index = ir.IndexType.get()\n    self.spec = spec\n    self.entries_per_wg = spec.entries_per_warpgroup\n    self.wrap_in_custom_primitive = wrap_in_custom_primitive\n    if spec.trace_scope == ThreadSubset.WARP:\n      trace_idx = warp_idx(sync=False)\n      scope_size = WARP_SIZE\n    elif spec.trace_scope == ThreadSubset.WARPGROUP:\n      trace_idx = warpgroup_idx(sync=False)\n      scope_size = WARPGROUP_SIZE\n    else:\n      raise NotImplementedError(f\"Scope {spec.trace_scope} not supported\")\n    trace_offset = arith.index_cast(\n        index, arith.muli(trace_idx, c(self.entries_per_wg, i32))\n    )\n    smem_buffer = memref_slice(smem_buffer, ds(trace_offset, self.entries_per_wg))\n    is_profiling_thread = arith.cmpi(\n        arith.CmpIPredicate.eq,\n        arith.remui(thread_idx(), c(scope_size, i32)),\n        c(0, i32),\n    )\n    # Hopefully mem2reg will remove the allocation.\n    offset = memref.alloca(ir.MemRefType.get((), index), [], [])\n    memref.store(c(0, index), offset, [])\n    self.ctx = _ProfilerCtx(\n        start=globaltimer(\"low\"),\n        is_profiling_thread=is_profiling_thread,\n        smem_buffer=smem_buffer,\n        gmem_buffer=gmem_buffer,\n        offset=offset,","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/profiler.py#L360-L396","documentation":"When generating the profiling instrumentation, the active trace scope must be WARP or WARPGROUP to determine which thread writes the trace (warp_idx vs warpgroup_idx). Any other scope on the spec raises NotImplementedError at instrumentation build time.","triggerScenarios":"Building a profiled kernel with a spec whose trace_scope is not WARP/WARPGROUP (again usually via post-construction mutation, since __init__ validates).","commonSituations":"Sharing/mutating a ProfilerSpec across differently-scoped builds.","solutions":["Construct a fresh ProfilerSpec with WARP or WARPGROUP scope","Do not mutate spec.trace_scope after construction"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat ProfilerSpec as immutable after construction","Construct specs with supported scopes only"],"tags":["profiling","mosaic","gpu","argument-validation"],"backgroundTag":"unsupported-enum-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}