Files
rocm-systems/tests/test_analyze_commands.py
T

1631 lines
38 KiB
Python
Raw Normal View History

2022-11-04 14:49:36 -05:00
import os.path
from pathlib import Path
from unittest.mock import patch
import pytest
from importlib.machinery import SourceFileLoader
2022-11-04 14:49:36 -05:00
omniperf = SourceFileLoader("omniperf", "src/omniperf").load_module()
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
baseline_opts = ["omniperf", "analyze"]
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_valid_path():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
["omniperf", "analyze", "--path", "tests/workloads/mixbench/mi100"],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
2023-10-25 14:09:59 -05:00
with patch(
"sys.argv",
["omniperf", "analyze", "--path", "tests/workloads/mixbench/mi200"],
):
2022-11-04 14:49:36 -05:00
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_list_kernels():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
2023-10-25 14:09:59 -05:00
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--list-kernels",
],
):
2022-11-04 14:49:36 -05:00
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
2022-11-04 14:49:36 -05:00
"--list-kernels",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.list_metrics
2023-10-25 14:09:59 -05:00
def test_list_metrics_gfx90a():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch("sys.argv", ["omniperf", "analyze", "--list-metrics", "gfx90a"]):
omniperf.main()
assert e.value.code == 0
2023-10-25 14:09:59 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--list-metrics",
"gfx90a",
],
):
omniperf.main()
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
2023-10-25 14:09:59 -05:00
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--list-metrics",
"gfx90a",
],
):
2022-11-04 14:49:36 -05:00
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.list_metrics
2023-10-25 14:09:59 -05:00
def test_list_metrics_gfx906():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
2023-10-25 14:09:59 -05:00
with patch("sys.argv", ["omniperf", "analyze", "--list-metrics", "gfx906"]):
2022-11-04 14:49:36 -05:00
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--list-metrics",
"gfx906",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--list-metrics",
"gfx906",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.list_metrics
2023-10-25 14:09:59 -05:00
def test_list_metrics_gfx908():
with pytest.raises(SystemExit) as e:
with patch("sys.argv", ["omniperf", "analyze", "--list-metrics", "gfx908"]):
omniperf.main()
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--list-metrics",
"gfx908",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--list-metrics",
"gfx908",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_metrics
2023-10-25 14:09:59 -05:00
def test_filter_metrics_1():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--metric",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--metric",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_metrics
2023-10-25 14:09:59 -05:00
def test_filter_metrics_2():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--metric",
"5",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--metric",
"5",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_metrics
2023-10-25 14:09:59 -05:00
def test_filter_metrics_3():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--metric",
"5.2.2",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--metric",
"5.2.2",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_metrics
2023-10-25 14:09:59 -05:00
def test_filter_metrics_4():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--metric",
"6.1",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--metric",
"6.1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_metrics
2023-10-25 14:09:59 -05:00
def test_filter_metrics_5():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--metric",
"10",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--metric",
"10",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_metrics
2023-10-25 14:09:59 -05:00
def test_filter_metrics_6():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--metric",
"100",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--metric",
"100",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_kernel
2023-10-25 14:09:59 -05:00
def test_filter_kernel_1():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--kernel",
2022-11-04 14:49:36 -05:00
"0",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--kernel",
"0",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_kernel
2023-10-25 14:09:59 -05:00
def test_filter_kernel_2():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--kernel",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--kernel",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.filter_kernel
2023-10-25 14:09:59 -05:00
def test_filter_kernel_3():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2023-10-25 14:09:59 -05:00
"--kernel",
"0",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi200",
"--kernel",
"0",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.dispatch
2023-10-25 14:09:59 -05:00
def test_dispatch_1():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
2023-10-25 14:09:59 -05:00
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--dispatch",
"0",
],
2022-11-04 14:49:36 -05:00
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
2023-10-25 14:09:59 -05:00
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--dispatch",
"0",
],
):
2022-11-04 14:49:36 -05:00
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.dispatch
2023-10-25 14:09:59 -05:00
def test_dispatch_2():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
2023-10-25 14:09:59 -05:00
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--dispatch",
"1",
],
):
2022-11-04 14:49:36 -05:00
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--dispatch",
"1",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.dispatch
2023-10-25 14:09:59 -05:00
def test_dispatch_3():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--dispatch",
"2",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--dispatch",
"2",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.dispatch
2023-10-25 14:09:59 -05:00
def test_dispatch_4():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--dispatch",
"1",
"4",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--dispatch",
"1",
"4",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.dispatch
2023-10-25 14:09:59 -05:00
def test_dispatch_5():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--dispatch",
2023-10-25 14:09:59 -05:00
"5",
"6",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--dispatch",
2023-10-25 14:09:59 -05:00
"5",
"6",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_gpu_ids():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--gpu-id",
2022-11-04 14:49:36 -05:00
"0",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--gpu-id",
2023-10-25 14:09:59 -05:00
"0",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.normal_unit
2023-10-25 14:09:59 -05:00
def test_normal_unit_per_wave():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--normal-unit",
"per_wave",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--normal-unit",
"per_wave",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.normal_unit
2023-10-25 14:09:59 -05:00
def test_normal_unit_per_cycle():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--normal-unit",
"per_cycle",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--normal-unit",
"per_cycle",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.normal_unit
2023-10-25 14:09:59 -05:00
def test_normal_unit_per_second():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--normal-unit",
"per_second",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--normal-unit",
"per_second",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.normal_unit
2023-10-25 14:09:59 -05:00
def test_normal_unit_per_kernel():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--normal-unit",
"per_kernel",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--normal-unit",
"per_kernel",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.max_kernel
2023-10-25 14:09:59 -05:00
def test_max_kernel_num_1():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--max-kernel-num",
"0",
],
):
omniperf.main()
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
2023-10-25 14:09:59 -05:00
"--max-kernel-num",
"0",
2022-11-04 14:49:36 -05:00
],
):
omniperf.main()
2023-10-25 14:09:59 -05:00
assert e.value.code == 0
2022-11-04 14:49:36 -05:00
2024-02-07 12:52:44 -06:00
@pytest.mark.max_kernel
2023-10-25 14:09:59 -05:00
def test_max_kernel_num_2():
2022-11-04 14:49:36 -05:00
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
2023-10-25 14:09:59 -05:00
"tests/workloads/mixbench/mi100",
"--max-kernel-num",
"5",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--max-kernel-num",
"5",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.max_kernel
2023-10-25 14:09:59 -05:00
def test_max_kernel_num_3():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--max-kernel-num",
"10",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--max-kernel-num",
"10",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.max_kernel
2023-10-25 14:09:59 -05:00
def test_max_kernel_num_4():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--max-kernel-num",
"15",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--max-kernel-num",
"15",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.time_unit
2023-10-25 14:09:59 -05:00
def test_time_unit_s():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--time-unit",
"s",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--time-unit",
"s",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.time_unit
2023-10-25 14:09:59 -05:00
def test_time_unit_ms():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--time-unit",
"ms",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--time-unit",
"ms",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.time_unit
2023-10-25 14:09:59 -05:00
def test_time_unit_us():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--time-unit",
"us",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--time-unit",
"us",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.time_unit
2023-10-25 14:09:59 -05:00
def test_time_unit_ns():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--time-unit",
"ns",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--time-unit",
"ns",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.decimal
2023-10-25 14:09:59 -05:00
def test_decimal_1():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--decimal",
"0",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--decimal",
"0",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.decimal
2023-10-25 14:09:59 -05:00
def test_decimal_2():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--decimal",
"1",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--decimal",
"1",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.decimal
2023-10-25 14:09:59 -05:00
def test_decimal_3():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--decimal",
"4",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--decimal",
"4",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_save_dfs():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--save-dfs",
"saved_dfs",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--save-dfs",
"saved_dfs",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.col
2023-10-25 14:09:59 -05:00
def test_col_1():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--cols",
"0",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--cols",
"0",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.col
2023-10-25 14:09:59 -05:00
def test_col_2():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--cols",
"2",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--cols",
"2",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.col
2023-10-25 14:09:59 -05:00
def test_col_3():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--cols",
"0",
"2",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--cols",
"0",
"2",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_g():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"-g",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"-g",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_0():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"0",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"0",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_1():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"1",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"1",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_2():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"2",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"2",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_3():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"3",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"3",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_4():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"4",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"4",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_5():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"5",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"5",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.kernel_verbose
2023-10-25 14:09:59 -05:00
def test_kernel_verbose_6():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"6",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--kernel-verbose",
2023-10-25 14:09:59 -05:00
"6",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_baseline():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--path",
"tests/workloads/mixbench/mi100",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi200",
"--path",
"tests/workloads/mixbench1/mi200",
],
):
omniperf.main()
assert e.value.code == 0
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
"--path",
"tests/workloads/mixbench1/mi100",
],
):
omniperf.main()
assert e.value.code == 0
2024-02-07 12:52:44 -06:00
@pytest.mark.misc
2023-10-25 14:09:59 -05:00
def test_dependency_mi100():
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/mixbench/mi100",
2022-11-04 14:49:36 -05:00
"--dependency",
],
):
omniperf.main()
assert e.value.code == 0