{"record":{"id":"e45e9af63e91c033","repo":"sgl-project/sglang","slug":"hpc-ops-backend-can-only-be-used-with-non-mla-mode","errorCode":null,"errorMessage":"hpc_ops backend can only be used with non-MLA models.","messagePattern":"hpc_ops backend can only be used with non-MLA models\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/attention/attention_registry.py","lineNumber":263,"sourceCode":"def create_cutlass_mla_backend(runner):\n    from sglang.srt.layers.attention.cutlass_mla_backend import CutlassMLABackend\n\n    return CutlassMLABackend(runner)\n\n\n@register_attention_backend(\"trtllm_mha\")\ndef create_trtllm_mha_backend(runner):\n    if runner.use_mla_backend:\n        raise ValueError(\"trtllm_mha backend can only be used with non-MLA models.\")\n    from sglang.srt.layers.attention.trtllm_mha_backend import TRTLLMHAAttnBackend\n\n    return TRTLLMHAAttnBackend(runner)\n\n\n@register_attention_backend(\"hpc_ops\")\ndef create_hpc_ops_backend(runner):\n    if runner.use_mla_backend:\n        raise ValueError(\"hpc_ops backend can only be used with non-MLA models.\")\n    if runner.model_config.is_encoder_decoder:\n        raise ValueError(\n            \"Cross attention is not supported in the hpc_ops attention backend.\"\n        )\n    if get_spec().speculative_algorithm is not None:\n        raise ValueError(\n            \"hpc_ops backend does not support speculative decoding for now.\"\n        )\n    from sglang.srt.layers.attention.hpc_ops_backend import HPCOpsAttnBackend\n\n    return HPCOpsAttnBackend(runner)\n\n\n@register_attention_backend(\"intel_amx\")\ndef create_intel_amx_backend(runner):\n    from sglang.srt.layers.attention.intel_amx_backend import IntelAMXAttnBackend\n\n    return IntelAMXAttnBackend(runner)","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/attention/attention_registry.py#L245-L281","documentation":"The hpc_ops attention backend only supports non-MLA architectures. When runner.use_mla_backend is true the factory raises immediately, since the HPC-ops kernels have no MLA-absorbed decode path.","triggerScenarios":"Selecting the 'hpc_ops' backend (typically on Ascend NPU) for an MLA model such as DeepSeek.","commonSituations":"NPU deployments that force hpc_ops for performance, then loading an MLA checkpoint; or defaulting to hpc_ops when the model actually needs an MLA backend.","solutions":["Remove the hpc_ops backend override for MLA models","Pick an MLA-capable backend supported on your hardware for the MLA checkpoint"],"exampleFix":"# before\n--model DeepSeek-V3 --attention-backend hpc_ops\n# after\n--model DeepSeek-V3  # use an MLA-capable backend","handlingStrategy":"validation","validationCode":"if model_runner.use_mla_backend and server_args.attention_backend == \"hpc_ops\":\n    raise SystemExit(\"hpc_ops only supports non-MLA models\")","typeGuard":"def is_mla_model(runner) -> bool:\n    return bool(getattr(runner, \"use_mla_backend\", False))","tryCatchPattern":null,"preventionTips":["On NPU, validate backend selection per model family in deployment scripts","Maintain a compatibility matrix of model arch vs attention backend in your ops docs"],"tags":["attention-backend","hpc-ops","mla","model-arch-mismatch","npu","sglang"],"backgroundTag":"backend-model-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}