Skip to content

Commit

Permalink
Revert "Revert "Revert "Remove program cache checks"""
Browse files Browse the repository at this point in the history
This reverts commit 351edaf.
  • Loading branch information
sminakov-tt committed Feb 28, 2025
1 parent d298eef commit 8475369
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/tt_eager/ops/test_eltwise_binary_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ int main() {

run_binary_ops();

TT_FATAL(device->num_program_cache_entries() == 3, "There are {} entries", device->num_program_cache_entries());

device->disable_and_clear_program_cache();

TT_FATAL(device->num_program_cache_entries() == 0, "Error");

TT_FATAL(tt::tt_metal::CloseDevice(device), "Error");

return 0;
Expand Down
3 changes: 3 additions & 0 deletions tests/tt_eager/ops/test_eltwise_unary_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ void test_program_cache() {
device->enable_program_cache();
run_tests();

TT_FATAL(device->num_program_cache_entries() == 4, "There are {} entries", device->num_program_cache_entries());

device->disable_and_clear_program_cache();
TT_FATAL(device->num_program_cache_entries() == 0, "Error");
TT_FATAL(tt::tt_metal::CloseDevice(device), "Error");
}

Expand Down
8 changes: 8 additions & 0 deletions tt-train/tests/model/nano_gpt_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ void train_test(bool use_moreh_adamw = false, bool memory_efficient = false) {
steps_time.emplace_back((double)duration / 1000.0);
}

// verify program cache
auto program_cache_entries = device->num_program_cache_entries();
if (!use_moreh_adamw) {
EXPECT_EQ(program_cache_entries, 123);
} else {
EXPECT_EQ(program_cache_entries, 102);
}

// verify time per step
size_t num_steps_below = 0;
const double expected_default_runner_time_ms = 330.0;
Expand Down
3 changes: 3 additions & 0 deletions tt-train/tests/ttnn_fixed/dropout_op_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ TEST_F(DropoutTest, TestSeed) {
xt::xarray<float> xtensor_a = xt::random::rand(shape, -0.5, 0.5);

auto xtensor_a_tensor = ttml::core::from_xtensor(xtensor_a, device);
auto num_cache_before = device->num_program_cache_entries();
auto result01 = ttnn::experimental::dropout(xtensor_a_tensor, prob, scale, dropout_seed1);
auto result02 = ttnn::experimental::dropout(xtensor_a_tensor, prob, scale, dropout_seed2);
auto result11 = ttnn::experimental::dropout(xtensor_a_tensor, prob, scale, dropout_seed1);
auto result12 = ttnn::experimental::dropout(xtensor_a_tensor, prob, scale, dropout_seed2);
auto num_cache_after = device->num_program_cache_entries();

auto result01_vec = ttml::core::to_xtensor(result01);
auto result02_vec = ttml::core::to_xtensor(result02);
Expand All @@ -50,6 +52,7 @@ TEST_F(DropoutTest, TestSeed) {
EXPECT_TRUE(xt::allclose(result01_vec, result11_vec, /*rtol=*/1e-4, /*atol=*/1e-3));
EXPECT_TRUE(xt::allclose(result02_vec, result12_vec, /*rtol=*/1e-4, /*atol=*/1e-3));
EXPECT_FALSE(xt::allclose(result01_vec, result02_vec, /*rtol=*/1e-4, /*atol=*/1e-3));
EXPECT_EQ(num_cache_before, num_cache_after - 1);
}
}

Expand Down

0 comments on commit 8475369

Please sign in to comment.