Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix freq CTS bug & add CTS for setRange edge case #67

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,15 @@ TEST_F(
for (auto pfreq_handle : pfreq_handles) {
EXPECT_NE(nullptr, pfreq_handle);
uint32_t count = 0;
zes_freq_properties_t freq_property =
lzt::get_freq_properties(pfreq_handle);

auto pFrequency = lzt::get_available_clocks(pfreq_handle, count);

for (uint32_t i = 0; i < pFrequency.size(); i++) {
if (pFrequency[i] != -1) {
EXPECT_GT(pFrequency[i], 0);
EXPECT_LE(pFrequency[i], freq_property.max);
}
if (i > 0)
EXPECT_GE(
Expand Down Expand Up @@ -386,7 +390,7 @@ TEST_F(
zes_freq_range_t freqRange = {};
zes_freq_range_t freqRangeReset = {};
uint32_t count = 0;
auto frequency = lzt::get_available_clocks(*pfreq_handles.data(), count);
auto frequency = lzt::get_available_clocks(pfreq_handle, count);
ASSERT_GT(frequency.size(), 0);
if (count == 1) {
freqRange.min = frequency[0];
Expand All @@ -408,6 +412,42 @@ TEST_F(
}
}
}

TEST_F(
FREQUENCY_TEST,
GivenInvalidFrequencyRangeWhenRequestingSetFrequencyThenExpectMinAndMaxFrequencyInGetFrequencyCall) {
vishnu-khanth marked this conversation as resolved.
Show resolved Hide resolved
for (auto device : devices) {
uint32_t p_count = 0;
auto pfreq_handles = lzt::get_freq_handles(device, p_count);
if (p_count == 0) {
FAIL() << "No handles found: "
<< _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}

for (auto pfreq_handle : pfreq_handles) {
EXPECT_NE(nullptr, pfreq_handle);

zes_freq_range_t freq_range = {};
vishnu-khanth marked this conversation as resolved.
Show resolved Hide resolved
zes_freq_range_t modified_freq_range = {};

zes_freq_properties_t freq_property =
lzt::get_freq_properties(pfreq_handle);

if (freq_property.min - 100 >= 0) {
freq_range.min = freq_property.min - 100;
} else {
freq_range.min = 0;
}
freq_range.max = freq_property.max + 100;

lzt::set_freq_range(pfreq_handle, freq_range);
vishnu-khanth marked this conversation as resolved.
Show resolved Hide resolved
modified_freq_range = lzt::get_and_validate_freq_range(pfreq_handle);
EXPECT_EQ(freq_property.min, modified_freq_range.min);
EXPECT_EQ(freq_property.max, modified_freq_range.max);
}
}
}

void load_for_gpu(ze_device_handle_t target_device) {
int m, k, n;
m = k = n = 5000;
Expand Down