{"record":{"id":"7b0638bc8927257e","repo":"jax-ml/jax","slug":"dynamic-grid-bounds-not-supported-in-the-mosaic-gp","errorCode":null,"errorMessage":"Dynamic grid bounds not supported in the Mosaic GPU lowering.","messagePattern":"Dynamic grid bounds not supported in the Mosaic GPU lowering\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic_gpu/lowering.py","lineNumber":777,"sourceCode":"      transforms=bm.transforms,\n  )\n\n\ndef lower_pipelined_jaxpr_to_module(\n    grid_mapping: pallas_core.GridMapping,\n    gpu_mesh: gpu_core.Mesh | None,\n    jax_mesh: mesh_lib.Mesh | None,\n    jaxpr: jax_core.Jaxpr,\n    params: gpu_core.CompilerParams,\n    cost_estimate: pallas_core.CostEstimate | None,\n    outer_traceback: xc.Traceback | None = None,\n) -> LoweringResult:\n  del cost_estimate  # Unused.\n\n  assert len(jaxpr.outvars) == 0\n  assert not grid_mapping.vmapped_dims\n  if grid_mapping.num_dynamic_grid_bounds:\n    raise NotImplementedError(\n        \"Dynamic grid bounds not supported in the Mosaic GPU lowering.\"\n    )\n  if grid_mapping.num_index_operands:\n    raise NotImplementedError(\n        \"Scalar prefetch not supported in Mosaic GPU lowering.\"\n    )\n\n  block_mappings = grid_mapping.block_mappings\n  _check_block_mappings(block_mappings, jaxpr.debug_info)\n  in_block_mappings, out_block_mappings = util.split_list(\n      block_mappings, [grid_mapping.num_inputs]\n  )\n\n  grid: Sequence[int]\n  if gpu_mesh:\n    assert isinstance(gpu_mesh, gpu_core.Mesh)\n    block = (128 * (gpu_mesh.num_threads or 1), 1, 1)\n    grid = gpu_mesh.grid","sourceCodeStart":759,"sourceCodeEnd":795,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic_gpu/lowering.py#L759-L795","documentation":"Raised by lower_pipelined_jaxpr_to_module for Mosaic GPU: pipelined kernels must have fully static grid bounds, because the pipelining schedule is computed at compile time; dynamic (runtime-dependent) grid bounds raise NotImplementedError.","triggerScenarios":"Thrown at jax/_src/pallas/mosaic_gpu/lowering.py:777 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass static Python-int grid bounds to pallas_call instead of data-dependent (traced) values","Compute the grid size on the host and launch the kernel with a fixed grid","Choose a backend/lowering that supports dynamic grid bounds, if available"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}