{"record":{"id":"fc8e13ccd65d7d9f","repo":"jax-ml/jax","slug":"b-scale-address-calculation-for-multiple-n-tiles","errorCode":null,"errorMessage":"B scale address calculation for multiple N tiles","messagePattern":"B scale address calculation for multiple N tiles","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/tcgen05.py","lineNumber":601,"sourceCode":"      assert a_desc_base is not None\n      a_offset = mi * a_m_group_stride + ki * a_k_group_stride\n      a_mk = (a_desc_base[0], a_desc_base[1] + mma_utils.encode_addr(a_offset))\n    b_offset = ni * b_n_group_stride + ki * b_k_group_stride\n    b_nk = (b_desc_base[0], b_desc_base[1] + mma_utils.encode_addr(b_offset))\n    if a_sparse_addr_base is not None:\n      if n_groups != 1 or m_groups != 1:\n        raise NotImplementedError(\"A sparse metadata address calculation for multiple tiles\")\n      sparse_group_elems = 8 if utils.bitwidth(mma_a_element_type) == 4 else 4\n      # Each sparse group has 2 entries, each TMEM column holds 16 i2 entries.\n      cols_per_k_group = k_group_elems // sparse_group_elems * 2 // 16\n      a_sparse_addr = arith.addi(a_sparse_addr_base, utils.c(ki * cols_per_k_group, i32))\n    else:\n      a_sparse_addr = None\n    if a_scale_addr_base is not None and b_scale_addr_base is not None:\n      if m_groups != 1:\n        raise NotImplementedError(\"A scale address calculation for multiple M tiles\")\n      if n_groups != 1:\n        raise NotImplementedError(\"B scale address calculation for multiple N tiles\")\n      assert scale_block is not None  # For type checkers.\n      assert k_group_elems % (scale_block * 4) == 0\n      assert m_group_elems % 32 == 0 and n_group_elems % (8 * num_cta) == 0\n      k_scales_per_group = k_group_elems // (scale_block * 4)\n      a_scale_addr = arith.addi(\n          a_scale_addr_base,\n          utils.c(ki * k_scales_per_group * a_scale_m_stride, i32),\n      )\n      b_scale_addr = arith.addi(\n          b_scale_addr_base,\n          utils.c(ki * k_scales_per_group * b_scale_n_stride, i32)\n      )\n    else:\n      a_scale_addr = b_scale_addr = None\n    acc = accumulate if ki == 0 else true\n    ni_lane_group, ni_col = ni // n_col_groups, ni % n_col_groups\n    d_offset = (\n        ((ni_lane_group * lanes_per_n_group) << 16)","sourceCodeStart":583,"sourceCodeEnd":619,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/tcgen05.py#L583-L619","documentation":"Block-scale TMEM addressing for the B scale tensor across multiple N tiles is not implemented; when both scales are supplied, mma requires n_groups == 1.","triggerScenarios":"Block-scaled mma() with a_scale/b_scale supplied and n_groups > 1 (N larger than one tile).","commonSituations":"Wide-N MXFP8 GEMMs where N > 256 per tile; auto-tiler choosing multiple N groups with scaling enabled.","solutions":["Loop over N outside mma and issue one call per N tile","Set per-call n so that n_groups == 1"],"exampleFix":"# before\ntcgen05.mma(a, b, d, a_scale=asc, b_scale=bsc, n=512)  # n_groups=2\n# after\nfor ni in range(2):\n  tcgen05.mma(a, b.slice(ni), d.slice(ni), a_scale=asc, b_scale=bsc, n=256)","handlingStrategy":"validation","validationCode":"assert n_groups == 1  # block-scaled B scale addressing supports single N tile","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Loop over N outside mma for scaled kernels","Size per-call n to a single tile"],"tags":["gpu","mosaic","tcgen05","block-scaling","not-implemented","tiling"],"backgroundTag":"unsupported-operation","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}