{"record":{"id":"d1e3743c905858af","repo":"jax-ml/jax","slug":"memory-space-self-memory-space-is-not-supported","errorCode":null,"errorMessage":"Memory space {self.memory_space} is not supported by mesh {self.mesh}","messagePattern":"Memory space (.+?) is not supported by mesh (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/core.py","lineNumber":308,"sourceCode":"\n  def __call__(self, shape: tuple[int, ...], dtype: jnp.dtype):\n    # A convenience function for constructing MemoryRef types of ShapedArrays.\n    return self.from_type(jax_core.ShapedArray(shape, dtype))\n\n  def __str__(self) -> str:\n    return self.value\n\n\n@dataclasses.dataclass(frozen=True)\nclass CoreMemorySpace:\n  \"\"\"A memory space tied to a Pallas mesh.\"\"\"\n\n  memory_space: Any\n  mesh: Mesh\n\n  def __post_init__(self):\n    if not self.memory_space in self.mesh.supported_memory_spaces:\n      raise ValueError(\n          f\"Memory space {self.memory_space} is not supported by mesh\"\n          f\" {self.mesh}\"\n      )\n\n  def __call__(self, shape: Sequence[int], dtype: jnp.dtype[Any]):\n    return MemoryRef(jax_core.ShapedArray(tuple(shape), dtype), self)\n\n  def __str__(self) -> str:\n    return f\"{self.memory_space}@{self.mesh.core_type}\"\n\n  def __repr__(self) -> str:\n    return f\"{self.memory_space!r}@{self.mesh.core_type!r}\"\n\n  @property\n  def name(self) -> Any:\n    return f\"{self.memory_space}@{self.mesh.core_type.name}\"\n\n  @property","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/core.py#L290-L326","documentation":"Pallas meshes declare which memory spaces (e.g. HBM, VMEM/SMEM per backend) they support. AbstractMemorySpec.__post_init__ (grid/mesh helpers) validates that the requested memory_space appears in mesh.supported_memory_spaces and rejects mismatches, preventing kernels from allocating in memory the target doesn't offer.","triggerScenarios":"Creating a Mesh-related memory spec with a memory space string/object not in the mesh's supported list — e.g. requesting 'vmem' on a mesh whose backend only supports HBM/SMEM names, or mixing TPU (VMEM) and GPU (SMEM) memory-space constants.","commonSituations":"Porting a TPU Pallas kernel (using VMEM) to GPU where the space is named differently; typos in memory space names; backend version differences in supported spaces.","solutions":["Print mesh.supported_memory_spaces and use one of those exact values","Use backend-provided constants (e.g. tpu.VMEM / triton.SMEM) instead of raw strings","Ensure the mesh was constructed for the backend you target"],"exampleFix":"# before\nspec = pl.core.AbstractMemorySpec(memory_space='vmem', mesh=mesh)  # GPU mesh\n# after\nfrom jax.experimental.pallas import triton as pl_gpu\nspec = pl.core.AbstractMemorySpec(memory_space=pl_gpu.SMEM, mesh=mesh)","handlingStrategy":"validation","validationCode":"assert memory_space in mesh.supported_memory_spaces, (\n    f'{memory_space} not in {mesh.supported_memory_spaces}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always read supported_memory_spaces off the mesh before choosing a space","Use backend constants (VMEM/SMEM) rather than string literals"],"tags":["jax","pallas","memory-space","mesh","gpu","tpu"],"backgroundTag":"unsupported-configuration-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}