Skip to content

Commit

Permalink
#9045: Merge 1 and 2 cq tests back into one file after enabling mixin…
Browse files Browse the repository at this point in the history
…g of 1/2 cqs in the same process
  • Loading branch information
tt-aho committed Jun 28, 2024
1 parent 0bad60d commit ebd9b61
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 301 deletions.
87 changes: 0 additions & 87 deletions models/demos/resnet/tests/test_metal_resnet50_2cqs_performant.py

This file was deleted.

78 changes: 78 additions & 0 deletions models/demos/resnet/tests/test_metal_resnet50_performant.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,81 @@ def test_run_resnet50_trace_inference(
)

device.enable_async(False)


@skip_for_wormhole_b0("This test is not supported on WHB0, please use the TTNN version.")
@pytest.mark.parametrize("device_params", [{"l1_small_size": 24576, "num_hw_cqs": 2}], indirect=True)
@pytest.mark.parametrize("batch_size", [20], ids=["batch_20"])
@pytest.mark.parametrize(
"weights_dtype",
[tt_lib.tensor.DataType.BFLOAT8_B],
ids=["weights_BFLOAT8_B"],
)
@pytest.mark.parametrize(
"activations_dtype",
[tt_lib.tensor.DataType.BFLOAT8_B],
ids=["activations_BFLOAT8_B"],
)
@pytest.mark.parametrize(
"math_fidelity",
[tt_lib.tensor.MathFidelity.LoFi],
ids=["LoFi"],
)
def test_run_resnet50_2cqs_inference(
device, use_program_cache, batch_size, weights_dtype, activations_dtype, math_fidelity, imagenet_sample_input
):
run_resnet50_inference(
device,
batch_size,
weights_dtype,
activations_dtype,
math_fidelity,
imagenet_sample_input,
run_2cq_model,
)


@skip_for_wormhole_b0("This test is not supported on WHB0, please use the TTNN version.")
@pytest.mark.parametrize(
"device_params", [{"l1_small_size": 24576, "num_hw_cqs": 2, "trace_region_size": 1500000}], indirect=True
)
@pytest.mark.parametrize("batch_size", [20], ids=["batch_20"])
@pytest.mark.parametrize(
"weights_dtype",
[tt_lib.tensor.DataType.BFLOAT8_B],
ids=["weights_BFLOAT8_B"],
)
@pytest.mark.parametrize(
"activations_dtype",
[tt_lib.tensor.DataType.BFLOAT8_B],
ids=["activations_BFLOAT8_B"],
)
@pytest.mark.parametrize(
"math_fidelity",
[tt_lib.tensor.MathFidelity.LoFi],
ids=["LoFi"],
)
@pytest.mark.parametrize("enable_async", [True, False])
def test_run_resnet50_trace_2cqs_inference(
device,
use_program_cache,
batch_size,
weights_dtype,
activations_dtype,
math_fidelity,
imagenet_sample_input,
enable_async,
):
device.enable_async(enable_async)

run_resnet50_inference(
device,
batch_size,
weights_dtype,
activations_dtype,
math_fidelity,
imagenet_sample_input,
run_trace_2cq_model,
)

device.enable_async(False)
47 changes: 47 additions & 0 deletions models/demos/resnet/tests/test_perf_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,50 @@ def test_perf_trace_bare_metal(
f"resnet50_trace_{mode}",
)
device.enable_async(False)


@skip_for_wormhole_b0(reason_str="Not tested on single WH")
@pytest.mark.parametrize("device_params", [{"l1_small_size": 32768, "num_hw_cqs": 2}], indirect=True)
@pytest.mark.models_performance_bare_metal
@pytest.mark.parametrize(
"batch_size, expected_inference_time, expected_compile_time",
((20, 0.0042, 16),),
)
def test_perf_2cqs_bare_metal(
device,
use_program_cache,
batch_size,
expected_inference_time,
expected_compile_time,
hf_cat_image_sample_input,
):
run_perf_resnet(
batch_size, expected_inference_time, expected_compile_time, hf_cat_image_sample_input, device, "resnet50_2cqs"
)


@skip_for_wormhole_b0(reason_str="Not tested on single WH")
@pytest.mark.parametrize(
"device_params", [{"l1_small_size": 32768, "num_hw_cqs": 2, "trace_region_size": 1332224}], indirect=True
)
@pytest.mark.models_performance_bare_metal
@pytest.mark.parametrize(
"batch_size, expected_inference_time, expected_compile_time",
((20, 0.0042, 16),),
)
def test_perf_trace_2cqs_bare_metal(
device,
use_program_cache,
batch_size,
expected_inference_time,
expected_compile_time,
hf_cat_image_sample_input,
):
run_perf_resnet(
batch_size,
expected_inference_time,
expected_compile_time,
hf_cat_image_sample_input,
device,
"resnet50_trace_2cqs",
)
55 changes: 0 additions & 55 deletions models/demos/resnet/tests/test_perf_resnet_2cqs.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/scripts/run_performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ run_perf_models_other() {

env pytest models/demos/ttnn_falcon7b/tests -m $test_marker

# Separate calls since we can't mix switching between number of cqs
env pytest models/demos/resnet/tests/test_perf_resnet.py -m $test_marker
env pytest models/demos/resnet/tests/test_perf_resnet_2cqs.py -m $test_marker

env pytest tests/ttnn/integration_tests/whisper/test_performance.py -m $test_marker

Expand Down
2 changes: 0 additions & 2 deletions tests/scripts/single_card/nightly/run_gs_only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ fi
echo "Running model nightly tests for GS only"

env pytest models/demos/resnet/tests/test_metal_resnet50_performant.py

env pytest models/demos/resnet/tests/test_metal_resnet50_2cqs_performant.py
Loading

0 comments on commit ebd9b61

Please sign in to comment.