jax-ml/jax · error · ValueError

unsupported eviction policy: {eviction_policy}

Error message

unsupported eviction policy: {eviction_policy}

What it means

The eviction_policy string passed to a Triton Pallas load must exist in _STR_TO_EVICTION_POLICY (e.g. 'evict_first', 'evict_last'); anything else raises this ValueError via the KeyError conversion.

Source

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

    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}")
  ptr_type = tt_dialect.PointerType(ptr_type)
  if other is not None and mask is None:
    raise ValueError("other requires mask to be provided")
  if not isinstance(ptr.type, ir.RankedTensorType):
    if other is not None and isinstance(other.type, ir.RankedTensorType):
      raise ValueError("other cannot be a block if pointer is not a block")
    if mask is not None and isinstance(mask.type, ir.RankedTensorType):

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Use a supported policy name ('evict_first', 'evict_last') or None for NORMAL
  2. Omit eviction_policy to use the default
  3. Verify against the _STR_TO_EVICTION_POLICY mapping in your JAX version

Example fix

// before
v = pl.load(ref, eviction_policy='evict_normal')

// after
v = pl.load(ref, eviction_policy='evict_last')  # or omit
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_EVICTION = {None, 'evict_first', 'evict_last'}
assert eviction_policy in SUPPORTED_EVICTION, f'bad eviction_policy: {eviction_policy}'

Type guard

def valid_eviction_policy(p) -> bool:
    return p is None or p in ('evict_first', 'evict_last')

Try / catch

try:
    v = pl.load(ref, mask=m, eviction_policy=ep)
except ValueError:
    v = pl.load(ref, mask=m)  # retry with default eviction

Prevention

When it happens

Trigger: Passing an unsupported eviction_policy string (e.g. 'evict_normal', typo'd values, or CUDA-only names) to a load inside a Triton Pallas kernel.

Common situations: Porting Triton-lang kernel annotations verbatim into Pallas; assuming all Triton eviction policy names are exposed; typos.

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/83c31f7f3f1c2afd. Report an issue: GitHub.