{"record":{"id":"23073126d78323bb","repo":"jax-ml/jax","slug":"mesh-has-self-num-subcores-subcores-but-the-cur","errorCode":null,"errorMessage":"Mesh has {self.num_subcores} subcores, but the current TPU chip has only {sc_info.num_subcores} subcores","messagePattern":"Mesh has (.+?) subcores, but the current TPU chip has only (.+?) subcores","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/sc_core.py","lineNumber":134,"sourceCode":"class VectorSubcoreMesh(pallas_core.Mesh):\n  core_axis_name: str\n  subcore_axis_name: str\n  num_cores: int = dataclasses.field(\n      default_factory=lambda: get_sparse_core_info().num_cores\n  )\n  num_subcores: int = dataclasses.field(\n      default_factory=lambda: get_sparse_core_info().num_subcores\n  )\n\n  def __post_init__(self):\n    sc_info = get_sparse_core_info()\n    if self.num_cores > sc_info.num_cores:\n      raise ValueError(\n          f\"Mesh has {self.num_cores} cores, but the current TPU chip has only\"\n          f\" {sc_info.num_cores} SparseCores\"\n      )\n    if self.num_subcores > sc_info.num_subcores:\n      raise ValueError(\n          f\"Mesh has {self.num_subcores} subcores, but the current TPU chip has\"\n          f\" only {sc_info.num_subcores} subcores\"\n      )\n\n  @property\n  def core_type(self) -> tpu_core.CoreType:\n    return tpu_core.CoreType.SC_VECTOR_SUBCORE\n\n  @property\n  def default_memory_space(self) -> tpu_core.MemorySpace:\n    return tpu_core.MemorySpace.HBM\n\n  @property\n  def shape(self):\n    return collections.OrderedDict({\n        self.core_axis_name: self.num_cores,\n        self.subcore_axis_name: self.num_subcores,\n    })","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/sc_core.py#L116-L152","documentation":"VectorSubcoreMesh.__post_init__ validates num_subcores against the number of subcores per SparseCore on the current chip. A value larger than the hardware's subcore count fails at construction time.","triggerScenarios":"Building a VectorSubcoreMesh whose num_subcores exceeds get_sparse_core_info().num_subcores; default (num_subcores default_factory) normally matches hardware, so this happens when overriding it.","commonSituations":"Manually setting num_subcores for a different chip generation; assuming 2x subcore count relative to actual hardware.","solutions":["Omit num_subcores so it defaults to the hardware value","Set num_subcores = get_sparse_core_info().num_subcores"],"exampleFix":"# before\nmesh = pl_mosaic.VectorSubcoreMesh(..., num_subcores=8)\n# after\nmesh = pl_mosaic.VectorSubcoreMesh(..., num_subcores=get_sparse_core_info().num_subcores)","handlingStrategy":"validation","validationCode":"n = get_sparse_core_info().num_subcores\nassert kwargs.get('num_subcores', n) <= n","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Leave num_subcores at its default","Query hardware before constructing meshes"],"tags":["jax","pallas","tpu","hardware-mismatch","sparsecore"],"backgroundTag":"resource-count-exceeds-hardware","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}