{"record":{"id":"f73308b403916676","repo":"jax-ml/jax","slug":"dma-partial-discharge-add-true-not-yet-implemented","errorCode":null,"errorMessage":"DMA partial discharge add=True not yet implemented.","messagePattern":"DMA partial discharge add=True not yet implemented\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/primitives.py","lineNumber":411,"sourceCode":"      pp.text(\" \"),\n      sp.pp_ref_transforms(context, src_ref),\n      pp.text(\" -> \"),\n      sp.pp_ref_transforms(context, dst_ref),\n      pp.text(\" \"),\n      sp.pp_ref_transforms(context, dst_sem),\n  ])\n\njax_core.pp_eqn_rules[dma_start_p] = _dma_start_pp_eqn\n\n\ndef dma_start_discharge_rule(\n    ctx, *args, tree, device_id_type,\n    priority, add\n):\n  # Note: we ignore the DMA priority in discharge rules.\n  del priority\n  if add:\n    raise NotImplementedError(\n        \"DMA partial discharge add=True not yet implemented.\")\n  src_ref, dst_ref, dst_sem, src_sem, device_id = _dma_unflatten(tree, args)\n  src_ref, src_transforms = _get_ref_and_transforms(src_ref)\n  dst_ref, dst_transforms = _get_ref_and_transforms(dst_ref)\n  dst_sem, dst_sem_transforms = _get_ref_and_transforms(dst_sem)\n  src_sem, src_sem_transforms = _get_ref_and_transforms(src_sem)\n\n  src_ref_aval, dst_ref_aval, dst_sem_aval, src_sem_aval, _ = _dma_unflatten(\n      tree, ctx.in_avals\n  )\n\n  _, dst_discharge, dst_sem_discharge, *maybe_src_sem_discharge = (\n      _dma_unflatten(tree, ctx.should_discharge)\n  )\n  dst_discharge = _get_ref(dst_discharge)\n  dst_sem_discharge = _get_ref(dst_sem_discharge)\n  is_remote = device_id is not None\n  src_sem_discharge = None","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/primitives.py#L393-L429","documentation":"The discharge rule for dma_start lowers queued DMAs into explicit memory effects when discharging state; partial-discharge accumulation (add=True, which would accumulate the DMA'd data additively) is not implemented, so it raises NotImplementedError.","triggerScenarios":"Running a transformation that triggers the dma_start discharge rule with add=True (partial discharge path), typically via certain pipelining or state-discharge passes in the Mosaic pipeline.","commonSituations":"Using advanced pipelining features or custom pipeline transformations that discharge DMA state with accumulation enabled; cutting-edge kernel code that combines DMA with partial state discharge; version changes where discharge logic became stricter.","solutions":["Use add=False for the DMA (full discharge instead of partial accumulation)","Restructure the kernel so accumulation happens via explicit loads/adds/stores after the DMA rather than during discharge","Update JAX — this is a known unimplemented corner and may land in a newer release","Report/check the JAX issue tracker for dma partial discharge support"],"exampleFix":"# before\ndma_start(src, dst, sem, add=True)  # later hits discharge rule\n\n# after\ndma_start(src, dst, sem, add=False)\n# then accumulate manually:\n# dst_ref[...] = dst_ref[...] + value","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n  run_with_discharge(...)\nexcept NotImplementedError as e:\n  if 'partial discharge' in str(e):\n    # retry with add=False and accumulate manually\n    run_with_discharge(..., dma_add=False)","preventionTips":["Avoid add=True on DMAs that will pass through discharge passes","Pin a known-good JAX version if you rely on pipelining internals","Watch upstream release notes for partial-discharge support"],"tags":["jax","pallas","mosaic","dma","discharge","not-implemented","pipelining"],"backgroundTag":"feature-not-implemented-yet","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}