{"record":{"id":"d7ea9f7e7441c44f","repo":"jax-ml/jax","slug":"uninitialized-memory-str-dtype","errorCode":null,"errorMessage":"{uninitialized_memory} + {str(dtype)}","messagePattern":"\\{uninitialized_memory\\} \\+ \\{str\\(dtype\\)\\}","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/interpret/utils.py","lineNumber":43,"sourceCode":"from jax._src.pallas import primitives\nfrom jax._src.util import safe_map\nimport jax.numpy as jnp\nimport numpy as np\n\n\ndef get_uninitialized_value(\n    dtype, uninitialized_memory: Literal[\"nan\", \"zero\"]\n):\n  if uninitialized_memory == \"nan\":\n    if jnp.issubdtype(dtype, jnp.floating):\n      return np.nan\n    elif jnp.issubdtype(dtype, jnp.integer):\n      return jnp.iinfo(dtype).max\n    elif jnp.issubdtype(dtype, jnp.bool):\n      return True\n  if uninitialized_memory == \"zero\":\n    return 0\n  raise NotImplementedError(uninitialized_memory + \" + \" + str(dtype))\n\n\ndef get_uninitialized_array(\n    shape, dtype, uninitialized_memory: Literal[\"nan\", \"zero\"]\n):\n  return jnp.full(\n      shape,\n      get_uninitialized_value(dtype, uninitialized_memory),\n      dtype,\n  )\n\n\ndef pad_to_block_dimension(\n    value, block_shape, uninitialized_memory: Literal[\"nan\", \"zero\"]\n):\n  \"\"\"Pads values so the shape evenly divides into block dimensions.\n\n  For example, if values has a shape of (33, 2, 5) with a block_shape of","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/interpret/utils.py#L25-L61","documentation":"get_uninitialized_value could not produce an uninitialized sentinel for the combination of uninitialized_memory mode and dtype. Only NaN (floating) and zero modes are supported; NaN for non-float or unrecognized dtype combos hits the NotImplementedError.","triggerScenarios":"Requesting uninitialized (padded/out-of-bounds) memory with uninitialized_memory='nan' for an integer/bool/bfloat16-unsupported dtype, or an unrecognized dtype, in interpret-mode reads.","commonSituations":"Kernels reading padded regions of integer accumulators in interpret mode; new/extended dtypes not yet covered by the sentinel table.","solutions":["Use uninitialized_memory='zero' if the dtype has no NaN sentinel","Avoid depending on OOB/padded reads for non-float dtypes; mask reads instead","File/patch support for the dtype in get_uninitialized_value if it should be supported"],"exampleFix":"// before\nparams = interpret.InterpretParams(uninitialized_memory='nan')  # with int32 buffers\n// after\nparams = interpret.InterpretParams(uninitialized_memory='zero')","handlingStrategy":"fallback","validationCode":"import jax.numpy as jnp\nmode = 'nan' if jnp.issubdtype(dtype, jnp.floating) else 'zero'","typeGuard":null,"tryCatchPattern":"try:\n    val = get_uninitialized_value(dtype, 'nan')\nexcept NotImplementedError:\n    val = 0  # fall back to zero for non-float dtypes","preventionTips":["Mask OOB/padded reads instead of consuming uninitialized sentinel values","Choose 'nan' mode only when all relevant buffers are floating point"],"tags":["jax","pallas","mosaic","dtype","not-implemented","interpret-mode"],"backgroundTag":"unsupported-dtype","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}