For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
set_neg_zero
def set_neg_zero[dtype: DType, width: Int]() -> SIMD[dtype, width]
Returns the universal "not ready" sentinel pack.
The pack is the fp32 -0.0 bit pattern (0x80000000) tiled over every 4
bytes. This one pattern is DTYPE-INDEPENDENT, yet has_neg_zero[dtype]
detects it as the sentinel for every supported transport dtype, because:
- the readiness poll is ANY-lane (it spins while any lane is
-0.0), and - IEEE floats put the sign bit at the element MSB, so
0x80every 4 bytes lands on a sign bit for fp32 (all lanes) and for the odd lanes of 2-byte dtypes (bf16/fp16) -- at least one-0.0lane under each interpretation.
Parameters:
- dtype (
DType): The transport float type (bfloat16, float16, or float32). - width (
Int): The SIMD pack width.width * sizeof(dtype)must be a multiple of 4 bytes (true for every 128-bit pack used by the protocol).
Returns:
SIMD[dtype, width]: The sentinel pack reinterpreted as SIMD[dtype, width].
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!