Files
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

49 lines
1.4 KiB
Python

"""Tests for perfxpert.tools.occupancy."""
import pytest
from perfxpert.tools import occupancy
from perfxpert.tools._class import ToolClass
def test_lookup_vgpr_32_gives_8_waves_on_cdna3():
assert occupancy.lookup_waves_per_eu(32, "gfx942") == 8
def test_lookup_vgpr_64_gives_8_waves_on_cdna3():
assert occupancy.lookup_waves_per_eu(64, "gfx942") == 8
def test_lookup_vgpr_128_gives_4_waves_on_cdna3():
assert occupancy.lookup_waves_per_eu(128, "gfx942") == 4
def test_lookup_vgpr_256_gives_2_waves_on_cdna3():
assert occupancy.lookup_waves_per_eu(256, "gfx942") == 2
def test_lookup_vgpr_128_gives_2_waves_on_cdna1():
assert occupancy.lookup_waves_per_eu(128, "gfx908") == 2
def test_lookup_unknown_arch_raises():
with pytest.raises(KeyError):
occupancy.lookup_waves_per_eu(32, "gfx9999")
def test_suggest_reduction_for_hot_kernel_with_high_vgpr():
r = occupancy.suggest_vgpr_reduction(current_vgpr=96, occupancy_pct=0.25, kernel_time_pct=0.50)
assert r["applicable"]
assert r["target_vgpr"] < 96
assert r["expected_occupancy_multiplier"] > 1.0
def test_suggest_skips_small_kernel():
r = occupancy.suggest_vgpr_reduction(current_vgpr=96, occupancy_pct=0.25, kernel_time_pct=0.02)
assert not r["applicable"]
def test_is_read_only_class():
assert occupancy.lookup_waves_per_eu.__tool_class__ == ToolClass.READ_ONLY
assert occupancy.suggest_vgpr_reduction.__tool_class__ == ToolClass.READ_ONLY