{"record":{"id":"11d4c9fe2e7560ed","repo":"jax-ml/jax","slug":"unsupported-memory-space-ref-type-memory-space","errorCode":null,"errorMessage":"Unsupported memory space: {ref_type.memory_space}","messagePattern":"Unsupported memory space: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/experimental/mosaic/gpu/dialect_lowering.py","lineNumber":583,"sourceCode":"      assert isinstance(tiling_transform, lc.TileTransform)\n\n      def store_tiled(optimized: bool):\n        fragmented_array.store_tiled(\n            unwrapped_ref, swizzle, optimized,\n            tiling_rank=len(tiling_transform.tiling),\n            atomic=atomic\n        )\n\n      _retry_on_failure(store_tiled, optimized)\n    else:\n\n      def store_untiled(optimized: bool):\n        fragmented_array.store_untiled(\n            ref, optimized=optimized, swizzle=swizzle, atomic=atomic\n        )\n      _retry_on_failure(store_untiled, optimized)\n  else:\n    raise ValueError(f\"Unsupported memory space: {ref_type.memory_space}\")\n\n  if ctx.auto_barriers:\n    utils.warpgroup_barrier()  # Make sure the writes have completed.\n\n  return []\n\n\n@_register_lowering(mgpu.AsyncStoreSmemOp)\ndef _async_store_smem_op_lowering_rule(\n    ctx: LoweringContext, op: mgpu.AsyncStoreSmemOp\n) -> Sequence[ir.Value]:\n  index = ir.IndexType.get()\n\n  [to_store_layout] = inference_utils.in_layouts(op)\n  value = _fragmented_array_from_ir(op.valueToStore, to_store_layout)\n  layout = layouts_lib.from_layout_attr(to_store_layout)\n  if not isinstance(layout, fa.TiledLayout):\n    raise NotImplementedError(f\"Expected TiledLayout, got {type(layout)}\")","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/mosaic/gpu/dialect_lowering.py#L565-L601","documentation":"The vector store lowering only supports SMEM (memory_space == 1 path) and the GMEM/transforms path; any other memory space on the destination ref raises this ValueError.","triggerScenarios":"Storing a fragmented array to a memref with memory_space other than SMEM or None/GMEM-with-transforms in _vector_store_op_lowering_rule.","commonSituations":"Storing to thread-local or tensor-memory refs; using custom memref allocations with unusual address space attributes in a Mosaic kernel.","solutions":["Store to shared memory or a plain global-memory ref with proper transforms","Allocate destinations with mosaic's alloc/smem helpers rather than raw memref.alloc with custom memory spaces"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"space = ref.type.memory_space\nassert space is None or int(space) == 1, f'cannot store to memory space {space}'","typeGuard":"def storable_ref(ref) -> bool:\n    return ref.type.memory_space is None or int(ref.type.memory_space) == 1","tryCatchPattern":null,"preventionTips":["Store to SMEM (memory_space 1) or GMEM with transforms"],"tags":["jax","mosaic","gpu","memory-space","store"],"backgroundTag":"unsupported-memory-space","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}