{"record":{"id":"103861dbaf6913e6","repo":"xai-org/x-algorithm","slug":"spt-requires-dq-write-order-to-be-provided","errorCode":null,"errorMessage":"spt requires dq_write_order to be provided","messagePattern":"spt requires dq_write_order to be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/cutedsl/ranker_fa4/block_sparsity.py","lineNumber":486,"sourceCode":"        mask_cnt.device,\n    )\n    valid_block_lower = _check_and_expand_metadata_tensor(\n        \"valid_block_lower\",\n        tensors.valid_block_lower,\n        metadata_block_shape,\n        context,\n        hint,\n        mask_cnt.device,\n    )\n    if (valid_block_upper is None) != (valid_block_lower is None):\n        raise ValueError(\n            \"valid_block_upper and valid_block_lower must both be provided or both be None\"\n        )\n    spt = tensors.spt\n    if spt is not None and not isinstance(spt, bool):\n        raise ValueError(\"spt must be a bool when provided\")\n    if spt is not None and dq_write_order is None:\n        raise ValueError(\"spt requires dq_write_order to be provided\")\n\n    return BlockSparseTensorsTorch(\n        mask_block_cnt=mask_cnt,\n        mask_block_idx=mask_idx,\n        full_block_cnt=full_cnt,\n        full_block_idx=full_idx,\n        cu_total_m_blocks=tensors.cu_total_m_blocks,\n        cu_block_idx_offsets=tensors.cu_block_idx_offsets,\n        block_size=tensors.block_size,\n        dq_write_order=dq_write_order,\n        dq_write_order_full=dq_write_order_full,\n        spt=spt,\n        diag_block_cnt=diag_cnt,\n        diag_block_idx=diag_idx,\n        dq_write_order_diag=dq_write_order_diag,\n        valid_block_upper=valid_block_upper,\n        valid_block_lower=valid_block_lower,\n    )","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/cutedsl/ranker_fa4/block_sparsity.py#L468-L504","documentation":"Enabling spt (the special-path flag) additionally requires dq_write_order metadata, because that path uses the write-order tensor to sequence dQ accumulation. spt set without dq_write_order is rejected.","triggerScenarios":"Setting tensors.spt = True while leaving tensors.dq_write_order as None, typically when enabling the SPT optimization without shipping its metadata.","commonSituations":"Toggling an experimental spt flag in config without regenerating the mask bundle that includes dq_write_order; partial upgrade to a newer mask format that added dq_write_order.","solutions":["Provide tensors.dq_write_order (built by the mask-generation utilities for the SPT path)","Or disable spt (set to None/False) if you don't need that path","Regenerate your block-sparse artifacts with the current tooling so all SPT metadata is present"],"exampleFix":"# before\ntensors.spt = True                      # no dq_write_order\n\n# after\ntensors = BlockSparseTensorsTorch(..., spt=True, dq_write_order=dqwo)\n# or: tensors.spt = None","handlingStrategy":"validation","validationCode":"if tensors.spt is not None:\n    assert tensors.dq_write_order is not None, 'spt requires dq_write_order'","typeGuard":"def spt_ready(t) -> bool:\n    return t.spt is None or t.dq_write_order is not None","tryCatchPattern":null,"preventionTips":["Generate SPT artifacts as one bundle (spt flag + dq_write_order)","Leave spt None unless the path is explicitly enabled"],"tags":["block-sparsity","spt","missing-dependency"],"backgroundTag":"missing-required-parameter","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}