{"record":{"id":"cd4aa2f7dbffc613","repo":"jax-ml/jax","slug":"the-following-ordered-effects-are-not-supported-fo","errorCode":null,"errorMessage":"The following ordered effects are not supported for more than 1 device: {unsupported_effects}","messagePattern":"The following ordered effects are not supported for more than 1 device: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/interpreters/pxla.py","lineNumber":748,"sourceCode":"  log_priority = logging.WARNING if config.log_compiles.value else logging.DEBUG\n  if logger.isEnabledFor(log_priority):\n    logger.log(log_priority,\n               \"Compiling %s with global shapes and types %s. \"\n               \"Argument mapping: %s.\",\n               module_name, in_avals, in_shardings)\n\n  in_mlir_shardings = map(_to_logical_sharding, in_avals, in_shardings)\n  out_mlir_shardings = map(_to_logical_sharding, out_avals, out_shardings)\n  replicated_args = [False] * len(in_avals)\n  axis_ctx = sharding_impls.ShardingContext(num_devices, device_assignment,\n                                            abstract_mesh)\n\n  if num_devices > 1:\n    unsupported_effects = effects.ordered_effects.filter_in(closed_jaxpr.effects)\n    unsupported_effects = effects.shardable_ordered_effects.filter_not_in(\n        unsupported_effects)\n    if len(unsupported_effects) > 0:\n      raise ValueError(\n        \"The following ordered effects are not supported for \"\n        f\"more than 1 device: {unsupported_effects}\")\n  ordered_effects = list(effects.ordered_effects.filter_in(closed_jaxpr.effects))\n  arg_names = (\"\",) * num_const_args + jaxpr._debug_info.safe_arg_names(len(in_avals) - num_const_args)\n  with dispatch.log_elapsed_time(\n        \"Finished jaxpr to MLIR module conversion {fun_name} in {elapsed_time:.9f} sec\",\n        fun_name=module_name, event=dispatch.JAXPR_TO_MLIR_MODULE_EVENT):\n    lowering_result = mlir.lower_jaxpr_to_module(\n        module_name,\n        closed_jaxpr,\n        num_const_args=num_const_args,\n        ordered_effects=ordered_effects,\n        backend=backend,\n        platforms=platforms,\n        axis_context=axis_ctx,\n        in_avals=in_avals,\n        out_avals=out_avals,\n        donated_args=donated_invars,","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/interpreters/pxla.py#L730-L766","documentation":"Ordered effects (e.g. host callback ordered effects like print with ordered=True, or custom ordered effects) execute in sequence, which cannot be preserved when a computation is sharded across multiple devices. Lowering (via _cached_lowering_to_hlo) checks this and rejects ordered, non-shardable effects whenever num_devices > 1.","triggerScenarios":"A jitted/pjitted function over a multi-device mesh containing ordered effects — commonly jax.debug.print with ordered=True, or experimental host callback effects — while running with more than one device in the sharding.","commonSituations":"Debug prints left with ordered=True in multi-device pipelines; scaling single-GPU code to multi-GPU/TPU; custom effect implementations not marked shardable.","solutions":["Remove ordered=True (use unordered prints) or drop the debug print entirely in multi-device runs","Register the effect as shardable (effects.shardable_ordered_effects) if its semantics permit per-device execution","Run the computation on a single device if ordering is essential"],"exampleFix":"# before\njax.debug.print('x={}', x, ordered=True)  # inside multi-device pjit\n\n# after\njax.debug.print('x={}', x)  # unordered; or remove entirely","handlingStrategy":"validation","validationCode":"num_devices = len(jax.devices())\nif num_devices > 1:\n    # ensure no ordered effects in traced function\n    jaxpr = jax.make_jaxpr(fn)(*args)\n    from jax._src import effects\n    bad = effects.ordered_effects.filter_not_in(effects.shardable_ordered_effects).filter_in(jaxpr.jaxpr.effects)\n    assert not bad, f'ordered effects unsupported multi-device: {bad}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use ordered=True prints in multi-device code","Gate debug printing behind a single-device check"],"tags":["jax","effects","multi-device","ordered-effects","pjit","debug-print"],"backgroundTag":"unsupported-operation-in-distributed-mode","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}