{"record":{"id":"c5988baa8844fe20","repo":"jax-ml/jax","slug":"unsupported-cache-modifier-cache-modifier","errorCode":null,"errorMessage":"unsupported cache modifier: {cache_modifier}","messagePattern":"unsupported cache modifier: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/triton/lowering.py","lineNumber":2024,"sourceCode":"_STR_TO_EVICTION_POLICY = {str(e): e for e in tt_dialect.EvictionPolicy}\n_STR_TO_CACHE_MODIFIER = {str(c): c for c in tt_dialect.CacheModifier}\n\n\ndef _load(\n    ptr: ir.Value,\n    mask: ir.Value | None = None,\n    other: ir.Value | None = None,\n    *,\n    cache_modifier: str | None = None,\n    eviction_policy: str | None = None,\n    is_volatile: bool = False,\n) -> ir.Value:\n  if cache_modifier is None:\n    cache = tt_dialect.CacheModifier.NONE\n  elif cache_modifier == \".ca\" or cache_modifier == \".cg\":\n    cache = _STR_TO_CACHE_MODIFIER[cache_modifier]\n  else:\n    raise ValueError(f\"unsupported cache modifier: {cache_modifier}\")\n  if eviction_policy is None:\n    evict = tt_dialect.EvictionPolicy.NORMAL\n  else:\n    try:\n      evict = _STR_TO_EVICTION_POLICY[eviction_policy]\n    except KeyError:\n      raise ValueError(\n          f\"unsupported eviction policy: {eviction_policy}\"\n      ) from None\n\n  if _is_triton_pointer_type(ptr.type):\n    ptr_type = tt_dialect.PointerType(ptr.type)\n    if isinstance(ptr_type.pointee_type, ir.RankedTensorType):\n      raise NotImplementedError(\"loading from a block pointer is not supported\")\n\n  ptr_type = _element_type(ptr.type)\n  if not _is_triton_pointer_type(ptr_type):\n    raise ValueError(f\"unsupported pointer type: {ptr_type}\")","sourceCodeStart":2006,"sourceCodeEnd":2042,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/triton/lowering.py#L2006-L2042","documentation":"The Triton load lowering only accepts cache_modifier values None, '.ca' or '.cg', mapping to tt_dialect.CacheModifier. Any other string raises ValueError before the tt.load op is emitted.","triggerScenarios":"Passing cache_modifier='.cb' or an arbitrary Triton-lang string to pallas.triton load primitives (e.g. pl.load with cache_modifier=...) that _load does not whitelist.","commonSituations":"Copying cache modifier names from CUDA/Triton-lang docs ('.cs', '.lu', '.cv', '.wb') that JAX's Pallas API doesn't map; typos in the modifier string.","solutions":["Use only None, '.ca' or '.cg'","Drop the cache_modifier argument entirely for defaults","Check the JAX Pallas docs/changelog for newly supported modifiers before using exotic ones"],"exampleFix":"// before\nv = pl.load(ref, cache_modifier='.cv')\n\n// after\nv = pl.load(ref, cache_modifier='.cg')  # or omit the argument","handlingStrategy":"validation","validationCode":"ALLOWED_CACHE_MODIFIERS = {None, '.ca', '.cg'}\nassert cache_modifier in ALLOWED_CACHE_MODIFIERS, f'bad cache_modifier: {cache_modifier}'","typeGuard":"def valid_cache_modifier(m) -> bool:\n    return m is None or m in ('.ca', '.cg')","tryCatchPattern":"try:\n    v = pl.load(ref, mask=m, cache_modifier=cm)\nexcept ValueError:\n    v = pl.load(ref, mask=m)  # retry with default cache behavior","preventionTips":["Restrict cache_modifier to '.ca'/'.cg'/None in kernels","Centralize load calls in a helper that validates modifiers","Check the JAX version's supported modifier set before porting Triton-lang kernels"],"tags":["jax","triton","pallas","load","cache-modifier","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}