jax-ml/jax · error · ValueError
Must signal an int32 value, but got {value_aval.dtype}
Error message
Must signal an int32 value, but got {value_aval.dtype} What it means
semaphore_signal requires the increment value to be an int32; the abstract eval rejects any other dtype.
Source
Thrown at jax/_src/pallas/primitives.py:1030
)
@semaphore_signal_p.def_effectful_abstract_eval
def _semaphore_signal_abstract_eval(
*avals,
args_tree,
device_id_type: DeviceIdType,
):
(
sem_aval,
sem_transforms_avals,
value_aval,
device_id_aval,
core_index_aval,
) = tree_util.tree_unflatten(args_tree, avals)
check_sem_avals(sem_aval, sem_transforms_avals, "signal")
if value_aval.dtype != jnp.dtype("int32"):
raise ValueError(f"Must signal an int32 value, but got {value_aval.dtype}")
effs: set[effects.Effect] = {sem_effect}
if device_id_aval is not None:
device_id_flat_avals = tree_util.tree_leaves(device_id_aval)
for aval in device_id_flat_avals:
if aval.dtype != jnp.dtype("int32"):
raise ValueError(
f"`device_id`s must be an int32 value, but got {aval.dtype}"
)
if device_id_type is DeviceIdType.MESH and isinstance(device_id_aval, dict):
for k in device_id_aval:
if not isinstance(k, tuple):
k = (k,)
for k_ in k:
effs.add(jax_core.NamedAxisEffect(k_))
else:
effs.add(pallas_core.comms_effect)
return [], effs
View on GitHub (pinned to 1e1c6a8fc0)
Solutions
- Cast the value: semaphore_signal(sem, value.astype(jnp.int32))
- Ensure the increment is produced as int32 from the start (e.g., jnp.int32(1))
Example fix
// before semaphore_signal(sem, jnp.float32(1.0)) // after semaphore_signal(sem, jnp.int32(1))
Defensive patterns
Strategy: validation
Validate before calling
assert value_aval.dtype == jnp.dtype('int32'), f"signal value must be int32, got {value_aval.dtype}" Prevention
- Always cast semaphore increments to jnp.int32
- Avoid float counters in semaphore logic
When it happens
Trigger: Calling semaphore_signal(sem, value) where value is not int32 — e.g., a Python int traced as int32 is fine, but a float32 array or int64 constant is rejected.
Common situations: Passing jnp.float32 counters or int64 (default for large Python ints on some platforms) increments; computing the increment in a different dtype inside the kernel.
Related errors
- Must {name} semaphores of the following types: {allowed_sema
- `device_id`s must be an int32 value, but got {aval.dtype}
- Must wait an int32 value.
- Non-decrementing wait is not supported.
- Semaphore {sem_id} occurs as both fixed-id and internal.
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/8a976e0235190f53.
Report an issue: GitHub.