Qualify scoped Windows RTX Qwen3.8 FP8 text and image path

This commit is contained in:
tzhouam committed 2026-09-24 17:01:16 +08:00
1 parent 5bb16af8ee
commit 32a81111bd
23 files changed
+3368 -8

No files matched your search

@@ -0,0 +1,69 @@
#!/usr/bin/env python3
"""Record file-size and bundled CRC32 checks for a native Qwen3.8 FP8 copy."""
from __future__ import annotations
import argparse
import json
import time
import zlib
from pathlib import Path
def crc32(path: Path) -> str:
value = 0
with path.open("rb") as stream:
while chunk := stream.read(8 * 1024 * 1024):
value = zlib.crc32(chunk, value)
return f"{value:08x}"
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--source", type=Path, required=True)
parser.add_argument("--copy", type=Path, required=True)
parser.add_argument("--out", type=Path, required=True)
args = parser.parse_args()
started = time.monotonic()
original = {path.name: path.stat().st_size for path in args.source.iterdir() if path.is_file()}
copied = {path.name: path.stat().st_size for path in args.copy.iterdir() if path.is_file()}
if original != copied:
raise ValueError("source and copy differ in file names or sizes")
manifest = {}
for line in (args.source / "crc32.txt").read_text(encoding="utf-8").splitlines():
expected, name = line.split(maxsplit=1)
manifest[name] = expected.lower()
rows = []
for name, expected in manifest.items():
actual = crc32(args.copy / name)
source_actual = crc32(args.source / name) if actual != expected else None
rows.append({"file": name, "bytes": copied[name], "manifest_crc32": expected,
"copy_crc32": actual, "source_crc32_if_manifest_differs": source_actual})
weight_rows = [row for row in rows if row["file"].endswith(".safetensors")]
mismatches = [row for row in rows if row["manifest_crc32"] != row["copy_crc32"]]
if len(weight_rows) != 66 or any(row["manifest_crc32"] != row["copy_crc32"] for row in weight_rows):
raise ValueError("at least one safetensors file failed its bundled CRC32")
if any(row["source_crc32_if_manifest_differs"] != row["copy_crc32"] for row in mismatches):
raise ValueError("copy differs from source on a stale-manifest file")
result = {
"status": "checked",
"source": str(args.source),
"copy": str(args.copy),
"file_count": len(copied),
"total_bytes": sum(copied.values()),
"manifest_entries": len(rows),
"weight_files_matching_manifest": len(weight_rows),
"stale_manifest_nonweight_files": [row["file"] for row in mismatches],
"elapsed_s": time.monotonic() - started,
"files": rows,
}
args.out.parent.mkdir(parents=True, exist_ok=True)
args.out.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
print(json.dumps({key: result[key] for key in (
"status", "file_count", "manifest_entries", "weight_files_matching_manifest",
"stale_manifest_nonweight_files", "elapsed_s"
)}))
if __name__ == "__main__":
main()
@@ -0,0 +1,116 @@
#!/usr/bin/env python3
"""Audit the scoped native-Windows Qwen3.8-27B FP8 recovery and serial profile."""
from __future__ import annotations
import argparse
import hashlib
import json
import math
import re
from pathlib import Path
REVISION = "017b9c7af6b5689d5dd426a76e0bc077eb5ca20a"
def digest(path: Path) -> dict[str, int | str]:
with path.open("rb") as stream:
return {"bytes": path.stat().st_size, "sha256": hashlib.file_digest(stream, "sha256").hexdigest()}
def percentile(values: list[float], fraction: float) -> float:
return sorted(values)[math.ceil(len(values) * fraction) - 1]
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--evidence-dir", type=Path, required=True)
args = parser.parse_args()
root = args.evidence_dir
names = [
"fp8_copy_integrity.json",
"fp8_triton_probe.json",
"fp8_triton_probe.driver.log",
"qwen38_image_fp8_attempt1.json",
"qwen38_image_fp8_attempt1.driver.log",
"qwen38_image_fp8_triton_attempt1.json",
"qwen38_image_fp8_triton_attempt1.driver.log",
"qwen38_image_fp8_triton_attempt2.json",
"qwen38_image_fp8_triton_attempt2.driver.log",
"qwen38_image_fp8_triton_ntfs_attempt1.json",
"qwen38_image_fp8_triton_ntfs_attempt1.driver.log",
"qwen38_fp8_triton_ntfs_profile20.json",
"qwen38_fp8_triton_ntfs_profile20.driver.log",
]
paths = {name: root / name for name in names}
reports = {name: json.loads(paths[name].read_text(encoding="utf-8")) for name in names if name.endswith(".json")}
logs = {name: paths[name].read_text(encoding="utf-8", errors="replace") for name in names if name.endswith(".log")}
probe = reports["fp8_triton_probe.json"]
copy = reports["fp8_copy_integrity.json"]
if (copy["status"] != "checked" or copy["file_count"] != 81
or copy["weight_files_matching_manifest"] != 66
or set(copy["stale_manifest_nonweight_files"]) != {
"chat_template.jinja", "generation_config.json", "tokenizer_config.json"
}):
raise ValueError("native checkpoint copy integrity record is incomplete")
if probe["status"] != "pass" or probe["capability"] != [12, 0] or probe["value"] != 128:
raise ValueError("FP8 Triton operation did not pass on SM120")
if reports["qwen38_image_fp8_attempt1.json"]["status"] != "failed" or "No compiled cutlass_scaled_mm" not in logs["qwen38_image_fp8_attempt1.driver.log"]:
raise ValueError("default CUTLASS failure is missing")
if reports["qwen38_image_fp8_triton_attempt1.json"]["status"] != "failed" or "no structured config owner: linear_backend" not in logs["qwen38_image_fp8_triton_attempt1.driver.log"]:
raise ValueError("Omni config ownership failure is missing")
if reports["qwen38_image_fp8_triton_attempt2.json"]["status"] != "failed" or "0.33 GiB KV cache is needed" not in logs["qwen38_image_fp8_triton_attempt2.driver.log"]:
raise ValueError("undersized KV-cache refusal is missing")
single = reports["qwen38_image_fp8_triton_ntfs_attempt1.json"]
profile = reports["qwen38_fp8_triton_ntfs_profile20.json"]
for report in (single, profile):
cfg = report["config"]
if (report["status"] != "completed" or report["outputs"] != ["Red"]
or cfg["linear_backend"] != "triton" or cfg["cpu_offload_gb"] != 12
or cfg["gpu_memory_utilization"] != 0.8 or cfg["max_model_len"] != 512
or "Qwen3.8-27B-FP8" not in report["model"]):
raise ValueError("successful report does not match the bounded FP8 image case")
for name in ("qwen38_image_fp8_triton_ntfs_attempt1.driver.log", "qwen38_fp8_triton_ntfs_profile20.driver.log"):
if not all(token in logs[name] for token in (
"Selected TritonFp8BlockScaledMMKernel",
"Loading safetensors checkpoint shards: 100% Completed | 66/66",
)):
raise ValueError(f"successful log lacks kernel/load/cache evidence: {name}")
cache_match = re.search(r"GPU KV cache size: ([\d,]+) tokens", logs[name])
if cache_match is None or int(cache_match.group(1).replace(",", "")) < 512:
raise ValueError(f"successful log lacks enough KV cache for one request: {name}")
if profile["text_output"] != ["ready"]:
raise ValueError("text warmup answer changed")
timing = {}
for kind, expected in (("image", "Red"), ("text", "ready")):
rows = [row for row in profile["profile"] if row["kind"] == kind]
if len(rows) != 20 or {row["index"] for row in rows} != set(range(20)) or any(row["output"] != expected for row in rows):
raise ValueError(f"{kind} serial profile is incomplete or changed output")
values = [row["wall_s"] for row in rows]
timing[kind] = {"n": len(values), "nearest_rank_p50_s": percentile(values, 0.5),
"nearest_rank_p95_s": percentile(values, 0.95), "min_s": min(values), "max_s": max(values)}
result = {
"status": "audited_scoped_e2e",
"evidence_depth": "P: complete text and synthetic-image requests on native Windows RTX; no long context or broad quality claim",
"artifact": "Qwen/Qwen3.8-27B-FP8",
"checkpoint_revision": REVISION,
"host": "Windows 11 build 26200; Ryzen AI 9 HX 370; RTX 5090 Laptop; driver 610.71",
"runtime": "native vLLM 0.29.0+cu134; PyTorch 2.13.0+cu130; Triton FP8 block linear backend",
"configuration": profile["config"],
"warmups": {"image": 1, "text": 1},
"timing": timing,
"files": {name: digest(path) for name, path in paths.items()},
"limits": [
"The FP8 checkpoint and Triton backend are distinct from the NVFP4 Marlin failure.",
"The image is a synthetic 96x96 red square and the text prompt is a single-word response; no broad multimodal or long-context quality claim follows.",
"The 12 GiB host offload and 0.80 GPU-memory cap are declared settings, not measured loading-peak admission or a sampled power profile.",
"Cancellation, public AsyncOmni, concurrency, video, sustained power/thermal behavior and task quality remain unverified for this native-Windows route.",
],
}
(root / "fp8_audit_report.json").write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
print(json.dumps({"status": result["status"], "timing": timing}))
if __name__ == "__main__":
main()
@@ -0,0 +1,39 @@
"""Check the installed Windows vLLM block-FP8 kernel before loading 27B weights."""
import json
import sys
import traceback
from pathlib import Path
import torch
def main() -> None:
out = Path(sys.argv[1])
result = {
"torch": torch.__version__,
"device": torch.cuda.get_device_name(0),
"capability": torch.cuda.get_device_capability(0),
}
try:
import vllm.model_executor.kernels.linear.scaled_mm.triton # noqa: F401
a = torch.ones((4, 128), device="cuda", dtype=torch.float8_e4m3fn)
b = torch.ones((128, 128), device="cuda", dtype=torch.float8_e4m3fn)
sa = torch.ones((4, 1), device="cuda", dtype=torch.float32)
sb = torch.ones((1, 1), device="cuda", dtype=torch.float32)
y = torch.ops.vllm.w8a8_triton_block_scaled_mm_func(
a, b, sa, sb, [128, 128], torch.bfloat16
)
torch.cuda.synchronize()
result.update(status="pass", shape=list(y.shape), value=float(y[0, 0]))
except Exception as exc:
result.update(status="failed", error=repr(exc), traceback=traceback.format_exc())
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
if result["status"] != "pass":
raise SystemExit(1)
if __name__ == "__main__":
main()