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

Function to check for heapless mode #92

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions utils/test_harness/tools/include/test_harness_debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ void debug_write_registers(const zet_debug_session_handle_t &debug_session,

std::vector<uint8_t> get_debug_info(const zet_module_handle_t &module);

bool is_heapless_mode(ze_device_thread_t stopped_thread,
ze_device_handle_t &device_handle,
zet_debug_session_handle_t debug_session);

}; // namespace level_zero_tests

#endif /* TEST_HARNESS_DEBUG_HPP */
27 changes: 27 additions & 0 deletions utils/test_harness/tools/src/test_harness_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,31 @@ std::vector<uint8_t> get_debug_info(const zet_module_handle_t &module_handle) {
return debug_info;
}

bool is_heapless_mode(ze_device_thread_t stopped_thread,
ze_device_handle_t &device_handle,
zet_debug_session_handle_t debug_session) {

uint8_t *mode_values = nullptr;
bool result = false;
std::vector<zet_debug_regset_properties_t> regset_properties =
lzt::get_register_set_properties(device_handle);
for (auto &register_set : regset_properties) {
if (register_set.type == ZET_DEBUG_REGSET_TYPE_MODE_FLAGS_INTEL_GPU) {
auto reg_size_in_bytes = register_set.count * register_set.byteSize;
mode_values = new uint8_t[reg_size_in_bytes];
EXPECT_EQ(
zetDebugReadRegisters(debug_session, stopped_thread,
ZET_DEBUG_REGSET_TYPE_MODE_FLAGS_INTEL_GPU, 0,
register_set.count, mode_values),
ZE_RESULT_SUCCESS);

uint32_t *uint32_t_values = (uint32_t *)mode_values;
LOG_DEBUG << "[Debugger] mode value: %u " << uint32_t_values[0];
result = (uint32_t_values[0] & ZET_DEBUG_MODE_FLAG_HEAPLESS);
}
}

return result;
}

} // namespace level_zero_tests
Loading