{"record":{"id":"f98dfd7598d0126d","repo":"sgl-project/sglang","slug":"unknown-gpu-gpu-expected-one-of-sorted-gpu-b","errorCode":null,"errorMessage":"unknown gpu '{gpu}', expected one of {sorted(GPU_BUDGETS_BYTES)}","messagePattern":"unknown gpu '(.+?)', expected one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/lplb/shmem_budget.py","lineNumber":98,"sourceCode":"    \"\"\"Per-array byte breakdown — useful for debugging shmem pressure.\"\"\"\n    b = bytes_per_elem\n    return ShmemBreakdown(\n        nc=nc,\n        nv=nv,\n        a_bytes=b * nc * nv,\n        c_bytes=b * nv,\n        x_bytes=b * nv,\n        ata_bytes=b * nc * nc,\n        rhs_bytes=b * nc,\n        d_bytes=b * nv,\n        pad_bytes=_RUNTIME_PAD_BYTES,\n    )\n\n\ndef gpu_budget_bytes(gpu: str) -> int:\n    key = gpu.lower()\n    if key not in GPU_BUDGETS_BYTES:\n        raise ValueError(\n            f\"unknown gpu '{gpu}', expected one of {sorted(GPU_BUDGETS_BYTES)}\"\n        )\n    return GPU_BUDGETS_BYTES[key]\n\n\ndef fits(nc: int, nv: int, gpu: str = \"h100\") -> bool:\n    return shmem_bytes(nc, nv) <= gpu_budget_bytes(gpu)\n\n\ndef assert_fits(nc: int, nv: int, gpu: str = \"h100\") -> None:\n    \"\"\"Raise if the fused kernel will not fit on the target GPU.\"\"\"\n    used = shmem_bytes(nc, nv)\n    cap = gpu_budget_bytes(gpu)\n    if used > cap:\n        raise ValueError(\n            f\"fused IPM kernel needs {used/1024:.1f} KiB of shared memory for \"\n            f\"NC={nc}, NV={nv}, but {gpu} allows {cap/1024:.1f} KiB/block. \"\n            f\"Either reduce problem size or switch to a tiled design.\"","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/lplb/shmem_budget.py#L80-L116","documentation":"gpu_budget_bytes looks up per-block shared-memory capacity by GPU name and only knows the keys in GPU_BUDGETS_BYTES (e.g. 'h100'). An unknown GPU string raises ValueError. This is a lookup-table contract for the fused IPM kernel's shmem budget check.","triggerScenarios":"Calling gpu_budget_bytes('a100'), fits(..., gpu='A100'), assert_fits(..., gpu='l40s') or any solve/warmup path that forwards a GPU name not in the table; also case variants are fine (lowercased) but typos or unlisted GPUs are not.","commonSituations":"Running on a GPU generation not yet added to the table (e.g. B200); passing a torch device name like 'cuda:0' or 'NVIDIA H100 80GB HBM3' instead of the short key; version skew where the table lags new hardware.","solutions":["Pass one of the exact keys printed in the message, e.g. 'h100'","If your GPU is legitimately supported hardware, add its budget (bytes per block) to GPU_BUDGETS_BYTES in shmem_budget.py and re-run","If the GPU is unsupported, use the non-fused torch reference solver (solve_ipm_torch_reference) instead"],"exampleFix":"// before\nassert_fits(nc, nv, gpu=torch.cuda.get_device_name(0))\n\n// after\nassert_fits(nc, nv, gpu='h100')","handlingStrategy":"validation","validationCode":"from sglang.kernels.ops.lplb.shmem_budget import GPU_BUDGETS_BYTES\ngpu = gpu if gpu.lower() in GPU_BUDGETS_BYTES else 'h100'","typeGuard":"def is_known_gpu(gpu: str) -> bool:\n    return gpu.lower() in GPU_BUDGETS_BYTES","tryCatchPattern":null,"preventionTips":["Use the short canonical keys ('h100', etc.) from the table, not torch device names","After upgrading hardware, check GPU_BUDGETS_BYTES for new entries before assuming support"],"tags":["gpu","lookup-table","shared-memory","lplb"],"backgroundTag":"invalid-enum-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}