{"record":{"id":"dfdca760813b38dd","repo":"xai-org/x-algorithm","slug":"self-block-kv-must-be-a-multiple-of-64","errorCode":null,"errorMessage":"{self.block_kv=} must be a multiple of 64","messagePattern":"(.+?) must be a multiple of 64","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/pallas/ranker_attention_fa3.py","lineNumber":61,"sourceCode":"@dataclasses.dataclass(frozen=True)\nclass TuningConfig:\n    block_q: int\n    block_kv: int\n    max_concurrent_steps: int\n    use_schedule_barrier: bool = True\n    causal: bool = False\n    compute_wgs_bwd: int = 1\n\n    block_q_dkv: int | None = None\n    block_kv_dkv: int | None = None\n    block_q_dq: int | None = None\n    block_kv_dq: int | None = None\n\n    def __post_init__(self):\n        if self.block_q % 64:\n            raise ValueError(f\"{self.block_q=} must be a multiple of 64\")\n        if self.block_kv % 64:\n            raise ValueError(f\"{self.block_kv=} must be a multiple of 64\")\n        if self.max_concurrent_steps < 2:\n            raise ValueError(f\"{self.max_concurrent_steps=} must be at least 2\")\n\n        backward_blocks = [self.block_q_dkv, self.block_kv_dkv, self.block_q_dq, self.block_kv_dq]\n        block_is_set = [blk is not None for blk in backward_blocks]\n        if any(block_is_set) and not all(block_is_set):\n            raise ValueError(\n                \"Backward block sizes (block_q_dkv, block_kv_dkv, block_q_dq, \"\n                \"block_kv_dq) must either all be specified or all be None.\"\n            )\n\n    @property\n    def has_backward_blocks(self) -> bool:\n        return self.block_q_dkv is not None\n\n\ndef _attention_forward(\n    q,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/pallas/ranker_attention_fa3.py#L43-L79","documentation":"TuningConfig.__post_init__ requires the forward key/value tile size block_kv to be a multiple of 64, matching the TMA shared-memory alignment requirements of the FA3-style kernels.","triggerScenarios":"Constructing TuningConfig with block_kv like 32, 48, or 100 — any value not divisible by 64.","commonSituations":"Reducing block_kv to fit long-context sequences in shared memory without preserving 64-alignment; porting configs from FA2-style pallas kernels.","solutions":["Set block_kv to a multiple of 64 (e.g. 64 or 128)","Reduce num_stages or max_concurrent_steps instead if shared memory is the constraint"],"exampleFix":"# before\ncfg = TuningConfig(block_q=128, block_kv=50, ...)\n# after\ncfg = TuningConfig(block_q=128, block_kv=64, ...)","handlingStrategy":"validation","validationCode":"assert block_kv % 64 == 0, \"block_kv must be a multiple of 64\"","typeGuard":"null","tryCatchPattern":null,"preventionTips":["Use 64/128 as the only kv tile candidates","Validate config immediately after dataclass construction in tests"],"tags":["jax","pallas","tuning-config","alignment"],"backgroundTag":"invalid-block-size-config","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}