{"record":{"id":"8a976e0235190f53","repo":"jax-ml/jax","slug":"must-signal-an-int32-value-but-got-value-aval-dt","errorCode":null,"errorMessage":"Must signal an int32 value, but got {value_aval.dtype}","messagePattern":"Must signal an int32 value, but got (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/primitives.py","lineNumber":1030,"sourceCode":"  )\n\n\n@semaphore_signal_p.def_effectful_abstract_eval\ndef _semaphore_signal_abstract_eval(\n    *avals,\n    args_tree,\n    device_id_type: DeviceIdType,\n):\n  (\n      sem_aval,\n      sem_transforms_avals,\n      value_aval,\n      device_id_aval,\n      core_index_aval,\n  ) = tree_util.tree_unflatten(args_tree, avals)\n  check_sem_avals(sem_aval, sem_transforms_avals, \"signal\")\n  if value_aval.dtype != jnp.dtype(\"int32\"):\n    raise ValueError(f\"Must signal an int32 value, but got {value_aval.dtype}\")\n  effs: set[effects.Effect] = {sem_effect}\n  if device_id_aval is not None:\n    device_id_flat_avals = tree_util.tree_leaves(device_id_aval)\n    for aval in device_id_flat_avals:\n      if aval.dtype != jnp.dtype(\"int32\"):\n        raise ValueError(\n            f\"`device_id`s must be an int32 value, but got {aval.dtype}\"\n        )\n    if device_id_type is DeviceIdType.MESH and isinstance(device_id_aval, dict):\n      for k in device_id_aval:\n        if not isinstance(k, tuple):\n          k = (k,)\n        for k_ in k:\n          effs.add(jax_core.NamedAxisEffect(k_))\n    else:\n      effs.add(pallas_core.comms_effect)\n  return [], effs\n","sourceCodeStart":1012,"sourceCodeEnd":1048,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/primitives.py#L1012-L1048","documentation":"semaphore_signal requires the increment value to be an int32; the abstract eval rejects any other dtype.","triggerScenarios":"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.","commonSituations":"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.","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))"],"exampleFix":"// before\nsemaphore_signal(sem, jnp.float32(1.0))\n// after\nsemaphore_signal(sem, jnp.int32(1))","handlingStrategy":"validation","validationCode":"assert value_aval.dtype == jnp.dtype('int32'), f\"signal value must be int32, got {value_aval.dtype}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always cast semaphore increments to jnp.int32","Avoid float counters in semaphore logic"],"tags":["pallas","semaphore","dtype-validation","jax"],"backgroundTag":"dtype-mismatch","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}