{"record":{"id":"5ae46ba6961370c7","repo":"jax-ml/jax","slug":"unsupported-block-size-type-type-bd","errorCode":null,"errorMessage":"Unsupported block size type: {type(bd)}","messagePattern":"Unsupported block size type: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic_gpu/pipeline.py","lineNumber":63,"sourceCode":"\nOOBFillMode = gpu_primitives.OOBFillMode\n\nclass PipelineCallback[T](Protocol):\n  \"\"\"A callback that returns the same type as the input.\"\"\"\n  def __call__(self, arg: T, /) -> T: ...\n\ntype BlockSpecPytree = Sequence[pl.BlockSpec | BlockSpecPytree]\ntype AbstractRefPytree = Sequence[state.AbstractRef | AbstractRefPytree]\n\n\ndef _get_block_size(bd: pl.BlockDim | int | None) -> int:\n  match bd:\n    case int():\n      return bd\n    case pl.Blocked() | pl.Element():\n      return bd.block_size\n    case _:\n      raise NotImplementedError(f\"Unsupported block size type: {type(bd)}\")\n\n\ndef _get_block_shape(spec: pallas_core.BlockSpec, ref_shape: tuple[int, ...]):\n  if spec.block_shape is None:\n    return ref_shape\n\n  block_shape = tuple(\n      _get_block_size(bd)\n      for bd in spec.block_shape\n      if not (bd is None or isinstance(bd, pl.Squeezed))\n  )\n  return block_shape\n\n\ndef _is_fully_in_bounds(\n    spec: pallas_core.BlockSpec, operand_shape: tuple[int, ...]\n) -> bool:\n  \"\"\"Returns whether all windowed accesses into an operand stay in bounds.\"\"\"","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic_gpu/pipeline.py#L45-L81","documentation":"When computing block sizes in the Mosaic GPU pipeline, a block dimension must be an int, pl.Blocked, or pl.Element. Any other type (e.g. None, custom object, or a pl-pipeline placeholder) raises NotImplementedError with the offending type name.","triggerScenarios":"Constructing a BlockSpec whose block_shape entries are unusual types — commonly a None or an unspecialized placeholder from using pallas pipeline APIs before grid specialization resolves them.","commonSituations":"Passing None block_shapes expecting full-shape blocks in contexts that call _get_block_size before defaults are applied; using stale pl.BlockSpec argument shapes across JAX version changes.","solutions":["Use concrete ints, pl.Blocked(...), or pl.Element(...) in block_shape","Ensure grid/blockspec construction goes through public pallas APIs so placeholders are resolved","Upgrade JAX if the value comes from internal pipeline plumbing"],"exampleFix":"# before\nbs = pl.BlockSpec(block_shape=(None, 128))\n# after\nbs = pl.BlockSpec(block_shape=(ref_len, 128))  # concrete ints / pl.Blocked","handlingStrategy":"type-guard","validationCode":"from jax.experimental import pallas as pl\nassert all(isinstance(b, (int, pl.Blocked, pl.Element)) for b in block_shape)","typeGuard":"def valid_block_spec(bd) -> bool:\n    from jax.experimental import pallas as pl\n    return isinstance(bd, (int, pl.Blocked, pl.Element))","tryCatchPattern":null,"preventionTips":["Use concrete ints or pl.Blocked/pl.Element in block_shape","Build BlockSpecs via public pallas APIs"],"tags":["pallas","mosaic-gpu","blockspec","not-implemented"],"backgroundTag":"unsupported-operation","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}