From 50eea8c6b5b150e62d09a6195c48711672b79356 Mon Sep 17 00:00:00 2001 From: "Nigam, Aviral" Date: Thu, 10 Oct 2024 21:02:12 +0530 Subject: [PATCH] Fix cts to validate scratch register. --- conformance_tests/tools/debug/src/test_debug.cpp | 12 +++++++----- conformance_tests/tools/debug/src/test_debug.hpp | 6 +++--- .../tools/debug/src/test_debug_helper.cpp | 11 +++++++---- .../tools/include/test_harness_debug.hpp | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/conformance_tests/tools/debug/src/test_debug.cpp b/conformance_tests/tools/debug/src/test_debug.cpp index d01e7f031..7b04f776e 100644 --- a/conformance_tests/tools/debug/src/test_debug.cpp +++ b/conformance_tests/tools/debug/src/test_debug.cpp @@ -1207,15 +1207,17 @@ TEST( } void zetDebugReadWriteRegistersTest::run_read_write_registers_test( - std::vector &devices, bool use_sub_devices) { + std::vector &devices, bool use_sub_devices, + bool test_slm) { for (auto &device : devices) { print_device(device); if (!is_debug_supported(device)) continue; synchro->clear_debugger_signal(); - debugHelper = launch_process(LONG_RUNNING_KERNEL_INTERRUPTED, device, - use_sub_devices); + debug_test_type_t test_type = test_slm ? LONG_RUNNING_KERNEL_INTERRUPTED_SLM + : LONG_RUNNING_KERNEL_INTERRUPTED; + debugHelper = launch_process(test_type, device, use_sub_devices); zet_debug_event_t module_event; attach_and_get_module_event(debugHelper.id(), synchro, device, debugSession, @@ -1351,14 +1353,14 @@ TEST_F( GivenActiveDebugSessionWhenReadingAndWritingRegistersThenValidDataReadAndDataWrittenSuccessfully) { auto driver = lzt::get_default_driver(); auto devices = lzt::get_devices(driver); - run_read_write_registers_test(devices, false); + run_read_write_registers_test(devices, false, true); } TEST_F( zetDebugReadWriteRegistersTest, GivenActiveDebugSessionWhenReadingAndWritingSubDeviceRegistersThenValidDataReadAndDataWrittenSuccessfully) { auto all_sub_devices = lzt::get_all_sub_devices(); - run_read_write_registers_test(all_sub_devices, true); + run_read_write_registers_test(all_sub_devices, true, false); } void zetDebugThreadControlTest::SetUpThreadControl(ze_device_handle_t &device, diff --git a/conformance_tests/tools/debug/src/test_debug.hpp b/conformance_tests/tools/debug/src/test_debug.hpp index c3ad19ec4..93d20125e 100644 --- a/conformance_tests/tools/debug/src/test_debug.hpp +++ b/conformance_tests/tools/debug/src/test_debug.hpp @@ -16,8 +16,8 @@ namespace fs = boost::filesystem; namespace bp = boost::process; namespace bi = boost::interprocess; -const uint16_t eventsTimeoutMS = 30000; -const uint16_t eventsTimeoutS = 30; +const uint16_t eventsTimeoutMS = 3000000; +const uint16_t eventsTimeoutS = 3600; namespace lzt = level_zero_tests; @@ -254,7 +254,7 @@ class zetDebugReadWriteRegistersTest : public zetDebugMemAccessTest { void SetUp() override { zetDebugMemAccessTest::SetUp(); } void TearDown() override { zetDebugMemAccessTest::TearDown(); } void run_read_write_registers_test(std::vector &devices, - bool use_sub_devices); + bool use_sub_devices, bool test_slm); }; class zetDebugThreadControlTest : public zetDebugBaseSetup { diff --git a/conformance_tests/tools/debug/src/test_debug_helper.cpp b/conformance_tests/tools/debug/src/test_debug_helper.cpp index ceeec5a25..4c0beb48f 100644 --- a/conformance_tests/tools/debug/src/test_debug_helper.cpp +++ b/conformance_tests/tools/debug/src/test_debug_helper.cpp @@ -404,7 +404,8 @@ void multiple_modules_created_test(ze_context_handle_t context, } void run_long_kernel(ze_context_handle_t context, ze_device_handle_t device, - process_synchro &synchro, debug_options &options) { + process_synchro &synchro, debug_options &options, + bool test_slm) { auto command_list = lzt::create_command_list(device); auto command_queue = lzt::create_command_queue(device); @@ -426,9 +427,11 @@ void run_long_kernel(ze_context_handle_t context, ze_device_handle_t device, } synchro.wait_for_debugger_signal(); + const char *build_flags = + test_slm ? "-g" : "-g -igc_opts 'VISAOptions=-forcespills'"; auto module = lzt::create_module(device, module_name, ZE_MODULE_FORMAT_IL_SPIRV, - "-g" /* include debug symbols*/, nullptr); + build_flags /* include debug symbols*/, nullptr); auto kernel = lzt::create_function(module, kernel_name); @@ -1205,13 +1208,13 @@ int main(int argc, char **argv) { attach_after_module_destroyed_test(context, device, synchro, options); break; case LONG_RUNNING_KERNEL_INTERRUPTED: - run_long_kernel(context, device, synchro, options); + run_long_kernel(context, device, synchro, options, false); break; case LONG_RUNNING_KERNEL_INTERRUPTED_SLM: options.use_custom_module = true; options.module_name_in = "debug_loop_slm.spv"; options.kernel_name_in = "long_kernel_slm"; - run_long_kernel(context, device, synchro, options); + run_long_kernel(context, device, synchro, options, true); break; case MULTIPLE_THREADS: run_multiple_threads(context, device, synchro, options); diff --git a/utils/test_harness/tools/include/test_harness_debug.hpp b/utils/test_harness/tools/include/test_harness_debug.hpp index f3eeb6d67..90cabe06c 100644 --- a/utils/test_harness/tools/include/test_harness_debug.hpp +++ b/utils/test_harness/tools/include/test_harness_debug.hpp @@ -25,7 +25,7 @@ extern std::unordered_map sessionsAttachStatus; zet_debug_session_handle_t debug_attach(const ze_device_handle_t &device, const zet_debug_config_t &debug_config, - uint32_t timeout = 30); + uint32_t timeout = 3600); void debug_detach(const zet_debug_session_handle_t &debug_session);