xai-org/x-algorithm · error · ValueError

{self.max_concurrent_steps=} must be at least 2

Error message

{self.max_concurrent_steps=} must be at least 2

What it means

TuningConfig.__post_init__ enforces max_concurrent_steps >= 2 because the warp-specialized kernel runs a producer and at least one consumer warp group in parallel; a single concurrent step cannot overlap loads and compute.

Source

Thrown at phoenix/xrex/pallas/ranker_attention_fa3.py:63

    block_q: int
    block_kv: int
    max_concurrent_steps: int
    use_schedule_barrier: bool = True
    causal: bool = False
    compute_wgs_bwd: int = 1

    block_q_dkv: int | None = None
    block_kv_dkv: int | None = None
    block_q_dq: int | None = None
    block_kv_dq: int | None = None

    def __post_init__(self):
        if self.block_q % 64:
            raise ValueError(f"{self.block_q=} must be a multiple of 64")
        if self.block_kv % 64:
            raise ValueError(f"{self.block_kv=} must be a multiple of 64")
        if self.max_concurrent_steps < 2:
            raise ValueError(f"{self.max_concurrent_steps=} must be at least 2")

        backward_blocks = [self.block_q_dkv, self.block_kv_dkv, self.block_q_dq, self.block_kv_dq]
        block_is_set = [blk is not None for blk in backward_blocks]
        if any(block_is_set) and not all(block_is_set):
            raise ValueError(
                "Backward block sizes (block_q_dkv, block_kv_dkv, block_q_dq, "
                "block_kv_dq) must either all be specified or all be None."
            )

    @property
    def has_backward_blocks(self) -> bool:
        return self.block_q_dkv is not None


def _attention_forward(
    q,
    k,
    v,

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Set max_concurrent_steps to 2 or higher
  2. If memory is tight, reduce block sizes or num_stages instead

Example fix

# before
cfg = TuningConfig(..., max_concurrent_steps=1)
# after
cfg = TuningConfig(..., max_concurrent_steps=2)
Defensive patterns

Strategy: validation

Validate before calling

assert max_concurrent_steps >= 2

Type guard

null

Prevention

When it happens

Trigger: Constructing TuningConfig with max_concurrent_steps=1 (or 0/negative) trying to serialize pipeline stages to save shared memory.

Common situations: Memory-constrained tuning where users lower pipeline depth to 1; misreading max_concurrent_steps as a total-steps knob rather than pipeline depth.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/4702ce197731e0f4. Report an issue: GitHub.