{"record":{"id":"70db65f4539bced2","repo":"jax-ml/jax","slug":"unreduced-psum-scatter-only-accepts-inputs-that-ar","errorCode":null,"errorMessage":"unreduced_psum_scatter only accepts inputs that are unreduced. Got {x_aval.str_short(True)}","messagePattern":"unreduced_psum_scatter only accepts inputs that are unreduced\\. Got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/lax/parallel.py","lineNumber":2673,"sourceCode":"  if not isinstance(axis_name, tuple):\n    axis_name = (axis_name,)\n  if not axis_name:\n    return x\n  axis_size = _axis_size(axis_name, None)\n  def bind(leaf):\n    return unreduced_reduce_scatter_p.bind(\n        leaf, axis_name=axis_name, scatter_dimension=scatter_dimension,\n        axis_size=axis_size, tiled=tiled)\n  return tree_util.tree_map(bind, x)\n\nunreduced_reduce_scatter_p = core.Primitive('unreduced_reduce_scatter')\n\ndef _unreduced_reduce_scatter_effectful_abstract_eval(\n    x_aval, *, axis_name, scatter_dimension, axis_size, tiled\n):\n  _check_axis_names(axis_name, 'reduce_scatter')\n  if not x_aval.mat.unreduced:\n    raise ValueError('unreduced_psum_scatter only accepts inputs that are'\n                     f' unreduced. Got {x_aval.str_short(True)}')\n  # If intersection between x.unreduced & axis_name is empty, error\n  if not (x_aval.mat.unreduced & frozenset(axis_name)):\n    raise ValueError(\n        \"unreduced_psum_scatter is a Unreduced -> Varying collective. This\"\n        f\" means that the {axis_name=} passed to `unreduced_psum_scatter` must\"\n        \" be present in\"\n        f\" jax.typeof(x).mat.unreduced={x_aval.mat.unreduced}\"\n    )\n  if x_aval.mat.varying & set(axis_name):\n    raise ValueError(\n        \"unreduced_psum_scatter's input cannot be varying across the axis_name\"\n        f\" provided. Got x={x_aval.str_short(True)} and {axis_name=}\")\n\n  new_shape = list(x_aval.shape)\n  scatter_dim_input_size = x_aval.shape[scatter_dimension]\n  if tiled:\n    if scatter_dim_input_size % axis_size != 0:","sourceCodeStart":2655,"sourceCodeEnd":2691,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/lax/parallel.py#L2655-L2691","documentation":"`unreduced_psum_scatter` is an Unreduced -> Varying collective: it consumes a value whose `mat.unreduced` set is non-empty (e.g. the output of a psum-like computation tracked as unreduced-sum). If the input has no unreduced axes, the abstract eval rejects it immediately. Typically the producer op that marks the value unreduced is missing.","triggerScenarios":"Passing a plain array or a fully varying value into `unreduced_psum_scatter` without a preceding op producing `UnreducedKind.sum` state on the relevant axis.","commonSituations":"Building reduce-scatter pipelines manually in the new named-mesh API and skipping the unreduced-producing step; refactoring from `psum_scatter` where the unreduced tracking was implicit.","solutions":["Ensure the input comes from a computation marked unreduced (e.g. proper collective output) on the target axis","Check `jax.typeof(x).mat.unreduced` before the call and add the missing producer op","Use regular `psum_scatter` if you do not need unreduced semantics"],"exampleFix":"// before\ny = lax.unreduced_psum_scatter(x, axis_name='i', scatter_dimension=0, axis_size=8)\n// after\n# produce x so that jax.typeof(x).mat.unreduced contains 'i', e.g. via an unreduced-sum collective\ny = lax.unreduced_psum_scatter(unreduced_x, axis_name='i', scatter_dimension=0, axis_size=8)","handlingStrategy":"validation","validationCode":"if not jax.typeof(x).mat.unreduced:\n    raise ValueError(f'input not unreduced: {jax.typeof(x)}')\ny = lax.unreduced_psum_scatter(x, ...)","typeGuard":"def is_unreduced(x) -> bool:\n    return bool(jax.typeof(x).mat.unreduced)","tryCatchPattern":"try:\n    y = lax.unreduced_psum_scatter(x, ...)\nexcept ValueError as e:\n    if 'only accepts inputs that are unreduced' in str(e):\n        y = lax.psum_scatter(x, axis_name)  # fallback to standard collective\n    else:\n        raise","preventionTips":["Build reduce-scatter pipelines from one tested helper that guarantees unreduced inputs","Log jax.typeof(x).mat at pipeline stage boundaries"],"tags":["jax","collectives","mesh","spmd","reduce-scatter"],"backgroundTag":"jax-mat-axis-state-mismatch","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}