CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
91 lines
2.9 KiB
Python
91 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Test that compressed models can be loaded and used."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
|
|
from predict import Predictor
|
|
|
|
|
|
def test_fp16_model_decompression():
|
|
"""Test that fp16 model is auto-decompressed and usable."""
|
|
model_dir = Path(__file__).parent.parent / "models" / "gemm_universal_fp16_gfx950"
|
|
|
|
# Ensure .lgbm.gz exists
|
|
gz_file = model_dir / "model_tflops.lgbm.gz"
|
|
|
|
assert gz_file.exists(), f"Compressed model not found: {gz_file}"
|
|
|
|
# Load predictor - should auto-decompress
|
|
predictor = Predictor(model_dir)
|
|
|
|
# Test prediction
|
|
problem = {"m": 128, "n": 1536, "k": 7168, "dtype": "fp16", "layout": "rcr"}
|
|
kernel_config = {
|
|
"tile_shape": {"m0": 128, "n0": 128, "k0": 16},
|
|
"wave_shape": {"m1": 2, "n1": 2, "k1": 1},
|
|
"warp_tile": {"m2": 32, "n2": 32, "k2": 8},
|
|
}
|
|
|
|
tflops = predictor.predict_tflops(problem, kernel_config)
|
|
|
|
assert isinstance(tflops, float), f"Expected float, got {type(tflops)}"
|
|
assert tflops > 0, f"Expected positive TFLOPS, got {tflops}"
|
|
|
|
# Verify decompressed file was created
|
|
lgbm_file = model_dir / "model_tflops.lgbm"
|
|
assert lgbm_file.exists(), "Model should have been decompressed"
|
|
|
|
print(f"✅ FP16 model decompression test passed")
|
|
print(f" Predicted TFLOPS: {tflops:.2f}")
|
|
print(f" Decompressed to: {lgbm_file}")
|
|
return True
|
|
|
|
|
|
def test_fp8_model_decompression():
|
|
"""Test that fp8 model is auto-decompressed and usable."""
|
|
model_dir = Path(__file__).parent.parent / "models" / "gemm_universal_fp8_gfx950"
|
|
|
|
# Ensure .lgbm.gz exists
|
|
gz_file = model_dir / "model_tflops.lgbm.gz"
|
|
|
|
assert gz_file.exists(), f"Compressed model not found: {gz_file}"
|
|
|
|
# Load predictor - should auto-decompress
|
|
predictor = Predictor(model_dir)
|
|
|
|
# Test prediction
|
|
problem = {"m": 2048, "n": 2048, "k": 2048, "dtype": "fp8", "layout": "rcr"}
|
|
kernel_config = {
|
|
"tile_shape": {"m0": 256, "n0": 256, "k0": 64},
|
|
"wave_shape": {"m1": 2, "n1": 2, "k1": 1},
|
|
"warp_tile": {"m2": 32, "n2": 32, "k2": 16},
|
|
}
|
|
|
|
tflops = predictor.predict_tflops(problem, kernel_config)
|
|
|
|
assert isinstance(tflops, float), f"Expected float, got {type(tflops)}"
|
|
assert tflops > 0, f"Expected positive TFLOPS, got {tflops}"
|
|
|
|
# Verify decompressed file was created
|
|
lgbm_file = model_dir / "model_tflops.lgbm"
|
|
assert lgbm_file.exists(), "Model should have been decompressed"
|
|
|
|
print(f"✅ FP8 model decompression test passed")
|
|
print(f" Predicted TFLOPS: {tflops:.2f}")
|
|
print(f" Decompressed to: {lgbm_file}")
|
|
return True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("Testing compressed model auto-decompression...")
|
|
print()
|
|
|
|
test_fp16_model_decompression()
|
|
print()
|
|
test_fp8_model_decompression()
|
|
print()
|
|
print("✅ All model compression tests passed!")
|