{"record":{"id":"0bfe88e6e588c019","repo":"jax-ml/jax","slug":"dma-start-not-implemented-in-lojax-yet","errorCode":null,"errorMessage":"dma_start not implemented in LoJAX yet.","messagePattern":"dma_start not implemented in LoJAX yet\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/primitives.py","lineNumber":325,"sourceCode":"        for k_ in k:\n          effs.add(jax_core.NamedAxisEffect(k_))\n  return effs\n\n\ndma_start_p = jax_core.Primitive('dma_start')\ndma_start_p.multiple_results = True\n\ndef _dma_is_high(*avals, **params):\n  return any(aval.is_high for aval in avals)\n\ndma_start_p.is_high = _dma_is_high\n\ndef _dma_start_to_lojax(*args, tree, device_id_type, priority, add):\n  src_ref, dst_ref, dst_sem, src_sem, device_id = _dma_unflatten(tree, args)\n  src_ref_aval = jax_core.typeof(_get_ref(src_ref))\n  dst_ref_aval = jax_core.typeof(_get_ref(dst_ref))\n  if not (src_ref_aval.is_high and dst_ref_aval.is_high):\n    raise NotImplementedError(\"dma_start not implemented in LoJAX yet.\")\n  dst_sem_aval = jax_core.typeof(_get_ref(dst_sem))\n  if dst_sem_aval.is_high:\n    raise NotImplementedError(\"dma_start not implemented in LoJAX yet.\")\n  if _get_ref(src_sem) is not None:\n    if jax_core.typeof(_get_ref(src_sem)).is_high:\n      raise NotImplementedError(\"dma_start not implemented in LoJAX yet.\")\n  src_ref_aval.inner_aval.dma_start(\n      src_ref,\n      dst_ref,\n      src_sem,\n      dst_sem,\n      device_id=device_id,\n      priority=priority,\n      device_id_type=device_id_type,\n      add=add,\n  )\n  return []\ndma_start_p.to_lojax = _dma_start_to_lojax","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/primitives.py#L307-L343","documentation":"When a dma_start is lowered into LoJAX (single-device/multi-core) form, both the source and destination refs must be 'high' (per-core global) refs. If either the src or dst ref is not high, the LoJAX lowering does not know how to route the copy and raises NotImplementedError.","triggerScenarios":"dma_start with a src or dst ref whose aval has is_high == False while running under the LoJAX lowering path (e.g. refs created inside a per-core context being used for a cross-core copy).","commonSituations":"Running multi-core (LoJAX) Pallas kernels where buffers were allocated in core-local space; mixing core-local scratch refs into DMA operations.","solutions":["Allocate/rebind the src and dst buffers as high (global) refs so is_high is true for both","Restructure so the DMA only references globally visible buffers, with local processing done via ordinary loads/stores","Check the JAX version — LoJAX dma_start coverage may have expanded"],"exampleFix":"// no user-level one-liner; pattern:\n# before: src_ref is core-local (is_high=False)\ndma_start(src_ref, dst_ref, sem, ...)\n\n# after: obtain a high/global view for both endpoints\nglobal_src = get_high_ref(...)\nglobal_dst = get_high_ref(...)\ndma_start(global_src, global_dst, sem, ...)","handlingStrategy":"fallback","validationCode":"src_h = jax_core.typeof(get_ref(src_ref)).is_high\ndst_h = jax_core.typeof(get_ref(dst_ref)).is_high\nassert src_h and dst_h, \"both DMA endpoints must be high refs under LoJAX\"","typeGuard":"def is_high_ref(r) -> bool:\n  import jax._src.core as c\n  return c.typeof(r).is_high","tryCatchPattern":"try:\n  _dma_start_to_lojax(...)\nexcept NotImplementedError:\n  # fall back to ordinary load/store copy within one core","preventionTips":["Allocate DMA endpoints as high/global refs in multi-core kernels","Keep core-local buffers out of dma_start arguments"],"tags":["jax","pallas","mosaic","lojax","dma","not-implemented","tpu"],"backgroundTag":"dma-not-implemented-for-lowering","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}