jax-ml/jax · error · ValueError

unsupported cache modifier: {cache_modifier}

Error message

unsupported cache modifier: {cache_modifier}

What it means

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.

Source

Thrown at jax/_src/pallas/triton/lowering.py:2024

_STR_TO_EVICTION_POLICY = {str(e): e for e in tt_dialect.EvictionPolicy}
_STR_TO_CACHE_MODIFIER = {str(c): c for c in tt_dialect.CacheModifier}


def _load(
    ptr: ir.Value,
    mask: ir.Value | None = None,
    other: ir.Value | None = None,
    *,
    cache_modifier: str | None = None,
    eviction_policy: str | None = None,
    is_volatile: bool = False,
) -> ir.Value:
  if cache_modifier is None:
    cache = tt_dialect.CacheModifier.NONE
  elif cache_modifier == ".ca" or cache_modifier == ".cg":
    cache = _STR_TO_CACHE_MODIFIER[cache_modifier]
  else:
    raise ValueError(f"unsupported cache modifier: {cache_modifier}")
  if eviction_policy is None:
    evict = tt_dialect.EvictionPolicy.NORMAL
  else:
    try:
      evict = _STR_TO_EVICTION_POLICY[eviction_policy]
    except KeyError:
      raise ValueError(
          f"unsupported eviction policy: {eviction_policy}"
      ) from None

  if _is_triton_pointer_type(ptr.type):
    ptr_type = tt_dialect.PointerType(ptr.type)
    if isinstance(ptr_type.pointee_type, ir.RankedTensorType):
      raise NotImplementedError("loading from a block pointer is not supported")

  ptr_type = _element_type(ptr.type)
  if not _is_triton_pointer_type(ptr_type):
    raise ValueError(f"unsupported pointer type: {ptr_type}")

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Use only None, '.ca' or '.cg'
  2. Drop the cache_modifier argument entirely for defaults
  3. Check the JAX Pallas docs/changelog for newly supported modifiers before using exotic ones

Example fix

// before
v = pl.load(ref, cache_modifier='.cv')

// after
v = pl.load(ref, cache_modifier='.cg')  # or omit the argument
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED_CACHE_MODIFIERS = {None, '.ca', '.cg'}
assert cache_modifier in ALLOWED_CACHE_MODIFIERS, f'bad cache_modifier: {cache_modifier}'

Type guard

def valid_cache_modifier(m) -> bool:
    return m is None or m in ('.ca', '.cg')

Try / catch

try:
    v = pl.load(ref, mask=m, cache_modifier=cm)
except ValueError:
    v = pl.load(ref, mask=m)  # retry with default cache behavior

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/c5988baa8844fe20. Report an issue: GitHub.