From bb80d327c7af3364921aef0b9f03060d69f48a31 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Mon, 6 May 2019 12:33:44 +0200 Subject: [PATCH] Move HardwareInfo ownership to ExecutionEnvironment [1/n] Change-Id: I5e5b4cc45947a8841282c7d431fb69d9c397a2d4 Signed-off-by: Dunajski, Bartosz --- offline_compiler/offline_compiler.cpp | 54 ++-- runtime/api/api.cpp | 4 +- runtime/aub/aub_center.cpp | 2 +- runtime/built_ins/built_ins_storage.cpp | 2 +- .../aub_command_stream_receiver.cpp | 8 +- .../command_stream_receiver_hw.inl | 4 +- .../create_command_stream_impl.cpp | 12 +- .../create_command_stream_impl.h | 3 +- runtime/command_stream/preemption.inl | 2 +- .../scratch_space_controller.cpp | 2 +- .../scratch_space_controller_base.cpp | 4 +- .../tbx_command_stream_receiver.cpp | 4 +- .../tbx_command_stream_receiver_hw.inl | 2 +- runtime/compiler_interface/binary_cache.cpp | 6 +- .../compiler_interface/compiler_interface.cpp | 52 ++-- runtime/device/device.cpp | 48 ++-- runtime/device/device.h | 22 +- runtime/device/device_caps.cpp | 10 +- runtime/device/device_info.cpp | 4 +- runtime/device_queue/device_queue.cpp | 2 +- runtime/dll/get_devices.cpp | 5 +- runtime/dll/linux/drm_neo_create.cpp | 4 +- .../execution_environment.cpp | 17 +- .../execution_environment.h | 7 +- runtime/gen10/hw_helper_gen10.cpp | 2 +- runtime/gen10/hw_info_cnl.inl | 18 +- runtime/gen10/linux/hw_info_config_cnl.inl | 2 +- runtime/gen10/preamble_gen10.cpp | 4 +- .../command_stream_receiver_hw_gen11.cpp | 20 +- runtime/gen11/hw_helper_gen11.cpp | 2 +- runtime/gen11/hw_info_icllp.inl | 12 +- runtime/gen11/hw_info_lkf.inl | 6 +- runtime/gen11/linux/hw_info_config_icllp.inl | 2 +- runtime/gen11/linux/hw_info_config_lkf.inl | 2 +- runtime/gen11/preamble_gen11.cpp | 4 +- runtime/gen8/hw_info_bdw.inl | 12 +- runtime/gen8/linux/hw_info_config_bdw.inl | 6 +- runtime/gen8/preamble_gen8.cpp | 2 +- runtime/gen9/hw_info_bxt.inl | 10 +- runtime/gen9/hw_info_cfl.inl | 14 +- runtime/gen9/hw_info_glk.inl | 8 +- runtime/gen9/hw_info_kbl.inl | 16 +- runtime/gen9/hw_info_skl.inl | 20 +- runtime/gen9/linux/hw_info_config_bxt.inl | 4 +- runtime/gen9/linux/hw_info_config_cfl.inl | 6 +- runtime/gen9/linux/hw_info_config_glk.inl | 4 +- runtime/gen9/linux/hw_info_config_kbl.inl | 6 +- runtime/gen9/linux/hw_info_config_skl.inl | 12 +- runtime/gen9/preamble_gen9.cpp | 4 +- runtime/gmm_helper/gmm.cpp | 4 +- runtime/gmm_helper/gmm_helper.cpp | 2 +- runtime/gtpin/gtpin_callbacks.cpp | 8 +- runtime/helpers/hw_helper_common.inl | 4 +- runtime/helpers/hw_info.cpp | 2 +- runtime/helpers/hw_info.h | 8 +- runtime/helpers/preamble.inl | 4 +- runtime/kernel/kernel.cpp | 8 +- runtime/mem_obj/buffer.cpp | 6 +- runtime/mem_obj/image.cpp | 4 +- runtime/memory_manager/memory_manager.cpp | 2 +- runtime/os_interface/device_factory.cpp | 19 +- runtime/os_interface/device_factory.h | 6 +- .../linux/device_factory_linux.cpp | 18 +- runtime/os_interface/linux/hw_info_config.cpp | 33 +-- .../linux/performance_counters_linux.cpp | 2 +- runtime/os_interface/performance_counters.cpp | 4 +- .../windows/device_factory_win.cpp | 24 +- .../os_interface/windows/hw_info_config.cpp | 14 +- runtime/os_interface/windows/wddm/wddm.cpp | 8 +- runtime/platform/platform.cpp | 13 +- runtime/program/kernel_info.cpp | 2 +- runtime/sampler/sampler.cpp | 4 +- runtime/scheduler/scheduler_kernel.cpp | 6 +- runtime/sku_info/definitions/sku_info.h | 4 +- unit_tests/api/cl_build_program_tests.inl | 2 +- ...cl_set_performance_configuration_tests.inl | 7 +- unit_tests/api/cl_svm_alloc_tests.inl | 22 +- unit_tests/aub/aub_center_tests.cpp | 4 +- .../aub_command_stream_fixture.cpp | 2 +- .../command_stream/aub_mem_dump_tests.cpp | 4 +- unit_tests/aub_tests/fixtures/aub_fixture.h | 5 +- .../enqueue_debug_kernel_tests.cpp | 4 +- unit_tests/command_queue/enqueue_fixture.cpp | 1 + unit_tests/command_queue/enqueue_fixture.h | 16 +- .../command_queue/enqueue_kernel_2_tests.cpp | 4 +- .../command_queue/local_work_size_tests.cpp | 58 ++-- .../aub_command_stream_receiver_1_tests.cpp | 9 +- .../aub_command_stream_receiver_2_tests.cpp | 7 +- .../command_stream_receiver_tests.cpp | 4 +- ...nd_stream_receiver_with_aub_dump_tests.cpp | 2 +- .../command_stream/get_devices_tests.cpp | 49 ++-- .../tbx_command_stream_tests.cpp | 15 +- .../compiler_interface/binary_cache_tests.cpp | 12 +- .../compiler_interface_tests.cpp | 20 +- unit_tests/context/context_tests.cpp | 2 +- .../context/driver_diagnostics_tests.cpp | 4 +- unit_tests/context/driver_diagnostics_tests.h | 2 +- .../get_supported_image_formats_tests.cpp | 4 +- unit_tests/device/device_caps_tests.cpp | 51 ++-- unit_tests/device/device_tests.cpp | 35 ++- unit_tests/event/event_tests.cpp | 2 +- .../execution_environment_tests.cpp | 12 +- unit_tests/fixtures/buffer_enqueue_fixture.h | 6 +- unit_tests/fixtures/device_fixture.cpp | 4 +- .../device_instrumentation_fixture.cpp | 4 +- unit_tests/fixtures/image_fixture.h | 7 +- .../fixtures/memory_allocator_fixture.h | 2 +- .../fixtures/memory_manager_fixture.cpp | 2 +- unit_tests/gen10/hw_helper_tests_gen10.cpp | 30 +- .../linux/device_factory_tests_gen10.cpp | 12 +- .../linux/hw_info_config_tests_gen10.cpp | 145 ++++------ unit_tests/gen10/test_device_caps_gen10.cpp | 6 +- unit_tests/gen10/test_hw_info_config_cnl.cpp | 16 +- unit_tests/gen10/test_preamble_gen10.cpp | 42 +-- unit_tests/gen10/test_preemption_gen10.cpp | 2 +- unit_tests/gen10/test_sample_gen10.cpp | 2 +- .../windows/hw_info_config_tests_gen10.cpp | 5 +- .../windows/os_interface_tests_gen10.cpp | 6 +- unit_tests/gen11/hw_helper_tests_gen11.cpp | 14 +- .../linux/hw_info_config_tests_icllp.cpp | 88 ++---- .../gen11/icllp/test_hw_info_config_icllp.cpp | 63 ++--- .../windows/hw_info_config_tests_icllp.cpp | 5 +- .../lkf/linux/hw_info_config_tests_lkf.cpp | 59 ++-- .../gen11/lkf/test_hw_info_config_lkf.cpp | 38 ++- .../lkf/windows/hw_info_config_tests_lkf.cpp | 5 +- .../program_media_sampler_tests_gen11.cpp | 14 +- unit_tests/gen11/test_device_caps_gen11.cpp | 4 +- unit_tests/gen11/test_preamble_gen11.cpp | 18 +- .../bdw/linux/hw_info_config_tests_bdw.cpp | 142 +++++----- unit_tests/gen8/bdw/test_device_caps_bdw.cpp | 6 +- .../gen8/bdw/test_hw_info_config_bdw.cpp | 14 +- .../bdw/windows/hw_info_config_tests_bdw.cpp | 5 +- unit_tests/gen8/hw_helper_tests_gen8.cpp | 14 +- unit_tests/gen8/test_preamble_gen8.cpp | 3 +- unit_tests/gen8/test_sample_gen8.cpp | 2 +- .../gen9/bxt/linux/hw_info_config_tests.cpp | 194 ++++++------- .../gen9/bxt/test_hw_info_config_bxt.cpp | 15 +- .../bxt/windows/hw_info_config_tests_bxt.cpp | 5 +- .../cfl/linux/hw_info_config_tests_cfl.cpp | 146 +++++----- .../gen9/cfl/test_hw_info_config_cfl.cpp | 14 +- .../cfl/windows/hw_info_config_tests_cfl.cpp | 5 +- .../glk/linux/hw_info_config_tests_glk.cpp | 192 ++++++------- .../gen9/glk/test_hw_info_config_glk.cpp | 21 +- .../glk/windows/hw_info_config_tests_glk.cpp | 5 +- unit_tests/gen9/hw_helper_tests_gen9.cpp | 18 +- .../kbl/linux/hw_info_config_tests_kbl.cpp | 224 +++++++-------- .../gen9/kbl/test_hw_info_config_kbl.cpp | 15 +- .../kbl/windows/hw_info_config_tests_kbl.cpp | 4 +- .../gen9/linux/device_factory_tests_gen9.cpp | 11 +- .../skl/linux/hw_info_config_tests_skl.cpp | 260 ++++++++---------- .../gen9/skl/test_hw_info_config_skl.cpp | 17 +- unit_tests/gen9/skl/test_preamble_skl.cpp | 13 +- unit_tests/gen9/skl/test_sample_skl.cpp | 2 +- .../skl/windows/hw_info_config_tests_skl.cpp | 5 +- unit_tests/gen9/test_device_caps_gen9.cpp | 6 +- unit_tests/gen9/test_platform_caps_gen9.cpp | 4 +- unit_tests/gen9/test_preemption_gen9.cpp | 4 +- .../gen9/windows/os_interface_tests_gen9.cpp | 6 +- .../gen_commands_common_validation.h | 4 +- unit_tests/global_environment.cpp | 4 +- unit_tests/gmm_helper/gmm_helper_tests.cpp | 11 +- unit_tests/gtpin/gtpin_tests.cpp | 12 +- unit_tests/helpers/CMakeLists.txt | 1 - .../helpers/execution_environment_helper.cpp | 3 +- unit_tests/helpers/hw_helper_tests.cpp | 17 +- unit_tests/helpers/hw_helper_tests.h | 3 +- unit_tests/helpers/hw_info_helper.h | 32 --- unit_tests/helpers/kmd_notify_tests.cpp | 49 ++-- unit_tests/helpers/timestamp_packet_tests.cpp | 14 +- unit_tests/kernel/debug_kernel_tests.cpp | 8 +- .../kernel_reflection_surface_tests.cpp | 4 +- unit_tests/kernel/kernel_tests.cpp | 16 +- unit_tests/kernel/parent_kernel_tests.cpp | 12 +- unit_tests/libult/create_command_stream.cpp | 9 +- unit_tests/libult/create_command_stream.h | 2 +- unit_tests/linux/main_linux_dll.cpp | 2 +- unit_tests/main.cpp | 32 +-- unit_tests/mem_obj/buffer_tests.cpp | 40 +-- .../mem_obj/image2d_from_buffer_tests.cpp | 2 +- unit_tests/mem_obj/image_tests.cpp | 2 +- .../mem_obj/mem_obj_destruction_tests.cpp | 2 +- unit_tests/mem_obj/mem_obj_tests.cpp | 2 +- .../deferrable_allocation_deletion_tests.cpp | 2 +- .../memory_manager/memory_manager_tests.cpp | 22 +- unit_tests/memory_manager/surface_tests.cpp | 2 +- unit_tests/mocks/mock_device.cpp | 24 +- unit_tests/mocks/mock_device.h | 22 +- unit_tests/mocks/mock_execution_environment.h | 4 +- unit_tests/mocks/mock_program.cpp | 2 +- .../offline_compiler_tests.cpp | 2 +- .../os_interface/device_factory_tests.cpp | 98 +++---- .../os_interface/hw_info_config_tests.cpp | 52 +--- .../os_interface/hw_info_config_tests.h | 20 +- .../linux/device_command_stream_fixture.h | 2 +- .../linux/device_factory_tests.cpp | 26 +- .../linux/drm_command_stream_tests.cpp | 6 +- .../linux/drm_memory_manager_tests.cpp | 2 +- .../linux/hw_info_config_linux_tests.cpp | 159 ++++++----- .../linux/hw_info_config_linux_tests.h | 2 - .../performance_counters_gen_tests.cpp | 4 +- .../windows/device_command_stream_tests.cpp | 21 +- .../windows/driver_info_tests.cpp | 6 +- .../os_interface/windows/gdi_dll_fixture.h | 4 +- .../windows/gl/gl_os_sharing_tests.cpp | 4 +- .../windows/hw_info_config_win_tests.cpp | 11 +- .../windows/hw_info_config_win_tests.h | 1 - .../windows/os_interface_win_tests.cpp | 4 +- .../os_interface/windows/wddm20_tests.cpp | 80 ++---- .../os_interface/windows/wddm23_tests.cpp | 4 +- .../os_interface/windows/wddm_fixture.h | 4 +- .../windows/wddm_memory_manager_tests.cpp | 4 +- .../windows/wddm_memory_manager_tests.h | 4 +- .../windows/wddm_preemption_tests.cpp | 2 +- .../wddm_residency_controller_tests.cpp | 4 +- unit_tests/platform/platform_tests.cpp | 6 +- unit_tests/preamble/preamble_fixture.h | 12 +- unit_tests/preamble/preamble_tests.cpp | 4 +- unit_tests/preemption/preemption_tests.cpp | 28 +- unit_tests/program/program_data_tests.cpp | 2 +- unit_tests/program/program_nonuniform.cpp | 2 +- unit_tests/program/program_tests.cpp | 14 +- .../program_with_kernel_debug_tests.cpp | 28 +- ...d_write_buffer_scenarios_windows_tests.cpp | 5 +- .../scheduler/scheduler_kernel_tests.cpp | 14 +- .../sharings/gl/gl_arb_sync_event_tests.cpp | 2 +- unit_tests/sharings/gl/gl_texture_tests.cpp | 2 +- unit_tests/sharings/sharing_factory_tests.cpp | 2 +- .../source_level_debugger_csr_tests.cpp | 8 +- .../source_level_debugger_device_tests.cpp | 6 +- .../source_level_debugger_preamble_test.inl | 6 +- .../source_level_debugger_tests.cpp | 12 +- unit_tests/tbx/main_tbx.cpp | 22 +- unit_tests/windows/get_devices_tests.cpp | 5 +- 233 files changed, 1786 insertions(+), 2298 deletions(-) delete mode 100644 unit_tests/helpers/hw_info_helper.h diff --git a/offline_compiler/offline_compiler.cpp b/offline_compiler/offline_compiler.cpp index f3c0b7ab8f..50f65d9537 100644 --- a/offline_compiler/offline_compiler.cpp +++ b/offline_compiler/offline_compiler.cpp @@ -237,7 +237,7 @@ int OfflineCompiler::getHardwareInfo(const char *pDeviceName) { if (hardwareInfoTable[productId]) { hwInfo = hardwareInfoTable[productId]; familyNameWithType.clear(); - familyNameWithType.append(familyName[hwInfo->pPlatform->eRenderCoreFamily]); + familyNameWithType.append(familyName[hwInfo->pPlatform.eRenderCoreFamily]); familyNameWithType.append(getPlatformType(*hwInfo)); retVal = CL_SUCCESS; break; @@ -394,39 +394,39 @@ int OfflineCompiler::initialize(size_t numArgs, const char *const *argv) { if ((igcPlatform == nullptr) || (igcGtSystemInfo == nullptr) || (igcFeWa == nullptr)) { return CL_OUT_OF_HOST_MEMORY; } - IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), *hwInfo->pPlatform); - IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), *hwInfo->pSysInfo); + IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), hwInfo->pPlatform); + IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo->pSysInfo); // populate with features - igcFeWa.get()->SetFtrDesktop(hwInfo->pSkuTable->ftrDesktop); - igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(hwInfo->pSkuTable->ftrChannelSwizzlingXOREnabled); + igcFeWa.get()->SetFtrDesktop(hwInfo->pSkuTable.ftrDesktop); + igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(hwInfo->pSkuTable.ftrChannelSwizzlingXOREnabled); - igcFeWa.get()->SetFtrGtBigDie(hwInfo->pSkuTable->ftrGtBigDie); - igcFeWa.get()->SetFtrGtMediumDie(hwInfo->pSkuTable->ftrGtMediumDie); - igcFeWa.get()->SetFtrGtSmallDie(hwInfo->pSkuTable->ftrGtSmallDie); + igcFeWa.get()->SetFtrGtBigDie(hwInfo->pSkuTable.ftrGtBigDie); + igcFeWa.get()->SetFtrGtMediumDie(hwInfo->pSkuTable.ftrGtMediumDie); + igcFeWa.get()->SetFtrGtSmallDie(hwInfo->pSkuTable.ftrGtSmallDie); - igcFeWa.get()->SetFtrGT1(hwInfo->pSkuTable->ftrGT1); - igcFeWa.get()->SetFtrGT1_5(hwInfo->pSkuTable->ftrGT1_5); - igcFeWa.get()->SetFtrGT2(hwInfo->pSkuTable->ftrGT2); - igcFeWa.get()->SetFtrGT3(hwInfo->pSkuTable->ftrGT3); - igcFeWa.get()->SetFtrGT4(hwInfo->pSkuTable->ftrGT4); + igcFeWa.get()->SetFtrGT1(hwInfo->pSkuTable.ftrGT1); + igcFeWa.get()->SetFtrGT1_5(hwInfo->pSkuTable.ftrGT1_5); + igcFeWa.get()->SetFtrGT2(hwInfo->pSkuTable.ftrGT2); + igcFeWa.get()->SetFtrGT3(hwInfo->pSkuTable.ftrGT3); + igcFeWa.get()->SetFtrGT4(hwInfo->pSkuTable.ftrGT4); - igcFeWa.get()->SetFtrIVBM0M1Platform(hwInfo->pSkuTable->ftrIVBM0M1Platform); - igcFeWa.get()->SetFtrGTL(hwInfo->pSkuTable->ftrGT1); - igcFeWa.get()->SetFtrGTM(hwInfo->pSkuTable->ftrGT2); - igcFeWa.get()->SetFtrGTH(hwInfo->pSkuTable->ftrGT3); + igcFeWa.get()->SetFtrIVBM0M1Platform(hwInfo->pSkuTable.ftrIVBM0M1Platform); + igcFeWa.get()->SetFtrGTL(hwInfo->pSkuTable.ftrGT1); + igcFeWa.get()->SetFtrGTM(hwInfo->pSkuTable.ftrGT2); + igcFeWa.get()->SetFtrGTH(hwInfo->pSkuTable.ftrGT3); - igcFeWa.get()->SetFtrSGTPVSKUStrapPresent(hwInfo->pSkuTable->ftrSGTPVSKUStrapPresent); - igcFeWa.get()->SetFtrGTA(hwInfo->pSkuTable->ftrGTA); - igcFeWa.get()->SetFtrGTC(hwInfo->pSkuTable->ftrGTC); - igcFeWa.get()->SetFtrGTX(hwInfo->pSkuTable->ftrGTX); - igcFeWa.get()->SetFtr5Slice(hwInfo->pSkuTable->ftr5Slice); + igcFeWa.get()->SetFtrSGTPVSKUStrapPresent(hwInfo->pSkuTable.ftrSGTPVSKUStrapPresent); + igcFeWa.get()->SetFtrGTA(hwInfo->pSkuTable.ftrGTA); + igcFeWa.get()->SetFtrGTC(hwInfo->pSkuTable.ftrGTC); + igcFeWa.get()->SetFtrGTX(hwInfo->pSkuTable.ftrGTX); + igcFeWa.get()->SetFtr5Slice(hwInfo->pSkuTable.ftr5Slice); - igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(hwInfo->pSkuTable->ftrGpGpuMidThreadLevelPreempt); - igcFeWa.get()->SetFtrIoMmuPageFaulting(hwInfo->pSkuTable->ftrIoMmuPageFaulting); - igcFeWa.get()->SetFtrWddm2Svm(hwInfo->pSkuTable->ftrWddm2Svm); - igcFeWa.get()->SetFtrPooledEuEnabled(hwInfo->pSkuTable->ftrPooledEuEnabled); + igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(hwInfo->pSkuTable.ftrGpGpuMidThreadLevelPreempt); + igcFeWa.get()->SetFtrIoMmuPageFaulting(hwInfo->pSkuTable.ftrIoMmuPageFaulting); + igcFeWa.get()->SetFtrWddm2Svm(hwInfo->pSkuTable.ftrWddm2Svm); + igcFeWa.get()->SetFtrPooledEuEnabled(hwInfo->pSkuTable.ftrPooledEuEnabled); - igcFeWa.get()->SetFtrResourceStreamer(hwInfo->pSkuTable->ftrResourceStreamer); + igcFeWa.get()->SetFtrResourceStreamer(hwInfo->pSkuTable.ftrResourceStreamer); return retVal; } diff --git a/runtime/api/api.cpp b/runtime/api/api.cpp index dc54ebcb80..cb797f9f19 100644 --- a/runtime/api/api.cpp +++ b/runtime/api/api.cpp @@ -452,7 +452,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context, pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL, DRIVER_CALLS_INTERNAL_CL_FLUSH); if (castToObjectOrAbort(commandQueue)->isProfilingEnabled()) { pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL, PROFILING_ENABLED); - if (pDevice->getDeviceInfo().preemptionSupported && pDevice->getHardwareInfo().pPlatform->eProductFamily < IGFX_SKYLAKE) { + if (pDevice->getDeviceInfo().preemptionSupported && pDevice->getHardwareInfo().pPlatform.eProductFamily < IGFX_SKYLAKE) { pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL, PROFILING_ENABLED_WITH_DISABLED_PREEMPTION); } } @@ -3894,7 +3894,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL, DRIVER_CALLS_INTERNAL_CL_FLUSH); if (castToObjectOrAbort(commandQueue)->isProfilingEnabled()) { pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL, PROFILING_ENABLED); - if (pDevice->getDeviceInfo().preemptionSupported && pDevice->getHardwareInfo().pPlatform->eProductFamily < IGFX_SKYLAKE) { + if (pDevice->getDeviceInfo().preemptionSupported && pDevice->getHardwareInfo().pPlatform.eProductFamily < IGFX_SKYLAKE) { pContext->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL, PROFILING_ENABLED_WITH_DISABLED_PREEMPTION); } } diff --git a/runtime/aub/aub_center.cpp b/runtime/aub/aub_center.cpp index ed2a4e7c00..feeac46cbe 100644 --- a/runtime/aub/aub_center.cpp +++ b/runtime/aub/aub_center.cpp @@ -36,7 +36,7 @@ AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const aub_stream::setTbxServerIp(DebugManager.flags.TbxServer.get()); aub_stream::setTbxServerPort(DebugManager.flags.TbxPort.get()); - aubManager.reset(createAubManager(pHwInfo->pPlatform->eProductFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubStreamMode)); + aubManager.reset(createAubManager(pHwInfo->pPlatform.eProductFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubStreamMode)); } addressMapper = std::make_unique(); streamProvider = std::make_unique(); diff --git a/runtime/built_ins/built_ins_storage.cpp b/runtime/built_ins/built_ins_storage.cpp index c57debf8b6..eb00a37c10 100644 --- a/runtime/built_ins/built_ins_storage.cpp +++ b/runtime/built_ins/built_ins_storage.cpp @@ -197,7 +197,7 @@ BuiltinResourceT BuiltinsLib::getBuiltinResource(EBuiltInOps builtin, BuiltinCod std::string resourceNameGeneric = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType)); std::string resourceNameForPlatformType = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getFamilyNameWithType()); std::string resourceNameForPlatformTypeAndStepping = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getFamilyNameWithType(), - device.getHardwareInfo().pPlatform->usRevId); + device.getHardwareInfo().pPlatform.usRevId); for (auto &rn : {resourceNameForPlatformTypeAndStepping, resourceNameForPlatformType, resourceNameGeneric}) { // first look for dedicated version, only fallback to generic one for (auto &s : allStorages) { diff --git a/runtime/command_stream/aub_command_stream_receiver.cpp b/runtime/command_stream/aub_command_stream_receiver.cpp index c3dc3d232c..15a7918c91 100644 --- a/runtime/command_stream/aub_command_stream_receiver.cpp +++ b/runtime/command_stream/aub_command_stream_receiver.cpp @@ -22,10 +22,10 @@ namespace NEO { AubCommandStreamReceiverCreateFunc aubCommandStreamReceiverFactory[IGFX_MAX_CORE] = {}; std::string AUBCommandStreamReceiver::createFullFilePath(const HardwareInfo &hwInfo, const std::string &filename) { - std::string hwPrefix = hardwarePrefix[hwInfo.pPlatform->eProductFamily]; + std::string hwPrefix = hardwarePrefix[hwInfo.pPlatform.eProductFamily]; // Generate the full filename - const auto >SystemInfo = *hwInfo.pSysInfo; + const auto >SystemInfo = hwInfo.pSysInfo; std::stringstream strfilename; uint32_t subSlicesPerSlice = gtSystemInfo.SubSliceCount / gtSystemInfo.SliceCount; strfilename << hwPrefix << "_" << gtSystemInfo.SliceCount << "x" << subSlicesPerSlice << "x" << gtSystemInfo.MaxEuPerSubSlice << "_" << filename << ".aub"; @@ -50,12 +50,12 @@ CommandStreamReceiver *AUBCommandStreamReceiver::create(const std::string &baseN filePath.assign(DebugManager.flags.AUBDumpCaptureFileName.get()); } - if (hwInfo->pPlatform->eRenderCoreFamily >= IGFX_MAX_CORE) { + if (hwInfo->pPlatform.eRenderCoreFamily >= IGFX_MAX_CORE) { DEBUG_BREAK_IF(!false); return nullptr; } - auto pCreate = aubCommandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily]; + auto pCreate = aubCommandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily]; return pCreate ? pCreate(filePath, standalone, executionEnvironment) : nullptr; } } // namespace NEO diff --git a/runtime/command_stream/command_stream_receiver_hw.inl b/runtime/command_stream/command_stream_receiver_hw.inl index 573c91cbb5..bcdd596431 100644 --- a/runtime/command_stream/command_stream_receiver_hw.inl +++ b/runtime/command_stream/command_stream_receiver_hw.inl @@ -42,7 +42,7 @@ template CommandStreamReceiverHw::CommandStreamReceiverHw(ExecutionEnvironment &executionEnvironment) : CommandStreamReceiver(executionEnvironment) { - auto &hwHelper = HwHelper::get(peekHwInfo().pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(peekHwInfo().pPlatform.eRenderCoreFamily); localMemoryEnabled = hwHelper.getEnableLocalMemory(peekHwInfo()); requiredThreadArbitrationPolicy = PreambleHelper::getDefaultThreadArbitrationPolicy(); @@ -390,7 +390,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( makeResident(*preemptionCsrAllocation); if (dispatchFlags.preemptionMode == PreemptionMode::MidThread || device.isSourceLevelDebuggerActive()) { - auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().pPlatform->eRenderCoreFamily, device.isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().pPlatform.eRenderCoreFamily, device.isSourceLevelDebuggerActive()); makeResident(*device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device).getSipAllocation()); if (debugSurface) { makeResident(*debugSurface); diff --git a/runtime/command_stream/create_command_stream_impl.cpp b/runtime/command_stream/create_command_stream_impl.cpp index 50886e434a..a80b9094ed 100644 --- a/runtime/command_stream/create_command_stream_impl.cpp +++ b/runtime/command_stream/create_command_stream_impl.cpp @@ -18,7 +18,7 @@ namespace NEO { extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE]; CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEnvironment) { - auto funcCreate = commandStreamReceiverFactory[executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily]; + auto funcCreate = commandStreamReceiverFactory[executionEnvironment.getHardwareInfo()->pPlatform.eRenderCoreFamily]; if (funcCreate == nullptr) { return nullptr; } @@ -49,7 +49,7 @@ CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEn return commandStreamReceiver; } -bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) { +bool getDevicesImpl(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) { bool result; int32_t csr = DebugManager.flags.SetCommandStreamReceiver.get(); if (csr < 0) { @@ -57,15 +57,15 @@ bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned, Execution } switch (csr) { case CSR_HW: - result = DeviceFactory::getDevices(hwInfo, numDevicesReturned, executionEnvironment); - DEBUG_BREAK_IF(result && (hwInfo == nullptr)); + result = DeviceFactory::getDevices(numDevicesReturned, executionEnvironment); + DEBUG_BREAK_IF(!result); return result; case CSR_AUB: case CSR_TBX: case CSR_TBX_WITH_AUB: - return DeviceFactory::getDevicesForProductFamilyOverride(hwInfo, numDevicesReturned, executionEnvironment); + return DeviceFactory::getDevicesForProductFamilyOverride(numDevicesReturned, executionEnvironment); case CSR_HW_WITH_AUB: - return DeviceFactory::getDevices(hwInfo, numDevicesReturned, executionEnvironment); + return DeviceFactory::getDevices(numDevicesReturned, executionEnvironment); default: return false; } diff --git a/runtime/command_stream/create_command_stream_impl.h b/runtime/command_stream/create_command_stream_impl.h index 4825e38400..d87f97657b 100644 --- a/runtime/command_stream/create_command_stream_impl.h +++ b/runtime/command_stream/create_command_stream_impl.h @@ -7,10 +7,9 @@ #pragma once #include "runtime/command_stream/command_stream_receiver.h" -#include "runtime/helpers/hw_info.h" namespace NEO { class ExecutionEnvironment; extern CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEnvironment); -extern bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); +extern bool getDevicesImpl(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); } // namespace NEO diff --git a/runtime/command_stream/preemption.inl b/runtime/command_stream/preemption.inl index 1161e8e0e4..9a4166fdb6 100644 --- a/runtime/command_stream/preemption.inl +++ b/runtime/command_stream/preemption.inl @@ -81,7 +81,7 @@ void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device & if (isMidThreadPreemption || sourceLevelDebuggerActive) { auto sip = reinterpret_cast(preambleCmdStream.getSpace(sizeof(STATE_SIP))); *sip = GfxFamily::cmdInitStateSip; - auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().pPlatform->eRenderCoreFamily, sourceLevelDebuggerActive); + auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().pPlatform.eRenderCoreFamily, sourceLevelDebuggerActive); sip->setSystemInstructionPointer(device.getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, device).getSipAllocation()->getGpuAddressToPatch()); } } diff --git a/runtime/command_stream/scratch_space_controller.cpp b/runtime/command_stream/scratch_space_controller.cpp index 345e3dd044..69659cafba 100644 --- a/runtime/command_stream/scratch_space_controller.cpp +++ b/runtime/command_stream/scratch_space_controller.cpp @@ -17,7 +17,7 @@ namespace NEO { ScratchSpaceController::ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) : executionEnvironment(environment), csrAllocationStorage(allocationStorage) { auto hwInfo = executionEnvironment.getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily); computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(hwInfo); } diff --git a/runtime/command_stream/scratch_space_controller_base.cpp b/runtime/command_stream/scratch_space_controller_base.cpp index 09c59daf74..22cca94816 100644 --- a/runtime/command_stream/scratch_space_controller_base.cpp +++ b/runtime/command_stream/scratch_space_controller_base.cpp @@ -49,7 +49,7 @@ void ScratchSpaceControllerBase::createScratchSpaceAllocation() { } uint64_t ScratchSpaceControllerBase::calculateNewGSH() { - auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform.eRenderCoreFamily); auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit(); return scratchAllocation->getGpuAddress() - scratchSpaceOffsetFor64bit; } @@ -61,7 +61,7 @@ uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() { if (scratchAllocation) { scratchAddress = scratchAllocation->getGpuAddressToPatch(); if (is64bit && !getMemoryManager()->peekForce32BitAllocations()) { - auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform.eRenderCoreFamily); auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit(); //this is to avoid scractch allocation offset "0" scratchAddress = scratchSpaceOffsetFor64bit; diff --git a/runtime/command_stream/tbx_command_stream_receiver.cpp b/runtime/command_stream/tbx_command_stream_receiver.cpp index 94a470b1e4..d1c4c56a78 100644 --- a/runtime/command_stream/tbx_command_stream_receiver.cpp +++ b/runtime/command_stream/tbx_command_stream_receiver.cpp @@ -20,12 +20,12 @@ TbxCommandStreamReceiverCreateFunc tbxCommandStreamReceiverFactory[IGFX_MAX_CORE CommandStreamReceiver *TbxCommandStreamReceiver::create(const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment) { auto hwInfo = executionEnvironment.getHardwareInfo(); - if (hwInfo->pPlatform->eRenderCoreFamily >= IGFX_MAX_CORE) { + if (hwInfo->pPlatform.eRenderCoreFamily >= IGFX_MAX_CORE) { DEBUG_BREAK_IF(!false); return nullptr; } - auto pCreate = tbxCommandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily]; + auto pCreate = tbxCommandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily]; return pCreate ? pCreate(baseName, withAubDump, executionEnvironment) : nullptr; } diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.inl b/runtime/command_stream/tbx_command_stream_receiver_hw.inl index d9af8c5acc..a75b420d43 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.inl +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.inl @@ -150,7 +150,7 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw::create(const std:: TbxCommandStreamReceiverHw *csr; if (withAubDump) { auto hwInfo = executionEnvironment.getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily); auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hwInfo); auto fullName = AUBCommandStreamReceiver::createFullFilePath(*hwInfo, baseName); executionEnvironment.initAubCenter(localMemoryEnabled, fullName, CommandStreamReceiverType::CSR_TBX_WITH_AUB); diff --git a/runtime/compiler_interface/binary_cache.cpp b/runtime/compiler_interface/binary_cache.cpp index b8e64965a5..4977bb234c 100644 --- a/runtime/compiler_interface/binary_cache.cpp +++ b/runtime/compiler_interface/binary_cache.cpp @@ -37,11 +37,11 @@ const std::string BinaryCache::getCachedFileName(const HardwareInfo &hwInfo, con hash.update(&*internalOptions.begin(), internalOptions.size()); hash.update("----", 4); - hash.update(reinterpret_cast(hwInfo.pPlatform), sizeof(*hwInfo.pPlatform)); + hash.update(reinterpret_cast(&hwInfo.pPlatform), sizeof(hwInfo.pPlatform)); hash.update("----", 4); - hash.update(reinterpret_cast(hwInfo.pSkuTable), sizeof(*hwInfo.pSkuTable)); + hash.update(reinterpret_cast(&hwInfo.pSkuTable), sizeof(hwInfo.pSkuTable)); hash.update("----", 4); - hash.update(reinterpret_cast(hwInfo.pWaTable), sizeof(*hwInfo.pWaTable)); + hash.update(reinterpret_cast(&hwInfo.pWaTable), sizeof(hwInfo.pWaTable)); auto res = hash.finish(); std::stringstream stream; diff --git a/runtime/compiler_interface/compiler_interface.cpp b/runtime/compiler_interface/compiler_interface.cpp index 81fdf427ff..272681b991 100644 --- a/runtime/compiler_interface/compiler_interface.cpp +++ b/runtime/compiler_interface/compiler_interface.cpp @@ -441,39 +441,39 @@ CIF::RAII::UPtr_t CompilerInterface::createIgcT if (productFamily != "unk") { getHwInfoForPlatformString(productFamily.c_str(), hwInfo); } - IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, *hwInfo->pPlatform); - IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, *hwInfo->pSysInfo); + IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, hwInfo->pPlatform); + IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, hwInfo->pSysInfo); - igcFeWa.get()->SetFtrDesktop(device.getHardwareInfo().pSkuTable->ftrDesktop); - igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(device.getHardwareInfo().pSkuTable->ftrChannelSwizzlingXOREnabled); + igcFeWa.get()->SetFtrDesktop(device.getHardwareInfo().pSkuTable.ftrDesktop); + igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(device.getHardwareInfo().pSkuTable.ftrChannelSwizzlingXOREnabled); - igcFeWa.get()->SetFtrGtBigDie(device.getHardwareInfo().pSkuTable->ftrGtBigDie); - igcFeWa.get()->SetFtrGtMediumDie(device.getHardwareInfo().pSkuTable->ftrGtMediumDie); - igcFeWa.get()->SetFtrGtSmallDie(device.getHardwareInfo().pSkuTable->ftrGtSmallDie); + igcFeWa.get()->SetFtrGtBigDie(device.getHardwareInfo().pSkuTable.ftrGtBigDie); + igcFeWa.get()->SetFtrGtMediumDie(device.getHardwareInfo().pSkuTable.ftrGtMediumDie); + igcFeWa.get()->SetFtrGtSmallDie(device.getHardwareInfo().pSkuTable.ftrGtSmallDie); - igcFeWa.get()->SetFtrGT1(device.getHardwareInfo().pSkuTable->ftrGT1); - igcFeWa.get()->SetFtrGT1_5(device.getHardwareInfo().pSkuTable->ftrGT1_5); - igcFeWa.get()->SetFtrGT2(device.getHardwareInfo().pSkuTable->ftrGT2); - igcFeWa.get()->SetFtrGT3(device.getHardwareInfo().pSkuTable->ftrGT3); - igcFeWa.get()->SetFtrGT4(device.getHardwareInfo().pSkuTable->ftrGT4); + igcFeWa.get()->SetFtrGT1(device.getHardwareInfo().pSkuTable.ftrGT1); + igcFeWa.get()->SetFtrGT1_5(device.getHardwareInfo().pSkuTable.ftrGT1_5); + igcFeWa.get()->SetFtrGT2(device.getHardwareInfo().pSkuTable.ftrGT2); + igcFeWa.get()->SetFtrGT3(device.getHardwareInfo().pSkuTable.ftrGT3); + igcFeWa.get()->SetFtrGT4(device.getHardwareInfo().pSkuTable.ftrGT4); - igcFeWa.get()->SetFtrIVBM0M1Platform(device.getHardwareInfo().pSkuTable->ftrIVBM0M1Platform); - igcFeWa.get()->SetFtrGTL(device.getHardwareInfo().pSkuTable->ftrGT1); - igcFeWa.get()->SetFtrGTM(device.getHardwareInfo().pSkuTable->ftrGT2); - igcFeWa.get()->SetFtrGTH(device.getHardwareInfo().pSkuTable->ftrGT3); + igcFeWa.get()->SetFtrIVBM0M1Platform(device.getHardwareInfo().pSkuTable.ftrIVBM0M1Platform); + igcFeWa.get()->SetFtrGTL(device.getHardwareInfo().pSkuTable.ftrGT1); + igcFeWa.get()->SetFtrGTM(device.getHardwareInfo().pSkuTable.ftrGT2); + igcFeWa.get()->SetFtrGTH(device.getHardwareInfo().pSkuTable.ftrGT3); - igcFeWa.get()->SetFtrSGTPVSKUStrapPresent(device.getHardwareInfo().pSkuTable->ftrSGTPVSKUStrapPresent); - igcFeWa.get()->SetFtrGTA(device.getHardwareInfo().pSkuTable->ftrGTA); - igcFeWa.get()->SetFtrGTC(device.getHardwareInfo().pSkuTable->ftrGTC); - igcFeWa.get()->SetFtrGTX(device.getHardwareInfo().pSkuTable->ftrGTX); - igcFeWa.get()->SetFtr5Slice(device.getHardwareInfo().pSkuTable->ftr5Slice); + igcFeWa.get()->SetFtrSGTPVSKUStrapPresent(device.getHardwareInfo().pSkuTable.ftrSGTPVSKUStrapPresent); + igcFeWa.get()->SetFtrGTA(device.getHardwareInfo().pSkuTable.ftrGTA); + igcFeWa.get()->SetFtrGTC(device.getHardwareInfo().pSkuTable.ftrGTC); + igcFeWa.get()->SetFtrGTX(device.getHardwareInfo().pSkuTable.ftrGTX); + igcFeWa.get()->SetFtr5Slice(device.getHardwareInfo().pSkuTable.ftr5Slice); - igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(device.getHardwareInfo().pSkuTable->ftrGpGpuMidThreadLevelPreempt); - igcFeWa.get()->SetFtrIoMmuPageFaulting(device.getHardwareInfo().pSkuTable->ftrIoMmuPageFaulting); - igcFeWa.get()->SetFtrWddm2Svm(device.getHardwareInfo().pSkuTable->ftrWddm2Svm); - igcFeWa.get()->SetFtrPooledEuEnabled(device.getHardwareInfo().pSkuTable->ftrPooledEuEnabled); + igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(device.getHardwareInfo().pSkuTable.ftrGpGpuMidThreadLevelPreempt); + igcFeWa.get()->SetFtrIoMmuPageFaulting(device.getHardwareInfo().pSkuTable.ftrIoMmuPageFaulting); + igcFeWa.get()->SetFtrWddm2Svm(device.getHardwareInfo().pSkuTable.ftrWddm2Svm); + igcFeWa.get()->SetFtrPooledEuEnabled(device.getHardwareInfo().pSkuTable.ftrPooledEuEnabled); - igcFeWa.get()->SetFtrResourceStreamer(device.getHardwareInfo().pSkuTable->ftrResourceStreamer); + igcFeWa.get()->SetFtrResourceStreamer(device.getHardwareInfo().pSkuTable.ftrResourceStreamer); igcDeviceContexts[&device] = std::move(newDeviceCtx); return igcDeviceContexts[&device]->CreateTranslationCtx(inType, outType); diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 0e43e0a6f5..102b539a5c 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -66,18 +66,19 @@ bool familyEnabled[IGFX_MAX_CORE] = { false, }; -Device::Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) - : hwInfo(hwInfo), executionEnvironment(executionEnvironment), deviceIndex(deviceIndex) { +Device::Device(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) + : executionEnvironment(executionEnvironment), deviceIndex(deviceIndex) { memset(&deviceInfo, 0, sizeof(deviceInfo)); deviceExtensions.reserve(1000); name.reserve(100); + auto &hwInfo = getHardwareInfo(); preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); if (!getSourceLevelDebugger()) { this->executionEnvironment->initSourceLevelDebugger(); } this->executionEnvironment->incRefInternal(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); hwHelper.setupHardwareCapabilities(&this->hardwareCapabilities, hwInfo); } @@ -105,10 +106,10 @@ Device::~Device() { executionEnvironment->decRefInternal(); } -bool Device::createDeviceImpl(const HardwareInfo *pHwInfo) { +bool Device::createDeviceImpl() { executionEnvironment->initGmm(); - if (!createEngines(pHwInfo)) { + if (!createEngines()) { return false; } @@ -123,10 +124,11 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo) { initializeCaps(); + auto &hwInfo = getHardwareInfo(); if (osTime->getOSInterface()) { - if (pHwInfo->capabilityTable.instrumentationEnabled) { + if (hwInfo.capabilityTable.instrumentationEnabled) { performanceCounters = createPerformanceCountersFunc(osTime.get()); - performanceCounters->initialize(pHwInfo); + performanceCounters->initialize(&hwInfo); } } @@ -165,9 +167,10 @@ AllocationProperties Device::getAllocationPropertiesForPreemption() const { properties.alignment = 256 * MemoryConstants::kiloByte; return properties; } -bool Device::createEngines(const HardwareInfo *pHwInfo) { - auto defaultEngineType = getChosenEngineType(*pHwInfo); - auto &gpgpuEngines = HwHelper::get(pHwInfo->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances(); +bool Device::createEngines() { + auto &hwInfo = getHardwareInfo(); + auto defaultEngineType = getChosenEngineType(hwInfo); + auto &gpgpuEngines = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily).getGpgpuEngineInstances(); for (uint32_t deviceCsrIndex = 0; deviceCsrIndex < gpgpuEngines.size(); deviceCsrIndex++) { if (!executionEnvironment->initializeCommandStreamReceiver(getDeviceIndex(), deviceCsrIndex)) { @@ -196,13 +199,9 @@ bool Device::createEngines(const HardwareInfo *pHwInfo) { return true; } -const HardwareInfo *Device::getDeviceInitHwInfo(const HardwareInfo *pHwInfoIn) { - return pHwInfoIn ? pHwInfoIn : platformDevices[0]; -} +const HardwareInfo &Device::getHardwareInfo() const { return *executionEnvironment->getHardwareInfo(); } -const HardwareInfo &Device::getHardwareInfo() const { return hwInfo; } - -const WorkaroundTable *Device::getWaTable() const { return hwInfo.pWaTable; } +const WorkaroundTable *Device::getWaTable() const { return &getHardwareInfo().pWaTable; } const DeviceInfo &Device::getDeviceInfo() const { return deviceInfo; @@ -224,21 +223,22 @@ void Device::prepareSLMWindow() { } const char *Device::getProductAbbrev() const { - return hardwarePrefix[hwInfo.pPlatform->eProductFamily]; + return hardwarePrefix[executionEnvironment->getHardwareInfo()->pPlatform.eProductFamily]; } const std::string Device::getFamilyNameWithType() const { - std::string platformName = familyName[hwInfo.pPlatform->eRenderCoreFamily]; + auto &hwInfo = getHardwareInfo(); + std::string platformName = familyName[hwInfo.pPlatform.eRenderCoreFamily]; platformName.append(getPlatformType(hwInfo)); return platformName; } double Device::getProfilingTimerResolution() { - return osTime->getDynamicDeviceTimerResolution(hwInfo); + return osTime->getDynamicDeviceTimerResolution(getHardwareInfo()); } unsigned int Device::getSupportedClVersion() const { - return hwInfo.capabilityTable.clVersionSupport; + return getHardwareInfo().capabilityTable.clVersionSupport; } /* We hide the retain and release function of BaseObject. */ @@ -252,11 +252,13 @@ unique_ptr_if_unused Device::release() { } bool Device::isSimulation() const { - bool simulation = hwInfo.capabilityTable.isSimulation(hwInfo.pPlatform->usDeviceID); + auto &hwInfo = getHardwareInfo(); + + bool simulation = hwInfo.capabilityTable.isSimulation(hwInfo.pPlatform.usDeviceID); if (engines[0].commandStreamReceiver->getType() != CommandStreamReceiverType::CSR_HW) { simulation = true; } - if (hwInfo.pSkuTable->ftrSimulationMode) { + if (hwInfo.pSkuTable.ftrSimulationMode) { simulation = true; } return simulation; @@ -268,7 +270,7 @@ double Device::getPlatformHostTimerResolution() const { return 0.0; } GFXCORE_FAMILY Device::getRenderCoreFamily() const { - return this->getHardwareInfo().pPlatform->eRenderCoreFamily; + return this->getHardwareInfo().pPlatform.eRenderCoreFamily; } bool Device::isSourceLevelDebuggerActive() const { diff --git a/runtime/device/device.h b/runtime/device/device.h index 477ae570f3..8cd423f1ed 100644 --- a/runtime/device/device.h +++ b/runtime/device/device.h @@ -39,10 +39,9 @@ class Device : public BaseObject<_cl_device_id> { static const cl_ulong objectMagic = 0x8055832341AC8D08LL; template - static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv, uint32_t deviceIndex) { - pHwInfo = getDeviceInitHwInfo(pHwInfo); - T *device = new T(*pHwInfo, execEnv, deviceIndex); - return createDeviceInternals(pHwInfo, device); + static T *create(ExecutionEnvironment *execEnv, uint32_t deviceIndex) { + T *device = new T(execEnv, deviceIndex); + return createDeviceInternals(device); } Device &operator=(const Device &) = delete; @@ -106,7 +105,7 @@ class Device : public BaseObject<_cl_device_id> { static decltype(&PerformanceCounters::create) createPerformanceCountersFunc; PreemptionMode getPreemptionMode() const { return preemptionMode; } GraphicsAllocation *getPreemptionAllocation() const { return preemptionAllocation; } - MOCKABLE_VIRTUAL const WhitelistedRegisters &getWhitelistedRegisters() { return hwInfo.capabilityTable.whitelistedRegisters; } + MOCKABLE_VIRTUAL const WhitelistedRegisters &getWhitelistedRegisters() { return getHardwareInfo().capabilityTable.whitelistedRegisters; } std::vector simultaneousInterops; std::string deviceExtensions; std::string name; @@ -121,20 +120,20 @@ class Device : public BaseObject<_cl_device_id> { protected: Device() = delete; - Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); + Device(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); template - static T *createDeviceInternals(const HardwareInfo *pHwInfo, T *device) { - if (false == device->createDeviceImpl(pHwInfo)) { + static T *createDeviceInternals(T *device) { + if (false == device->createDeviceImpl()) { delete device; return nullptr; } return device; } - bool createDeviceImpl(const HardwareInfo *pHwInfo); - bool createEngines(const HardwareInfo *pHwInfo); - static const HardwareInfo *getDeviceInitHwInfo(const HardwareInfo *pHwInfoIn); + bool createDeviceImpl(); + bool createEngines(); + MOCKABLE_VIRTUAL void initializeCaps(); void setupFp64Flags(); void appendOSExtensions(std::string &deviceExtensions); @@ -142,7 +141,6 @@ class Device : public BaseObject<_cl_device_id> { unsigned int enabledClVersion = 0u; - const HardwareInfo &hwInfo; HardwareCapabilities hardwareCapabilities = {}; DeviceInfo deviceInfo; diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 3c6b4617fb..12b895a4ab 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -43,6 +43,7 @@ static constexpr cl_device_fp_config defaultFpFlags = static_casteRenderCoreFamily]; + name += familyName[hwInfo.pPlatform.eRenderCoreFamily]; name += " HD Graphics NEO"; if (driverInfo) { @@ -85,7 +87,7 @@ void Device::initializeCaps() { driverVersion.assign(driverInfo.get()->getVersion(driverVersion).c_str()); } - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); deviceInfo.name = name.c_str(); deviceInfo.driverVersion = driverVersion.c_str(); @@ -203,7 +205,7 @@ void Device::initializeCaps() { deviceInfo.addressBits = 64; //copy system info to prevent misaligned reads - const auto systemInfo = *hwInfo.pSysInfo; + const auto systemInfo = hwInfo.pSysInfo; deviceInfo.globalMemCachelineSize = 64; deviceInfo.globalMemCacheSize = systemInfo.L3BankCount * 128 * KB; @@ -251,7 +253,7 @@ void Device::initializeCaps() { deviceInfo.numThreadsPerEU = 0; auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get() ? 32 : 8; - deviceInfo.maxNumEUsPerSubSlice = (systemInfo.EuCountPerPoolMin == 0 || hwInfo.pSkuTable->ftrPooledEuEnabled == 0) + deviceInfo.maxNumEUsPerSubSlice = (systemInfo.EuCountPerPoolMin == 0 || hwInfo.pSkuTable.ftrPooledEuEnabled == 0) ? (systemInfo.EUCount / systemInfo.SubSliceCount) : systemInfo.EuCountPerPoolMin; deviceInfo.numThreadsPerEU = systemInfo.ThreadCount / systemInfo.EUCount; diff --git a/runtime/device/device_info.cpp b/runtime/device/device_info.cpp index 354a191e42..b5b8a8a317 100644 --- a/runtime/device/device_info.cpp +++ b/runtime/device/device_info.cpp @@ -206,7 +206,7 @@ cl_int Device::getDeviceInfo(cl_device_info paramName, getCap(src, srcSize, retSize); break; default: - DeviceHelper::getExtraDeviceInfo(hwInfo, paramName, param, src, srcSize, retSize); + DeviceHelper::getExtraDeviceInfo(getHardwareInfo(), paramName, param, src, srcSize, retSize); } retVal = ::getInfo(paramValue, paramValueSize, src, srcSize); @@ -222,7 +222,7 @@ bool Device::getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTime TimeStampData queueTimeStamp; bool retVal = getOSTime()->getCpuGpuTime(&queueTimeStamp); if (retVal) { - uint64_t resolution = (uint64_t)getOSTime()->getDynamicDeviceTimerResolution(this->hwInfo); + uint64_t resolution = (uint64_t)getOSTime()->getDynamicDeviceTimerResolution(getHardwareInfo()); *deviceTimestamp = queueTimeStamp.GPUTimeStamp * resolution; } diff --git a/runtime/device_queue/device_queue.cpp b/runtime/device_queue/device_queue.cpp index da472b2058..1ecdedbf25 100644 --- a/runtime/device_queue/device_queue.cpp +++ b/runtime/device_queue/device_queue.cpp @@ -116,7 +116,7 @@ void DeviceQueue::allocateResources() { queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({queueStorageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER}); memset(queueStorageBuffer->getUnderlyingBuffer(), 0, queueStorageBuffer->getUnderlyingBufferSize()); - auto &hwHelper = HwHelper::get(device->getHardwareInfo().pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(device->getHardwareInfo().pPlatform.eRenderCoreFamily); const size_t IDTSize = numberOfIDTables * interfaceDescriptorEntries * hwHelper.getInterfaceDescriptorDataSize(); // Additional padding of PAGE_SIZE for PageFaults just after DSH to satisfy hw requirements diff --git a/runtime/dll/get_devices.cpp b/runtime/dll/get_devices.cpp index fa6f2545ed..46f73f0db9 100644 --- a/runtime/dll/get_devices.cpp +++ b/runtime/dll/get_devices.cpp @@ -7,13 +7,12 @@ #include "runtime/command_stream/create_command_stream_impl.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/helpers/hw_info.h" #include "runtime/os_interface/device_factory.h" namespace NEO { -bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnviornment) { - return getDevicesImpl(hwInfo, numDevicesReturned, executionEnviornment); +bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnviornment) { + return getDevicesImpl(numDevicesReturned, executionEnviornment); } } // namespace NEO diff --git a/runtime/dll/linux/drm_neo_create.cpp b/runtime/dll/linux/drm_neo_create.cpp index ecdc9dabfd..e11f6a4b06 100644 --- a/runtime/dll/linux/drm_neo_create.cpp +++ b/runtime/dll/linux/drm_neo_create.cpp @@ -180,13 +180,13 @@ Drm *Drm::create(int32_t deviceOrdinal) { if (ret != 0) { // turbo patch not present, we are not on custom Kernel, switch to simplified Mocs selection // do this only for GEN9+ - if (device->pHwInfo->pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (device->pHwInfo->pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { drmObject->setSimplifiedMocsTableUsage(true); } printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n"); } - if (HwHelper::get(device->pHwInfo->pPlatform->eRenderCoreFamily).getEnableLocalMemory(*device->pHwInfo)) { + if (HwHelper::get(device->pHwInfo->pPlatform.eRenderCoreFamily).getEnableLocalMemory(*device->pHwInfo)) { drmObject->queryMemoryInfo(); } diff --git a/runtime/execution_environment/execution_environment.cpp b/runtime/execution_environment/execution_environment.cpp index 1eac84726f..dd725a5ce9 100644 --- a/runtime/execution_environment/execution_environment.cpp +++ b/runtime/execution_environment/execution_environment.cpp @@ -21,22 +21,25 @@ #include "runtime/source_level_debugger/source_level_debugger.h" namespace NEO { -ExecutionEnvironment::ExecutionEnvironment() = default; +ExecutionEnvironment::ExecutionEnvironment() { + hwInfo = std::make_unique(*platformDevices[0]); +}; + ExecutionEnvironment::~ExecutionEnvironment() = default; extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment); void ExecutionEnvironment::initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) { if (!aubCenter) { - aubCenter.reset(new AubCenter(this->hwInfo, localMemoryEnabled, aubFileName, csrType)); + aubCenter.reset(new AubCenter(hwInfo.get(), localMemoryEnabled, aubFileName, csrType)); } } void ExecutionEnvironment::initGmm() { if (!gmmHelper) { - gmmHelper.reset(new GmmHelper(this->hwInfo)); + gmmHelper.reset(new GmmHelper(hwInfo.get())); } } void ExecutionEnvironment::setHwInfo(const HardwareInfo *hwInfo) { - this->hwInfo = hwInfo; + *this->hwInfo = *hwInfo; } bool ExecutionEnvironment::initializeCommandStreamReceiver(uint32_t deviceIndex, uint32_t deviceCsrIndex) { if (deviceIndex + 1 > commandStreamReceivers.size()) { @@ -53,7 +56,7 @@ bool ExecutionEnvironment::initializeCommandStreamReceiver(uint32_t deviceIndex, if (!commandStreamReceiver) { return false; } - if (HwHelper::get(this->hwInfo->pPlatform->eRenderCoreFamily).isPageTableManagerSupported(*this->hwInfo)) { + if (HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily).isPageTableManagerSupported(*hwInfo)) { commandStreamReceiver->createPageTableManager(); } commandStreamReceiver->setDeviceIndex(deviceIndex); @@ -87,11 +90,11 @@ void ExecutionEnvironment::initializeMemoryManager() { DEBUG_BREAK_IF(!this->memoryManager); } void ExecutionEnvironment::initSourceLevelDebugger() { - if (this->hwInfo->capabilityTable.sourceLevelDebuggerSupported) { + if (hwInfo->capabilityTable.sourceLevelDebuggerSupported) { sourceLevelDebugger.reset(SourceLevelDebugger::create()); } if (sourceLevelDebugger) { - bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == SipKernel::getSipKernelType(this->hwInfo->pPlatform->eRenderCoreFamily, true)); + bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == SipKernel::getSipKernelType(hwInfo->pPlatform.eRenderCoreFamily, true)); sourceLevelDebugger->initialize(localMemorySipAvailable); } } diff --git a/runtime/execution_environment/execution_environment.h b/runtime/execution_environment/execution_environment.h index f81b5603cd..2738439f1f 100644 --- a/runtime/execution_environment/execution_environment.h +++ b/runtime/execution_environment/execution_environment.h @@ -38,7 +38,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject protected: std::unique_ptr gmmHelper; - const HardwareInfo *hwInfo = nullptr; + std::unique_ptr hwInfo; public: ExecutionEnvironment(); @@ -51,9 +51,8 @@ class ExecutionEnvironment : public ReferenceTrackedObject void initializeMemoryManager(); void initSourceLevelDebugger(); void setHwInfo(const HardwareInfo *hwInfo); - const HardwareInfo *getHardwareInfo() const { - return this->hwInfo; - } + const HardwareInfo *getHardwareInfo() const { return hwInfo.get(); } + HardwareInfo *getMutableHardwareInfo() const { return hwInfo.get(); } bool isFullRangeSvm() const { return hwInfo->capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress; } diff --git a/runtime/gen10/hw_helper_gen10.cpp b/runtime/gen10/hw_helper_gen10.cpp index 4c28c5562a..ebcff9497c 100644 --- a/runtime/gen10/hw_helper_gen10.cpp +++ b/runtime/gen10/hw_helper_gen10.cpp @@ -16,7 +16,7 @@ typedef CNLFamily Family; template <> void HwHelperHw::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) { - if (pHwInfo->pPlatform->usRevId < 0x4) { + if (pHwInfo->pPlatform.usRevId < 0x4) { coherencyFlag = false; } else { coherencyFlag = true; diff --git a/runtime/gen10/hw_info_cnl.inl b/runtime/gen10/hw_info_cnl.inl index 3ecbde4d40..be8f129d7d 100644 --- a/runtime/gen10/hw_info_cnl.inl +++ b/runtime/gen10/hw_info_cnl.inl @@ -75,8 +75,8 @@ WorkaroundTable CNL::workaroundTable = {}; FeatureTable CNL::featureTable = {}; void CNL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrL3IACoherency = true; pSkuTable->ftrGpGpuMidBatchPreempt = true; @@ -107,10 +107,10 @@ void CNL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { pWaTable->waReportPerfCountUseGlobalContextID = true; pWaTable->waSamplerCacheFlushBetweenRedescribedSurfaceReads = true; - if ((1 << hwInfo->pPlatform->usRevId) & 0x3) { + if ((1 << hwInfo->pPlatform.usRevId) & 0x3) { pWaTable->waFbcLinearSurfaceStride = true; } - if ((1 << hwInfo->pPlatform->usRevId) & 0x1) { + if ((1 << hwInfo->pPlatform.usRevId) & 0x1) { pWaTable->waEncryptedEdramOnlyPartials = true; } } @@ -123,7 +123,7 @@ const HardwareInfo CNL_2x5x8::hwInfo = { }; GT_SYSTEM_INFO CNL_2x5x8::gtSystemInfo = {0}; void CNL_2x5x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 39; gtSysInfo->ThreadCount = 39 * CNL::threadsPerEu; gtSysInfo->SliceCount = 2; @@ -155,7 +155,7 @@ const HardwareInfo CNL_2x4x8::hwInfo = { }; GT_SYSTEM_INFO CNL_2x4x8::gtSystemInfo = {0}; void CNL_2x4x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 31; gtSysInfo->ThreadCount = 31 * CNL::threadsPerEu; gtSysInfo->SliceCount = 2; @@ -187,7 +187,7 @@ const HardwareInfo CNL_1x3x8::hwInfo = { }; GT_SYSTEM_INFO CNL_1x3x8::gtSystemInfo = {0}; void CNL_1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 23; gtSysInfo->ThreadCount = 23 * CNL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -219,7 +219,7 @@ const HardwareInfo CNL_1x2x8::hwInfo = { }; GT_SYSTEM_INFO CNL_1x2x8::gtSystemInfo = {0}; void CNL_1x2x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 15; gtSysInfo->ThreadCount = 15 * CNL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -251,7 +251,7 @@ const HardwareInfo CNL_4x9x8::hwInfo = { }; GT_SYSTEM_INFO CNL_4x9x8::gtSystemInfo = {0}; void CNL_4x9x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 71; gtSysInfo->ThreadCount = 71 * CNL::threadsPerEu; gtSysInfo->SliceCount = 4; diff --git a/runtime/gen10/linux/hw_info_config_cnl.inl b/runtime/gen10/linux/hw_info_config_cnl.inl index b8f2006382..8f95af42ca 100644 --- a/runtime/gen10/linux/hw_info_config_cnl.inl +++ b/runtime/gen10/linux/hw_info_config_cnl.inl @@ -15,7 +15,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInf if (nullptr == osIface) { return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; if (pSysInfo->SubSliceCount == 9) { pSysInfo->SliceCount = 4; diff --git a/runtime/gen10/preamble_gen10.cpp b/runtime/gen10/preamble_gen10.cpp index d4e0cd9192..b2976a5d33 100644 --- a/runtime/gen10/preamble_gen10.cpp +++ b/runtime/gen10/preamble_gen10.cpp @@ -15,7 +15,7 @@ template <> uint32_t PreambleHelper::getL3Config(const HardwareInfo &hwInfo, bool useSLM) { uint32_t l3Config = 0; - switch (hwInfo.pPlatform->eProductFamily) { + switch (hwInfo.pPlatform.eProductFamily) { case IGFX_CANNONLAKE: l3Config = getL3ConfigHelper(useSLM); break; @@ -60,7 +60,7 @@ void PreambleHelper::addPipeControlBeforeVfeCmd(LinearStream *pComman auto pipeControl = pCommandStream->getSpaceForCmd(); *pipeControl = PIPE_CONTROL::sInit(); pipeControl->setCommandStreamerStallEnable(true); - if (hwInfo->pWaTable->waSendMIFLUSHBeforeVFE) { + if (hwInfo->pWaTable.waSendMIFLUSHBeforeVFE) { pipeControl->setRenderTargetCacheFlushEnable(true); pipeControl->setDepthCacheFlushEnable(true); pipeControl->setDcFlushEnable(true); diff --git a/runtime/gen11/command_stream_receiver_hw_gen11.cpp b/runtime/gen11/command_stream_receiver_hw_gen11.cpp index 917e921ac9..fa695f67ee 100644 --- a/runtime/gen11/command_stream_receiver_hw_gen11.cpp +++ b/runtime/gen11/command_stream_receiver_hw_gen11.cpp @@ -36,7 +36,7 @@ template <> void CommandStreamReceiverHw::programMediaSampler(LinearStream &stream, DispatchFlags &dispatchFlags) { using PWR_CLK_STATE_REGISTER = Family::PWR_CLK_STATE_REGISTER; - if (peekHwInfo().pPlatform->eProductFamily == IGFX_ICELAKE_LP) { + if (peekHwInfo().pPlatform.eProductFamily == IGFX_ICELAKE_LP) { if (dispatchFlags.mediaSamplerRequired) { if (!lastVmeSubslicesConfig) { auto pc = addPipeControlCmd(stream); @@ -49,13 +49,13 @@ void CommandStreamReceiverHw::programMediaSampler(LinearStream &stream, pc->setConstantCacheInvalidationEnable(true); pc->setStateCacheInvalidationEnable(true); - uint32_t numSubslices = peekHwInfo().pSysInfo->SubSliceCount; + uint32_t numSubslices = peekHwInfo().pSysInfo.SubSliceCount; uint32_t numSubslicesWithVme = numSubslices / 2; // 1 VME unit per DSS uint32_t numSlicesForPowerGating = 1; // power gating supported only if #Slices = 1 PWR_CLK_STATE_REGISTER reg = Family::cmdInitPwrClkStateRegister; - reg.TheStructure.Common.EUmin = peekHwInfo().pSysInfo->MaxEuPerSubSlice; - reg.TheStructure.Common.EUmax = peekHwInfo().pSysInfo->MaxEuPerSubSlice; + reg.TheStructure.Common.EUmin = peekHwInfo().pSysInfo.MaxEuPerSubSlice; + reg.TheStructure.Common.EUmax = peekHwInfo().pSysInfo.MaxEuPerSubSlice; reg.TheStructure.Common.SSCountEn = 1; // Enable SScount reg.TheStructure.Common.SScount = numSubslicesWithVme; reg.TheStructure.Common.EnableSliceCountRequest = 1; // Enable SliceCountRequest @@ -84,13 +84,13 @@ void CommandStreamReceiverHw::programMediaSampler(LinearStream &stream, // In Gen11-LP, software programs this register as if GT consists of // 2 slices with 4 subslices in each slice. Hardware maps this to the // LP 1 slice/8-subslice physical layout - uint32_t numSubslices = peekHwInfo().pSysInfo->SubSliceCount; + uint32_t numSubslices = peekHwInfo().pSysInfo.SubSliceCount; uint32_t numSubslicesMapped = numSubslices / 2; - uint32_t numSlicesMapped = peekHwInfo().pSysInfo->SliceCount * 2; + uint32_t numSlicesMapped = peekHwInfo().pSysInfo.SliceCount * 2; PWR_CLK_STATE_REGISTER reg = Family::cmdInitPwrClkStateRegister; - reg.TheStructure.Common.EUmin = peekHwInfo().pSysInfo->MaxEuPerSubSlice; - reg.TheStructure.Common.EUmax = peekHwInfo().pSysInfo->MaxEuPerSubSlice; + reg.TheStructure.Common.EUmin = peekHwInfo().pSysInfo.MaxEuPerSubSlice; + reg.TheStructure.Common.EUmax = peekHwInfo().pSysInfo.MaxEuPerSubSlice; reg.TheStructure.Common.SSCountEn = 1; // Enable SScount reg.TheStructure.Common.SScount = numSubslicesMapped; reg.TheStructure.Common.EnableSliceCountRequest = 1; // Enable SliceCountRequest @@ -107,7 +107,7 @@ void CommandStreamReceiverHw::programMediaSampler(LinearStream &stream, template <> bool CommandStreamReceiverHw::detectInitProgrammingFlagsRequired(const DispatchFlags &dispatchFlags) const { bool flag = DebugManager.flags.ForceCsrReprogramming.get(); - if (peekHwInfo().pPlatform->eProductFamily == IGFX_ICELAKE_LP) { + if (peekHwInfo().pPlatform.eProductFamily == IGFX_ICELAKE_LP) { if (!dispatchFlags.mediaSamplerRequired) { if (lastVmeSubslicesConfig) { flag = true; @@ -122,7 +122,7 @@ size_t CommandStreamReceiverHw::getCmdSizeForMediaSampler(bool mediaSamp typedef typename Family::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; typedef typename Family::PIPE_CONTROL PIPE_CONTROL; - if (peekHwInfo().pPlatform->eProductFamily == IGFX_ICELAKE_LP) { + if (peekHwInfo().pPlatform.eProductFamily == IGFX_ICELAKE_LP) { if (mediaSamplerRequired) { if (!lastVmeSubslicesConfig) { return sizeof(MI_LOAD_REGISTER_IMM) + 2 * sizeof(PIPE_CONTROL); diff --git a/runtime/gen11/hw_helper_gen11.cpp b/runtime/gen11/hw_helper_gen11.cpp index 33107bb990..8231154b9e 100644 --- a/runtime/gen11/hw_helper_gen11.cpp +++ b/runtime/gen11/hw_helper_gen11.cpp @@ -16,7 +16,7 @@ typedef ICLFamily Family; template <> uint32_t HwHelperHw::getComputeUnitsUsedForScratch(const HardwareInfo *pHwInfo) const { - return pHwInfo->pSysInfo->MaxSubSlicesSupported * pHwInfo->pSysInfo->MaxEuPerSubSlice * 8; + return pHwInfo->pSysInfo.MaxSubSlicesSupported * pHwInfo->pSysInfo.MaxEuPerSubSlice * 8; } template class AubHelperHw; diff --git a/runtime/gen11/hw_info_icllp.inl b/runtime/gen11/hw_info_icllp.inl index bebfa8c58f..a06c63905f 100644 --- a/runtime/gen11/hw_info_icllp.inl +++ b/runtime/gen11/hw_info_icllp.inl @@ -72,8 +72,8 @@ WorkaroundTable ICLLP::workaroundTable = {}; FeatureTable ICLLP::featureTable = {}; void ICLLP::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrL3IACoherency = true; pSkuTable->ftrPPGTT = true; @@ -116,7 +116,7 @@ const HardwareInfo ICLLP_1x8x8::hwInfo = { GT_SYSTEM_INFO ICLLP_1x8x8::gtSystemInfo = {0}; void ICLLP_1x8x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 63; gtSysInfo->ThreadCount = 63 * ICLLP::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -150,7 +150,7 @@ const HardwareInfo ICLLP_1x4x8::hwInfo = { GT_SYSTEM_INFO ICLLP_1x4x8::gtSystemInfo = {0}; void ICLLP_1x4x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 31; gtSysInfo->ThreadCount = 31 * ICLLP::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -183,7 +183,7 @@ const HardwareInfo ICLLP_1x6x8::hwInfo = { GT_SYSTEM_INFO ICLLP_1x6x8::gtSystemInfo = {0}; void ICLLP_1x6x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 47; gtSysInfo->ThreadCount = 47 * ICLLP::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -216,7 +216,7 @@ const HardwareInfo ICLLP_1x1x8::hwInfo = { }; GT_SYSTEM_INFO ICLLP_1x1x8::gtSystemInfo = {0}; void ICLLP_1x1x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 8; gtSysInfo->ThreadCount = 8 * ICLLP::threadsPerEu; gtSysInfo->SliceCount = 1; diff --git a/runtime/gen11/hw_info_lkf.inl b/runtime/gen11/hw_info_lkf.inl index 5fabe61506..3b00d7141d 100644 --- a/runtime/gen11/hw_info_lkf.inl +++ b/runtime/gen11/hw_info_lkf.inl @@ -71,8 +71,8 @@ WorkaroundTable LKF::workaroundTable = {}; FeatureTable LKF::featureTable = {}; void LKF::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrL3IACoherency = true; pSkuTable->ftrPPGTT = true; @@ -114,7 +114,7 @@ const HardwareInfo LKF_1x8x8::hwInfo = { }; GT_SYSTEM_INFO LKF_1x8x8::gtSystemInfo = {0}; void LKF_1x8x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 64; gtSysInfo->ThreadCount = 64 * LKF::threadsPerEu; gtSysInfo->SliceCount = 1; diff --git a/runtime/gen11/linux/hw_info_config_icllp.inl b/runtime/gen11/linux/hw_info_config_icllp.inl index 2c165e9723..19d1e72c92 100644 --- a/runtime/gen11/linux/hw_info_config_icllp.inl +++ b/runtime/gen11/linux/hw_info_config_icllp.inl @@ -16,7 +16,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInf return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; pSysInfo->SliceCount = 1; diff --git a/runtime/gen11/linux/hw_info_config_lkf.inl b/runtime/gen11/linux/hw_info_config_lkf.inl index 335753e980..695ed9c1ec 100644 --- a/runtime/gen11/linux/hw_info_config_lkf.inl +++ b/runtime/gen11/linux/hw_info_config_lkf.inl @@ -16,7 +16,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; pSysInfo->SliceCount = 1; diff --git a/runtime/gen11/preamble_gen11.cpp b/runtime/gen11/preamble_gen11.cpp index e74e0d4d8c..f81381eb4b 100644 --- a/runtime/gen11/preamble_gen11.cpp +++ b/runtime/gen11/preamble_gen11.cpp @@ -17,7 +17,7 @@ template <> uint32_t PreambleHelper::getL3Config(const HardwareInfo &hwInfo, bool useSLM) { uint32_t l3Config = 0; - switch (hwInfo.pPlatform->eProductFamily) { + switch (hwInfo.pPlatform.eProductFamily) { case IGFX_ICELAKE_LP: l3Config = getL3ConfigHelper(useSLM); break; @@ -46,7 +46,7 @@ void PreambleHelper::addPipeControlBeforeVfeCmd(LinearStream *pComman auto pipeControl = pCommandStream->getSpaceForCmd(); *pipeControl = ICLFamily::cmdInitPipeControl; pipeControl->setCommandStreamerStallEnable(true); - if (hwInfo->pWaTable->waSendMIFLUSHBeforeVFE) { + if (hwInfo->pWaTable.waSendMIFLUSHBeforeVFE) { pipeControl->setRenderTargetCacheFlushEnable(true); pipeControl->setDepthCacheFlushEnable(true); pipeControl->setDcFlushEnable(true); diff --git a/runtime/gen8/hw_info_bdw.inl b/runtime/gen8/hw_info_bdw.inl index acabe11da5..adf076f195 100644 --- a/runtime/gen8/hw_info_bdw.inl +++ b/runtime/gen8/hw_info_bdw.inl @@ -76,8 +76,8 @@ WorkaroundTable BDW::workaroundTable = {}; FeatureTable BDW::featureTable = {}; void BDW::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrL3IACoherency = true; pSkuTable->ftrPPGTT = true; @@ -106,7 +106,7 @@ const HardwareInfo BDW_1x2x6::hwInfo = { GT_SYSTEM_INFO BDW_1x2x6::gtSystemInfo = {0}; void BDW_1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 12; gtSysInfo->ThreadCount = 12 * BDW::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -139,7 +139,7 @@ const HardwareInfo BDW_1x3x6::hwInfo = { }; GT_SYSTEM_INFO BDW_1x3x6::gtSystemInfo = {0}; void BDW_1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 18; gtSysInfo->ThreadCount = 18 * BDW::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -172,7 +172,7 @@ const HardwareInfo BDW_1x3x8::hwInfo = { }; GT_SYSTEM_INFO BDW_1x3x8::gtSystemInfo = {0}; void BDW_1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 23; gtSysInfo->ThreadCount = 23 * BDW::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -205,7 +205,7 @@ const HardwareInfo BDW_2x3x8::hwInfo = { }; GT_SYSTEM_INFO BDW_2x3x8::gtSystemInfo = {0}; void BDW_2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 47; gtSysInfo->ThreadCount = 47 * BDW::threadsPerEu; gtSysInfo->SliceCount = 2; diff --git a/runtime/gen8/linux/hw_info_config_bdw.inl b/runtime/gen8/linux/hw_info_config_bdw.inl index 831328e063..8a0cd64b15 100644 --- a/runtime/gen8/linux/hw_info_config_bdw.inl +++ b/runtime/gen8/linux/hw_info_config_bdw.inl @@ -15,7 +15,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo if (nullptr == osIface) { return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; // There is no interface to read total slice count from drm/i915, so we // derive this from the number of EUs and subslices. @@ -26,8 +26,8 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo pSysInfo->SliceCount = 1; } - if (hwInfo->pPlatform->usDeviceID == IBDW_GT3_HALO_MOBL_DEVICE_F0_ID || - hwInfo->pPlatform->usDeviceID == IBDW_GT3_SERV_DEVICE_F0_ID) { + if (hwInfo->pPlatform.usDeviceID == IBDW_GT3_HALO_MOBL_DEVICE_F0_ID || + hwInfo->pPlatform.usDeviceID == IBDW_GT3_SERV_DEVICE_F0_ID) { pSysInfo->EdramSizeInKb = 128 * 1024; } return 0; diff --git a/runtime/gen8/preamble_gen8.cpp b/runtime/gen8/preamble_gen8.cpp index b8472f8d20..d45048914f 100644 --- a/runtime/gen8/preamble_gen8.cpp +++ b/runtime/gen8/preamble_gen8.cpp @@ -21,7 +21,7 @@ template <> uint32_t PreambleHelper::getL3Config(const HardwareInfo &hwInfo, bool useSLM) { uint32_t l3Config = 0; - switch (hwInfo.pPlatform->eProductFamily) { + switch (hwInfo.pPlatform.eProductFamily) { case IGFX_BROADWELL: l3Config = getL3ConfigHelper(useSLM); break; diff --git a/runtime/gen9/hw_info_bxt.inl b/runtime/gen9/hw_info_bxt.inl index 2da624e563..a41ef4be51 100644 --- a/runtime/gen9/hw_info_bxt.inl +++ b/runtime/gen9/hw_info_bxt.inl @@ -73,9 +73,9 @@ WorkaroundTable BXT::workaroundTable = {}; FeatureTable BXT::featureTable = {}; void BXT::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - PLATFORM *pPlatform = const_cast(hwInfo->pPlatform); - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + PLATFORM *pPlatform = &hwInfo->pPlatform; + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrGpGpuMidBatchPreempt = true; pSkuTable->ftrGpGpuThreadGroupLevelPreempt = true; @@ -123,7 +123,7 @@ const HardwareInfo BXT_1x2x6::hwInfo = { }; GT_SYSTEM_INFO BXT_1x2x6::gtSystemInfo = {0}; void BXT_1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 12; gtSysInfo->ThreadCount = 12 * BXT::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -156,7 +156,7 @@ const HardwareInfo BXT_1x3x6::hwInfo = { }; GT_SYSTEM_INFO BXT_1x3x6::gtSystemInfo = {0}; void BXT_1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 18; gtSysInfo->ThreadCount = 18 * BXT::threadsPerEu; gtSysInfo->SliceCount = 1; diff --git a/runtime/gen9/hw_info_cfl.inl b/runtime/gen9/hw_info_cfl.inl index e70a52328e..901285037e 100644 --- a/runtime/gen9/hw_info_cfl.inl +++ b/runtime/gen9/hw_info_cfl.inl @@ -68,8 +68,8 @@ WorkaroundTable CFL::workaroundTable = {}; FeatureTable CFL::featureTable = {}; void CFL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrGpGpuMidBatchPreempt = true; pSkuTable->ftrGpGpuThreadGroupLevelPreempt = true; @@ -111,7 +111,7 @@ const HardwareInfo CFL_1x2x6::hwInfo = { }; GT_SYSTEM_INFO CFL_1x2x6::gtSystemInfo = {0}; void CFL_1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 11; gtSysInfo->ThreadCount = 11 * CFL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -144,7 +144,7 @@ const HardwareInfo CFL_1x3x6::hwInfo = { }; GT_SYSTEM_INFO CFL_1x3x6::gtSystemInfo = {0}; void CFL_1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 17; gtSysInfo->ThreadCount = 17 * CFL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -177,7 +177,7 @@ const HardwareInfo CFL_1x3x8::hwInfo = { }; GT_SYSTEM_INFO CFL_1x3x8::gtSystemInfo = {0}; void CFL_1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 23; gtSysInfo->ThreadCount = 23 * CFL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -210,7 +210,7 @@ const HardwareInfo CFL_2x3x8::hwInfo = { }; GT_SYSTEM_INFO CFL_2x3x8::gtSystemInfo = {0}; void CFL_2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 47; gtSysInfo->ThreadCount = 47 * CFL::threadsPerEu; gtSysInfo->SliceCount = 2; @@ -243,7 +243,7 @@ const HardwareInfo CFL_3x3x8::hwInfo = { }; GT_SYSTEM_INFO CFL_3x3x8::gtSystemInfo = {0}; void CFL_3x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 71; gtSysInfo->ThreadCount = 71 * CFL::threadsPerEu; gtSysInfo->SliceCount = 3; diff --git a/runtime/gen9/hw_info_glk.inl b/runtime/gen9/hw_info_glk.inl index 2314dff047..f84320747e 100644 --- a/runtime/gen9/hw_info_glk.inl +++ b/runtime/gen9/hw_info_glk.inl @@ -68,8 +68,8 @@ WorkaroundTable GLK::workaroundTable = {}; FeatureTable GLK::featureTable = {}; void GLK::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrGpGpuMidBatchPreempt = true; pSkuTable->ftrGpGpuThreadGroupLevelPreempt = true; @@ -111,7 +111,7 @@ const HardwareInfo GLK_1x3x6::hwInfo = { GT_SYSTEM_INFO GLK_1x3x6::gtSystemInfo = {0}; void GLK_1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 18; gtSysInfo->ThreadCount = 18 * GLK::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -144,7 +144,7 @@ const HardwareInfo GLK_1x2x6::hwInfo = { }; GT_SYSTEM_INFO GLK_1x2x6::gtSystemInfo = {0}; void GLK_1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 12; gtSysInfo->ThreadCount = 12 * GLK::threadsPerEu; gtSysInfo->SliceCount = 1; diff --git a/runtime/gen9/hw_info_kbl.inl b/runtime/gen9/hw_info_kbl.inl index 77fe985fac..6b90802255 100644 --- a/runtime/gen9/hw_info_kbl.inl +++ b/runtime/gen9/hw_info_kbl.inl @@ -68,9 +68,9 @@ WorkaroundTable KBL::workaroundTable = {}; FeatureTable KBL::featureTable = {}; void KBL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - PLATFORM *pPlatform = const_cast(hwInfo->pPlatform); - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + PLATFORM *pPlatform = &hwInfo->pPlatform; + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrGpGpuMidBatchPreempt = true; pSkuTable->ftrGpGpuThreadGroupLevelPreempt = true; @@ -120,7 +120,7 @@ const HardwareInfo KBL_1x2x6::hwInfo = { }; GT_SYSTEM_INFO KBL_1x2x6::gtSystemInfo = {0}; void KBL_1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 11; gtSysInfo->ThreadCount = 11 * KBL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -154,7 +154,7 @@ const HardwareInfo KBL_1x3x6::hwInfo = { GT_SYSTEM_INFO KBL_1x3x6::gtSystemInfo = {0}; void KBL_1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 17; gtSysInfo->ThreadCount = 17 * KBL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -187,7 +187,7 @@ const HardwareInfo KBL_1x3x8::hwInfo = { }; GT_SYSTEM_INFO KBL_1x3x8::gtSystemInfo = {0}; void KBL_1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 23; gtSysInfo->ThreadCount = 23 * KBL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -220,7 +220,7 @@ const HardwareInfo KBL_2x3x8::hwInfo = { }; GT_SYSTEM_INFO KBL_2x3x8::gtSystemInfo = {0}; void KBL_2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 47; gtSysInfo->ThreadCount = 47 * KBL::threadsPerEu; gtSysInfo->SliceCount = 2; @@ -253,7 +253,7 @@ const HardwareInfo KBL_3x3x8::hwInfo = { }; GT_SYSTEM_INFO KBL_3x3x8::gtSystemInfo = {0}; void KBL_3x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 71; gtSysInfo->ThreadCount = 71 * KBL::threadsPerEu; gtSysInfo->SliceCount = 3; diff --git a/runtime/gen9/hw_info_skl.inl b/runtime/gen9/hw_info_skl.inl index bf6993274b..1a3e347db9 100644 --- a/runtime/gen9/hw_info_skl.inl +++ b/runtime/gen9/hw_info_skl.inl @@ -74,8 +74,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{ WorkaroundTable SKL::workaroundTable = {}; FeatureTable SKL::featureTable = {}; void SKL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + WorkaroundTable *pWaTable = &hwInfo->pWaTable; pSkuTable->ftrGpGpuMidBatchPreempt = true; pSkuTable->ftrGpGpuThreadGroupLevelPreempt = true; @@ -113,14 +113,14 @@ void SKL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { pWaTable->waForcePcBbFullCfgRestore = true; pWaTable->waSamplerCacheFlushBetweenRedescribedSurfaceReads = true; - if ((1 << hwInfo->pPlatform->usRevId) & 0x0eu) { + if ((1 << hwInfo->pPlatform.usRevId) & 0x0eu) { pWaTable->waCompressedResourceRequiresConstVA21 = true; } - if ((1 << hwInfo->pPlatform->usRevId) & 0x0fu) { + if ((1 << hwInfo->pPlatform.usRevId) & 0x0fu) { pWaTable->waDisablePerCtxtPreemptionGranularityControl = true; pWaTable->waModifyVFEStateAfterGPGPUPreemption = true; } - if ((1 << hwInfo->pPlatform->usRevId) & 0x3f) { + if ((1 << hwInfo->pPlatform.usRevId) & 0x3f) { pWaTable->waCSRUncachable = true; } } @@ -133,7 +133,7 @@ const HardwareInfo SKL_1x2x6::hwInfo = { }; GT_SYSTEM_INFO SKL_1x2x6::gtSystemInfo = {0}; void SKL_1x2x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 11; gtSysInfo->ThreadCount = 11 * SKL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -166,7 +166,7 @@ const HardwareInfo SKL_1x3x6::hwInfo = { }; GT_SYSTEM_INFO SKL_1x3x6::gtSystemInfo = {0}; void SKL_1x3x6::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 17; gtSysInfo->ThreadCount = 17 * SKL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -199,7 +199,7 @@ const HardwareInfo SKL_1x3x8::hwInfo = { }; GT_SYSTEM_INFO SKL_1x3x8::gtSystemInfo = {0}; void SKL_1x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 23; gtSysInfo->ThreadCount = 23 * SKL::threadsPerEu; gtSysInfo->SliceCount = 1; @@ -232,7 +232,7 @@ const HardwareInfo SKL_2x3x8::hwInfo = { }; GT_SYSTEM_INFO SKL_2x3x8::gtSystemInfo = {0}; void SKL_2x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 47; gtSysInfo->ThreadCount = 47 * SKL::threadsPerEu; gtSysInfo->SliceCount = 2; @@ -265,7 +265,7 @@ const HardwareInfo SKL_3x3x8::hwInfo = { }; GT_SYSTEM_INFO SKL_3x3x8::gtSystemInfo = {0}; void SKL_3x3x8::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) { - GT_SYSTEM_INFO *gtSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *gtSysInfo = &hwInfo->pSysInfo; gtSysInfo->EUCount = 71; gtSysInfo->ThreadCount = 71 * SKL::threadsPerEu; gtSysInfo->SliceCount = 3; diff --git a/runtime/gen9/linux/hw_info_config_bxt.inl b/runtime/gen9/linux/hw_info_config_bxt.inl index f0642bd639..e05f60184c 100644 --- a/runtime/gen9/linux/hw_info_config_bxt.inl +++ b/runtime/gen9/linux/hw_info_config_bxt.inl @@ -19,8 +19,8 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, } Drm *drm = osIface->get()->getDrm(); - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; pSysInfo->SliceCount = 1; diff --git a/runtime/gen9/linux/hw_info_config_cfl.inl b/runtime/gen9/linux/hw_info_config_cfl.inl index 9becd34ce2..f6a51fc479 100644 --- a/runtime/gen9/linux/hw_info_config_cfl.inl +++ b/runtime/gen9/linux/hw_info_config_cfl.inl @@ -15,7 +15,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInf if (nullptr == osIface) { return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; if (pSysInfo->SubSliceCount > 3) { pSysInfo->SliceCount = 2; @@ -26,8 +26,8 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInf pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = true; pSysInfo->VEBoxInfo.IsValid = true; - if (hwInfo->pPlatform->usDeviceID == ICFL_GT3_ULT_28W_DEVICE_F0_ID || - hwInfo->pPlatform->usDeviceID == ICFL_GT3_ULT_15W_DEVICE_F0_ID) { + if (hwInfo->pPlatform.usDeviceID == ICFL_GT3_ULT_28W_DEVICE_F0_ID || + hwInfo->pPlatform.usDeviceID == ICFL_GT3_ULT_15W_DEVICE_F0_ID) { pSysInfo->EdramSizeInKb = 64 * 1024; } diff --git a/runtime/gen9/linux/hw_info_config_glk.inl b/runtime/gen9/linux/hw_info_config_glk.inl index 19f5ba8e1f..4dd4167cbe 100644 --- a/runtime/gen9/linux/hw_info_config_glk.inl +++ b/runtime/gen9/linux/hw_info_config_glk.inl @@ -19,8 +19,8 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInf } Drm *drm = osIface->get()->getDrm(); - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = 1; pSysInfo->VEBoxInfo.IsValid = true; diff --git a/runtime/gen9/linux/hw_info_config_kbl.inl b/runtime/gen9/linux/hw_info_config_kbl.inl index eb818cc795..be7465e3a1 100644 --- a/runtime/gen9/linux/hw_info_config_kbl.inl +++ b/runtime/gen9/linux/hw_info_config_kbl.inl @@ -15,7 +15,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, if (nullptr == osIface) { return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; if (pSysInfo->SubSliceCount > 3) { pSysInfo->SliceCount = 2; @@ -26,8 +26,8 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled = 1; pSysInfo->VEBoxInfo.IsValid = true; - if (hwInfo->pPlatform->usDeviceID == IKBL_GT3_28W_ULT_DEVICE_F0_ID || - hwInfo->pPlatform->usDeviceID == IKBL_GT3_15W_ULT_DEVICE_F0_ID) { + if (hwInfo->pPlatform.usDeviceID == IKBL_GT3_28W_ULT_DEVICE_F0_ID || + hwInfo->pPlatform.usDeviceID == IKBL_GT3_15W_ULT_DEVICE_F0_ID) { pSysInfo->EdramSizeInKb = 64 * 1024; } diff --git a/runtime/gen9/linux/hw_info_config_skl.inl b/runtime/gen9/linux/hw_info_config_skl.inl index 1ab3725b59..e0062d694c 100644 --- a/runtime/gen9/linux/hw_info_config_skl.inl +++ b/runtime/gen9/linux/hw_info_config_skl.inl @@ -16,7 +16,7 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, if (nullptr == osIface) { return 0; } - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; if (pSysInfo->SubSliceCount > 3) { pSysInfo->SliceCount = 2; @@ -29,14 +29,14 @@ int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, pSysInfo->VEBoxInfo.IsValid = true; pSysInfo->VDBoxInfo.IsValid = true; - if (hwInfo->pPlatform->usDeviceID == ISKL_GT3e_ULT_DEVICE_F0_ID_540 || - hwInfo->pPlatform->usDeviceID == ISKL_GT3e_ULT_DEVICE_F0_ID_550 || - hwInfo->pPlatform->usDeviceID == ISKL_GT3_MEDIA_SERV_DEVICE_F0_ID) { + if (hwInfo->pPlatform.usDeviceID == ISKL_GT3e_ULT_DEVICE_F0_ID_540 || + hwInfo->pPlatform.usDeviceID == ISKL_GT3e_ULT_DEVICE_F0_ID_550 || + hwInfo->pPlatform.usDeviceID == ISKL_GT3_MEDIA_SERV_DEVICE_F0_ID) { pSysInfo->EdramSizeInKb = 64 * 1024; } - if (hwInfo->pPlatform->usDeviceID == ISKL_GT4_HALO_MOBL_DEVICE_F0_ID || - hwInfo->pPlatform->usDeviceID == ISKL_GT4_WRK_DEVICE_F0_ID) { + if (hwInfo->pPlatform.usDeviceID == ISKL_GT4_HALO_MOBL_DEVICE_F0_ID || + hwInfo->pPlatform.usDeviceID == ISKL_GT4_WRK_DEVICE_F0_ID) { pSysInfo->EdramSizeInKb = 128 * 1024; } diff --git a/runtime/gen9/preamble_gen9.cpp b/runtime/gen9/preamble_gen9.cpp index 07991c02fd..f2571952e4 100644 --- a/runtime/gen9/preamble_gen9.cpp +++ b/runtime/gen9/preamble_gen9.cpp @@ -14,7 +14,7 @@ template <> uint32_t PreambleHelper::getL3Config(const HardwareInfo &hwInfo, bool useSLM) { uint32_t l3Config = 0; - switch (hwInfo.pPlatform->eProductFamily) { + switch (hwInfo.pPlatform.eProductFamily) { case IGFX_SKYLAKE: l3Config = getL3ConfigHelper(useSLM); break; @@ -45,7 +45,7 @@ void PreambleHelper::addPipeControlBeforeVfeCmd(LinearStream *pComman auto pipeControl = pCommandStream->getSpaceForCmd(); *pipeControl = SKLFamily::cmdInitPipeControl; pipeControl->setCommandStreamerStallEnable(true); - if (hwInfo->pWaTable->waSendMIFLUSHBeforeVFE) { + if (hwInfo->pWaTable.waSendMIFLUSHBeforeVFE) { pipeControl->setRenderTargetCacheFlushEnable(true); pipeControl->setDepthCacheFlushEnable(true); pipeControl->setDcFlushEnable(true); diff --git a/runtime/gmm_helper/gmm.cpp b/runtime/gmm_helper/gmm.cpp index 74af577f49..18855813a6 100644 --- a/runtime/gmm_helper/gmm.cpp +++ b/runtime/gmm_helper/gmm.cpp @@ -131,7 +131,7 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo) { } applyAuxFlagsForImage(imgInfo); - auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform.eRenderCoreFamily); if (!hwHelper.supportsYTiling() && resourceParams.Flags.Info.TiledY == 1) { resourceParams.Flags.Info.Linear = 0; resourceParams.Flags.Info.TiledY = 0; @@ -194,7 +194,7 @@ void Gmm::queryImageParams(ImageInfo &imgInfo) { } uint32_t Gmm::queryQPitch(GMM_RESOURCE_TYPE resType) { - if (GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) { + if (GmmHelper::getInstance()->getHardwareInfo()->pPlatform.eRenderCoreFamily == IGFX_GEN8_CORE && resType == GMM_RESOURCE_TYPE::RESOURCE_3D) { return 0; } return gmmResourceInfo->getQPitch(); diff --git a/runtime/gmm_helper/gmm_helper.cpp b/runtime/gmm_helper/gmm_helper.cpp index 9119a7b18a..92af55059c 100644 --- a/runtime/gmm_helper/gmm_helper.cpp +++ b/runtime/gmm_helper/gmm_helper.cpp @@ -143,7 +143,7 @@ GMM_YUV_PLANE GmmHelper::convertPlane(OCLPlane oclPlane) { return GMM_NO_PLANE; } GmmHelper::GmmHelper(const HardwareInfo *pHwInfo) : hwInfo(pHwInfo) { - initContext(pHwInfo->pPlatform, pHwInfo->pSkuTable, pHwInfo->pWaTable, pHwInfo->pSysInfo); + initContext(&pHwInfo->pPlatform, &pHwInfo->pSkuTable, &pHwInfo->pWaTable, &pHwInfo->pSysInfo); } GmmHelper::~GmmHelper() { gmmEntries.pfnDestroySingletonContext(); diff --git a/runtime/gtpin/gtpin_callbacks.cpp b/runtime/gtpin/gtpin_callbacks.cpp index eb9f2031f1..072fef3b5b 100644 --- a/runtime/gtpin/gtpin_callbacks.cpp +++ b/runtime/gtpin/gtpin_callbacks.cpp @@ -43,10 +43,10 @@ void gtpinNotifyContextCreate(cl_context context) { platform_info_t gtpinPlatformInfo; auto pPlatform = platform(); auto pDevice = pPlatform->getDevice(0); - GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; GTPinHwHelper >pinHelper = GTPinHwHelper::get(genFamily); gtpinPlatformInfo.gen_version = (gtpin::GTPIN_GEN_VERSION)gtpinHelper.getGenVersion(); - gtpinPlatformInfo.device_id = static_cast(pDevice->getHardwareInfo().pPlatform->usDeviceID); + gtpinPlatformInfo.device_id = static_cast(pDevice->getHardwareInfo().pPlatform.usDeviceID); (*GTPinCallbacks.onContextCreate)((context_handle_t)context, >pinPlatformInfo, &pIgcInit); } } @@ -64,7 +64,7 @@ void gtpinNotifyKernelCreate(cl_kernel kernel) { // Enlarge local copy of SSH by 1 SS auto pPlatform = platform(); auto pDevice = pPlatform->getDevice(0); - GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; GTPinHwHelper >pinHelper = GTPinHwHelper::get(genFamily); if (!gtpinHelper.addSurfaceState(pKernel)) { // Kernel with no SSH or Kernel EM, not supported @@ -132,7 +132,7 @@ void gtpinNotifyKernelSubmit(cl_kernel kernel, void *pCmdQueue) { } auto pPlatform = platform(); auto pDevice = pPlatform->getDevice(0); - GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; GTPinHwHelper >pinHelper = GTPinHwHelper::get(genFamily); size_t gtpinBTI = pKernel->getNumberOfBindingTableStates() - 1; void *pSurfaceState = gtpinHelper.getSurfaceState(pKernel, gtpinBTI); diff --git a/runtime/helpers/hw_helper_common.inl b/runtime/helpers/hw_helper_common.inl index e74ff2be8f..03ea55a9d4 100644 --- a/runtime/helpers/hw_helper_common.inl +++ b/runtime/helpers/hw_helper_common.inl @@ -50,8 +50,8 @@ void HwHelperHw::setupHardwareCapabilities(HardwareCapabilities *caps, c template uint32_t HwHelperHw::getComputeUnitsUsedForScratch(const HardwareInfo *pHwInfo) const { - return pHwInfo->pSysInfo->MaxSubSlicesSupported * pHwInfo->pSysInfo->MaxEuPerSubSlice * - pHwInfo->pSysInfo->ThreadCount / pHwInfo->pSysInfo->EUCount; + return pHwInfo->pSysInfo.MaxSubSlicesSupported * pHwInfo->pSysInfo.MaxEuPerSubSlice * + pHwInfo->pSysInfo.ThreadCount / pHwInfo->pSysInfo.EUCount; } template diff --git a/runtime/helpers/hw_info.cpp b/runtime/helpers/hw_info.cpp index 24ce70013a..d978fa62f9 100644 --- a/runtime/helpers/hw_info.cpp +++ b/runtime/helpers/hw_info.cpp @@ -14,7 +14,7 @@ namespace NEO { HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *skuTable, const WorkaroundTable *waTable, const GT_SYSTEM_INFO *sysInfo, const RuntimeCapabilityTable &capabilityTable) - : pPlatform(platform), pSkuTable(skuTable), pWaTable(waTable), pSysInfo(sysInfo), capabilityTable(capabilityTable) { + : pPlatform(*platform), pSkuTable(*skuTable), pWaTable(*waTable), pSysInfo(*sysInfo), capabilityTable(capabilityTable) { } const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {}; diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index 01f03ce73d..fe34cf3a8d 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -68,10 +68,10 @@ struct HardwareInfo { HardwareInfo(const PLATFORM *platform, const FeatureTable *skuTable, const WorkaroundTable *waTable, const GT_SYSTEM_INFO *sysInfo, const RuntimeCapabilityTable &capabilityTable); - const PLATFORM *pPlatform = nullptr; - const FeatureTable *pSkuTable = nullptr; - const WorkaroundTable *pWaTable = nullptr; - const GT_SYSTEM_INFO *pSysInfo = nullptr; + PLATFORM pPlatform = {}; + FeatureTable pSkuTable = {}; + WorkaroundTable pWaTable = {}; + GT_SYSTEM_INFO pSysInfo = {}; RuntimeCapabilityTable capabilityTable = {}; }; diff --git a/runtime/helpers/preamble.inl b/runtime/helpers/preamble.inl index 4502e5228c..6597698579 100644 --- a/runtime/helpers/preamble.inl +++ b/runtime/helpers/preamble.inl @@ -117,8 +117,8 @@ size_t PreambleHelper::getKernelDebuggingCommandsSize(bool debuggingA template uint32_t PreambleHelper::getMaxThreadsForVfe(const HardwareInfo &hwInfo) { - uint32_t threadsPerEU = (hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU; - return hwInfo.pSysInfo->EUCount * threadsPerEU; + uint32_t threadsPerEU = (hwInfo.pSysInfo.ThreadCount / hwInfo.pSysInfo.EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU; + return hwInfo.pSysInfo.EUCount * threadsPerEU; } } // namespace NEO diff --git a/runtime/kernel/kernel.cpp b/runtime/kernel/kernel.cpp index dfe231bff9..ce2caaeabf 100644 --- a/runtime/kernel/kernel.cpp +++ b/runtime/kernel/kernel.cpp @@ -1460,7 +1460,7 @@ void Kernel::unsetArg(uint32_t argIndex) { void Kernel::createReflectionSurface() { if (this->isParentKernel && kernelReflectionSurface == nullptr) { auto &hwInfo = device.getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); BlockKernelManager *blockManager = program->getBlockKernelManager(); uint32_t blockCount = static_cast(blockManager->getCount()); @@ -1706,7 +1706,7 @@ void Kernel::ReflectionSurfaceHelper::getCurbeParams(std::vectoreRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); void *ssh = static_cast(kernelInfo.heapInfo.pSsh) + kernelInfo.patchInfo.bindingTableState->Offset; for (uint32_t i = 0; i < kernelInfo.patchInfo.bindingTableState->Count; i++) { @@ -1880,7 +1880,7 @@ void Kernel::ReflectionSurfaceHelper::setKernelAddressData(void *reflectionSurfa uint32_t sshTokensOffset, uint32_t btOffset, const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) { IGIL_KernelAddressData *kernelAddressData = reinterpret_cast(ptrOffset(reflectionSurface, offset)); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); kernelAddressData->m_KernelDataOffset = kernelDataOffset; kernelAddressData->m_SamplerHeapOffset = samplerHeapOffset; @@ -2139,7 +2139,7 @@ void Kernel::resolveArgs() { } bool Kernel::canTransformImages() const { - return device.getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE; + return device.getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE; } void Kernel::fillWithBuffersForAuxTranslation(MemObjsForAuxTranslation &memObjsForAuxTranslation) { diff --git a/runtime/mem_obj/buffer.cpp b/runtime/mem_obj/buffer.cpp index 0062bd5384..d93a9e491b 100644 --- a/runtime/mem_obj/buffer.cpp +++ b/runtime/mem_obj/buffer.cpp @@ -144,7 +144,7 @@ Buffer *Buffer::create(Context *context, context->peekContextType(), HwHelper::renderCompressedBuffersSupported(context->getDevice(0)->getHardwareInfo()), memoryManager->isLocalMemorySupported(), - HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(size)); + HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(size)); checkMemory(properties.flags, size, hostPtr, errcodeRet, alignementSatisfied, copyMemoryFromHostPtr, memoryManager); @@ -482,7 +482,7 @@ Buffer *Buffer::createBufferHw(Context *context, const auto device = context->getDevice(0); const auto &hwInfo = device->getHardwareInfo(); - auto funcCreate = bufferFactory[hwInfo.pPlatform->eRenderCoreFamily].createBufferFunction; + auto funcCreate = bufferFactory[hwInfo.pPlatform.eRenderCoreFamily].createBufferFunction; DEBUG_BREAK_IF(nullptr == funcCreate); auto pBuffer = funcCreate(context, properties, size, memoryStorage, hostPtr, gfxAllocation, zeroCopy, isHostPtrSVM, isImageRedescribed); @@ -505,7 +505,7 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device, const auto &hwInfo = device->getHardwareInfo(); - auto funcCreate = bufferFactory[hwInfo.pPlatform->eRenderCoreFamily].createBufferFunction; + auto funcCreate = bufferFactory[hwInfo.pPlatform.eRenderCoreFamily].createBufferFunction; DEBUG_BREAK_IF(nullptr == funcCreate); auto pBuffer = funcCreate(nullptr, flags, size, memoryStorage, hostPtr, gfxAllocation, zeroCopy, isHostPtrSVM, isImageRedescribed); diff --git a/runtime/mem_obj/image.cpp b/runtime/mem_obj/image.cpp index 9f41cdae00..d374b83c36 100644 --- a/runtime/mem_obj/image.cpp +++ b/runtime/mem_obj/image.cpp @@ -188,7 +188,7 @@ Image *Image::create(Context *context, bool transferNeeded = false; if (((imageDesc->image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) || (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D)) && (parentBuffer != nullptr)) { - HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).checkResourceCompatibility(parentBuffer, errcodeRet); + HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).checkResourceCompatibility(parentBuffer, errcodeRet); if (errcodeRet != CL_SUCCESS) { return nullptr; @@ -378,7 +378,7 @@ Image *Image::createImageHw(Context *context, cl_mem_flags flags, size_t size, v const auto device = context->getDevice(0); const auto &hwInfo = device->getHardwareInfo(); - auto funcCreate = imageFactory[hwInfo.pPlatform->eRenderCoreFamily].createImageFunction; + auto funcCreate = imageFactory[hwInfo.pPlatform.eRenderCoreFamily].createImageFunction; DEBUG_BREAK_IF(nullptr == funcCreate); auto image = funcCreate(context, flags, size, hostPtr, imageFormat, imageDesc, zeroCopy, graphicsAllocation, isObjectRedescribed, createTiledImage, baseMipLevel, mipCount, surfaceFormatInfo, nullptr); diff --git a/runtime/memory_manager/memory_manager.cpp b/runtime/memory_manager/memory_manager.cpp index bdd2687136..2302b85e77 100644 --- a/runtime/memory_manager/memory_manager.cpp +++ b/runtime/memory_manager/memory_manager.cpp @@ -35,7 +35,7 @@ namespace NEO { MemoryManager::MemoryManager(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment), hostPtrManager(std::make_unique()), multiContextResourceDestructor(std::make_unique()), allocator32Bit(nullptr) { auto hwInfo = executionEnvironment.getHardwareInfo(); - this->localMemorySupported = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily).getEnableLocalMemory(*hwInfo); + this->localMemorySupported = HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo); this->enable64kbpages = OSInterface::osEnabled64kbPages && hwInfo->capabilityTable.ftr64KBpages; if (DebugManager.flags.Enable64kbpages.get() > -1) { this->enable64kbpages = DebugManager.flags.Enable64kbpages.get() != 0; diff --git a/runtime/os_interface/device_factory.cpp b/runtime/os_interface/device_factory.cpp index 4ed021c63f..feab456fed 100644 --- a/runtime/os_interface/device_factory.cpp +++ b/runtime/os_interface/device_factory.cpp @@ -12,7 +12,7 @@ namespace NEO { -bool DeviceFactory::getDevicesForProductFamilyOverride(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) { +bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, ExecutionEnvironment &executionEnvironment) { auto totalDeviceCount = 1u; if (DebugManager.flags.CreateMultipleDevices.get()) { totalDeviceCount = DebugManager.flags.CreateMultipleDevices.get(); @@ -24,23 +24,16 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(HardwareInfo **pHWInfos, std::string hwInfoConfig; DebugManager.getHardwareInfoOverride(hwInfoConfig); - auto hardwareInfo = std::make_unique(); - hardwareInfo->pPlatform = new PLATFORM(*hwInfoConst->pPlatform); - hardwareInfo->pSkuTable = new FeatureTable(*hwInfoConst->pSkuTable); - hardwareInfo->pWaTable = new WorkaroundTable(*hwInfoConst->pWaTable); - hardwareInfo->pSysInfo = new GT_SYSTEM_INFO(*hwInfoConst->pSysInfo); - hardwareInfo->capabilityTable = hwInfoConst->capabilityTable; - hardwareInfoSetup[hwInfoConst->pPlatform->eProductFamily](hardwareInfo.get(), true, hwInfoConfig); + auto hardwareInfo = executionEnvironment.getMutableHardwareInfo(); + *hardwareInfo = *hwInfoConst; - HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform->eProductFamily); - hwConfig->configureHardwareCustom(hardwareInfo.get(), nullptr); + hardwareInfoSetup[hwInfoConst->pPlatform.eProductFamily](hardwareInfo, true, hwInfoConfig); - *pHWInfos = hardwareInfo.release(); + HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform.eProductFamily); + hwConfig->configureHardwareCustom(hardwareInfo, nullptr); - executionEnvironment.setHwInfo(*pHWInfos); numDevices = totalDeviceCount; DeviceFactory::numDevices = numDevices; - DeviceFactory::hwInfo = *pHWInfos; return true; } diff --git a/runtime/os_interface/device_factory.h b/runtime/os_interface/device_factory.h index fbfaec7045..d51c3303b0 100644 --- a/runtime/os_interface/device_factory.h +++ b/runtime/os_interface/device_factory.h @@ -10,18 +10,16 @@ namespace NEO { -struct HardwareInfo; class ExecutionEnvironment; class DeviceFactory { public: - static bool getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment); - static bool getDevicesForProductFamilyOverride(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment); + static bool getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment); + static bool getDevicesForProductFamilyOverride(size_t &numDevices, ExecutionEnvironment &executionEnvironment); static void releaseDevices(); protected: static size_t numDevices; - static HardwareInfo *hwInfo; }; class DeviceFactoryCleaner { diff --git a/runtime/os_interface/linux/device_factory_linux.cpp b/runtime/os_interface/linux/device_factory_linux.cpp index 2d68fd21a2..37db4f1fcb 100644 --- a/runtime/os_interface/linux/device_factory_linux.cpp +++ b/runtime/os_interface/linux/device_factory_linux.cpp @@ -21,9 +21,8 @@ namespace NEO { size_t DeviceFactory::numDevices = 0; -HardwareInfo *DeviceFactory::hwInfo = nullptr; -bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) { +bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment) { unsigned int devNum = 0; size_t requiredDeviceCount = 1; @@ -39,19 +38,16 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, Exec executionEnvironment.osInterface.reset(new OSInterface()); executionEnvironment.osInterface->get()->setDrm(drm); - auto hardwareInfo = std::make_unique(); + auto hardwareInfo = executionEnvironment.getMutableHardwareInfo(); const HardwareInfo *pCurrDevice = platformDevices[devNum]; - HwInfoConfig *hwConfig = HwInfoConfig::get(pCurrDevice->pPlatform->eProductFamily); - if (hwConfig->configureHwInfo(pCurrDevice, hardwareInfo.get(), executionEnvironment.osInterface.get())) { + HwInfoConfig *hwConfig = HwInfoConfig::get(pCurrDevice->pPlatform.eProductFamily); + if (hwConfig->configureHwInfo(pCurrDevice, hardwareInfo, executionEnvironment.osInterface.get())) { return false; } numDevices = requiredDeviceCount; - *pHWInfos = hardwareInfo.release(); - executionEnvironment.setHwInfo(*pHWInfos); DeviceFactory::numDevices = numDevices; - DeviceFactory::hwInfo = *pHWInfos; return true; } @@ -61,13 +57,7 @@ void DeviceFactory::releaseDevices() { for (unsigned int i = 0; i < DeviceFactory::numDevices; ++i) { Drm::closeDevice(i); } - delete hwInfo->pSysInfo; - delete hwInfo->pSkuTable; - delete hwInfo->pWaTable; - delete hwInfo->pPlatform; - delete hwInfo; } - DeviceFactory::hwInfo = nullptr; DeviceFactory::numDevices = 0; } diff --git a/runtime/os_interface/linux/hw_info_config.cpp b/runtime/os_interface/linux/hw_info_config.cpp index 3c26541937..5627ae1529 100644 --- a/runtime/os_interface/linux/hw_info_config.cpp +++ b/runtime/os_interface/linux/hw_info_config.cpp @@ -29,7 +29,7 @@ uint32_t bitExact(uint32_t value, uint32_t highBit, uint32_t lowBit) { } int configureCacheInfo(HardwareInfo *hwInfo) { - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; uint32_t type = 0; uint32_t subleaf = 0; @@ -70,20 +70,10 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou int ret = 0; Drm *drm = osIface->get()->getDrm(); - auto pPlatform = std::unique_ptr(new PLATFORM); - *pPlatform = *(inHwInfo->pPlatform); - auto pSysInfo = std::unique_ptr(new GT_SYSTEM_INFO); - *(pSysInfo) = *(inHwInfo->pSysInfo); - auto pSkuTable = std::unique_ptr(new FeatureTable); - *pSkuTable = *(inHwInfo->pSkuTable); - auto pWaTable = std::unique_ptr(new WorkaroundTable); - *pWaTable = *(inHwInfo->pWaTable); - - outHwInfo->pPlatform = pPlatform.get(); - outHwInfo->pSysInfo = pSysInfo.get(); - outHwInfo->pSkuTable = pSkuTable.get(); - outHwInfo->pWaTable = pWaTable.get(); - outHwInfo->capabilityTable = inHwInfo->capabilityTable; + *outHwInfo = *inHwInfo; + auto pPlatform = &outHwInfo->pPlatform; + auto pSysInfo = &outHwInfo->pSysInfo; + auto pSkuTable = &outHwInfo->pSkuTable; int val = 0; ret = drm->getDeviceID(val); @@ -163,10 +153,10 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou bool preemption = drm->isPreemptionSupported(); preemption = hwHelper.setupPreemptionRegisters(outHwInfo, preemption); PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable, - static_cast(outHwInfo->pSkuTable->ftrGpGpuMidThreadLevelPreempt) && preemption, - static_cast(outHwInfo->pSkuTable->ftrGpGpuThreadGroupLevelPreempt) && preemption, - static_cast(outHwInfo->pSkuTable->ftrGpGpuMidBatchPreempt) && preemption); - outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; + static_cast(outHwInfo->pSkuTable.ftrGpGpuMidThreadLevelPreempt) && preemption, + static_cast(outHwInfo->pSkuTable.ftrGpGpuThreadGroupLevelPreempt) && preemption, + static_cast(outHwInfo->pSkuTable.ftrGpGpuMidBatchPreempt) && preemption); + outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo.CsrSizeInMb * MemoryConstants::megaByte; auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties; KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify); @@ -176,11 +166,6 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.get(), kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits); KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds); - pPlatform.release(); - pSkuTable.release(); - pWaTable.release(); - pSysInfo.release(); - return 0; } diff --git a/runtime/os_interface/linux/performance_counters_linux.cpp b/runtime/os_interface/linux/performance_counters_linux.cpp index ac8da816c0..3727cd8074 100644 --- a/runtime/os_interface/linux/performance_counters_linux.cpp +++ b/runtime/os_interface/linux/performance_counters_linux.cpp @@ -36,7 +36,7 @@ void PerformanceCountersLinux::initialize(const HardwareInfo *hwInfo) { if (mdLibHandle) { perfmonLoadConfigFunc = reinterpret_cast(dlsymFunc(mdLibHandle, "drm_intel_perfmon_load_config")); } - setPlatformInfoFunc(hwInfo->pPlatform->eProductFamily, (void *)(hwInfo->pSkuTable)); + setPlatformInfoFunc(hwInfo->pPlatform.eProductFamily, (void *)(&hwInfo->pSkuTable)); } void PerformanceCountersLinux::enableImpl() { diff --git a/runtime/os_interface/performance_counters.cpp b/runtime/os_interface/performance_counters.cpp index 746bd661b4..d77bfbaa2a 100644 --- a/runtime/os_interface/performance_counters.cpp +++ b/runtime/os_interface/performance_counters.cpp @@ -58,8 +58,8 @@ void PerformanceCounters::shutdown() { } void PerformanceCounters::initialize(const HardwareInfo *hwInfo) { - useMIRPC = !(hwInfo->pWaTable->waDoNotUseMIReportPerfCount); - gfxFamily = hwInfo->pPlatform->eRenderCoreFamily; + useMIRPC = !(hwInfo->pWaTable.waDoNotUseMIReportPerfCount); + gfxFamily = hwInfo->pPlatform.eRenderCoreFamily; if (getPerfCountersQueryDataFactory[gfxFamily] != nullptr) { getPerfCountersQueryDataFunc = getPerfCountersQueryDataFactory[gfxFamily]; diff --git a/runtime/os_interface/windows/device_factory_win.cpp b/runtime/os_interface/windows/device_factory_win.cpp index e8bd76cd3e..e532bb2bf9 100644 --- a/runtime/os_interface/windows/device_factory_win.cpp +++ b/runtime/os_interface/windows/device_factory_win.cpp @@ -21,35 +21,31 @@ namespace NEO { extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT]; size_t DeviceFactory::numDevices = 0; -HardwareInfo *DeviceFactory::hwInfo = nullptr; -bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) { +bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executionEnvironment) { numDevices = 0; - auto hardwareInfo = std::make_unique(); + auto hardwareInfo = executionEnvironment.getMutableHardwareInfo(); std::unique_ptr wddm(Wddm::createWddm()); if (!wddm->enumAdapters(*hardwareInfo)) { return false; } - auto totalDeviceCount = DeviceHelper::getDevicesCount(hardwareInfo.get()); + auto totalDeviceCount = DeviceHelper::getDevicesCount(hardwareInfo); executionEnvironment.osInterface.reset(new OSInterface()); executionEnvironment.osInterface->get()->setWddm(wddm.release()); - HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform->eProductFamily); - if (hwConfig->configureHwInfo(hardwareInfo.get(), hardwareInfo.get(), nullptr)) { + HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform.eProductFamily); + if (hwConfig->configureHwInfo(hardwareInfo, hardwareInfo, nullptr)) { return false; } - *pHWInfos = hardwareInfo.release(); numDevices = totalDeviceCount; DeviceFactory::numDevices = numDevices; - DeviceFactory::hwInfo = *pHWInfos; - executionEnvironment.setHwInfo(*pHWInfos); executionEnvironment.initGmm(); - auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(**pHWInfos); + auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo); bool success = executionEnvironment.osInterface->get()->getWddm()->init(preemptionMode); DEBUG_BREAK_IF(!success); @@ -57,14 +53,6 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, Exec } void DeviceFactory::releaseDevices() { - if (DeviceFactory::numDevices > 0) { - delete hwInfo->pPlatform; - delete hwInfo->pSkuTable; - delete hwInfo->pWaTable; - delete hwInfo->pSysInfo; - delete hwInfo; - } - DeviceFactory::hwInfo = nullptr; DeviceFactory::numDevices = 0; } diff --git a/runtime/os_interface/windows/hw_info_config.cpp b/runtime/os_interface/windows/hw_info_config.cpp index 5eee956aa9..e78c950843 100644 --- a/runtime/os_interface/windows/hw_info_config.cpp +++ b/runtime/os_interface/windows/hw_info_config.cpp @@ -21,21 +21,21 @@ namespace NEO { HwInfoConfig *hwInfoConfigFactory[IGFX_MAX_PRODUCT] = {}; int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface) { - HwHelper &hwHelper = HwHelper::get(outHwInfo->pPlatform->eRenderCoreFamily); + HwHelper &hwHelper = HwHelper::get(outHwInfo->pPlatform.eRenderCoreFamily); - outHwInfo->capabilityTable.ftrSvm = outHwInfo->pSkuTable->ftrSVM; + outHwInfo->capabilityTable.ftrSvm = outHwInfo->pSkuTable.ftrSVM; hwHelper.adjustDefaultEngineType(outHwInfo); outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo); hwHelper.setCapabilityCoherencyFlag(outHwInfo, outHwInfo->capabilityTable.ftrSupportsCoherency); - hwHelper.setupPreemptionRegisters(outHwInfo, outHwInfo->pWaTable->waEnablePreemptionGranularityControlByUMD); + hwHelper.setupPreemptionRegisters(outHwInfo, outHwInfo->pWaTable.waEnablePreemptionGranularityControlByUMD); PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable, - static_cast(outHwInfo->pSkuTable->ftrGpGpuMidThreadLevelPreempt), - static_cast(outHwInfo->pSkuTable->ftrGpGpuThreadGroupLevelPreempt), - static_cast(outHwInfo->pSkuTable->ftrGpGpuMidBatchPreempt)); - outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; + static_cast(outHwInfo->pSkuTable.ftrGpGpuMidThreadLevelPreempt), + static_cast(outHwInfo->pSkuTable.ftrGpGpuThreadGroupLevelPreempt), + static_cast(outHwInfo->pSkuTable.ftrGpGpuMidBatchPreempt)); + outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo.CsrSizeInMb * MemoryConstants::megaByte; outHwInfo->capabilityTable.instrumentationEnabled &= haveInstrumentation; diff --git a/runtime/os_interface/windows/wddm/wddm.cpp b/runtime/os_interface/windows/wddm/wddm.cpp index ad178ca804..12be17c8eb 100644 --- a/runtime/os_interface/windows/wddm/wddm.cpp +++ b/runtime/os_interface/windows/wddm/wddm.cpp @@ -74,10 +74,10 @@ bool Wddm::enumAdapters(HardwareInfo &outHardwareInfo) { return false; } - outHardwareInfo.pPlatform = new PLATFORM(*gfxPlatform); - outHardwareInfo.pSkuTable = new FeatureTable(*featureTable); - outHardwareInfo.pWaTable = new WorkaroundTable(*waTable); - outHardwareInfo.pSysInfo = new GT_SYSTEM_INFO(*gtSystemInfo); + outHardwareInfo.pPlatform = *gfxPlatform; + outHardwareInfo.pSkuTable = *featureTable; + outHardwareInfo.pWaTable = *waTable; + outHardwareInfo.pSysInfo = *gtSystemInfo; outHardwareInfo.capabilityTable = hardwareInfoTable[productFamily]->capabilityTable; outHardwareInfo.capabilityTable.maxRenderFrequency = maxRenderFrequency; diff --git a/runtime/platform/platform.cpp b/runtime/platform/platform.cpp index b53c7ccd77..c57f31c478 100644 --- a/runtime/platform/platform.cpp +++ b/runtime/platform/platform.cpp @@ -34,7 +34,7 @@ namespace NEO { std::unique_ptr platformImpl; -bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); +bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); Platform *platform() { return platformImpl.get(); } @@ -121,7 +121,6 @@ const std::string &Platform::peekCompilerExtensions() const { } bool Platform::initialize() { - HardwareInfo *hwInfo = nullptr; size_t numDevicesReturned = 0; TakeOwnershipWrapper platformOwnership(*this); @@ -135,7 +134,7 @@ bool Platform::initialize() { this->initializationLoopHelper(); } - state = NEO::getDevices(&hwInfo, numDevicesReturned, *executionEnvironment) ? StateIniting : StateNone; + state = NEO::getDevices(numDevicesReturned, *executionEnvironment) ? StateIniting : StateNone; if (state == StateNone) { return false; @@ -148,7 +147,7 @@ bool Platform::initialize() { this->devices.resize(numDevicesReturned); for (uint32_t deviceOrdinal = 0; deviceOrdinal < numDevicesReturned; ++deviceOrdinal) { - auto pDevice = Device::create(hwInfo, executionEnvironment, deviceOrdinal); + auto pDevice = Device::create(executionEnvironment, deviceOrdinal); DEBUG_BREAK_IF(!pDevice); if (pDevice) { this->devices[deviceOrdinal] = pDevice; @@ -174,15 +173,17 @@ bool Platform::initialize() { } executionEnvironment->initializeSpecialCommandStreamReceiver(); + auto hwInfo = executionEnvironment->getHardwareInfo(); + const bool sourceLevelDebuggerActive = executionEnvironment->sourceLevelDebugger && executionEnvironment->sourceLevelDebugger->isDebuggerActive(); if (devices[0]->getPreemptionMode() == PreemptionMode::MidThread || sourceLevelDebuggerActive) { - auto sipType = SipKernel::getSipKernelType(devices[0]->getHardwareInfo().pPlatform->eRenderCoreFamily, devices[0]->isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(hwInfo->pPlatform.eRenderCoreFamily, devices[0]->isSourceLevelDebuggerActive()); initSipKernel(sipType, *devices[0]); } CommandStreamReceiverType csrType = this->devices[0]->getDefaultEngine().commandStreamReceiver->getType(); if (csrType != CommandStreamReceiverType::CSR_HW) { - auto enableLocalMemory = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily).getEnableLocalMemory(*hwInfo); + auto enableLocalMemory = HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo); executionEnvironment->initAubCenter(enableLocalMemory, "aubfile", csrType); } diff --git a/runtime/program/kernel_info.cpp b/runtime/program/kernel_info.cpp index ae7a578edd..f5789dada6 100644 --- a/runtime/program/kernel_info.cpp +++ b/runtime/program/kernel_info.cpp @@ -159,7 +159,7 @@ WorkSizeInfo::WorkSizeInfo(const DispatchInfo &dispatchInfo) { this->hasBarriers = !!dispatchInfo.getKernel()->getKernelInfo().patchInfo.executionEnvironment->HasBarriers; this->simdSize = (uint32_t)dispatchInfo.getKernel()->getKernelInfo().getMaxSimdSize(); this->slmTotalSize = (uint32_t)dispatchInfo.getKernel()->slmTotalSize; - this->coreFamily = dispatchInfo.getKernel()->getDevice().getHardwareInfo().pPlatform->eRenderCoreFamily; + this->coreFamily = dispatchInfo.getKernel()->getDevice().getHardwareInfo().pPlatform.eRenderCoreFamily; this->numThreadsPerSubSlice = (uint32_t)dispatchInfo.getKernel()->getDevice().getDeviceInfo().maxNumEUsPerSubSlice * dispatchInfo.getKernel()->getDevice().getDeviceInfo().numThreadsPerEU; this->localMemSize = (uint32_t)dispatchInfo.getKernel()->getDevice().getDeviceInfo().localMemSize; setIfUseImg(dispatchInfo.getKernel()); diff --git a/runtime/sampler/sampler.cpp b/runtime/sampler/sampler.cpp index 428ff6ae0a..2a12a3ea1c 100644 --- a/runtime/sampler/sampler.cpp +++ b/runtime/sampler/sampler.cpp @@ -48,7 +48,7 @@ Sampler *Sampler::create(Context *context, cl_bool normalizedCoordinates, const auto device = context->getDevice(0); const auto &hwInfo = device->getHardwareInfo(); - auto funcCreate = samplerFactory[hwInfo.pPlatform->eRenderCoreFamily]; + auto funcCreate = samplerFactory[hwInfo.pPlatform.eRenderCoreFamily]; DEBUG_BREAK_IF(nullptr == funcCreate); sampler = funcCreate(context, normalizedCoordinates, addressingMode, filterMode, mipFilterMode, lodMin, lodMax); @@ -60,7 +60,7 @@ Sampler *Sampler::create(Context *context, cl_bool normalizedCoordinates, } size_t Sampler::getSamplerStateSize(const HardwareInfo &hwInfo) { - return getSamplerStateSizeHw[hwInfo.pPlatform->eRenderCoreFamily](); + return getSamplerStateSizeHw[hwInfo.pPlatform.eRenderCoreFamily](); } template diff --git a/runtime/scheduler/scheduler_kernel.cpp b/runtime/scheduler/scheduler_kernel.cpp index f46fe7c810..b29c603434 100644 --- a/runtime/scheduler/scheduler_kernel.cpp +++ b/runtime/scheduler/scheduler_kernel.cpp @@ -42,13 +42,13 @@ void SchedulerKernel::setArgs(GraphicsAllocation *queue, void SchedulerKernel::computeGws() { auto &devInfo = device.getDeviceInfo(); auto &hwInfo = device.getHardwareInfo(); - auto &helper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &helper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); - size_t hWThreadsPerSubSlice = devInfo.maxComputUnits / hwInfo.pSysInfo->SubSliceCount; + size_t hWThreadsPerSubSlice = devInfo.maxComputUnits / hwInfo.pSysInfo.SubSliceCount; size_t wkgsPerSubSlice = hWThreadsPerSubSlice / PARALLEL_SCHEDULER_HWTHREADS_IN_HW_GROUP20; wkgsPerSubSlice = std::min(wkgsPerSubSlice, helper.getMaxBarrierRegisterPerSlice()); - gws = wkgsPerSubSlice * hwInfo.pSysInfo->SubSliceCount * PARALLEL_SCHEDULER_HWTHREADS_IN_HW_GROUP20 * PARALLEL_SCHEDULER_COMPILATION_SIZE_20; + gws = wkgsPerSubSlice * hwInfo.pSysInfo.SubSliceCount * PARALLEL_SCHEDULER_HWTHREADS_IN_HW_GROUP20 * PARALLEL_SCHEDULER_COMPILATION_SIZE_20; if (device.isSimulation()) { gws = PARALLEL_SCHEDULER_HWTHREADS_IN_HW_GROUP20 * PARALLEL_SCHEDULER_COMPILATION_SIZE_20; diff --git a/runtime/sku_info/definitions/sku_info.h b/runtime/sku_info/definitions/sku_info.h index 2fef931c4f..04fbd48ed8 100644 --- a/runtime/sku_info/definitions/sku_info.h +++ b/runtime/sku_info/definitions/sku_info.h @@ -9,7 +9,7 @@ #include "runtime/sku_info/sku_info_base.h" namespace NEO { -struct FeatureTable : FeatureTableBase {}; +struct alignas(4) FeatureTable : FeatureTableBase {}; -struct WorkaroundTable : WorkaroundTableBase {}; +struct alignas(4) WorkaroundTable : WorkaroundTableBase {}; } // namespace NEO diff --git a/unit_tests/api/cl_build_program_tests.inl b/unit_tests/api/cl_build_program_tests.inl index bc27b0aa77..bbefaf2872 100644 --- a/unit_tests/api/cl_build_program_tests.inl +++ b/unit_tests/api/cl_build_program_tests.inl @@ -190,7 +190,7 @@ TEST_F(clBuildProgramTests, GivenSpirAsInputWhenCreatingProgramFromBinaryThenPro SProgramBinaryHeader progBin = {}; progBin.Magic = iOpenCL::MAGIC_CL; progBin.Version = iOpenCL::CURRENT_ICBE_VERSION; - progBin.Device = pContext->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily; + progBin.Device = pContext->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily; igcDebugVars.binaryToReturn = &progBin; igcDebugVars.binaryToReturnSize = sizeof(progBin); auto prevDebugVars = getIgcDebugVars(); diff --git a/unit_tests/api/cl_set_performance_configuration_tests.inl b/unit_tests/api/cl_set_performance_configuration_tests.inl index a4776551d5..e773ba346e 100644 --- a/unit_tests/api/cl_set_performance_configuration_tests.inl +++ b/unit_tests/api/cl_set_performance_configuration_tests.inl @@ -49,14 +49,13 @@ TEST_F(clSetPerformanceConfigurationINTELTests, negativeInstrumentationDisabled) cl_uint offsets[2]; cl_uint values[2]; - HardwareInfo *pInHwInfo = const_cast(hwInfo); - bool instrumentationEnabled = pInHwInfo->capabilityTable.instrumentationEnabled; - pInHwInfo->capabilityTable.instrumentationEnabled = false; + bool instrumentationEnabled = hwInfo->capabilityTable.instrumentationEnabled; + hwInfo->capabilityTable.instrumentationEnabled = false; ret = clSetPerformanceConfigurationINTEL(device.get(), 2, offsets, values); EXPECT_EQ(CL_PROFILING_INFO_NOT_AVAILABLE, ret); - pInHwInfo->capabilityTable.instrumentationEnabled = instrumentationEnabled; + hwInfo->capabilityTable.instrumentationEnabled = instrumentationEnabled; } } // namespace ULT diff --git a/unit_tests/api/cl_svm_alloc_tests.inl b/unit_tests/api/cl_svm_alloc_tests.inl index 545a013140..42ec94a070 100644 --- a/unit_tests/api/cl_svm_alloc_tests.inl +++ b/unit_tests/api/cl_svm_alloc_tests.inl @@ -85,24 +85,7 @@ INSTANTIATE_TEST_CASE_P( clSVMAllocValidFlagsTests, testing::ValuesIn(SVMAllocValidFlags)); -struct clSVMAllocFtrFlagsTests : public clSVMAllocTemplateTests { - public: - void SetUp() override { - clSVMAllocTemplateTests::SetUp(); - const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - oldFtrSvm = hwInfo.capabilityTable.ftrSvm; - oldFtrCoherency = hwInfo.capabilityTable.ftrSupportsCoherency; - } - void TearDown() override { - const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - HardwareInfo *pHwInfo = const_cast(&hwInfo); - pHwInfo->capabilityTable.ftrSvm = oldFtrSvm; - pHwInfo->capabilityTable.ftrSupportsCoherency = oldFtrCoherency; - clSVMAllocTemplateTests::TearDown(); - } - bool oldFtrSvm; - bool oldFtrCoherency; -}; +using clSVMAllocFtrFlagsTests = clSVMAllocTemplateTests; INSTANTIATE_TEST_CASE_P( SVMAllocCheckFlagsFtrFlags, @@ -110,8 +93,7 @@ INSTANTIATE_TEST_CASE_P( testing::ValuesIn(SVMAllocValidFlags)); TEST_P(clSVMAllocFtrFlagsTests, SVMAllocValidFlags) { - const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - HardwareInfo *pHwInfo = const_cast(&hwInfo); + HardwareInfo *pHwInfo = pPlatform->peekExecutionEnvironment()->getMutableHardwareInfo(); cl_mem_flags flags = GetParam(); void *SVMPtr = nullptr; diff --git a/unit_tests/aub/aub_center_tests.cpp b/unit_tests/aub/aub_center_tests.cpp index 258402bfdc..95aa6c332e 100644 --- a/unit_tests/aub/aub_center_tests.cpp +++ b/unit_tests/aub/aub_center_tests.cpp @@ -30,11 +30,11 @@ TEST(AubCenter, GivenUseAubStreamDebugVariableSetWhenAubCenterIsCreatedThenCreat DebugManagerStateRestore restorer; DebugManager.flags.UseAubStream.set(false); - MockAubManager *mockAubManager = new MockAubManager(platformDevices[0]->pPlatform->eProductFamily, 4, 8 * MB, true, aub_stream::mode::aubFile); + MockAubManager *mockAubManager = new MockAubManager(platformDevices[0]->pPlatform.eProductFamily, 4, 8 * MB, true, aub_stream::mode::aubFile); MockAubCenter mockAubCenter(platformDevices[0], false, "", CommandStreamReceiverType::CSR_AUB); mockAubCenter.aubManager = std::unique_ptr(mockAubManager); - EXPECT_EQ(platformDevices[0]->pPlatform->eProductFamily, mockAubManager->mockAubManagerParams.productFamily); + EXPECT_EQ(platformDevices[0]->pPlatform.eProductFamily, mockAubManager->mockAubManagerParams.productFamily); EXPECT_EQ(4, mockAubManager->mockAubManagerParams.devicesCount); EXPECT_EQ(8 * MB, mockAubManager->mockAubManagerParams.memoryBankSize); EXPECT_EQ(true, mockAubManager->mockAubManagerParams.localMemorySupported); diff --git a/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp b/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp index 2f7143718b..5c2b220ff8 100644 --- a/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp +++ b/unit_tests/aub_tests/command_stream/aub_command_stream_fixture.cpp @@ -26,7 +26,7 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) { ASSERT_NE(pCmdQ, nullptr); auto &device = reinterpret_cast(pCmdQ->getDevice()); const auto &hwInfo = device.getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); std::stringstream strfilename; diff --git a/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp b/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp index ef7d1c068d..da6d30c25e 100644 --- a/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp +++ b/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp @@ -20,7 +20,7 @@ using NEO::DeviceFixture; using NEO::folderAUB; std::string getAubFileName(const NEO::Device *pDevice, const std::string baseName) { - const auto pGtSystemInfo = pDevice->getHardwareInfo().pSysInfo; + const auto pGtSystemInfo = &pDevice->getHardwareInfo().pSysInfo; std::stringstream strfilename; uint32_t subSlicesPerSlice = pGtSystemInfo->SubSliceCount / pGtSystemInfo->SliceCount; strfilename << pDevice->getProductAbbrev() << "_" << pGtSystemInfo->SliceCount << "x" << subSlicesPerSlice << "x" << pGtSystemInfo->MaxEuPerSubSlice << "_" << baseName; @@ -84,7 +84,7 @@ HWTEST_F(AubMemDumpTests, reserveMaxAddress) { auto gAddress = static_cast(-1) - 4096; auto pAddress = static_cast(gAddress) & 0xFFFFFFFF; - auto enableLocalMemory = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily).getEnableLocalMemory(hwInfo); + auto enableLocalMemory = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily).getEnableLocalMemory(hwInfo); NEO::AubHelperHw aubHelperHw(enableLocalMemory); AUB::reserveAddressPPGTT(aubFile, gAddress, 4096, pAddress, 7, aubHelperHw); diff --git a/unit_tests/aub_tests/fixtures/aub_fixture.h b/unit_tests/aub_tests/fixtures/aub_fixture.h index 96110f8d37..8c42fe43c6 100644 --- a/unit_tests/aub_tests/fixtures/aub_fixture.h +++ b/unit_tests/aub_tests/fixtures/aub_fixture.h @@ -28,7 +28,7 @@ class AUBFixture : public CommandQueueHwFixture { const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *platformDevices[0]; uint32_t deviceIndex = 0; - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); auto engineType = getChosenEngineType(hwInfo); const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); @@ -36,6 +36,7 @@ class AUBFixture : public CommandQueueHwFixture { strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name; executionEnvironment = platformImpl->peekExecutionEnvironment(); + executionEnvironment->setHwInfo(&hwInfo); if (testMode == TestMode::AubTestsWithTbx) { this->csr = TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment); } else { @@ -44,7 +45,7 @@ class AUBFixture : public CommandQueueHwFixture { executionEnvironment->commandStreamReceivers.resize(deviceIndex + 1); - device.reset(MockDevice::create(&hwInfo, executionEnvironment, deviceIndex)); + device.reset(MockDevice::create(executionEnvironment, deviceIndex)); device->resetCommandStreamReceiver(this->csr); CommandQueueHwFixture::SetUp(AUBFixture::device.get(), cl_command_queue_properties(0)); diff --git a/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp b/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp index 41baa875b5..27c607942e 100644 --- a/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp +++ b/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp @@ -34,7 +34,7 @@ class EnqueueDebugKernelTest : public ProgramSimpleFixture, device = pDevice; pDevice->executionEnvironment->sourceLevelDebugger.reset(new SourceLevelDebugger(nullptr)); - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { pDevice->getMutableDeviceInfo()->sourceLevelDebuggerActive = true; std::string filename; std::string kernelOption(CompilerOptions::debugKernelEnable); @@ -73,7 +73,7 @@ class EnqueueDebugKernelTest : public ProgramSimpleFixture, } void TearDown() override { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { delete kbHelper; debugKernel->release(); } diff --git a/unit_tests/command_queue/enqueue_fixture.cpp b/unit_tests/command_queue/enqueue_fixture.cpp index b798d257f9..a5d0c2b22f 100644 --- a/unit_tests/command_queue/enqueue_fixture.cpp +++ b/unit_tests/command_queue/enqueue_fixture.cpp @@ -11,6 +11,7 @@ // clang-format off // EnqueueTraits +using namespace NEO; cl_uint EnqueueTraits::numEventsInWaitList = 0; const cl_event *EnqueueTraits::eventWaitList = nullptr; cl_event *EnqueueTraits::event = nullptr; diff --git a/unit_tests/command_queue/enqueue_fixture.h b/unit_tests/command_queue/enqueue_fixture.h index edd6ce7474..9f91f58aa1 100644 --- a/unit_tests/command_queue/enqueue_fixture.h +++ b/unit_tests/command_queue/enqueue_fixture.h @@ -391,7 +391,7 @@ struct EnqueueReadBufferTraits : public EnqueueTraits { static const size_t sizeInBytes; static void *hostPtr; static cl_command_type cmdType; - static GraphicsAllocation *mapAllocation; + static NEO::GraphicsAllocation *mapAllocation; }; template @@ -406,7 +406,7 @@ struct EnqueueReadBufferHelper { size_t offset = Traits::offset, size_t size = Traits::sizeInBytes, void *ptr = Traits::hostPtr, - GraphicsAllocation *mapAllocation = Traits::mapAllocation, + NEO::GraphicsAllocation *mapAllocation = Traits::mapAllocation, cl_uint numEventsInWaitList = Traits::numEventsInWaitList, const cl_event *eventWaitList = Traits::eventWaitList, cl_event *event = Traits::event) { @@ -442,7 +442,7 @@ struct EnqueueReadImageTraits : public EnqueueTraits { static const size_t slicePitch; static void *hostPtr; static cl_command_type cmdType; - static GraphicsAllocation *mapAllocation; + static NEO::GraphicsAllocation *mapAllocation; }; template @@ -459,7 +459,7 @@ struct EnqueueReadImageHelper { size_t rowPitch = Traits::rowPitch, size_t slicePitch = Traits::slicePitch, void *ptr = Traits::hostPtr, - GraphicsAllocation *mapAllocation = Traits::mapAllocation, + NEO::GraphicsAllocation *mapAllocation = Traits::mapAllocation, cl_uint numEventsInWaitList = Traits::numEventsInWaitList, const cl_event *eventWaitList = Traits::eventWaitList, cl_event *event = Traits::event) { @@ -497,7 +497,7 @@ struct EnqueueWriteBufferTraits : public EnqueueTraits { static const size_t sizeInBytes; static void *hostPtr; static cl_command_type cmdType; - static GraphicsAllocation *mapAllocation; + static NEO::GraphicsAllocation *mapAllocation; }; template @@ -512,7 +512,7 @@ struct EnqueueWriteBufferHelper { size_t offset = Traits::offset, size_t size = Traits::sizeInBytes, void *ptr = Traits::hostPtr, - GraphicsAllocation *mapAllocation = Traits::mapAllocation, + NEO::GraphicsAllocation *mapAllocation = Traits::mapAllocation, cl_uint numEventsInWaitList = Traits::numEventsInWaitList, const cl_event *eventWaitList = Traits::eventWaitList, cl_event *event = Traits::event) { @@ -604,7 +604,7 @@ struct EnqueueWriteImageTraits : public EnqueueTraits { static const size_t slicePitch; static void *hostPtr; static cl_command_type cmdType; - static GraphicsAllocation *mapAllocation; + static NEO::GraphicsAllocation *mapAllocation; }; template @@ -621,7 +621,7 @@ struct EnqueueWriteImageHelper { size_t rowPitch = Traits::rowPitch, size_t slicePitch = Traits::slicePitch, const void *ptr = Traits::hostPtr, - GraphicsAllocation *mapAllocation = Traits::mapAllocation, + NEO::GraphicsAllocation *mapAllocation = Traits::mapAllocation, cl_uint numEventsInWaitList = Traits::numEventsInWaitList, const cl_event *eventWaitList = Traits::eventWaitList, cl_event *event = Traits::event) { diff --git a/unit_tests/command_queue/enqueue_kernel_2_tests.cpp b/unit_tests/command_queue/enqueue_kernel_2_tests.cpp index 428d139c34..2743a64cb6 100644 --- a/unit_tests/command_queue/enqueue_kernel_2_tests.cpp +++ b/unit_tests/command_queue/enqueue_kernel_2_tests.cpp @@ -314,8 +314,8 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratc auto *sba = (STATE_BASE_ADDRESS *)*itorCmdForStateBase; const HardwareInfo &hwInfo = **platformDevices; - uint32_t threadPerEU = (hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU; - uint32_t maxNumberOfThreads = hwInfo.pSysInfo->EUCount * threadPerEU; + uint32_t threadPerEU = (hwInfo.pSysInfo.ThreadCount / hwInfo.pSysInfo.EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU; + uint32_t maxNumberOfThreads = hwInfo.pSysInfo.EUCount * threadPerEU; // Verify we have a valid length EXPECT_EQ(maxNumberOfThreads, cmd->getMaximumNumberOfThreads()); diff --git a/unit_tests/command_queue/local_work_size_tests.cpp b/unit_tests/command_queue/local_work_size_tests.cpp index 6f22b56d4b..976a36e08d 100644 --- a/unit_tests/command_queue/local_work_size_tests.cpp +++ b/unit_tests/command_queue/local_work_size_tests.cpp @@ -17,7 +17,7 @@ using namespace NEO; TEST(localWorkSizeTest, given1DimWorkGroupAndSimdEqual8WhenComputeCalledThenLocalGroupComputed) { //wsInfo maxWorkGroupSize, hasBariers, simdSize, slmTotalSize, coreFamily, numThreadsPerSubSlice, localMemorySize, imgUsed, yTiledSurface - WorkSizeInfo wsInfo(256, 0u, 8, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 8, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 1; size_t workGroup[3] = {6144, 1, 1}; size_t workGroupSize[3]; @@ -47,7 +47,7 @@ TEST(localWorkSizeTest, given1DimWorkGroupAndSimdEqual8WhenComputeCalledThenLoca } TEST(localWorkSizeTest, given1DimWorkGroupAndSimdEqual32WhenComputeCalledThenLocalGroupComputed) { - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 1; size_t workGroup[3] = {6144, 1, 1}; size_t workGroupSize[3]; @@ -71,7 +71,7 @@ TEST(localWorkSizeTest, given1DimWorkGroupAndSimdEqual32WhenComputeCalledThenLoc } TEST(localWorkSizeTest, given2DimWorkGroupAndSimdEqual8WhenComputeCalledThenLocalGroupComputed) { - WorkSizeInfo wsInfo(256, 0u, 8, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 8, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {384, 96, 1}; size_t workGroupSize[3]; @@ -99,7 +99,7 @@ TEST(localWorkSizeTest, given2DimWorkGroupAndSimdEqual8WhenComputeCalledThenLoca TEST(localWorkSizeTest, given2DimWorkGroupAndSimdEqual32WhenComputeCalledThenLocalGroupComputed) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {384, 96, 1}; size_t workGroupSize[3]; @@ -131,7 +131,7 @@ TEST(localWorkSizeTest, given2DimWorkGroupAndSimdEqual32WhenComputeCalledThenLoc } TEST(localWorkSizeTest, given3DimWorkGroupAndSimdEqual8WhenComputeCalledThenLocalGroupComputed) { - WorkSizeInfo wsInfo(256, 0u, 8, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 8, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 0u, false, false); uint32_t workDim = 3; size_t workGroup[3] = {384, 384, 384}; size_t workGroupSize[3]; @@ -167,7 +167,7 @@ TEST(localWorkSizeTest, given3DimWorkGroupAndSimdEqual8WhenComputeCalledThenLoca } TEST(localWorkSizeTest, given3DimWorkGroupAndSimdEqual32WhenComputeCalledThenLocalGroupComputed) { - NEO::WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + NEO::WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 3; size_t workGroup[3] = {384, 384, 384}; size_t workGroupSize[3]; @@ -213,7 +213,7 @@ TEST(localWorkSizeTest, given2DimWorkGroupAndSquaredAlgorithmWhenComputeCalledTh DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(true); - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {384, 96, 1}; size_t workGroupSize[3]; @@ -228,7 +228,7 @@ TEST(localWorkSizeTest, given1DimWorkGroupAndSquaredAlgorithmOnWhenComputeCalled DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(true); - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 1; size_t workGroup[3] = {1024, 1, 1}; size_t workGroupSize[3]; @@ -243,7 +243,7 @@ TEST(localWorkSizeTest, given2DdispatchWithImagesAndSquaredAlgorithmOnWhenLwsIsC DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(true); - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, true, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, true, false); uint32_t workDim = 2; size_t workGroup[3] = {256, 96, 1}; size_t workGroupSize[3]; @@ -255,7 +255,7 @@ TEST(localWorkSizeTest, given2DdispatchWithImagesAndSquaredAlgorithmOnWhenLwsIsC } TEST(localWorkSizeTest, givenKernelWithTileYImagesAndBarrierWhenWorkgroupSizeIsComputedThenItMimicsTilingPattern) { - WorkSizeInfo wsInfo(256, true, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, true, true); + WorkSizeInfo wsInfo(256, true, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -276,7 +276,7 @@ TEST(localWorkSizeTest, givenKernelWithTileYImagesAndBarrierWhenWorkgroupSizeIsC } TEST(localWorkSizeTest, givenKernelWithTileYImagesAndNoBarriersWhenWorkgroupSizeIsComputedThenItMimicsTilingPattern) { - WorkSizeInfo wsInfo(256, false, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, true, true); + WorkSizeInfo wsInfo(256, false, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -297,7 +297,7 @@ TEST(localWorkSizeTest, givenKernelWithTileYImagesAndNoBarriersWhenWorkgroupSize } TEST(localWorkSizeTest, givenSimd16KernelWithTileYImagesAndNoBarriersWhenWorkgroupSizeIsComputedThenItMimicsTilingPattern) { - WorkSizeInfo wsInfo(256, false, 16, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, true, true); + WorkSizeInfo wsInfo(256, false, 16, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -318,7 +318,7 @@ TEST(localWorkSizeTest, givenSimd16KernelWithTileYImagesAndNoBarriersWhenWorkgro } TEST(localWorkSizeTest, givenKernelWithTwoDimensionalGlobalSizesWhenLwsIsComputedThenItHasMaxWorkgroupSize) { - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -332,7 +332,7 @@ TEST(localWorkSizeTest, givenKernelWithTwoDimensionalGlobalSizesWhenLwsIsCompute } TEST(localWorkSizeTest, givenKernelWithBarriersAndTiledImagesWithYdimensionHigherThenXDimensionWhenLwsIsComputedThenItMimicsTiling) { - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, true, true); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -367,7 +367,7 @@ TEST(localWorkSizeTest, givenKernelWithBarriersAndTiledImagesWithYdimensionHighe } TEST(localWorkSizeTest, givenHighOneDimensionalGwsWhenLwsIsComputedThenMaxWorkgoupSizeIsUsed) { - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -388,7 +388,7 @@ TEST(localWorkSizeTest, givenHighOneDimensionalGwsWhenLwsIsComputedThenMaxWorkgo } TEST(localWorkSizeTest, givenVeriousGwsSizesWithImagesWhenLwsIsComputedThenProperSizesAreReturned) { - WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, true, true); + WorkSizeInfo wsInfo(256, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -432,7 +432,7 @@ TEST(localWorkSizeTest, givenVeriousGwsSizesWithImagesWhenLwsIsComputedThenPrope } TEST(localWorkSizeTest, givenHigh1DGwsAndSimdSize16WhenLwsIsComputedThenMaxWorkgroupSizeIsChoosen) { - WorkSizeInfo wsInfo(256u, 0u, 16, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 0, false, false); + WorkSizeInfo wsInfo(256u, 0u, 16, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 0, false, false); size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -445,7 +445,7 @@ TEST(localWorkSizeTest, givenHigh1DGwsAndSimdSize16WhenLwsIsComputedThenMaxWorkg } TEST(localWorkSizeTest, givenHigh1DGwsAndSimdSize8WhenLwsIsComputedThenMaxWorkgroupSizeIsChoosen) { - WorkSizeInfo wsInfo(256u, 0u, 8, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0, false, false); + WorkSizeInfo wsInfo(256u, 0u, 8, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0, false, false); size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -458,7 +458,7 @@ TEST(localWorkSizeTest, givenHigh1DGwsAndSimdSize8WhenLwsIsComputedThenMaxWorkgr } TEST(localWorkSizeTest, givenKernelUtilizingImagesAndSlmWhenLwsIsBeingComputedThenItMimicsGlobalWorkgroupSizes) { - WorkSizeInfo wsInfo(256u, 1u, 32, 4096u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 65536u, true, true); + WorkSizeInfo wsInfo(256u, 1u, 32, 4096u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 65536u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {1, 1, 1}; size_t workGroupSize[3]; @@ -479,7 +479,7 @@ TEST(localWorkSizeTest, givenKernelUtilizingImagesAndSlmWhenLwsIsBeingComputedTh } TEST(localWorkSizeTest, useStrictRatio) { - WorkSizeInfo wsInfo(256u, 0u, 32u, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 0u, 0u, true, true); + WorkSizeInfo wsInfo(256u, 0u, 32u, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 0u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {194, 234, 1}; size_t workGroupSize[3]; @@ -507,7 +507,7 @@ TEST(localWorkSizeTest, useStrictRatio) { } TEST(localWorkSizeTest, useBarriers) { - WorkSizeInfo wsInfo(256u, 1u, 32u, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 0u, true, true); + WorkSizeInfo wsInfo(256u, 1u, 32u, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 0u, true, true); uint32_t workDim = 2; size_t workGroup[3] = {194, 234, 1}; size_t workGroupSize[3]; @@ -533,7 +533,7 @@ TEST(localWorkSizeTest, useBarriers) { } TEST(localWorkSizeTest, given2DimWorkWhenComputeSquaredCalledThenLocalGroupComputed) { - WorkSizeInfo wsInfo(256, 0u, 16, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 6u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 16, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 6u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {2048, 272, 1}; size_t workGroupSize[3]; @@ -582,7 +582,7 @@ TEST(localWorkSizeTest, given2DimWorkWhenComputeSquaredCalledThenLocalGroupCompu TEST(localWorkSizeTest, givenDeviceSupportingLws1024AndKernelCompiledInSimd8WhenGwsIs1024ThenLwsIsComputedAsMaxOptimalMultipliedBySimd) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); - WorkSizeInfo wsInfo(1024, 0u, 8, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 0u, false, false); + WorkSizeInfo wsInfo(1024, 0u, 8, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {32, 32, 1}; @@ -597,7 +597,7 @@ TEST(localWorkSizeTest, givenDeviceSupportingLws1024AndKernelCompiledInSimd8When TEST(localWorkSizeTest, givenDeviceWith36ThreadsPerSubsliceWhenSimd16KernelIsBeingSubmittedThenWorkgroupContainsOf8HwThreads) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); - WorkSizeInfo wsInfo(256, 0u, 16, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 36u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 16, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 36u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {1024, 1024, 1}; @@ -612,7 +612,7 @@ TEST(localWorkSizeTest, givenDeviceWith36ThreadsPerSubsliceWhenSimd16KernelIsBei TEST(localWorkSizeTest, givenDeviceWith56ThreadsPerSubsliceWhenSimd16KernelIsBeingSubmittedThenWorkgroupContainsOf16HwThreads) { DebugManagerStateRestore dbgRestore; DebugManager.flags.EnableComputeWorkSizeSquared.set(false); - WorkSizeInfo wsInfo(256, 0u, 16, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 56u, 0u, false, false); + WorkSizeInfo wsInfo(256, 0u, 16, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 56u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {1024, 1024, 1}; @@ -625,13 +625,13 @@ TEST(localWorkSizeTest, givenDeviceWith56ThreadsPerSubsliceWhenSimd16KernelIsBei } TEST(localWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenItHasCorrectNumberOfThreads) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockKernelWithInternals kernel(device); DispatchInfo dispatchInfo; dispatchInfo.setKernel(kernel.mockKernel); - auto threadsPerEu = platformDevices[0]->pSysInfo->ThreadCount / platformDevices[0]->pSysInfo->EUCount; - auto euPerSubSlice = platformDevices[0]->pSysInfo->ThreadCount / platformDevices[0]->pSysInfo->MaxEuPerSubSlice; + auto threadsPerEu = platformDevices[0]->pSysInfo.ThreadCount / platformDevices[0]->pSysInfo.EUCount; + auto euPerSubSlice = platformDevices[0]->pSysInfo.ThreadCount / platformDevices[0]->pSysInfo.MaxEuPerSubSlice; auto deviceInfo = device.getMutableDeviceInfo(); deviceInfo->maxNumEUsPerSubSlice = euPerSubSlice; @@ -641,7 +641,7 @@ TEST(localWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenItHasCorre EXPECT_EQ(workSizeInfo.numThreadsPerSubSlice, threadsPerEu * euPerSubSlice); } TEST(localWorkSizeTest, givenMaxWorkgroupSizeEqualToSimdSizeWhenLwsIsCalculatedThenItIsDownsizedToMaxWorkgroupSize) { - WorkSizeInfo wsInfo(32, 0u, 32, 0u, platformDevices[0]->pPlatform->eRenderCoreFamily, 32u, 0u, false, false); + WorkSizeInfo wsInfo(32, 0u, 32, 0u, platformDevices[0]->pPlatform.eRenderCoreFamily, 32u, 0u, false, false); uint32_t workDim = 2; size_t workGroup[3] = {32, 32, 1}; size_t workGroupSize[3]; diff --git a/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp index baae782ea9..ed789c52d2 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp @@ -62,15 +62,12 @@ TEST_F(AubCommandStreamReceiverTests, givenStructureWhenMisalignedUint64ThenUseS } TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedWithWrongGfxCoreFamilyThenNullPointerShouldBeReturned) { - HardwareInfo hwInfo = *platformDevices[0]; - GFXCORE_FAMILY family = hwInfo.pPlatform->eRenderCoreFamily; + HardwareInfo *hwInfo = pDevice->executionEnvironment->getMutableHardwareInfo(); - const_cast(hwInfo.pPlatform)->eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family + hwInfo->pPlatform.eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family CommandStreamReceiver *aubCsr = AUBCommandStreamReceiver::create("", true, *pDevice->executionEnvironment); EXPECT_EQ(nullptr, aubCsr); - - const_cast(hwInfo.pPlatform)->eRenderCoreFamily = family; } TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenTypeIsCheckedThenAubCsrIsReturned) { @@ -254,7 +251,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesInitializeTheirEnginesThenUniqueGlobalGttAdressesAreGenerated) { pDevice->executionEnvironment->aubCenter.reset(new AubCenter()); - auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); auto aubCsr1 = std::make_unique>("", true, *pDevice->executionEnvironment); diff --git a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp index 557c296111..405da50fa3 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -475,7 +475,7 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); auto memoryManager = new OsAgnosticMemoryManagerForImagesWithNoHostPtr(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw("", true, *executionEnvironment)); @@ -717,7 +717,7 @@ HWTEST_F(AubCommandStreamReceiverTests, whenAubCommandStreamReceiverIsCreatedThe } HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineIsInitializedThenDumpHandleIsGenerated) { - auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); MockExecutionEnvironment executionEnvironment(platformDevices[0]); @@ -877,9 +877,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenSshSize HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) { MockAubCsr aubCsr("", true, *pDevice->executionEnvironment); - auto oldSkuTable = hwInfoHelper.pSkuTable; - std::unique_ptr> skuTable(new FeatureTable, [&](FeatureTable *ptr) { delete ptr; hwInfoHelper.pSkuTable = oldSkuTable; }); - hwInfoHelper.pSkuTable = skuTable.get(); std::unique_ptr allocator(aubCsr.createPhysicalAddressAllocator(&hwInfoHelper)); ASSERT_NE(nullptr, allocator); } diff --git a/unit_tests/command_stream/command_stream_receiver_tests.cpp b/unit_tests/command_stream/command_stream_receiver_tests.cpp index e74b705b3a..441c0e9a7d 100644 --- a/unit_tests/command_stream/command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_tests.cpp @@ -419,7 +419,7 @@ TEST(CommandStreamReceiverSimpleTest, givenVariousDataSetsWhenVerifyingMemoryThe TEST(CommandStreamReceiverMultiContextTests, givenMultipleCsrsWhenSameResourcesAreUsedThenResidencyIsProperlyHandled) { auto executionEnvironment = platformImpl->peekExecutionEnvironment(); - std::unique_ptr device(Device::create(nullptr, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); auto &commandStreamReceiver0 = *executionEnvironment->commandStreamReceivers[0][0]; auto &commandStreamReceiver1 = *executionEnvironment->commandStreamReceivers[0][1]; @@ -458,7 +458,7 @@ struct CreateAllocationForHostSurfaceTest : public ::testing::Test { executionEnvironment->setHwInfo(&hwInfo); gmockMemoryManager = new ::testing::NiceMock(*executionEnvironment); executionEnvironment->memoryManager.reset(gmockMemoryManager); - device.reset(MockDevice::create(&hwInfo, executionEnvironment, 0u)); + device.reset(MockDevice::create(executionEnvironment, 0u)); commandStreamReceiver = &device->getCommandStreamReceiver(); } HardwareInfo hwInfo = *platformDevices[0]; diff --git a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp index 00b68e57ac..4f62379337 100644 --- a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp @@ -136,7 +136,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); CommandStreamReceiverWithAUBDump> csrWithAubDump("aubfile", *executionEnvironment); - MockOsContext osContext(0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + MockOsContext osContext(0, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csrWithAubDump.setupContext(osContext); diff --git a/unit_tests/command_stream/get_devices_tests.cpp b/unit_tests/command_stream/get_devices_tests.cpp index 9be741ad10..b4776ba445 100644 --- a/unit_tests/command_stream/get_devices_tests.cpp +++ b/unit_tests/command_stream/get_devices_tests.cpp @@ -18,9 +18,9 @@ namespace NEO { bool operator==(const HardwareInfo &hwInfoIn, const HardwareInfo &hwInfoOut) { - bool result = (0 == memcmp(hwInfoIn.pPlatform, hwInfoOut.pPlatform, sizeof(PLATFORM))); - result &= (0 == memcmp(hwInfoIn.pSkuTable, hwInfoOut.pSkuTable, sizeof(FeatureTable))); - result &= (0 == memcmp(hwInfoIn.pWaTable, hwInfoOut.pWaTable, sizeof(WorkaroundTable))); + bool result = (0 == memcmp(&hwInfoIn.pPlatform, &hwInfoOut.pPlatform, sizeof(PLATFORM))); + result &= (0 == memcmp(&hwInfoIn.pSkuTable, &hwInfoOut.pSkuTable, sizeof(FeatureTable))); + result &= (0 == memcmp(&hwInfoIn.pWaTable, &hwInfoOut.pWaTable, sizeof(WorkaroundTable))); result &= (0 == memcmp(&hwInfoIn.capabilityTable, &hwInfoOut.capabilityTable, sizeof(RuntimeCapabilityTable))); return result; } @@ -28,19 +28,13 @@ bool operator==(const HardwareInfo &hwInfoIn, const HardwareInfo &hwInfoOut) { struct GetDevicesTest : ::testing::Test { void SetUp() override { overrideDeviceWithDefaultHardwareInfo = false; - gtSystemInfo = *platformDevices[0]->pSysInfo; } void TearDown() override { overrideDeviceWithDefaultHardwareInfo = true; - memcpy(const_cast(platformDevices[0]->pSysInfo), >SystemInfo, sizeof(GT_SYSTEM_INFO)); } - GT_SYSTEM_INFO gtSystemInfo; int i = 0; size_t numDevices = 0; - HardwareInfo *hwInfo = nullptr; - FeatureTable featureTable = {}; - WorkaroundTable workaroundTable = {}; - GT_SYSTEM_INFO sysInfo = {}; + const HardwareInfo *hwInfo = nullptr; DebugManagerStateRestore stateRestorer; }; @@ -67,7 +61,8 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio DebugManager.flags.ProductFamilyOverride.set(productFamily); ExecutionEnvironment *exeEnv = platformImpl->peekExecutionEnvironment(); - const auto ret = getDevices(&hwInfo, numDevices, *exeEnv); + const auto ret = getDevices(numDevices, *exeEnv); + hwInfo = exeEnv->getHardwareInfo(); switch (csrType) { case CSR_HW: @@ -87,20 +82,20 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio auto hardwareInfo = hardwareInfoTable[i]; if (hardwareInfo == nullptr) continue; - if (hardwareInfoTable[i]->pPlatform->eProductFamily == hwInfo->pPlatform->eProductFamily) + if (hardwareInfoTable[i]->pPlatform.eProductFamily == hwInfo->pPlatform.eProductFamily) break; } EXPECT_TRUE(i < IGFX_MAX_PRODUCT); ASSERT_NE(nullptr, hardwarePrefix[i]); HardwareInfo hwInfoFromTable = *hardwareInfoTable[i]; - hwInfoFromTable.pSkuTable = &featureTable; - hwInfoFromTable.pWaTable = &workaroundTable; - hwInfoFromTable.pSysInfo = &sysInfo; - hardwareInfoSetup[hwInfoFromTable.pPlatform->eProductFamily](&hwInfoFromTable, true, "default"); - HwInfoConfig *hwConfig = HwInfoConfig::get(hwInfoFromTable.pPlatform->eProductFamily); + hwInfoFromTable.pSkuTable = {}; + hwInfoFromTable.pWaTable = {}; + hwInfoFromTable.pSysInfo = {}; + hardwareInfoSetup[hwInfoFromTable.pPlatform.eProductFamily](&hwInfoFromTable, true, "default"); + HwInfoConfig *hwConfig = HwInfoConfig::get(hwInfoFromTable.pPlatform.eProductFamily); hwConfig->configureHardwareCustom(&hwInfoFromTable, nullptr); - EXPECT_EQ(0, memcmp(hwInfoFromTable.pPlatform, hwInfo->pPlatform, sizeof(PLATFORM))); + EXPECT_EQ(0, memcmp(&hwInfoFromTable.pPlatform, &hwInfo->pPlatform, sizeof(PLATFORM))); EXPECT_EQ(0, memcmp(&hwInfoFromTable.capabilityTable, &hwInfo->capabilityTable, sizeof(RuntimeCapabilityTable))); EXPECT_STREQ(hardwarePrefix[i], productFamily.c_str()); @@ -125,13 +120,13 @@ HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToVal DebugManager.flags.ProductFamilyOverride.set(productFamily); ExecutionEnvironment *exeEnv = platformImpl->peekExecutionEnvironment(); - auto ret = getDevices(&hwInfo, numDevices, *exeEnv); + auto ret = getDevices(numDevices, *exeEnv); + hwInfo = exeEnv->getHardwareInfo(); switch (csrType) { case CSR_HW: case CSR_HW_WITH_AUB: EXPECT_TRUE(ret); - EXPECT_NE(nullptr, hwInfo); EXPECT_EQ(expectedDevices, numDevices); DeviceFactory::releaseDevices(); break; @@ -145,19 +140,19 @@ HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToVal auto hardwareInfo = hardwareInfoTable[i]; if (hardwareInfo == nullptr) continue; - if (hardwareInfoTable[i]->pPlatform->eProductFamily == hwInfo->pPlatform->eProductFamily) + if (hardwareInfoTable[i]->pPlatform.eProductFamily == hwInfo->pPlatform.eProductFamily) break; } EXPECT_TRUE(i < IGFX_MAX_PRODUCT); ASSERT_NE(nullptr, hardwarePrefix[i]); HardwareInfo defaultHwInfo = **platformDevices; - defaultHwInfo.pSkuTable = &featureTable; - defaultHwInfo.pWaTable = &workaroundTable; - defaultHwInfo.pSysInfo = &sysInfo; - hardwareInfoSetup[defaultHwInfo.pPlatform->eProductFamily](&defaultHwInfo, true, "default"); - HwInfoConfig *hwConfig = HwInfoConfig::get(defaultHwInfo.pPlatform->eProductFamily); + defaultHwInfo.pSkuTable = {}; + defaultHwInfo.pWaTable = {}; + defaultHwInfo.pSysInfo = {}; + hardwareInfoSetup[defaultHwInfo.pPlatform.eProductFamily](&defaultHwInfo, true, "default"); + HwInfoConfig *hwConfig = HwInfoConfig::get(defaultHwInfo.pPlatform.eProductFamily); hwConfig->configureHardwareCustom(&defaultHwInfo, nullptr); - EXPECT_EQ(0, memcmp(defaultHwInfo.pPlatform, hwInfo->pPlatform, sizeof(PLATFORM))); + EXPECT_EQ(0, memcmp(&defaultHwInfo.pPlatform, &hwInfo->pPlatform, sizeof(PLATFORM))); EXPECT_EQ(0, memcmp(&defaultHwInfo.capabilityTable, &hwInfo->capabilityTable, sizeof(RuntimeCapabilityTable))); DeviceFactory::releaseDevices(); diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index f940e73a8f..297e6abe50 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -132,7 +132,7 @@ HWTEST_F(TbxCommandStreamTests, DISABLED_getCsTraits) { TEST(TbxCommandStreamReceiverTest, givenNullFactoryEntryWhenTbxCsrIsCreatedThenNullptrIsReturned) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - GFXCORE_FAMILY family = executionEnvironment->getHardwareInfo()->pPlatform->eRenderCoreFamily; + GFXCORE_FAMILY family = executionEnvironment->getHardwareInfo()->pPlatform.eRenderCoreFamily; VariableBackup tbxCsrFactoryBackup(&tbxCommandStreamReceiverFactory[family]); tbxCommandStreamReceiverFactory[family] = nullptr; @@ -143,15 +143,12 @@ TEST(TbxCommandStreamReceiverTest, givenNullFactoryEntryWhenTbxCsrIsCreatedThenN TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenItIsCreatedWithWrongGfxCoreFamilyThenNullPointerShouldBeReturned) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - auto hwInfo = executionEnvironment->getHardwareInfo(); - GFXCORE_FAMILY family = hwInfo->pPlatform->eRenderCoreFamily; + auto hwInfo = executionEnvironment->getMutableHardwareInfo(); - const_cast(hwInfo->pPlatform)->eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family + hwInfo->pPlatform.eRenderCoreFamily = GFXCORE_FAMILY_FORCE_ULONG; // wrong gfx core family CommandStreamReceiver *csr = TbxCommandStreamReceiver::create("", false, *executionEnvironment); EXPECT_EQ(nullptr, csr); - - const_cast(hwInfo->pPlatform)->eRenderCoreFamily = family; } TEST(TbxCommandStreamReceiverTest, givenTbxCommandStreamReceiverWhenTypeIsCheckedThenTbxCsrIsReturned) { @@ -387,12 +384,8 @@ HWTEST_F(TbxCommandSteamSimpleTest, whenTbxCommandStreamReceiverIsCreatedThenPPG HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) { MockTbxCsr tbxCsr(*pDevice->executionEnvironment); - auto oldSkuTable = hwInfoHelper.pSkuTable; - std::unique_ptr> skuTable(new FeatureTable, [&](FeatureTable *ptr) { delete ptr; hwInfoHelper.pSkuTable = oldSkuTable; }); - hwInfoHelper.pSkuTable = skuTable.get(); std::unique_ptr allocator(tbxCsr.createPhysicalAddressAllocator(&hwInfoHelper)); ASSERT_NE(nullptr, allocator); - hwInfoHelper.pSkuTable = nullptr; } HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenItIsCreatedWithUseAubStreamFalseThenDontInitializeAubManager) { @@ -505,7 +498,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) { auto hwInfo = pDevice->executionEnvironment->getHardwareInfo(); - MockOsContext osContext(0, 1, HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + MockOsContext osContext(0, 1, HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled, false); std::string fileName = ""; MockAubManager *mockManager = new MockAubManager(); diff --git a/unit_tests/compiler_interface/binary_cache_tests.cpp b/unit_tests/compiler_interface/binary_cache_tests.cpp index bbb64ebf54..6c72ff16ef 100644 --- a/unit_tests/compiler_interface/binary_cache_tests.cpp +++ b/unit_tests/compiler_interface/binary_cache_tests.cpp @@ -181,17 +181,17 @@ TEST_F(BinaryCacheHashTests, testUnique) { PLATFORM p1 = {(PRODUCT_FAMILY)1}; PLATFORM p2 = {(PRODUCT_FAMILY)2}; - const PLATFORM *platforms[] = {nullptr, &p1, &p2}; + const PLATFORM *platforms[] = {&p1, &p2}; FeatureTable s1; FeatureTable s2; s1.ftrSVM = true; s2.ftrSVM = false; - const FeatureTable *skus[] = {nullptr, &s1, &s2}; + const FeatureTable *skus[] = {&s1, &s2}; WorkaroundTable w1; WorkaroundTable w2; w1.waDoNotUseMIReportPerfCount = true; w2.waDoNotUseMIReportPerfCount = false; - const WorkaroundTable *was[] = {nullptr, &w1, &w2}; + const WorkaroundTable *was[] = {&w1, &w2}; // GT_SYSTEM_INFO s1 = {}; std::array input = {{std::string(""), @@ -219,13 +219,13 @@ TEST_F(BinaryCacheHashTests, testUnique) { std::unique_ptr buf4(new char[bufSize]); for (auto platform : platforms) { - hwInfo.pPlatform = platform; + hwInfo.pPlatform = *platform; for (auto sku : skus) { - hwInfo.pSkuTable = sku; + hwInfo.pSkuTable = *sku; for (auto wa : was) { - hwInfo.pWaTable = wa; + hwInfo.pWaTable = *wa; for (size_t i1 = 0; i1 < input.size(); i1++) { strcpy_s(buf1.get(), bufSize, input[i1].c_str()); diff --git a/unit_tests/compiler_interface/compiler_interface_tests.cpp b/unit_tests/compiler_interface/compiler_interface_tests.cpp index db623c92fd..079a471501 100644 --- a/unit_tests/compiler_interface/compiler_interface_tests.cpp +++ b/unit_tests/compiler_interface/compiler_interface_tests.cpp @@ -731,7 +731,7 @@ TEST_F(CompilerInterfaceTest, GivenRequestForNewFclTranslationCtxWhenDeviceCtxIs auto firstBaseCtx = this->pCompilerInterface->getFclBaseTranslationCtx(); EXPECT_NE(nullptr, firstBaseCtx); - MockDevice md{device->getHardwareInfo()}; + MockDevice md; auto ret2 = this->pCompilerInterface->createFclTranslationCtx(md, IGC::CodeType::oclC, IGC::CodeType::spirV); EXPECT_NE(nullptr, ret2.get()); EXPECT_EQ(firstBaseCtx, this->pCompilerInterface->getFclBaseTranslationCtx()); @@ -848,20 +848,20 @@ TEST_F(CompilerInterfaceTest, givenNoDbgKeyForceUseDifferentPlatformWhenRequestF IGC::IgcOclDeviceCtxTagOCL *devCtx = pCompilerInterface->peekIgcDeviceCtx(device); auto igcPlatform = devCtx->GetPlatformHandle(); auto igcSysInfo = devCtx->GetGTSystemInfoHandle(); - EXPECT_EQ(device->getHardwareInfo().pPlatform->eProductFamily, igcPlatform->GetProductFamily()); - EXPECT_EQ(device->getHardwareInfo().pPlatform->eRenderCoreFamily, igcPlatform->GetRenderCoreFamily()); - EXPECT_EQ(device->getHardwareInfo().pSysInfo->SliceCount, igcSysInfo->GetSliceCount()); - EXPECT_EQ(device->getHardwareInfo().pSysInfo->SubSliceCount, igcSysInfo->GetSubSliceCount()); - EXPECT_EQ(device->getHardwareInfo().pSysInfo->EUCount, igcSysInfo->GetEUCount()); - EXPECT_EQ(device->getHardwareInfo().pSysInfo->ThreadCount, igcSysInfo->GetThreadCount()); + EXPECT_TRUE(device->getHardwareInfo().pPlatform.eProductFamily == igcPlatform->GetProductFamily()); + EXPECT_TRUE(device->getHardwareInfo().pPlatform.eRenderCoreFamily == igcPlatform->GetRenderCoreFamily()); + EXPECT_TRUE(device->getHardwareInfo().pSysInfo.SliceCount == igcSysInfo->GetSliceCount()); + EXPECT_TRUE(device->getHardwareInfo().pSysInfo.SubSliceCount == igcSysInfo->GetSubSliceCount()); + EXPECT_TRUE(device->getHardwareInfo().pSysInfo.EUCount == igcSysInfo->GetEUCount()); + EXPECT_TRUE(device->getHardwareInfo().pSysInfo.ThreadCount == igcSysInfo->GetThreadCount()); } TEST_F(CompilerInterfaceTest, givenDbgKeyForceUseDifferentPlatformWhenRequestForNewTranslationCtxThenUseDbgKeyPlatform) { DebugManagerStateRestore dbgRestore; - auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.pPlatform->eProductFamily; + auto dbgProdFamily = DEFAULT_TEST_PLATFORM::hwInfo.pPlatform.eProductFamily; std::string dbgPlatformString(hardwarePrefix[dbgProdFamily]); - const PLATFORM dbgPlatform = *hardwareInfoTable[dbgProdFamily]->pPlatform; - const GT_SYSTEM_INFO dbgSystemInfo = *hardwareInfoTable[dbgProdFamily]->pSysInfo; + const PLATFORM dbgPlatform = hardwareInfoTable[dbgProdFamily]->pPlatform; + const GT_SYSTEM_INFO dbgSystemInfo = hardwareInfoTable[dbgProdFamily]->pSysInfo; DebugManager.flags.ForceCompilerUsePlatform.set(dbgPlatformString); auto device = this->pContext->getDevice(0); diff --git a/unit_tests/context/context_tests.cpp b/unit_tests/context/context_tests.cpp index 5fd7269d40..fec2badbf7 100644 --- a/unit_tests/context/context_tests.cpp +++ b/unit_tests/context/context_tests.cpp @@ -304,7 +304,7 @@ class ContextWithAsyncDeleterTest : public ::testing::WithParamInterface, public: void SetUp() override { memoryManager = new MockMemoryManager(); - device = new MockDevice(*platformDevices[0]); + device = new MockDevice; deleter = new MockDeferredDeleter(); device->injectMemoryManager(memoryManager); memoryManager->setDeferredDeleter(deleter); diff --git a/unit_tests/context/driver_diagnostics_tests.cpp b/unit_tests/context/driver_diagnostics_tests.cpp index 29df60a40d..0832292a36 100644 --- a/unit_tests/context/driver_diagnostics_tests.cpp +++ b/unit_tests/context/driver_diagnostics_tests.cpp @@ -117,7 +117,7 @@ TEST_P(PerformanceHintCommandQueueTest, GivenProfilingFlagAndPreemptionFlagWhenC EXPECT_EQ(profilingEnabled, containsHint(expectedHint, userData)); snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[PROFILING_ENABLED_WITH_DISABLED_PREEMPTION], 0); - if (device->getHardwareInfo().pPlatform->eProductFamily < IGFX_SKYLAKE && preemptionSupported && profilingEnabled) { + if (device->getHardwareInfo().pPlatform.eProductFamily < IGFX_SKYLAKE && preemptionSupported && profilingEnabled) { EXPECT_TRUE(containsHint(expectedHint, userData)); } else { EXPECT_FALSE(containsHint(expectedHint, userData)); @@ -142,7 +142,7 @@ TEST_P(PerformanceHintCommandQueueTest, GivenEnabledProfilingFlagAndSupportedPre EXPECT_EQ(profilingEnabled, containsHint(expectedHint, userData)); snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[PROFILING_ENABLED_WITH_DISABLED_PREEMPTION], 0); - if (device->getHardwareInfo().pPlatform->eProductFamily < IGFX_SKYLAKE && preemptionSupported && profilingEnabled) { + if (device->getHardwareInfo().pPlatform.eProductFamily < IGFX_SKYLAKE && preemptionSupported && profilingEnabled) { EXPECT_TRUE(containsHint(expectedHint, userData)); } else { EXPECT_FALSE(containsHint(expectedHint, userData)); diff --git a/unit_tests/context/driver_diagnostics_tests.h b/unit_tests/context/driver_diagnostics_tests.h index 85fd1fcc43..e114c6f351 100644 --- a/unit_tests/context/driver_diagnostics_tests.h +++ b/unit_tests/context/driver_diagnostics_tests.h @@ -113,7 +113,7 @@ struct PerformanceHintCommandQueueTest : public PerformanceHintTest, void SetUp() override { PerformanceHintTest::SetUp(); std::tie(profilingEnabled, preemptionSupported) = GetParam(); - device = new MockDevice(*platformDevices[0]); + device = new MockDevice; device->getDeviceInfoToModify()->preemptionSupported = preemptionSupported; } diff --git a/unit_tests/context/get_supported_image_formats_tests.cpp b/unit_tests/context/get_supported_image_formats_tests.cpp index a043b93434..f7e5fc4190 100644 --- a/unit_tests/context/get_supported_image_formats_tests.cpp +++ b/unit_tests/context/get_supported_image_formats_tests.cpp @@ -159,7 +159,7 @@ TEST(ImageFormats, isDepthFormat) { struct PackedYuvExtensionSupportedImageFormatsTest : public ::testing::TestWithParam> { void SetUp() override { - device = std::unique_ptr(new MockDevice(*platformDevices[0])); + device = std::unique_ptr(new MockDevice()); context = std::unique_ptr(new MockContext(device.get(), true)); } @@ -245,7 +245,7 @@ TEST_P(PackedYuvExtensionSupportedImageFormatsTest, retrieveImageFormatsPackedYU struct NV12ExtensionSupportedImageFormatsTest : public ::testing::TestWithParam> { void SetUp() override { - device = std::unique_ptr(new MockDevice(*platformDevices[0])); + device = std::unique_ptr(new MockDevice()); context = std::unique_ptr(new MockContext(device.get(), true)); } diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index 3e8151d08d..734533160b 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -63,7 +63,7 @@ TEST_F(DeviceGetCapsF, GivenDeviceCapsWhenQueryingForSLMWindowStartAddressThenPo TEST(Device_GetCaps, validate) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); const auto &caps = device->getDeviceInfo(); - const auto &sysInfo = *platformDevices[0]->pSysInfo; + const auto &sysInfo = platformDevices[0]->pSysInfo; EXPECT_NE(nullptr, caps.builtInKernels); @@ -107,7 +107,7 @@ TEST(Device_GetCaps, validate) { EXPECT_EQ(static_cast(CL_TRUE), caps.deviceAvailable); EXPECT_EQ(static_cast(CL_READ_WRITE_CACHE), caps.globalMemCacheType); - EXPECT_EQ(sysInfo.EUCount, caps.maxComputUnits); + EXPECT_TRUE(sysInfo.EUCount == caps.maxComputUnits); EXPECT_LT(0u, caps.maxConstantArgs); EXPECT_LE(128u, caps.maxReadImageArgs); @@ -187,7 +187,7 @@ TEST(Device_GetCaps, validateImage3DDimensions) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); const auto &caps = device->getDeviceInfo(); - if (device->getHardwareInfo().pPlatform->eRenderCoreFamily > IGFX_GEN8_CORE) { + if (device->getHardwareInfo().pPlatform.eRenderCoreFamily > IGFX_GEN8_CORE) { EXPECT_EQ(16384u, caps.image3DMaxWidth); EXPECT_EQ(16384u, caps.image3DMaxHeight); } else { @@ -339,7 +339,7 @@ TEST(Device_GetCaps, givenGlobalMemSizeWhenCalculatingMaxAllocSizeThenAdjustToHW const auto &caps = device->getDeviceInfo(); HardwareCapabilities hwCaps = {0}; - auto &hwHelper = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily); hwHelper.setupHardwareCapabilities(&hwCaps, *platformDevices[0]); uint64_t expectedSize = std::max((caps.globalMemSize / 2), static_cast(128ULL * MemoryConstants::megaByte)); @@ -714,10 +714,9 @@ TEST(DeviceGetCaps, givenOclVersion21WhenCapsAreCreatedThenDeviceReportsSpirvAsS } TEST(DeviceGetCaps, givenDisabledFtrPooledEuWhenCalculatingMaxEuPerSSThenIgnoreEuCountPerPoolMin) { - GT_SYSTEM_INFO mySysInfo = *platformDevices[0]->pSysInfo; - FeatureTable mySkuTable = *platformDevices[0]->pSkuTable; - HardwareInfo myHwInfo = {platformDevices[0]->pPlatform, &mySkuTable, platformDevices[0]->pWaTable, - &mySysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo myHwInfo = *platformDevices[0]; + GT_SYSTEM_INFO &mySysInfo = myHwInfo.pSysInfo; + FeatureTable &mySkuTable = myHwInfo.pSkuTable; mySysInfo.EUCount = 20; mySysInfo.EuCountPerPoolMin = 99999; @@ -733,10 +732,9 @@ TEST(DeviceGetCaps, givenDisabledFtrPooledEuWhenCalculatingMaxEuPerSSThenIgnoreE } TEST(DeviceGetCaps, givenEnabledFtrPooledEuWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin) { - GT_SYSTEM_INFO mySysInfo = *platformDevices[0]->pSysInfo; - FeatureTable mySkuTable = *platformDevices[0]->pSkuTable; - HardwareInfo myHwInfo = {platformDevices[0]->pPlatform, &mySkuTable, platformDevices[0]->pWaTable, - &mySysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo myHwInfo = *platformDevices[0]; + GT_SYSTEM_INFO &mySysInfo = myHwInfo.pSysInfo; + FeatureTable &mySkuTable = myHwInfo.pSkuTable; mySysInfo.EUCount = 20; mySysInfo.EuCountPerPoolMin = 99999; @@ -754,10 +752,8 @@ TEST(DeviceGetCaps, givenDebugFlagToUseMaxSimdSizeForWkgCalculationWhenDeviceCap DebugManagerStateRestore dbgRestorer; DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.set(true); - GT_SYSTEM_INFO mySysInfo = *platformDevices[0]->pSysInfo; - FeatureTable mySkuTable = *platformDevices[0]->pSkuTable; - HardwareInfo myHwInfo = {platformDevices[0]->pPlatform, &mySkuTable, platformDevices[0]->pWaTable, - &mySysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo myHwInfo = *platformDevices[0]; + GT_SYSTEM_INFO &mySysInfo = myHwInfo.pSysInfo; mySysInfo.EUCount = 24; mySysInfo.SubSliceCount = 3; @@ -769,10 +765,8 @@ TEST(DeviceGetCaps, givenDebugFlagToUseMaxSimdSizeForWkgCalculationWhenDeviceCap } TEST(DeviceGetCaps, givenDeviceThatHasHighNumberOfExecutionUnitsWhenMaxWorkgroupSizeIsComputedItIsLimitedTo1024) { - GT_SYSTEM_INFO mySysInfo = *platformDevices[0]->pSysInfo; - FeatureTable mySkuTable = *platformDevices[0]->pSkuTable; - HardwareInfo myHwInfo = {platformDevices[0]->pPlatform, &mySkuTable, platformDevices[0]->pWaTable, - &mySysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo myHwInfo = *platformDevices[0]; + GT_SYSTEM_INFO &mySysInfo = myHwInfo.pSysInfo; mySysInfo.EUCount = 32; mySysInfo.SubSliceCount = 2; @@ -821,7 +815,7 @@ TEST(Device_GetCaps, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenRet const auto &caps = device->getDeviceInfo(); std::string tempName = "Intel(R) "; - tempName += familyName[platformDevices[0]->pPlatform->eRenderCoreFamily]; + tempName += familyName[platformDevices[0]->pPlatform.eRenderCoreFamily]; tempName += " HD Graphics NEO"; #define QTR(a) #a @@ -839,29 +833,28 @@ TEST(Device_GetCaps, GivenFlagEnabled64kbPagesWhenSetThenReturnCorrectValue) { DebugManagerStateRestore dbgRestore; VariableBackup OsEnabled64kbPagesBackup(&OSInterface::osEnabled64kbPages); - HardwareInfo hwInfo = *platformDevices[0]; ExecutionEnvironment executionEnvironment; - executionEnvironment.setHwInfo(&hwInfo); + auto &capabilityTable = executionEnvironment.getMutableHardwareInfo()->capabilityTable; std::unique_ptr memoryManager; DebugManager.flags.Enable64kbpages.set(-1); - hwInfo.capabilityTable.ftr64KBpages = false; + capabilityTable.ftr64KBpages = false; OSInterface::osEnabled64kbPages = false; memoryManager.reset(new OsAgnosticMemoryManager(executionEnvironment)); EXPECT_FALSE(memoryManager->peek64kbPagesEnabled()); - hwInfo.capabilityTable.ftr64KBpages = false; + capabilityTable.ftr64KBpages = false; OSInterface::osEnabled64kbPages = true; memoryManager.reset(new OsAgnosticMemoryManager(executionEnvironment)); EXPECT_FALSE(memoryManager->peek64kbPagesEnabled()); - hwInfo.capabilityTable.ftr64KBpages = true; + capabilityTable.ftr64KBpages = true; OSInterface::osEnabled64kbPages = false; memoryManager.reset(new OsAgnosticMemoryManager(executionEnvironment)); EXPECT_FALSE(memoryManager->peek64kbPagesEnabled()); - hwInfo.capabilityTable.ftr64KBpages = true; + capabilityTable.ftr64KBpages = true; OSInterface::osEnabled64kbPages = true; memoryManager.reset(new OsAgnosticMemoryManager(executionEnvironment)); EXPECT_TRUE(memoryManager->peek64kbPagesEnabled()); @@ -887,9 +880,9 @@ typedef HwHelperTest DeviceCapsWithModifiedHwInfoTest; TEST_F(DeviceCapsWithModifiedHwInfoTest, givenPlatformWithSourceLevelDebuggerNotSupportedWhenDeviceIsCreatedThenSourceLevelDebuggerActiveIsSetToFalse) { - hwInfoHelper.hwInfo.capabilityTable.sourceLevelDebuggerSupported = false; + hwInfoHelper.capabilityTable.sourceLevelDebuggerSupported = false; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfoHelper.hwInfo)); + std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfoHelper)); const auto &caps = device->getDeviceInfo(); EXPECT_EQ(nullptr, device->getSourceLevelDebugger()); diff --git a/unit_tests/device/device_tests.cpp b/unit_tests/device/device_tests.cpp index a559661842..f86b8026e9 100644 --- a/unit_tests/device/device_tests.cpp +++ b/unit_tests/device/device_tests.cpp @@ -32,7 +32,7 @@ TEST_F(DeviceTest, Create) { TEST_F(DeviceTest, givenDeviceWhenGetProductAbbrevThenReturnsHardwarePrefix) { const auto productAbbrev = pDevice->getProductAbbrev(); - const auto hwPrefix = hardwarePrefix[pDevice->getHardwareInfo().pPlatform->eProductFamily]; + const auto hwPrefix = hardwarePrefix[pDevice->getHardwareInfo().pPlatform.eProductFamily]; EXPECT_EQ(hwPrefix, productAbbrev); } @@ -56,7 +56,7 @@ TEST_F(DeviceTest, givenDeviceWhenEngineIsCreatedThenSetInitialValueForTag) { } TEST_F(DeviceTest, givenDeviceWhenAskedForSpecificEngineThenRetrunIt) { - auto &engines = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances(); + auto &engines = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances(); for (uint32_t i = 0; i < engines.size(); i++) { bool lowPriority = (HwHelper::lowPriorityGpgpuEngineIndex == i); auto &deviceEngine = pDevice->getEngine(engines[i], lowPriority); @@ -70,7 +70,7 @@ TEST_F(DeviceTest, givenDeviceWhenAskedForSpecificEngineThenRetrunIt) { TEST_F(DeviceTest, givenDebugVariableToAlwaysChooseEngineZeroWhenNotExistingEngineSelectedThenIndexZeroEngineIsReturned) { DebugManagerStateRestore restore; DebugManager.flags.OverrideInvalidEngineWithDefault.set(true); - auto &engines = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances(); + auto &engines = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances(); auto &deviceEngine = pDevice->getEngine(engines[0], false); auto ¬ExistingEngine = pDevice->getEngine(aub_stream::ENGINE_VCS, false); EXPECT_EQ(¬ExistingEngine, &deviceEngine); @@ -172,16 +172,16 @@ TEST(DeviceCreation, givenDefaultHwCsrInDebugVarsWhenDeviceIsCreatedThenIsSimula TEST(DeviceCreation, givenDeviceWhenItIsCreatedThenOsContextIsRegistredInMemoryManager) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto memoryManager = device->getMemoryManager(); - EXPECT_EQ(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size(), memoryManager->getRegisteredEnginesCount()); + EXPECT_EQ(HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances().size(), memoryManager->getRegisteredEnginesCount()); } TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachOsContextHasUniqueId) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); const size_t numDevices = 2; - const auto &numGpgpuEngines = static_cast(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size()); + const auto &numGpgpuEngines = static_cast(HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances().size()); - auto device1 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 0u)); - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device1 = std::unique_ptr(Device::create(executionEnvironment, 0u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); auto ®isteredEngines = executionEnvironment->memoryManager->getRegisteredEngines(); EXPECT_EQ(numGpgpuEngines * numDevices, registeredEngines.size()); @@ -202,8 +202,8 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachOsContextHasUniqu TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperateDeviceIndex) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - auto device = std::unique_ptr(Device::create(nullptr, executionEnvironment, 0u)); - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device = std::unique_ptr(Device::create(executionEnvironment, 0u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); EXPECT_EQ(0u, device->getDeviceIndex()); EXPECT_EQ(1u, device2->getDeviceIndex()); @@ -212,9 +212,9 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperate TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperateCommandStreamReceiver) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); const size_t numDevices = 2; - const auto &numGpgpuEngines = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size(); - auto device1 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 0u)); - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + const auto &numGpgpuEngines = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances().size(); + auto device1 = std::unique_ptr(Device::create(executionEnvironment, 0u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); EXPECT_EQ(numDevices, executionEnvironment->commandStreamReceivers.size()); EXPECT_EQ(numGpgpuEngines, executionEnvironment->commandStreamReceivers[0].size()); @@ -230,7 +230,7 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperate TEST(DeviceCreation, givenDeviceWhenAskingForDefaultEngineThenReturnValidValue) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - auto device = std::unique_ptr(Device::create(platformDevices[0], executionEnvironment, 0)); + auto device = std::unique_ptr(Device::create(executionEnvironment, 0)); auto osContext = device->getDefaultEngine().osContext; EXPECT_EQ(platformDevices[0]->capabilityTable.defaultEngineType, osContext->getEngineType()); @@ -238,13 +238,10 @@ TEST(DeviceCreation, givenDeviceWhenAskingForDefaultEngineThenReturnValidValue) } TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsArePresentThenIsSimulationReturnsTrue) { - FeatureTable skuTable = *platformDevices[0]->pSkuTable; - skuTable.ftrSimulationMode = true; + HardwareInfo hwInfo = *platformDevices[0]; + hwInfo.pSkuTable.ftrSimulationMode = true; - HardwareInfo hwInfo = {platformDevices[0]->pPlatform, &skuTable, platformDevices[0]->pWaTable, - platformDevices[0]->pSysInfo, platformDevices[0]->capabilityTable}; - - bool simulationFromDeviceId = hwInfo.capabilityTable.isSimulation(hwInfo.pPlatform->usDeviceID); + bool simulationFromDeviceId = hwInfo.capabilityTable.isSimulation(hwInfo.pPlatform.usDeviceID); EXPECT_FALSE(simulationFromDeviceId); auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); diff --git a/unit_tests/event/event_tests.cpp b/unit_tests/event/event_tests.cpp index 07c24c21b4..79ceff7911 100644 --- a/unit_tests/event/event_tests.cpp +++ b/unit_tests/event/event_tests.cpp @@ -395,7 +395,7 @@ struct UpdateEventTest : public ::testing::Test { memoryManager = new MockMemoryManager(*executionEnvironment); hostPtrManager = static_cast(memoryManager->getHostPtrManager()); executionEnvironment->memoryManager.reset(memoryManager); - device.reset(Device::create(*platformDevices, executionEnvironment, 0u)); + device.reset(Device::create(executionEnvironment, 0u)); context = std::make_unique(device.get()); cl_int retVal = CL_OUT_OF_RESOURCES; commandQueue.reset(CommandQueue::create(context.get(), device.get(), nullptr, retVal)); diff --git a/unit_tests/execution_environment/execution_environment_tests.cpp b/unit_tests/execution_environment/execution_environment_tests.cpp index 0cd7b75b36..51e99172d3 100644 --- a/unit_tests/execution_environment/execution_environment_tests.cpp +++ b/unit_tests/execution_environment/execution_environment_tests.cpp @@ -104,7 +104,7 @@ TEST(ExecutionEnvironment, givenPlatformWhenItIsCreatedThenItCreatesMemoryManage TEST(ExecutionEnvironment, givenDeviceWhenItIsDestroyedThenMemoryManagerIsStillAvailable) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); executionEnvironment->initializeMemoryManager(); - std::unique_ptr device(Device::create(nullptr, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); device.reset(nullptr); EXPECT_NE(nullptr, executionEnvironment->memoryManager); } @@ -178,7 +178,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerI auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(hwInfo)); auto executionEnvironment = device->getExecutionEnvironment(); executionEnvironment->initializeCommandStreamReceiver(0, 0); - auto enableLocalMemory = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily).getEnableLocalMemory(*hwInfo); + auto enableLocalMemory = HwHelper::get(hwInfo->pPlatform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo); executionEnvironment->initializeMemoryManager(); EXPECT_EQ(enableLocalMemory, executionEnvironment->memoryManager->isLocalMemorySupported()); } @@ -192,7 +192,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerI static_assert(sizeof(ExecutionEnvironment) == sizeof(std::vector>) + sizeof(std::unique_ptr) + sizeof(std::mutex) + - sizeof(HardwareInfo *) + + sizeof(std::unique_ptr) + (is64bit ? 80 : 44), "New members detected in ExecutionEnvironment, please ensure that destruction sequence of objects is correct"); @@ -249,11 +249,11 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe TEST(ExecutionEnvironment, givenMultipleDevicesWhenTheyAreCreatedTheyAllReuseTheSameMemoryManagerAndCommandStreamReceiver) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - std::unique_ptr device(Device::create(nullptr, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); auto &commandStreamReceiver = device->getCommandStreamReceiver(); auto memoryManager = device->getMemoryManager(); - std::unique_ptr device2(Device::create(nullptr, executionEnvironment, 1u)); + std::unique_ptr device2(Device::create(executionEnvironment, 1u)); EXPECT_NE(&commandStreamReceiver, &device2->getCommandStreamReceiver()); EXPECT_EQ(memoryManager, device2->getMemoryManager()); } @@ -300,7 +300,7 @@ TEST(ExecutionEnvironment, whenSpecialCsrExistsThenReturnSpecialEngineControl) { EXPECT_NE(nullptr, executionEnvironment->memoryManager); executionEnvironment->specialCommandStreamReceiver.reset(createCommandStream(*executionEnvironment)); - auto engineType = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engineType = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(executionEnvironment->specialCommandStreamReceiver.get(), engineType, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); diff --git a/unit_tests/fixtures/buffer_enqueue_fixture.h b/unit_tests/fixtures/buffer_enqueue_fixture.h index d8d3d81f5d..f61f3c37c4 100644 --- a/unit_tests/fixtures/buffer_enqueue_fixture.h +++ b/unit_tests/fixtures/buffer_enqueue_fixture.h @@ -6,11 +6,11 @@ */ #pragma once +#include "runtime/helpers/hw_info.h" #include "runtime/memory_manager/internal_allocation_storage.h" #include "test.h" #include "unit_tests/fixtures/buffer_fixture.h" #include "unit_tests/helpers/execution_environment_helper.h" -#include "unit_tests/helpers/hw_info_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_command_queue.h" #include "unit_tests/mocks/mock_csr.h" @@ -43,7 +43,7 @@ struct BufferEnqueueFixture : public HardwareParse, memoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device = std::unique_ptr(Device::create(hwInfo, executionEnvironment, 0)); + device = std::unique_ptr(Device::create(executionEnvironment, 0)); context = std::make_unique(device.get()); @@ -61,7 +61,7 @@ struct BufferEnqueueFixture : public HardwareParse, protected: const size_t bufferSizeInDwords = 64; - HwInfoHelper hwInfoHelper; + HardwareInfo hwInfoHelper; HardwareInfo *hwInfo = nullptr; ExecutionEnvironment *executionEnvironment; cl_queue_properties properties = {}; diff --git a/unit_tests/fixtures/device_fixture.cpp b/unit_tests/fixtures/device_fixture.cpp index 3e24bc380b..cdf4e84c1e 100644 --- a/unit_tests/fixtures/device_fixture.cpp +++ b/unit_tests/fixtures/device_fixture.cpp @@ -31,9 +31,7 @@ void DeviceFixture::TearDown() { MockDevice *DeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) { hwInfoHelper = *platformDevices[0]; - platformHelper = *platformDevices[0]->pPlatform; - platformHelper.usDeviceID = usDeviceId; - hwInfoHelper.pPlatform = &platformHelper; + hwInfoHelper.pPlatform.usDeviceID = usDeviceId; return MockDevice::createWithNewExecutionEnvironment(&hwInfoHelper); } } // namespace NEO diff --git a/unit_tests/fixtures/device_instrumentation_fixture.cpp b/unit_tests/fixtures/device_instrumentation_fixture.cpp index 1d56904b67..33913ddfff 100644 --- a/unit_tests/fixtures/device_instrumentation_fixture.cpp +++ b/unit_tests/fixtures/device_instrumentation_fixture.cpp @@ -15,6 +15,6 @@ void DeviceInstrumentationFixture::SetUp(bool instrumentation) { ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo); if (instrumentation) hwInfo->capabilityTable.instrumentationEnabled = true; - device = std::unique_ptr(Device::create(&hwInfo[0], executionEnvironment, 0)); + device = std::unique_ptr(Device::create(executionEnvironment, 0)); } -} // namespace NEO \ No newline at end of file +} // namespace NEO diff --git a/unit_tests/fixtures/image_fixture.h b/unit_tests/fixtures/image_fixture.h index 65a3784e59..2d42b43bc1 100644 --- a/unit_tests/fixtures/image_fixture.h +++ b/unit_tests/fixtures/image_fixture.h @@ -12,7 +12,6 @@ #include "runtime/helpers/options.h" #include "runtime/mem_obj/image.h" #include "runtime/platform/platform.h" -#include "unit_tests/helpers/hw_info_helper.h" #include "unit_tests/mocks/mock_context.h" #include "CL/cl.h" @@ -117,10 +116,10 @@ class ImageClearColorFixture { using AUXILIARY_SURFACE_MODE = typename FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE; void SetUp() { - hwInfoHelper.hwInfo.capabilityTable.ftrRenderCompressedImages = true; + hwInfoHelper.capabilityTable.ftrRenderCompressedImages = true; NEO::platformImpl.reset(); - NEO::constructPlatform()->peekExecutionEnvironment()->setHwInfo(&hwInfoHelper.hwInfo); + NEO::constructPlatform()->peekExecutionEnvironment()->setHwInfo(&hwInfoHelper); NEO::platform()->peekExecutionEnvironment()->initGmm(); surfaceState = FamilyType::cmdInitRenderSurfaceState; @@ -135,7 +134,7 @@ class ImageClearColorFixture { } RENDER_SURFACE_STATE surfaceState; - HwInfoHelper hwInfoHelper; + NEO::HardwareInfo hwInfoHelper = **NEO::platformDevices; protected: MockContext context; diff --git a/unit_tests/fixtures/memory_allocator_fixture.h b/unit_tests/fixtures/memory_allocator_fixture.h index 26560ba17d..688143ec30 100644 --- a/unit_tests/fixtures/memory_allocator_fixture.h +++ b/unit_tests/fixtures/memory_allocator_fixture.h @@ -27,7 +27,7 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { memoryManager = new MockMemoryManager(false, false, *executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); csr = memoryManager->getDefaultCommandStreamReceiver(0); - auto engineType = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engineType = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); } diff --git a/unit_tests/fixtures/memory_manager_fixture.cpp b/unit_tests/fixtures/memory_manager_fixture.cpp index c57f870384..f4e9cd7e53 100644 --- a/unit_tests/fixtures/memory_manager_fixture.cpp +++ b/unit_tests/fixtures/memory_manager_fixture.cpp @@ -23,7 +23,7 @@ void MemoryManagerWithCsrFixture::SetUp() { csr->tagAddress = ¤tGpuTag; executionEnvironment.commandStreamReceivers.resize(1); executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); - auto engine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engine = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; auto osContext = memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); } diff --git a/unit_tests/gen10/hw_helper_tests_gen10.cpp b/unit_tests/gen10/hw_helper_tests_gen10.cpp index 6c85896b67..939b3d2249 100644 --- a/unit_tests/gen10/hw_helper_tests_gen10.cpp +++ b/unit_tests/gen10/hw_helper_tests_gen10.cpp @@ -19,11 +19,8 @@ GEN10TEST_F(HwHelperTestGen10, whenCnlRevIdForStepCThenSetCapabilityCoherencyFla auto &helper = HwHelper::get(renderCoreFamily); bool coherency = true; - HardwareInfo testHwInfo = hwInfoHelper.hwInfo; - PLATFORM testPlatform = *hwInfoHelper.hwInfo.pPlatform; - testHwInfo.pPlatform = &testPlatform; - testPlatform.usRevId = 0x3; - helper.setCapabilityCoherencyFlag(&testHwInfo, coherency); + hwInfoHelper.pPlatform.usRevId = 0x3; + helper.setCapabilityCoherencyFlag(&hwInfoHelper, coherency); EXPECT_FALSE(coherency); } @@ -31,11 +28,8 @@ GEN10TEST_F(HwHelperTestGen10, whenCnlRevIdForStepDThenSetCapabilityCoherencyFla auto &helper = HwHelper::get(renderCoreFamily); bool coherency = false; - HardwareInfo testHwInfo = hwInfoHelper.hwInfo; - PLATFORM testPlatform = *hwInfoHelper.hwInfo.pPlatform; - testHwInfo.pPlatform = &testPlatform; - testPlatform.usRevId = 0x4; - helper.setCapabilityCoherencyFlag(&testHwInfo, coherency); + hwInfoHelper.pPlatform.usRevId = 0x4; + helper.setCapabilityCoherencyFlag(&hwInfoHelper, coherency); EXPECT_TRUE(coherency); } @@ -43,28 +37,28 @@ GEN10TEST_F(HwHelperTestGen10, setupPreemptionRegisters) { auto &helper = HwHelper::get(renderCoreFamily); bool preemption = false; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_FALSE(preemption); - EXPECT_FALSE(hwInfoHelper.hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_FALSE(hwInfoHelper.capabilityTable.whitelistedRegisters.csChicken1_0x2580); preemption = true; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_TRUE(preemption); - EXPECT_TRUE(hwInfoHelper.hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_TRUE(hwInfoHelper.capabilityTable.whitelistedRegisters.csChicken1_0x2580); } GEN10TEST_F(HwHelperTestGen10, adjustDefaultEngineType) { - auto engineType = hwInfoHelper.hwInfo.capabilityTable.defaultEngineType; + auto engineType = hwInfoHelper.capabilityTable.defaultEngineType; auto &helper = HwHelper::get(renderCoreFamily); - helper.adjustDefaultEngineType(&hwInfoHelper.hwInfo); - EXPECT_EQ(engineType, hwInfoHelper.hwInfo.capabilityTable.defaultEngineType); + helper.adjustDefaultEngineType(&hwInfoHelper); + EXPECT_EQ(engineType, hwInfoHelper.capabilityTable.defaultEngineType); } GEN10TEST_F(HwHelperTestGen10, givenGen10PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) { auto &helper = HwHelper::get(renderCoreFamily); // Test default method implementation - testDefaultImplementationOfSetupHardwareCapabilities(helper, hwInfoHelper.hwInfo); + testDefaultImplementationOfSetupHardwareCapabilities(helper, hwInfoHelper); } GEN10TEST_F(HwHelperTestGen10, whenGetConfigureAddressSpaceModeThenReturnZero) { diff --git a/unit_tests/gen10/linux/device_factory_tests_gen10.cpp b/unit_tests/gen10/linux/device_factory_tests_gen10.cpp index de23efeb54..b14ef2ea9e 100644 --- a/unit_tests/gen10/linux/device_factory_tests_gen10.cpp +++ b/unit_tests/gen10/linux/device_factory_tests_gen10.cpp @@ -14,24 +14,24 @@ GEN10TEST_F(DeviceFactoryLinuxTestCnl, queryWhitelistedPreemptionRegister) { I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; - HardwareInfo *hwInfo = nullptr; + size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); - EXPECT_TRUE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_TRUE(executionEnvironment.getHardwareInfo()->capabilityTable.whitelistedRegisters.csChicken1_0x2580); DeviceFactory::releaseDevices(); } GEN10TEST_F(DeviceFactoryLinuxTestCnl, queryNotWhitelistedPreemptionRegister) { pDrm->StoredPreemptionSupport = 0; - HardwareInfo *hwInfo = nullptr; + size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); - EXPECT_FALSE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_FALSE(executionEnvironment.getHardwareInfo()->capabilityTable.whitelistedRegisters.csChicken1_0x2580); DeviceFactory::releaseDevices(); } diff --git a/unit_tests/gen10/linux/hw_info_config_tests_gen10.cpp b/unit_tests/gen10/linux/hw_info_config_tests_gen10.cpp index 9fd0197d8c..3a8aa71ed4 100644 --- a/unit_tests/gen10/linux/hw_info_config_tests_gen10.cpp +++ b/unit_tests/gen10/linux/hw_info_config_tests_gen10.cpp @@ -23,100 +23,88 @@ struct HwInfoConfigTestLinuxCnl : HwInfoConfigTestLinux { CNLTEST_F(HwInfoConfigTestLinuxCnl, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = ICNL_3x8_ULT_DEVICE_F0_ID; drm->StoredSSVal = 4; drm->setGtType(GTTYPE_GT1); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(2u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = ICNL_3x8_ULT_DEVICE_F0_ID; drm->StoredSSVal = 6; drm->setGtType(GTTYPE_GT2_5); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(3u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(3u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT2_5, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT2_5, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); } CNLTEST_F(HwInfoConfigTestLinuxCnl, negative) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredRetValForDeviceID = -1; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceID = 0; drm->StoredRetValForDeviceRevID = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceRevID = 0; drm->StoredRetValForEUVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForEUVal = 0; drm->StoredRetValForSSVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } @@ -124,38 +112,34 @@ CNLTEST_F(HwInfoConfigTestLinuxCnl, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 0; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - ReleaseOutHwInfoStructs(); - drm->StoredDeviceRevID = 1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(0u, outHwInfo.pWaTable.waEncryptedEdramOnlyPartials); drm->StoredDeviceRevID = 2; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waFbcLinearSurfaceStride); - EXPECT_EQ(0u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials); + EXPECT_EQ(0u, outHwInfo.pWaTable.waFbcLinearSurfaceStride); + EXPECT_EQ(0u, outHwInfo.pWaTable.waEncryptedEdramOnlyPartials); } CNLTEST_F(HwInfoConfigTestLinuxCnl, configureHwInfoIsL3HashModeEnabled) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - uint64_t oldL3CacheSizeInKb = testSysInfo.L3CacheSizeInKb; - uint32_t oldL3BankCount = testSysInfo.L3BankCount; + uint64_t oldL3CacheSizeInKb = testSysInfo->L3CacheSizeInKb; + uint32_t oldL3BankCount = testSysInfo->L3BankCount; - testSysInfo.IsL3HashModeEnabled = true; + testSysInfo->IsL3HashModeEnabled = true; drm->StoredSSVal = 9; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((oldL3BankCount - 1), outHwInfo.pSysInfo->L3BankCount); - EXPECT_EQ_VAL((oldL3CacheSizeInKb - 256), outHwInfo.pSysInfo->L3CacheSizeInKb); + EXPECT_EQ((oldL3BankCount - 1), outHwInfo.pSysInfo.L3BankCount); + EXPECT_EQ_VAL((oldL3CacheSizeInKb - 256), outHwInfo.pSysInfo.L3CacheSizeInKb); } template @@ -164,16 +148,9 @@ class CnlHwInfoTests : public ::testing::Test { typedef ::testing::Types cnlTestTypes; TYPED_TEST_CASE(CnlHwInfoTests, cnlTestTypes); TYPED_TEST(CnlHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen10/test_device_caps_gen10.cpp b/unit_tests/gen10/test_device_caps_gen10.cpp index 1215f2355d..c971d272f6 100644 --- a/unit_tests/gen10/test_device_caps_gen10.cpp +++ b/unit_tests/gen10/test_device_caps_gen10.cpp @@ -53,10 +53,10 @@ GEN10TEST_F(Gen10DeviceCaps, compression) { GEN10TEST_F(Gen10DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) { const auto &hwInfo = pDevice->getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); - uint32_t expectedValue = hwInfo.pSysInfo->MaxSubSlicesSupported * hwInfo.pSysInfo->MaxEuPerSubSlice * - hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount; + uint32_t expectedValue = hwInfo.pSysInfo.MaxSubSlicesSupported * hwInfo.pSysInfo.MaxEuPerSubSlice * + hwInfo.pSysInfo.ThreadCount / hwInfo.pSysInfo.EUCount; EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo)); EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch); diff --git a/unit_tests/gen10/test_hw_info_config_cnl.cpp b/unit_tests/gen10/test_hw_info_config_cnl.cpp index bb636165d5..f795d9fb9f 100644 --- a/unit_tests/gen10/test_hw_info_config_cnl.cpp +++ b/unit_tests/gen10/test_hw_info_config_cnl.cpp @@ -13,9 +13,9 @@ TEST(CnlHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_CANNONLAKE != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + gtSystemInfo = {0}; std::string strConfig = "1x2x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -77,15 +77,11 @@ CNLTEST_F(CnlHwInfo, givenBoolWhenCallCnlHardwareInfoSetupThenFeatureTableAndWor "4x9x8"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; + PLATFORM &pPlatform = hwInfo.pPlatform; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen10/test_preamble_gen10.cpp b/unit_tests/gen10/test_preamble_gen10.cpp index a2ba91b6a3..e3b6346fff 100644 --- a/unit_tests/gen10/test_preamble_gen10.cpp +++ b/unit_tests/gen10/test_preamble_gen10.cpp @@ -38,34 +38,7 @@ CNLTEST_F(CnlSlm, shouldBeEnabledOnGen10) { EXPECT_EQ(1u, lri.getDataDword() & 1); } -struct CnlPreambleWaCmds : public PreambleFixture { - CnlPreambleWaCmds() { - memset(reinterpret_cast(&waTable), 0, sizeof(waTable)); - } - void SetUp() override { - pHwInfo = const_cast(*NEO::platformDevices); - pOldWaTable = pHwInfo->pWaTable; - pHwInfo->pWaTable = &waTable; - - DeviceFixture::SetUpImpl(pHwInfo); - HardwareParse::SetUp(); - if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) { - preemptionLocation.reset(new MockGraphicsAllocation); - } - } - - void TearDown() override { - preemptionLocation.reset(); - pHwInfo->pWaTable = pOldWaTable; - HardwareParse::TearDown(); - DeviceFixture::TearDown(); - } - - WorkaroundTable waTable; - HardwareInfo *pHwInfo; - const WorkaroundTable *pOldWaTable; - std::unique_ptr preemptionLocation; -}; +using CnlPreambleWaCmds = PreambleFixture; typedef PreambleFixture Gen10UrbEntryAllocationSize; CNLTEST_F(Gen10UrbEntryAllocationSize, getUrbEntryAllocationSize) { @@ -76,9 +49,9 @@ CNLTEST_F(Gen10UrbEntryAllocationSize, getUrbEntryAllocationSize) { typedef PreambleVfeState Gen10PreambleVfeState; CNLTEST_F(Gen10PreambleVfeState, WaOff) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - testWaTable.waSendMIFLUSHBeforeVFE = 0; + testWaTable->waSendMIFLUSHBeforeVFE = 0; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, **platformDevices, 0, 0); + PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0); parseCommands(cs); @@ -94,9 +67,9 @@ CNLTEST_F(Gen10PreambleVfeState, WaOff) { CNLTEST_F(Gen10PreambleVfeState, WaOn) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - testWaTable.waSendMIFLUSHBeforeVFE = 1; + testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, **platformDevices, 0, 0); + PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0); parseCommands(cs); @@ -169,7 +142,7 @@ GEN10TEST_F(ThreadArbitrationGen10, givenPreambleWhenItIsProgrammedThenThreadArb typedef CNLFamily::PIPE_CONTROL PIPE_CONTROL; LinearStream &cs = linearStream; uint32_t l3Config = PreambleHelper::getL3Config(**platformDevices, true); - MockDevice mockDevice(**platformDevices); + MockDevice mockDevice; PreambleHelper::programPreamble(&linearStream, mockDevice, l3Config, ThreadArbitrationPolicy::RoundRobin, nullptr); @@ -184,7 +157,8 @@ GEN10TEST_F(ThreadArbitrationGen10, givenPreambleWhenItIsProgrammedThenThreadArb EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[ThreadArbitrationPolicy::RoundRobin], cmd->getDataDword()); - EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(MockDevice(*platformDevices[0]))); + MockDevice device; + EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(device)); EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL), PreambleHelper::getThreadArbitrationCommandsSize()); } diff --git a/unit_tests/gen10/test_preemption_gen10.cpp b/unit_tests/gen10/test_preemption_gen10.cpp index 3fd391e339..ae794d35c1 100644 --- a/unit_tests/gen10/test_preemption_gen10.cpp +++ b/unit_tests/gen10/test_preemption_gen10.cpp @@ -304,6 +304,6 @@ GEN10TEST_F(Gen10PreemptionTests, givenMidThreadPreemptionModeWhenStateSipIsProg auto cmd = hwParserOnlyPreemption.getCommand(); EXPECT_NE(nullptr, cmd); - auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform->eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform.eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); EXPECT_EQ(mockDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *mockDevice).getSipAllocation()->getGpuAddressToPatch(), cmd->getSystemInstructionPointer()); } diff --git a/unit_tests/gen10/test_sample_gen10.cpp b/unit_tests/gen10/test_sample_gen10.cpp index 9dc09107a6..060799ccc9 100644 --- a/unit_tests/gen10/test_sample_gen10.cpp +++ b/unit_tests/gen10/test_sample_gen10.cpp @@ -13,7 +13,7 @@ using namespace NEO; typedef Test CannonlakeOnlyTest; CNLTEST_F(CannonlakeOnlyTest, shouldPassOnCnl) { - EXPECT_EQ(IGFX_CANNONLAKE, pDevice->getHardwareInfo().pPlatform->eProductFamily); + EXPECT_EQ(IGFX_CANNONLAKE, pDevice->getHardwareInfo().pPlatform.eProductFamily); } typedef Test Gen10OnlyTest; diff --git a/unit_tests/gen10/windows/hw_info_config_tests_gen10.cpp b/unit_tests/gen10/windows/hw_info_config_tests_gen10.cpp index 44bde58d46..07a3d3ab49 100644 --- a/unit_tests/gen10/windows/hw_info_config_tests_gen10.cpp +++ b/unit_tests/gen10/windows/hw_info_config_tests_gen10.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsCnl = HwInfoConfigTestWindows; CNLTEST_F(HwInfoConfigTestWindowsCnl, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_CANNONLAKE, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen10/windows/os_interface_tests_gen10.cpp b/unit_tests/gen10/windows/os_interface_tests_gen10.cpp index 4199f17631..a2982c05b9 100644 --- a/unit_tests/gen10/windows/os_interface_tests_gen10.cpp +++ b/unit_tests/gen10/windows/os_interface_tests_gen10.cpp @@ -12,15 +12,15 @@ typedef OsInterfaceTest OsInterfaceTestCnl; GEN10TEST_F(OsInterfaceTestCnl, askKmdIfPreemptionRegisterWhitelisted) { - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; ExecutionEnvironment executionEnvironment; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); + auto hwInfo = executionEnvironment.getHardwareInfo(); for (size_t i = 0u; i < numDevices; i++) { - if (hwInfo[i].pWaTable->waEnablePreemptionGranularityControlByUMD) { + if (hwInfo[i].pWaTable.waEnablePreemptionGranularityControlByUMD) { EXPECT_TRUE(hwInfo[i].capabilityTable.whitelistedRegisters.csChicken1_0x2580); } else { EXPECT_FALSE(hwInfo[i].capabilityTable.whitelistedRegisters.csChicken1_0x2580); diff --git a/unit_tests/gen11/hw_helper_tests_gen11.cpp b/unit_tests/gen11/hw_helper_tests_gen11.cpp index 007ba96888..39a0629a81 100644 --- a/unit_tests/gen11/hw_helper_tests_gen11.cpp +++ b/unit_tests/gen11/hw_helper_tests_gen11.cpp @@ -19,7 +19,7 @@ GEN11TEST_F(HwHelperTestGen11, setCapabilityCoherencyFlag) { auto &helper = HwHelper::get(renderCoreFamily); bool coherency = false; - helper.setCapabilityCoherencyFlag(&hwInfoHelper.hwInfo, coherency); + helper.setCapabilityCoherencyFlag(&hwInfoHelper, coherency); EXPECT_TRUE(coherency); } @@ -27,26 +27,26 @@ GEN11TEST_F(HwHelperTestGen11, setupPreemptionRegisters) { auto &helper = HwHelper::get(renderCoreFamily); bool preemption = false; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_FALSE(preemption); preemption = true; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_TRUE(preemption); } GEN11TEST_F(HwHelperTestGen11, adjustDefaultEngineType) { - auto engineType = hwInfoHelper.hwInfo.capabilityTable.defaultEngineType; + auto engineType = hwInfoHelper.capabilityTable.defaultEngineType; auto &helper = HwHelper::get(renderCoreFamily); - helper.adjustDefaultEngineType(&hwInfoHelper.hwInfo); - EXPECT_EQ(engineType, hwInfoHelper.hwInfo.capabilityTable.defaultEngineType); + helper.adjustDefaultEngineType(&hwInfoHelper); + EXPECT_EQ(engineType, hwInfoHelper.capabilityTable.defaultEngineType); } GEN11TEST_F(HwHelperTestGen11, givenGen11PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) { auto &helper = HwHelper::get(renderCoreFamily); // Test default method implementation - testDefaultImplementationOfSetupHardwareCapabilities(helper, hwInfoHelper.hwInfo); + testDefaultImplementationOfSetupHardwareCapabilities(helper, hwInfoHelper); } GEN11TEST_F(HwHelperTestGen11, whenGetConfigureAddressSpaceModeThenReturnZero) { diff --git a/unit_tests/gen11/icllp/linux/hw_info_config_tests_icllp.cpp b/unit_tests/gen11/icllp/linux/hw_info_config_tests_icllp.cpp index 2cafa703f9..5cdc4189d8 100644 --- a/unit_tests/gen11/icllp/linux/hw_info_config_tests_icllp.cpp +++ b/unit_tests/gen11/icllp/linux/hw_info_config_tests_icllp.cpp @@ -22,69 +22,57 @@ struct HwInfoConfigTestLinuxIcllp : HwInfoConfigTestLinux { ICLLPTEST_F(HwInfoConfigTestLinuxIcllp, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_TRUE(outHwInfo.pSkuTable->ftrGT1); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT2); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT3); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT4); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGTA); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGTC); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGTX); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrTileY); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_TRUE(outHwInfo.pSkuTable.ftrGT1); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT2); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT3); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT4); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGTA); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGTC); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGTX); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrTileY); } ICLLPTEST_F(HwInfoConfigTestLinuxIcllp, negative) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredRetValForDeviceID = -1; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceID = 0; drm->StoredRetValForDeviceRevID = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceRevID = 0; drm->StoredRetValForEUVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForEUVal = 0; drm->StoredRetValForSSVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } using IcllpHwInfoTests = ::testing::Test; ICLLPTEST_F(IcllpHwInfoTests, icllp1x8x8systemInfo) { - GT_SYSTEM_INFO requestedGtSystemInfo = {}; GT_SYSTEM_INFO expectedGtSystemInfo = {}; - FeatureTable featureTable = {}; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = &requestedGtSystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO &requestedGtSystemInfo = hwInfo.pSysInfo; + requestedGtSystemInfo = {}; expectedGtSystemInfo.EUCount = 63; expectedGtSystemInfo.ThreadCount = 63 * ICLLP::threadsPerEu; @@ -110,16 +98,10 @@ ICLLPTEST_F(IcllpHwInfoTests, icllp1x8x8systemInfo) { } ICLLPTEST_F(IcllpHwInfoTests, icllp1x4x8systemInfo) { - GT_SYSTEM_INFO requestedGtSystemInfo = {}; - GT_SYSTEM_INFO expectedGtSystemInfo = {}; - FeatureTable featureTable = {}; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = &requestedGtSystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO expectedGtSystemInfo = {}; + GT_SYSTEM_INFO &requestedGtSystemInfo = hwInfo.pSysInfo; + requestedGtSystemInfo = {}; expectedGtSystemInfo.EUCount = 31; expectedGtSystemInfo.ThreadCount = 31 * ICLLP::threadsPerEu; @@ -145,16 +127,10 @@ ICLLPTEST_F(IcllpHwInfoTests, icllp1x4x8systemInfo) { } ICLLPTEST_F(IcllpHwInfoTests, icllp1x6x8systemInfo) { - GT_SYSTEM_INFO requestedGtSystemInfo = {}; GT_SYSTEM_INFO expectedGtSystemInfo = {}; - FeatureTable featureTable = {}; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = &requestedGtSystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO &requestedGtSystemInfo = hwInfo.pSysInfo; + requestedGtSystemInfo = {}; expectedGtSystemInfo.EUCount = 47; expectedGtSystemInfo.ThreadCount = 47 * ICLLP::threadsPerEu; @@ -180,16 +156,10 @@ ICLLPTEST_F(IcllpHwInfoTests, icllp1x6x8systemInfo) { } ICLLPTEST_F(IcllpHwInfoTests, icllp1x1x8systemInfo) { - GT_SYSTEM_INFO requestedGtSystemInfo = {}; GT_SYSTEM_INFO expectedGtSystemInfo = {}; - FeatureTable featureTable = {}; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = &requestedGtSystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO &requestedGtSystemInfo = hwInfo.pSysInfo; + requestedGtSystemInfo = {}; expectedGtSystemInfo.EUCount = 8; expectedGtSystemInfo.ThreadCount = 8 * ICLLP::threadsPerEu; diff --git a/unit_tests/gen11/icllp/test_hw_info_config_icllp.cpp b/unit_tests/gen11/icllp/test_hw_info_config_icllp.cpp index 85c1e55d8f..35f167aac4 100644 --- a/unit_tests/gen11/icllp/test_hw_info_config_icllp.cpp +++ b/unit_tests/gen11/icllp/test_hw_info_config_icllp.cpp @@ -13,50 +13,50 @@ TEST(IcllpHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCo if (IGFX_ICELAKE_LP != productFamily) { return; } - GT_SYSTEM_INFO gInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = &gInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + gtSystemInfo = {0}; std::string strConfig = "1x8x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(8u, gInfo.SubSliceCount); - EXPECT_EQ(63u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(8u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(63u, gtSystemInfo.EUCount); strConfig = "1x4x8"; - gInfo = {0}; + gtSystemInfo = {0}; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(4u, gInfo.SubSliceCount); - EXPECT_EQ(31u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(4u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(31u, gtSystemInfo.EUCount); strConfig = "1x6x8"; - gInfo = {0}; + gtSystemInfo = {0}; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(6u, gInfo.SubSliceCount); - EXPECT_EQ(47u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(6u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(47u, gtSystemInfo.EUCount); strConfig = "1x1x8"; - gInfo = {0}; + gtSystemInfo = {0}; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(1u, gInfo.SubSliceCount); - EXPECT_EQ(8u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(1u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(8u, gtSystemInfo.EUCount); strConfig = "default"; - gInfo = {0}; + gtSystemInfo = {0}; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(8u, gInfo.SubSliceCount); - EXPECT_EQ(63u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(8u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(63u, gtSystemInfo.EUCount); strConfig = "erroneous"; - gInfo = {0}; + gtSystemInfo = {0}; EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&hwInfo, false, strConfig)); - EXPECT_EQ(0u, gInfo.SliceCount); - EXPECT_EQ(0u, gInfo.SubSliceCount); - EXPECT_EQ(0u, gInfo.EUCount); + EXPECT_EQ(0u, gtSystemInfo.SliceCount); + EXPECT_EQ(0u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(0u, gtSystemInfo.EUCount); } using IcllpHwInfo = ::testing::Test; @@ -70,20 +70,15 @@ ICLLPTEST_F(IcllpHwInfo, givenBoolWhenCallIcllpHardwareInfoSetupThenFeatureTable bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = &gInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { - gInfo = {0}; + gtSystemInfo = {0}; pSkuTable = {}; pWaTable = {}; hardwareInfoSetup[productFamily](&hwInfo, setParamBool, config); diff --git a/unit_tests/gen11/icllp/windows/hw_info_config_tests_icllp.cpp b/unit_tests/gen11/icllp/windows/hw_info_config_tests_icllp.cpp index 0362c15955..fa44acbdee 100644 --- a/unit_tests/gen11/icllp/windows/hw_info_config_tests_icllp.cpp +++ b/unit_tests/gen11/icllp/windows/hw_info_config_tests_icllp.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsIcllp = HwInfoConfigTestWindows; ICLLPTEST_F(HwInfoConfigTestWindowsIcllp, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_ICELAKE_LP, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen11/lkf/linux/hw_info_config_tests_lkf.cpp b/unit_tests/gen11/lkf/linux/hw_info_config_tests_lkf.cpp index 5f8e876a37..5b2124a19a 100644 --- a/unit_tests/gen11/lkf/linux/hw_info_config_tests_lkf.cpp +++ b/unit_tests/gen11/lkf/linux/hw_info_config_tests_lkf.cpp @@ -22,54 +22,46 @@ struct HwInfoConfigTestLinuxLkf : HwInfoConfigTestLinux { TEST_F(HwInfoConfigTestLinuxLkf, configureHwInfoLkf) { auto hwInfoConfig = HwInfoConfigHw::get(); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_TRUE(outHwInfo.pSkuTable->ftrGT1); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT2); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT3); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGT4); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGTA); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGTC); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrGTX); - EXPECT_FALSE(outHwInfo.pSkuTable->ftrTileY); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_TRUE(outHwInfo.pSkuTable.ftrGT1); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT2); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT3); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGT4); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGTA); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGTC); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrGTX); + EXPECT_FALSE(outHwInfo.pSkuTable.ftrTileY); } TEST_F(HwInfoConfigTestLinuxLkf, negative) { auto hwInfoConfig = HwInfoConfigHw::get(); drm->StoredRetValForDeviceID = -1; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceID = 0; drm->StoredRetValForDeviceRevID = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceRevID = 0; drm->StoredRetValForEUVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForEUVal = 0; drm->StoredRetValForSSVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } @@ -78,16 +70,9 @@ class LkfHwInfoTests : public ::testing::Test {}; typedef ::testing::Types lkfTestTypes; TYPED_TEST_CASE(LkfHwInfoTests, lkfTestTypes); TYPED_TEST(LkfHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable = {}; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen11/lkf/test_hw_info_config_lkf.cpp b/unit_tests/gen11/lkf/test_hw_info_config_lkf.cpp index 29e8c8125c..d3a4260188 100644 --- a/unit_tests/gen11/lkf/test_hw_info_config_lkf.cpp +++ b/unit_tests/gen11/lkf/test_hw_info_config_lkf.cpp @@ -13,29 +13,28 @@ TEST(LkfHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_LAKEFIELD != productFamily) { return; } - GT_SYSTEM_INFO gInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = &gInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; std::string strConfig = "1x8x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(8u, gInfo.SubSliceCount); - EXPECT_EQ(64u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(8u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(64u, gtSystemInfo.EUCount); strConfig = "default"; - gInfo = {0}; + gtSystemInfo = {0}; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); - EXPECT_EQ(1u, gInfo.SliceCount); - EXPECT_EQ(8u, gInfo.SubSliceCount); - EXPECT_EQ(64u, gInfo.EUCount); + EXPECT_EQ(1u, gtSystemInfo.SliceCount); + EXPECT_EQ(8u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(64u, gtSystemInfo.EUCount); strConfig = "erroneous"; - gInfo = {0}; + gtSystemInfo = {0}; EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&hwInfo, false, strConfig)); - EXPECT_EQ(0u, gInfo.SliceCount); - EXPECT_EQ(0u, gInfo.SubSliceCount); - EXPECT_EQ(0u, gInfo.EUCount); + EXPECT_EQ(0u, gtSystemInfo.SliceCount); + EXPECT_EQ(0u, gtSystemInfo.SubSliceCount); + EXPECT_EQ(0u, gtSystemInfo.EUCount); } using LkfHwInfo = ::testing::Test; @@ -43,21 +42,16 @@ using LkfHwInfo = ::testing::Test; LKFTEST_F(LkfHwInfo, givenBoolWhenCallLkfHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) { bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = &gInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; std::string strConfig = "1x8x8"; for (auto setParamBool : boolValue) { - gInfo = {0}; + gtSystemInfo = {0}; pSkuTable = {}; pWaTable = {}; hardwareInfoSetup[productFamily](&hwInfo, setParamBool, strConfig); diff --git a/unit_tests/gen11/lkf/windows/hw_info_config_tests_lkf.cpp b/unit_tests/gen11/lkf/windows/hw_info_config_tests_lkf.cpp index 7b9e64ef87..cd130adbab 100644 --- a/unit_tests/gen11/lkf/windows/hw_info_config_tests_lkf.cpp +++ b/unit_tests/gen11/lkf/windows/hw_info_config_tests_lkf.cpp @@ -15,8 +15,9 @@ using HwInfoConfigTestWindowsLkf = HwInfoConfigTestWindows; LKFTEST_F(HwInfoConfigTestWindowsLkf, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_LAKEFIELD, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen11/program_media_sampler_tests_gen11.cpp b/unit_tests/gen11/program_media_sampler_tests_gen11.cpp index ae9cc4edfc..04189c929a 100644 --- a/unit_tests/gen11/program_media_sampler_tests_gen11.cpp +++ b/unit_tests/gen11/program_media_sampler_tests_gen11.cpp @@ -79,10 +79,10 @@ ICLLPTEST_F(Gen11MediaSamplerProgramingTest, givenVmeEnableSubsliceDisabledWhenP auto expectedMiLrCmd = FamilyType::cmdInitLoadRegisterImm; expectedMiLrCmd.setRegisterOffset(gen11PowerClockStateRegister::address); - auto expectedRegValue = (device->getHardwareInfo().pSysInfo->SubSliceCount / 2) << gen11PowerClockStateRegister::subSliceCountShift; + auto expectedRegValue = (device->getHardwareInfo().pSysInfo.SubSliceCount / 2) << gen11PowerClockStateRegister::subSliceCountShift; expectedRegValue |= (gen11PowerClockStateRegister::vmeSliceCount << gen11PowerClockStateRegister::sliceCountShift); - expectedRegValue |= (device->getHardwareInfo().pSysInfo->MaxEuPerSubSlice << gen11PowerClockStateRegister::minEuCountShift); - expectedRegValue |= (device->getHardwareInfo().pSysInfo->MaxEuPerSubSlice << gen11PowerClockStateRegister::maxEuCountShift); + expectedRegValue |= (device->getHardwareInfo().pSysInfo.MaxEuPerSubSlice << gen11PowerClockStateRegister::minEuCountShift); + expectedRegValue |= (device->getHardwareInfo().pSysInfo.MaxEuPerSubSlice << gen11PowerClockStateRegister::maxEuCountShift); expectedRegValue |= gen11PowerClockStateRegister::enabledValue; expectedMiLrCmd.setDataDword(expectedRegValue); @@ -118,10 +118,10 @@ ICLLPTEST_F(Gen11MediaSamplerProgramingTest, givenVmeEnableSubsliceEnabledWhenPo auto expectedMiLrCmd = FamilyType::cmdInitLoadRegisterImm; expectedMiLrCmd.setRegisterOffset(gen11PowerClockStateRegister::address); - auto expectedRegValue = (device->getHardwareInfo().pSysInfo->SubSliceCount / 2) << gen11PowerClockStateRegister::subSliceCountShift; - expectedRegValue |= ((device->getHardwareInfo().pSysInfo->SliceCount * 2) << gen11PowerClockStateRegister::sliceCountShift); - expectedRegValue |= (device->getHardwareInfo().pSysInfo->MaxEuPerSubSlice << gen11PowerClockStateRegister::minEuCountShift); - expectedRegValue |= (device->getHardwareInfo().pSysInfo->MaxEuPerSubSlice << gen11PowerClockStateRegister::maxEuCountShift); + auto expectedRegValue = (device->getHardwareInfo().pSysInfo.SubSliceCount / 2) << gen11PowerClockStateRegister::subSliceCountShift; + expectedRegValue |= ((device->getHardwareInfo().pSysInfo.SliceCount * 2) << gen11PowerClockStateRegister::sliceCountShift); + expectedRegValue |= (device->getHardwareInfo().pSysInfo.MaxEuPerSubSlice << gen11PowerClockStateRegister::minEuCountShift); + expectedRegValue |= (device->getHardwareInfo().pSysInfo.MaxEuPerSubSlice << gen11PowerClockStateRegister::maxEuCountShift); expectedRegValue |= gen11PowerClockStateRegister::disabledValue; expectedMiLrCmd.setDataDword(expectedRegValue); diff --git a/unit_tests/gen11/test_device_caps_gen11.cpp b/unit_tests/gen11/test_device_caps_gen11.cpp index c5e56a00ea..c0ee372b96 100644 --- a/unit_tests/gen11/test_device_caps_gen11.cpp +++ b/unit_tests/gen11/test_device_caps_gen11.cpp @@ -87,9 +87,9 @@ GEN11TEST_F(Gen11DeviceCaps, compression) { GEN11TEST_F(Gen11DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) { const auto &hwInfo = pDevice->getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); - uint32_t expectedValue = hwInfo.pSysInfo->MaxSubSlicesSupported * hwInfo.pSysInfo->MaxEuPerSubSlice * 8; + uint32_t expectedValue = hwInfo.pSysInfo.MaxSubSlicesSupported * hwInfo.pSysInfo.MaxEuPerSubSlice * 8; EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo)); EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch); diff --git a/unit_tests/gen11/test_preamble_gen11.cpp b/unit_tests/gen11/test_preamble_gen11.cpp index 4253ebc838..53283ec82b 100644 --- a/unit_tests/gen11/test_preamble_gen11.cpp +++ b/unit_tests/gen11/test_preamble_gen11.cpp @@ -49,9 +49,9 @@ GEN11TEST_F(Gen11UrbEntryAllocationSize, getUrbEntryAllocationSize) { typedef PreambleVfeState Gen11PreambleVfeState; GEN11TEST_F(Gen11PreambleVfeState, WaOff) { typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL; - testWaTable.waSendMIFLUSHBeforeVFE = 0; + testWaTable->waSendMIFLUSHBeforeVFE = 0; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, **platformDevices, 0, 0); + PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0); parseCommands(cs); @@ -67,9 +67,9 @@ GEN11TEST_F(Gen11PreambleVfeState, WaOff) { GEN11TEST_F(Gen11PreambleVfeState, WaOn) { typedef typename ICLFamily::PIPE_CONTROL PIPE_CONTROL; - testWaTable.waSendMIFLUSHBeforeVFE = 1; + testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, **platformDevices, 0, 0); + PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0); parseCommands(cs); @@ -92,8 +92,9 @@ GEN11TEST_F(PreemptionWatermarkGen11, givenPreambleThenPreambleWorkAroundsIsNotP auto cmd = findMmioCmd(cmdList.begin(), cmdList.end(), FfSliceCsChknReg2::address); ASSERT_EQ(nullptr, cmd); - size_t expectedSize = PreemptionHelper::getRequiredPreambleSize(MockDevice(*platformDevices[0])); - EXPECT_EQ(expectedSize, PreambleHelper::getAdditionalCommandsSize(MockDevice(*platformDevices[0]))); + MockDevice device; + size_t expectedSize = PreemptionHelper::getRequiredPreambleSize(device); + EXPECT_EQ(expectedSize, PreambleHelper::getAdditionalCommandsSize(device)); } typedef PreambleFixture ThreadArbitrationGen11; @@ -104,7 +105,7 @@ GEN11TEST_F(ThreadArbitrationGen11, givenPreambleWhenItIsProgrammedThenThreadArb typedef ICLFamily::PIPE_CONTROL PIPE_CONTROL; LinearStream &cs = linearStream; uint32_t l3Config = PreambleHelper::getL3Config(**platformDevices, true); - MockDevice mockDevice(**platformDevices); + MockDevice mockDevice; PreambleHelper::programPreamble(&linearStream, mockDevice, l3Config, ThreadArbitrationPolicy::RoundRobin, nullptr); @@ -119,7 +120,8 @@ GEN11TEST_F(ThreadArbitrationGen11, givenPreambleWhenItIsProgrammedThenThreadArb EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[ThreadArbitrationPolicy::RoundRobin], cmd->getDataDword()); - EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(MockDevice(*platformDevices[0]))); + MockDevice device; + EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(device)); EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL), PreambleHelper::getThreadArbitrationCommandsSize()); } diff --git a/unit_tests/gen8/bdw/linux/hw_info_config_tests_bdw.cpp b/unit_tests/gen8/bdw/linux/hw_info_config_tests_bdw.cpp index d1ebb7816a..3f95d8e302 100644 --- a/unit_tests/gen8/bdw/linux/hw_info_config_tests_bdw.cpp +++ b/unit_tests/gen8/bdw/linux/hw_info_config_tests_bdw.cpp @@ -22,104 +22,100 @@ struct HwInfoConfigTestLinuxBdw : HwInfoConfigTestLinux { BDWTEST_F(HwInfoConfigTestLinuxBdw, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredSSVal = 3; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IBDW_GT1_HALO_MOBL_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT1); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IBDW_GT3_ULT_MOBL_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT3); drm->StoredSSVal = 6; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(2u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); } BDWTEST_F(HwInfoConfigTestLinuxBdw, negativeUnknownDevId) { drm->StoredDeviceID = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } BDWTEST_F(HwInfoConfigTestLinuxBdw, negativeFailedIoctlDevId) { drm->StoredRetValForDeviceID = -2; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-2, ret); } BDWTEST_F(HwInfoConfigTestLinuxBdw, negativeFailedIoctlDevRevId) { drm->StoredRetValForDeviceRevID = -3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-3, ret); } BDWTEST_F(HwInfoConfigTestLinuxBdw, negativeFailedIoctlEuCount) { drm->StoredRetValForEUVal = -4; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-4, ret); } BDWTEST_F(HwInfoConfigTestLinuxBdw, negativeFailedIoctlSsCount) { drm->StoredRetValForSSVal = -5; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-5, ret); } @@ -127,41 +123,38 @@ BDWTEST_F(HwInfoConfigTestLinuxBdw, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 0; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - - ReleaseOutHwInfoStructs(); } BDWTEST_F(HwInfoConfigTestLinuxBdw, configureHwInfoEdram) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrEDram); - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = IBDW_GT3_HALO_MOBL_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = IBDW_GT3_SERV_DEVICE_F0_ID; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); + EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); } BDWTEST_F(HwInfoConfigTestLinuxBdw, whenCallAdjustPlatformThenDoNothing) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(testHwInfo.pPlatform, pInHwInfo->pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } @@ -171,16 +164,9 @@ class BdwHwInfoTests : public ::testing::Test { typedef ::testing::Types bdwTestTypes; TYPED_TEST_CASE(BdwHwInfoTests, bdwTestTypes); TYPED_TEST(BdwHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen8/bdw/test_device_caps_bdw.cpp b/unit_tests/gen8/bdw/test_device_caps_bdw.cpp index 1421c5650d..52fe9bb7a7 100644 --- a/unit_tests/gen8/bdw/test_device_caps_bdw.cpp +++ b/unit_tests/gen8/bdw/test_device_caps_bdw.cpp @@ -48,10 +48,10 @@ BDWTEST_F(BdwDeviceCaps, BdwProfilingTimerResolution) { BDWTEST_F(BdwDeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) { const auto &hwInfo = pDevice->getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); - uint32_t expectedValue = hwInfo.pSysInfo->MaxSubSlicesSupported * hwInfo.pSysInfo->MaxEuPerSubSlice * - hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount; + uint32_t expectedValue = hwInfo.pSysInfo.MaxSubSlicesSupported * hwInfo.pSysInfo.MaxEuPerSubSlice * + hwInfo.pSysInfo.ThreadCount / hwInfo.pSysInfo.EUCount; EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo)); EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch); diff --git a/unit_tests/gen8/bdw/test_hw_info_config_bdw.cpp b/unit_tests/gen8/bdw/test_hw_info_config_bdw.cpp index 5700312ee7..d710dee76a 100644 --- a/unit_tests/gen8/bdw/test_hw_info_config_bdw.cpp +++ b/unit_tests/gen8/bdw/test_hw_info_config_bdw.cpp @@ -13,9 +13,8 @@ TEST(BdwHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_BROADWELL != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; std::string strConfig = "1x3x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -70,15 +69,10 @@ BDWTEST_F(BdwHwInfo, givenBoolWhenCallBdwHardwareInfoSetupThenFeatureTableAndWor "1x3x6"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen8/bdw/windows/hw_info_config_tests_bdw.cpp b/unit_tests/gen8/bdw/windows/hw_info_config_tests_bdw.cpp index e5556dd2c5..36977b13c5 100644 --- a/unit_tests/gen8/bdw/windows/hw_info_config_tests_bdw.cpp +++ b/unit_tests/gen8/bdw/windows/hw_info_config_tests_bdw.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsBdw = HwInfoConfigTestWindows; BDWTEST_F(HwInfoConfigTestWindowsBdw, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_BROADWELL, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen8/hw_helper_tests_gen8.cpp b/unit_tests/gen8/hw_helper_tests_gen8.cpp index 540cb20d88..37e40770a6 100644 --- a/unit_tests/gen8/hw_helper_tests_gen8.cpp +++ b/unit_tests/gen8/hw_helper_tests_gen8.cpp @@ -21,7 +21,7 @@ GEN8TEST_F(HwHelperTestGen8, setCapabilityCoherencyFlag) { auto &helper = HwHelper::get(renderCoreFamily); bool coherency = false; - helper.setCapabilityCoherencyFlag(&hwInfoHelper.hwInfo, coherency); + helper.setCapabilityCoherencyFlag(&hwInfoHelper, coherency); EXPECT_TRUE(coherency); } @@ -29,25 +29,25 @@ GEN8TEST_F(HwHelperTestGen8, setupPreemptionRegisters) { auto &helper = HwHelper::get(renderCoreFamily); bool preemption = false; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_FALSE(preemption); preemption = true; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_TRUE(preemption); } GEN8TEST_F(HwHelperTestGen8, adjustDefaultEngineType) { - auto engineType = hwInfoHelper.hwInfo.capabilityTable.defaultEngineType; + auto engineType = hwInfoHelper.capabilityTable.defaultEngineType; auto &helper = HwHelper::get(renderCoreFamily); - helper.adjustDefaultEngineType(&hwInfoHelper.hwInfo); - EXPECT_EQ(engineType, hwInfoHelper.hwInfo.capabilityTable.defaultEngineType); + helper.adjustDefaultEngineType(&hwInfoHelper); + EXPECT_EQ(engineType, hwInfoHelper.capabilityTable.defaultEngineType); } GEN8TEST_F(HwHelperTestGen8, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCalledThenSpecificImplementationIsUsed) { auto &helper = HwHelper::get(renderCoreFamily); HardwareCapabilities hwCaps = {0}; - helper.setupHardwareCapabilities(&hwCaps, hwInfoHelper.hwInfo); + helper.setupHardwareCapabilities(&hwCaps, hwInfoHelper); EXPECT_EQ(2048u, hwCaps.image3DMaxHeight); EXPECT_EQ(2048u, hwCaps.image3DMaxWidth); diff --git a/unit_tests/gen8/test_preamble_gen8.cpp b/unit_tests/gen8/test_preamble_gen8.cpp index 1303349563..871e4c545e 100644 --- a/unit_tests/gen8/test_preamble_gen8.cpp +++ b/unit_tests/gen8/test_preamble_gen8.cpp @@ -66,7 +66,8 @@ BDWTEST_F(ThreadArbitrationGen8, givenPolicyWhenThreadArbitrationProgrammedThenD EXPECT_EQ(0u, cs.getUsed()); - EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(MockDevice(**platformDevices))); + MockDevice device; + EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(device)); EXPECT_EQ(0u, PreambleHelper::getThreadArbitrationCommandsSize()); EXPECT_EQ(0u, PreambleHelper::getDefaultThreadArbitrationPolicy()); } diff --git a/unit_tests/gen8/test_sample_gen8.cpp b/unit_tests/gen8/test_sample_gen8.cpp index 4efb685ea6..7e6f9e2cf4 100644 --- a/unit_tests/gen8/test_sample_gen8.cpp +++ b/unit_tests/gen8/test_sample_gen8.cpp @@ -13,7 +13,7 @@ using namespace NEO; typedef Test BroadwellOnlyTest; BDWTEST_F(BroadwellOnlyTest, shouldPassOnBdw) { - EXPECT_EQ(IGFX_BROADWELL, pDevice->getHardwareInfo().pPlatform->eProductFamily); + EXPECT_EQ(IGFX_BROADWELL, pDevice->getHardwareInfo().pPlatform.eProductFamily); } typedef Test Gen8OnlyTest; diff --git a/unit_tests/gen9/bxt/linux/hw_info_config_tests.cpp b/unit_tests/gen9/bxt/linux/hw_info_config_tests.cpp index e4c0c71e56..1c9cecf795 100644 --- a/unit_tests/gen9/bxt/linux/hw_info_config_tests.cpp +++ b/unit_tests/gen9/bxt/linux/hw_info_config_tests.cpp @@ -25,84 +25,80 @@ struct HwInfoConfigTestLinuxBxt : HwInfoConfigTestLinux { BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfo) { drm->StoredDeviceRevID = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGttCacheInvalidation); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGttCacheInvalidation); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); //constant sysInfo/ftr flags - EXPECT_EQ(1u, outHwInfo.pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled); - EXPECT_TRUE(outHwInfo.pSysInfo->VEBoxInfo.IsValid); + EXPECT_EQ(1u, outHwInfo.pSysInfo.VEBoxInfo.Instances.Bits.VEBox0Enabled); + EXPECT_TRUE(outHwInfo.pSysInfo.VEBoxInfo.IsValid); - EXPECT_EQ(GTTYPE_GTA, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GTA, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IBXT_P_12EU_3x6_DEVICE_ID; drm->setGtType(GTTYPE_GTC); //IBXT_P_12EU_3x6_DEVICE_ID is GTA, but fot test sake make it GTC drm->StoredMinEUinPool = 6; drm->StoredDeviceRevID = 4; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GTC, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GTC, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IBXT_P_12EU_3x6_DEVICE_ID; drm->setGtType(GTTYPE_GTX); //IBXT_P_12EU_3x6_DEVICE_ID is GTA, but fot test sake make it GTX drm->StoredMinEUinPool = 9; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GTX, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GTX, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGTX); auto &outKmdNotifyProperties = outHwInfo.capabilityTable.kmdNotifyProperties; EXPECT_TRUE(outKmdNotifyProperties.enableKmdNotify); @@ -116,58 +112,58 @@ BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfo) { BXTTEST_F(HwInfoConfigTestLinuxBxt, negativeUnknownDevId) { drm->StoredDeviceID = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } BXTTEST_F(HwInfoConfigTestLinuxBxt, negativeFailedIoctlDevId) { drm->StoredRetValForDeviceID = -2; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-2, ret); } BXTTEST_F(HwInfoConfigTestLinuxBxt, negativeFailedIoctlDevRevId) { drm->StoredRetValForDeviceRevID = -3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-3, ret); } BXTTEST_F(HwInfoConfigTestLinuxBxt, negativeFailedIoctlEuCount) { drm->StoredRetValForEUVal = -4; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-4, ret); } BXTTEST_F(HwInfoConfigTestLinuxBxt, negativeFailedIoctlSsCount) { drm->StoredRetValForSSVal = -5; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-5, ret); } BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoFailingEnabledPool) { drm->StoredRetValForPooledEU = -1; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMax); } BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoDisabledEnabledPool) { drm->StoredHasPooledEU = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMax); } BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoFailingMinEuInPool) { @@ -175,22 +171,20 @@ BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoFailingMinEuInPool) { drm->StoredSSVal = 3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(9u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(9u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); drm->StoredSSVal = 2; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(3u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(3u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); } BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoInvalidMinEuInPool) { @@ -198,39 +192,36 @@ BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoInvalidMinEuInPool) { drm->StoredSSVal = 3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(9u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(9u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); drm->StoredSSVal = 2; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(3u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(3u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); } BXTTEST_F(HwInfoConfigTestLinuxBxt, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 0; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - - ReleaseOutHwInfoStructs(); } BXTTEST_F(HwInfoConfigTestLinuxBxt, whenCallAdjustPlatformThenDoNothing) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(testHwInfo.pPlatform, pInHwInfo->pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } @@ -240,16 +231,9 @@ class BxtHwInfoTests : public ::testing::Test { typedef ::testing::Types bxtTestTypes; TYPED_TEST_CASE(BxtHwInfoTests, bxtTestTypes); TYPED_TEST(BxtHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen9/bxt/test_hw_info_config_bxt.cpp b/unit_tests/gen9/bxt/test_hw_info_config_bxt.cpp index edb28e817e..965d126f0d 100644 --- a/unit_tests/gen9/bxt/test_hw_info_config_bxt.cpp +++ b/unit_tests/gen9/bxt/test_hw_info_config_bxt.cpp @@ -13,9 +13,8 @@ TEST(BxtHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_BROXTON != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; std::string strConfig = "1x2x6"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -53,15 +52,11 @@ BXTTEST_F(BxtHwInfo, givenBoolWhenCallBxtHardwareInfoSetupThenFeatureTableAndWor "1x3x6"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; + PLATFORM &pPlatform = hwInfo.pPlatform; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen9/bxt/windows/hw_info_config_tests_bxt.cpp b/unit_tests/gen9/bxt/windows/hw_info_config_tests_bxt.cpp index c9e813c5a2..3e0cdf3753 100644 --- a/unit_tests/gen9/bxt/windows/hw_info_config_tests_bxt.cpp +++ b/unit_tests/gen9/bxt/windows/hw_info_config_tests_bxt.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsBxt = HwInfoConfigTestWindows; BXTTEST_F(HwInfoConfigTestWindowsBxt, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_BROXTON, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen9/cfl/linux/hw_info_config_tests_cfl.cpp b/unit_tests/gen9/cfl/linux/hw_info_config_tests_cfl.cpp index 5c0a646dd7..9b122402e5 100644 --- a/unit_tests/gen9/cfl/linux/hw_info_config_tests_cfl.cpp +++ b/unit_tests/gen9/cfl/linux/hw_info_config_tests_cfl.cpp @@ -21,75 +21,71 @@ struct HwInfoConfigTestLinuxCfl : HwInfoConfigTestLinux { CFLTEST_F(HwInfoConfigTestLinuxCfl, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); //constant sysInfo/ftr flags - EXPECT_EQ(1u, outHwInfo.pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled); - EXPECT_TRUE(outHwInfo.pSysInfo->VEBoxInfo.IsValid); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSysInfo.VEBoxInfo.Instances.Bits.VEBox0Enabled); + EXPECT_TRUE(outHwInfo.pSysInfo.VEBoxInfo.IsValid); drm->StoredDeviceID = ICFL_GT1_DT_DEVICE_F0_ID; drm->StoredSSVal = 3; drm->setGtType(GTTYPE_GT1); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = ICFL_GT3_ULT_DEVICE_F0_ID; drm->StoredSSVal = 6; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(2u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); auto &outKmdNotifyProperties = outHwInfo.capabilityTable.kmdNotifyProperties; EXPECT_TRUE(outKmdNotifyProperties.enableKmdNotify); @@ -103,35 +99,35 @@ CFLTEST_F(HwInfoConfigTestLinuxCfl, configureHwInfo) { CFLTEST_F(HwInfoConfigTestLinuxCfl, negativeUnknownDevId) { drm->StoredDeviceID = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } CFLTEST_F(HwInfoConfigTestLinuxCfl, negativeFailedIoctlDevId) { drm->StoredRetValForDeviceID = -2; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-2, ret); } CFLTEST_F(HwInfoConfigTestLinuxCfl, negativeFailedIoctlDevRevId) { drm->StoredRetValForDeviceRevID = -3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-3, ret); } CFLTEST_F(HwInfoConfigTestLinuxCfl, negativeFailedIoctlEuCount) { drm->StoredRetValForEUVal = -4; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-4, ret); } CFLTEST_F(HwInfoConfigTestLinuxCfl, negativeFailedIoctlSsCount) { drm->StoredRetValForSSVal = -5; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-5, ret); } @@ -139,41 +135,38 @@ CFLTEST_F(HwInfoConfigTestLinuxCfl, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 0; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - - ReleaseOutHwInfoStructs(); } CFLTEST_F(HwInfoConfigTestLinuxCfl, configureHwInfoEdram) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrEDram); - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ICFL_GT3_ULT_28W_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ICFL_GT3_ULT_15W_DEVICE_F0_ID; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); } CFLTEST_F(HwInfoConfigTestLinuxCfl, whenCallAdjustPlatformThenDoNothing) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(testHwInfo.pPlatform, pInHwInfo->pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } @@ -183,16 +176,9 @@ class CflHwInfoTests : public ::testing::Test { typedef ::testing::Types cflTestTypes; TYPED_TEST_CASE(CflHwInfoTests, cflTestTypes); TYPED_TEST(CflHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen9/cfl/test_hw_info_config_cfl.cpp b/unit_tests/gen9/cfl/test_hw_info_config_cfl.cpp index 030563cdfd..8817542ad6 100644 --- a/unit_tests/gen9/cfl/test_hw_info_config_cfl.cpp +++ b/unit_tests/gen9/cfl/test_hw_info_config_cfl.cpp @@ -13,9 +13,8 @@ TEST(CflHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_COFFEELAKE != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; std::string strConfig = "1x3x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -77,15 +76,10 @@ CFLTEST_F(CflHwInfo, givenBoolWhenCallCflHardwareInfoSetupThenFeatureTableAndWor "1x3x6"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen9/cfl/windows/hw_info_config_tests_cfl.cpp b/unit_tests/gen9/cfl/windows/hw_info_config_tests_cfl.cpp index e9a9824ba1..08cc2a0465 100644 --- a/unit_tests/gen9/cfl/windows/hw_info_config_tests_cfl.cpp +++ b/unit_tests/gen9/cfl/windows/hw_info_config_tests_cfl.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsCfl = HwInfoConfigTestWindows; CFLTEST_F(HwInfoConfigTestWindowsCfl, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_COFFEELAKE, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen9/glk/linux/hw_info_config_tests_glk.cpp b/unit_tests/gen9/glk/linux/hw_info_config_tests_glk.cpp index ddf0c92ff2..e25d16212c 100644 --- a/unit_tests/gen9/glk/linux/hw_info_config_tests_glk.cpp +++ b/unit_tests/gen9/glk/linux/hw_info_config_tests_glk.cpp @@ -25,80 +25,76 @@ struct HwInfoConfigTestLinuxGlk : HwInfoConfigTestLinux { GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GTA, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GTA, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); //constant sysInfo/ftr flags - EXPECT_EQ(1u, outHwInfo.pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled); - EXPECT_TRUE(outHwInfo.pSysInfo->VEBoxInfo.IsValid); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSysInfo.VEBoxInfo.Instances.Bits.VEBox0Enabled); + EXPECT_TRUE(outHwInfo.pSysInfo.VEBoxInfo.IsValid); drm->StoredDeviceID = IGLK_GT2_ULT_18EU_DEVICE_F0_ID; drm->setGtType(GTTYPE_GTC); //IGLK_GT2_ULT_18EU_DEVICE_F0_ID is GTA, but fot test sake make it GTC drm->StoredMinEUinPool = 6; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GTC, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GTC, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IGLK_GT2_ULT_12EU_DEVICE_F0_ID; drm->setGtType(GTTYPE_GTX); //IGLK_GT2_ULT_18EU_DEVICE_F0_ID is GTA, but fot test sake make it GTX drm->StoredMinEUinPool = 9; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ((unsigned int)drm->StoredHasPooledEU, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ((uint32_t)drm->StoredMinEUinPool, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GTX, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GTX, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGTX); auto &outKmdNotifyProperties = outHwInfo.capabilityTable.kmdNotifyProperties; EXPECT_TRUE(outKmdNotifyProperties.enableKmdNotify); @@ -113,53 +109,45 @@ GLKTEST_F(HwInfoConfigTestLinuxGlk, negative) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredRetValForDeviceID = -1; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceID = 0; drm->StoredRetValForDeviceRevID = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForDeviceRevID = 0; drm->StoredRetValForEUVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - ReleaseOutHwInfoStructs(); - drm->StoredRetValForEUVal = 0; drm->StoredRetValForSSVal = -1; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); - - ReleaseOutHwInfoStructs(); } GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoFailingEnabledPool) { drm->StoredRetValForPooledEU = -1; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMax); } GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoDisabledEnabledPool) { drm->StoredHasPooledEU = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ(0u, outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ(0u, outHwInfo.pSysInfo.EuCountPerPoolMax); } GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoFailingMinEuInPool) { @@ -167,22 +155,20 @@ GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoFailingMinEuInPool) { drm->StoredSSVal = 3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(9u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(9u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); drm->StoredSSVal = 2; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(3u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(3u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); } GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoInvalidMinEuInPool) { @@ -190,39 +176,36 @@ GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoInvalidMinEuInPool) { drm->StoredSSVal = 3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(9u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(9u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); drm->StoredSSVal = 2; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrPooledEuEnabled); - EXPECT_EQ(3u, outHwInfo.pSysInfo->EuCountPerPoolMin); - EXPECT_EQ((outHwInfo.pSysInfo->EUCount - outHwInfo.pSysInfo->EuCountPerPoolMin), outHwInfo.pSysInfo->EuCountPerPoolMax); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrPooledEuEnabled); + EXPECT_EQ(3u, outHwInfo.pSysInfo.EuCountPerPoolMin); + EXPECT_EQ((outHwInfo.pSysInfo.EUCount - outHwInfo.pSysInfo.EuCountPerPoolMin), outHwInfo.pSysInfo.EuCountPerPoolMax); } GLKTEST_F(HwInfoConfigTestLinuxGlk, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 0; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - - ReleaseOutHwInfoStructs(); } GLKTEST_F(HwInfoConfigTestLinuxGlk, whenCallAdjustPlatformThenDoNothing) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(testHwInfo.pPlatform, pInHwInfo->pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } @@ -232,16 +215,9 @@ class GlkHwInfoTests : public ::testing::Test { typedef ::testing::Types glkTestTypes; TYPED_TEST_CASE(GlkHwInfoTests, glkTestTypes); TYPED_TEST(GlkHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen9/glk/test_hw_info_config_glk.cpp b/unit_tests/gen9/glk/test_hw_info_config_glk.cpp index da1c58bb31..bd580ce17f 100644 --- a/unit_tests/gen9/glk/test_hw_info_config_glk.cpp +++ b/unit_tests/gen9/glk/test_hw_info_config_glk.cpp @@ -13,15 +13,9 @@ TEST(GlkHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_GEMINILAKE != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + gtSystemInfo = {0}; std::string strConfig = "1x2x6"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -59,15 +53,10 @@ GLKTEST_F(GlkHwInfo, givenBoolWhenCallGlkHardwareInfoSetupThenFeatureTableAndWor "1x3x6"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen9/glk/windows/hw_info_config_tests_glk.cpp b/unit_tests/gen9/glk/windows/hw_info_config_tests_glk.cpp index b9c7538d32..2080d81bcd 100644 --- a/unit_tests/gen9/glk/windows/hw_info_config_tests_glk.cpp +++ b/unit_tests/gen9/glk/windows/hw_info_config_tests_glk.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsGlk = HwInfoConfigTestWindows; GLKTEST_F(HwInfoConfigTestWindowsGlk, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_GEMINILAKE, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen9/hw_helper_tests_gen9.cpp b/unit_tests/gen9/hw_helper_tests_gen9.cpp index 58dae1c55d..d10c84b1be 100644 --- a/unit_tests/gen9/hw_helper_tests_gen9.cpp +++ b/unit_tests/gen9/hw_helper_tests_gen9.cpp @@ -19,7 +19,7 @@ GEN9TEST_F(HwHelperTestGen9, setCapabilityCoherencyFlag) { auto &helper = HwHelper::get(renderCoreFamily); bool coherency = false; - helper.setCapabilityCoherencyFlag(&hwInfoHelper.hwInfo, coherency); + helper.setCapabilityCoherencyFlag(&hwInfoHelper, coherency); EXPECT_TRUE(coherency); } @@ -27,28 +27,28 @@ GEN9TEST_F(HwHelperTestGen9, setupPreemptionRegisters) { auto &helper = HwHelper::get(renderCoreFamily); bool preemption = false; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_FALSE(preemption); - EXPECT_FALSE(hwInfoHelper.hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_FALSE(hwInfoHelper.capabilityTable.whitelistedRegisters.csChicken1_0x2580); preemption = true; - preemption = helper.setupPreemptionRegisters(&hwInfoHelper.hwInfo, preemption); + preemption = helper.setupPreemptionRegisters(&hwInfoHelper, preemption); EXPECT_TRUE(preemption); - EXPECT_TRUE(hwInfoHelper.hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_TRUE(hwInfoHelper.capabilityTable.whitelistedRegisters.csChicken1_0x2580); } GEN9TEST_F(HwHelperTestGen9, adjustDefaultEngineType) { - auto engineType = hwInfoHelper.hwInfo.capabilityTable.defaultEngineType; + auto engineType = hwInfoHelper.capabilityTable.defaultEngineType; auto &helper = HwHelper::get(renderCoreFamily); - helper.adjustDefaultEngineType(&hwInfoHelper.hwInfo); - EXPECT_EQ(engineType, hwInfoHelper.hwInfo.capabilityTable.defaultEngineType); + helper.adjustDefaultEngineType(&hwInfoHelper); + EXPECT_EQ(engineType, hwInfoHelper.capabilityTable.defaultEngineType); } GEN9TEST_F(HwHelperTestGen9, givenGen9PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) { auto &helper = HwHelper::get(renderCoreFamily); // Test default method implementation - testDefaultImplementationOfSetupHardwareCapabilities(helper, hwInfoHelper.hwInfo); + testDefaultImplementationOfSetupHardwareCapabilities(helper, hwInfoHelper); } GEN9TEST_F(HwHelperTestGen9, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenDbgCsrLocalTypeIsReturned) { diff --git a/unit_tests/gen9/kbl/linux/hw_info_config_tests_kbl.cpp b/unit_tests/gen9/kbl/linux/hw_info_config_tests_kbl.cpp index 4d78f1a4bf..2e8235fcf3 100644 --- a/unit_tests/gen9/kbl/linux/hw_info_config_tests_kbl.cpp +++ b/unit_tests/gen9/kbl/linux/hw_info_config_tests_kbl.cpp @@ -21,121 +21,113 @@ struct HwInfoConfigTestLinuxKbl : HwInfoConfigTestLinux { KBLTEST_F(HwInfoConfigTestLinuxKbl, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); //constant sysInfo/ftr flags - EXPECT_EQ(1u, outHwInfo.pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled); - EXPECT_TRUE(outHwInfo.pSysInfo->VEBoxInfo.IsValid); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSysInfo.VEBoxInfo.Instances.Bits.VEBox0Enabled); + EXPECT_TRUE(outHwInfo.pSysInfo.VEBoxInfo.IsValid); drm->StoredDeviceID = IKBL_GT1_ULT_DEVICE_F0_ID; drm->StoredSSVal = 3; drm->setGtType(GTTYPE_GT1); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IKBL_GT1_5_ULX_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT1_5); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1_5, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1_5, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IKBL_GT3_ULT_DEVICE_F0_ID; drm->StoredSSVal = 6; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(2u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = IKBL_GT4_HALO_DEVICE_F0_ID; drm->StoredSSVal = 6; drm->setGtType(GTTYPE_GT4); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(2u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT4, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT4, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); auto &outKmdNotifyProperties = outHwInfo.capabilityTable.kmdNotifyProperties; EXPECT_TRUE(outKmdNotifyProperties.enableKmdNotify); @@ -149,35 +141,35 @@ KBLTEST_F(HwInfoConfigTestLinuxKbl, configureHwInfo) { KBLTEST_F(HwInfoConfigTestLinuxKbl, negativeUnknownDevId) { drm->StoredDeviceID = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } KBLTEST_F(HwInfoConfigTestLinuxKbl, negativeFailedIoctlDevId) { drm->StoredRetValForDeviceID = -2; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-2, ret); } KBLTEST_F(HwInfoConfigTestLinuxKbl, negativeFailedIoctlDevRevId) { drm->StoredRetValForDeviceRevID = -3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-3, ret); } KBLTEST_F(HwInfoConfigTestLinuxKbl, negativeFailedIoctlEuCount) { drm->StoredRetValForEUVal = -4; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-4, ret); } KBLTEST_F(HwInfoConfigTestLinuxKbl, negativeFailedIoctlSsCount) { drm->StoredRetValForSSVal = -5; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-5, ret); } @@ -185,56 +177,51 @@ KBLTEST_F(HwInfoConfigTestLinuxKbl, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 0; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - ReleaseOutHwInfoStructs(); - drm->StoredDeviceRevID = 7; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waDisableLSQCROPERFforOCL); - EXPECT_EQ(0u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(0u, outHwInfo.pWaTable.waDisableLSQCROPERFforOCL); + EXPECT_EQ(0u, outHwInfo.pWaTable.waEncryptedEdramOnlyPartials); drm->StoredDeviceRevID = 9; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waDisableLSQCROPERFforOCL); - EXPECT_EQ(0u, outHwInfo.pWaTable->waEncryptedEdramOnlyPartials); - EXPECT_EQ(0u, outHwInfo.pWaTable->waForcePcBbFullCfgRestore); + EXPECT_EQ(0u, outHwInfo.pWaTable.waDisableLSQCROPERFforOCL); + EXPECT_EQ(0u, outHwInfo.pWaTable.waEncryptedEdramOnlyPartials); + EXPECT_EQ(0u, outHwInfo.pWaTable.waForcePcBbFullCfgRestore); } KBLTEST_F(HwInfoConfigTestLinuxKbl, configureHwInfoEdram) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrEDram); - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = IKBL_GT3_28W_ULT_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = IKBL_GT3_15W_ULT_DEVICE_F0_ID; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); } KBLTEST_F(HwInfoConfigTestLinuxKbl, whenCallAdjustPlatformThenDoNothing) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(testHwInfo.pPlatform, pInHwInfo->pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } @@ -244,16 +231,9 @@ class KblHwInfoTests : public ::testing::Test { typedef ::testing::Types kblTestTypes; TYPED_TEST_CASE(KblHwInfoTests, kblTestTypes); TYPED_TEST(KblHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen9/kbl/test_hw_info_config_kbl.cpp b/unit_tests/gen9/kbl/test_hw_info_config_kbl.cpp index 159958c19b..017931991c 100644 --- a/unit_tests/gen9/kbl/test_hw_info_config_kbl.cpp +++ b/unit_tests/gen9/kbl/test_hw_info_config_kbl.cpp @@ -13,9 +13,8 @@ TEST(KblHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_KABYLAKE != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; std::string strConfig = "1x3x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -77,15 +76,11 @@ KBLTEST_F(KblHwInfo, givenBoolWhenCallKblHardwareInfoSetupThenFeatureTableAndWor "1x3x6"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; + PLATFORM &pPlatform = hwInfo.pPlatform; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen9/kbl/windows/hw_info_config_tests_kbl.cpp b/unit_tests/gen9/kbl/windows/hw_info_config_tests_kbl.cpp index 09f2e1adb6..561fe8a28c 100644 --- a/unit_tests/gen9/kbl/windows/hw_info_config_tests_kbl.cpp +++ b/unit_tests/gen9/kbl/windows/hw_info_config_tests_kbl.cpp @@ -16,8 +16,8 @@ using HwInfoConfigTestWindowsKbl = HwInfoConfigTestWindows; KBLTEST_F(HwInfoConfigTestWindowsKbl, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_KABYLAKE, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen9/linux/device_factory_tests_gen9.cpp b/unit_tests/gen9/linux/device_factory_tests_gen9.cpp index 7fd6c1342f..6ae0052996 100644 --- a/unit_tests/gen9/linux/device_factory_tests_gen9.cpp +++ b/unit_tests/gen9/linux/device_factory_tests_gen9.cpp @@ -14,24 +14,23 @@ GEN9TEST_F(DeviceFactoryLinuxTestSkl, queryWhitelistedPreemptionRegister) { I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); - EXPECT_TRUE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_TRUE(executionEnvironment.getHardwareInfo()->capabilityTable.whitelistedRegisters.csChicken1_0x2580); DeviceFactory::releaseDevices(); } GEN9TEST_F(DeviceFactoryLinuxTestSkl, queryNotWhitelistedPreemptionRegister) { pDrm->StoredPreemptionSupport = 0; - HardwareInfo *hwInfo = nullptr; + size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); - EXPECT_FALSE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580); + EXPECT_FALSE(executionEnvironment.getHardwareInfo()->capabilityTable.whitelistedRegisters.csChicken1_0x2580); DeviceFactory::releaseDevices(); } diff --git a/unit_tests/gen9/skl/linux/hw_info_config_tests_skl.cpp b/unit_tests/gen9/skl/linux/hw_info_config_tests_skl.cpp index 265650d553..9f2b09152d 100644 --- a/unit_tests/gen9/skl/linux/hw_info_config_tests_skl.cpp +++ b/unit_tests/gen9/skl/linux/hw_info_config_tests_skl.cpp @@ -21,120 +21,113 @@ struct HwInfoConfigTestLinuxSkl : HwInfoConfigTestLinux { SKLTEST_F(HwInfoConfigTestLinuxSkl, configureHwInfo) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT2, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); //constant sysInfo/ftr flags - EXPECT_EQ(1u, outHwInfo.pSysInfo->VEBoxInfo.Instances.Bits.VEBox0Enabled); - EXPECT_EQ(1u, outHwInfo.pSysInfo->VDBoxInfo.Instances.Bits.VDBox0Enabled); - EXPECT_TRUE(outHwInfo.pSysInfo->VEBoxInfo.IsValid); - EXPECT_TRUE(outHwInfo.pSysInfo->VDBoxInfo.IsValid); - ReleaseOutHwInfoStructs(); + EXPECT_EQ(1u, outHwInfo.pSysInfo.VEBoxInfo.Instances.Bits.VEBox0Enabled); + EXPECT_EQ(1u, outHwInfo.pSysInfo.VDBoxInfo.Instances.Bits.VDBox0Enabled); + EXPECT_TRUE(outHwInfo.pSysInfo.VEBoxInfo.IsValid); + EXPECT_TRUE(outHwInfo.pSysInfo.VDBoxInfo.IsValid); drm->StoredDeviceID = ISKL_GT1_DT_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT1); drm->StoredSSVal = 3; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(1u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(1u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = ISKL_GT1_5_DT_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT1_5); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT1_5, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT1_5, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = ISKL_GT3_DESK_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT3, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); drm->StoredDeviceID = ISKL_GT4_DESK_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT4); drm->StoredSSVal = 6; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform->usDeviceID); - EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform->usRevId); - EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo->EUCount); - EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo->SubSliceCount); - EXPECT_EQ(2u, outHwInfo.pSysInfo->SliceCount); + EXPECT_EQ((unsigned short)drm->StoredDeviceID, outHwInfo.pPlatform.usDeviceID); + EXPECT_EQ((unsigned short)drm->StoredDeviceRevID, outHwInfo.pPlatform.usRevId); + EXPECT_EQ((uint32_t)drm->StoredEUVal, outHwInfo.pSysInfo.EUCount); + EXPECT_EQ((uint32_t)drm->StoredSSVal, outHwInfo.pSysInfo.SubSliceCount); + EXPECT_EQ(2u, outHwInfo.pSysInfo.SliceCount); EXPECT_EQ(aub_stream::ENGINE_RCS, outHwInfo.capabilityTable.defaultEngineType); - EXPECT_EQ(GTTYPE_GT4, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GTTYPE_GT4, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); auto &outKmdNotifyProperties = outHwInfo.capabilityTable.kmdNotifyProperties; EXPECT_TRUE(outKmdNotifyProperties.enableKmdNotify); @@ -148,35 +141,35 @@ SKLTEST_F(HwInfoConfigTestLinuxSkl, configureHwInfo) { SKLTEST_F(HwInfoConfigTestLinuxSkl, negativeUnknownDevId) { drm->StoredDeviceID = 0; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } SKLTEST_F(HwInfoConfigTestLinuxSkl, negativeFailedIoctlDevId) { drm->StoredRetValForDeviceID = -2; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-2, ret); } SKLTEST_F(HwInfoConfigTestLinuxSkl, negativeFailedIoctlDevRevId) { drm->StoredRetValForDeviceRevID = -3; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-3, ret); } SKLTEST_F(HwInfoConfigTestLinuxSkl, negativeFailedIoctlEuCount) { drm->StoredRetValForEUVal = -4; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-4, ret); } SKLTEST_F(HwInfoConfigTestLinuxSkl, negativeFailedIoctlSsCount) { drm->StoredRetValForSSVal = -5; auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-5, ret); } @@ -184,91 +177,77 @@ SKLTEST_F(HwInfoConfigTestLinuxSkl, configureHwInfoWaFlags) { auto hwInfoConfig = HwInfoConfig::get(productFamily); drm->StoredDeviceRevID = 1; - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - ReleaseOutHwInfoStructs(); drm->StoredDeviceRevID = 0; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waCompressedResourceRequiresConstVA21); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(0u, outHwInfo.pWaTable.waCompressedResourceRequiresConstVA21); drm->StoredDeviceRevID = 5; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waCompressedResourceRequiresConstVA21); - EXPECT_EQ(0u, outHwInfo.pWaTable->waModifyVFEStateAfterGPGPUPreemption); - EXPECT_EQ(0u, outHwInfo.pWaTable->waDisablePerCtxtPreemptionGranularityControl); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(0u, outHwInfo.pWaTable.waCompressedResourceRequiresConstVA21); + EXPECT_EQ(0u, outHwInfo.pWaTable.waModifyVFEStateAfterGPGPUPreemption); + EXPECT_EQ(0u, outHwInfo.pWaTable.waDisablePerCtxtPreemptionGranularityControl); drm->StoredDeviceRevID = 6; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(0u, outHwInfo.pWaTable->waCompressedResourceRequiresConstVA21); - EXPECT_EQ(0u, outHwInfo.pWaTable->waModifyVFEStateAfterGPGPUPreemption); - EXPECT_EQ(0u, outHwInfo.pWaTable->waDisablePerCtxtPreemptionGranularityControl); - EXPECT_EQ(0u, outHwInfo.pWaTable->waCSRUncachable); + EXPECT_EQ(0u, outHwInfo.pWaTable.waCompressedResourceRequiresConstVA21); + EXPECT_EQ(0u, outHwInfo.pWaTable.waModifyVFEStateAfterGPGPUPreemption); + EXPECT_EQ(0u, outHwInfo.pWaTable.waDisablePerCtxtPreemptionGranularityControl); + EXPECT_EQ(0u, outHwInfo.pWaTable.waCSRUncachable); } SKLTEST_F(HwInfoConfigTestLinuxSkl, configureHwInfoEdram) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - int ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrEDram); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL(0u, outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ISKL_GT3e_ULT_DEVICE_F0_ID_540; drm->setGtType(GTTYPE_GT3); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ISKL_GT3e_ULT_DEVICE_F0_ID_550; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ISKL_GT3_MEDIA_SERV_DEVICE_F0_ID; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((64u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ISKL_GT4_HALO_MOBL_DEVICE_F0_ID; drm->setGtType(GTTYPE_GT4); - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); drm->StoredDeviceID = ISKL_GT4_WRK_DEVICE_F0_ID; - ret = hwInfoConfig->configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwInfoConfig->configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo->EdramSizeInKb); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); + EXPECT_EQ_VAL((128u * 1024u), outHwInfo.pSysInfo.EdramSizeInKb); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); } SKLTEST_F(HwInfoConfigTestLinuxSkl, whenCallAdjustPlatformThenDoNothing) { auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(testHwInfo.pPlatform, pInHwInfo->pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } @@ -278,16 +257,9 @@ class SklHwInfoTests : public ::testing::Test { typedef ::testing::Types sklTestTypes; TYPED_TEST_CASE(SklHwInfoTests, sklTestTypes); TYPED_TEST(SklHwInfoTests, gtSetupIsCorrect) { - GT_SYSTEM_INFO gtSystemInfo; - FeatureTable featureTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &featureTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; - memset(>SystemInfo, 0, sizeof(gtSystemInfo)); + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + TypeParam::setupHardwareInfo(&hwInfo, false); EXPECT_GT(gtSystemInfo.EUCount, 0u); EXPECT_GT(gtSystemInfo.ThreadCount, 0u); diff --git a/unit_tests/gen9/skl/test_hw_info_config_skl.cpp b/unit_tests/gen9/skl/test_hw_info_config_skl.cpp index 30006fabb5..27c294bbc3 100644 --- a/unit_tests/gen9/skl/test_hw_info_config_skl.cpp +++ b/unit_tests/gen9/skl/test_hw_info_config_skl.cpp @@ -13,9 +13,9 @@ TEST(SklHwInfoConfig, givenHwInfoConfigStringThenAfterSetupResultingHwInfoIsCorr if (IGFX_SKYLAKE != productFamily) { return; } - GT_SYSTEM_INFO gtSystemInfo = {0}; HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + gtSystemInfo = {0}; std::string strConfig = "1x3x8"; hardwareInfoSetup[productFamily](&hwInfo, false, strConfig); @@ -79,15 +79,12 @@ SKLTEST_F(SklHwInfo, givenBoolWhenCallSklHardwareInfoSetupThenFeatureTableAndWor "1x3x6"}; bool boolValue[]{ true, false}; - GT_SYSTEM_INFO gtSystemInfo = {0}; - FeatureTable pSkuTable; - WorkaroundTable pWaTable; - PLATFORM pPlatform; + HardwareInfo hwInfo; - hwInfo.pSysInfo = >SystemInfo; - hwInfo.pSkuTable = &pSkuTable; - hwInfo.pWaTable = &pWaTable; - hwInfo.pPlatform = &pPlatform; + GT_SYSTEM_INFO >SystemInfo = hwInfo.pSysInfo; + FeatureTable &pSkuTable = hwInfo.pSkuTable; + WorkaroundTable &pWaTable = hwInfo.pWaTable; + PLATFORM &pPlatform = hwInfo.pPlatform; for (auto &config : strConfig) { for (auto setParamBool : boolValue) { diff --git a/unit_tests/gen9/skl/test_preamble_skl.cpp b/unit_tests/gen9/skl/test_preamble_skl.cpp index 92e432f378..e4a99d5efd 100644 --- a/unit_tests/gen9/skl/test_preamble_skl.cpp +++ b/unit_tests/gen9/skl/test_preamble_skl.cpp @@ -77,7 +77,7 @@ SKLTEST_F(ThreadArbitration, givenPreambleWhenItIsProgrammedThenThreadArbitratio typedef SKLFamily::PIPE_CONTROL PIPE_CONTROL; LinearStream &cs = linearStream; uint32_t l3Config = PreambleHelper::getL3Config(**platformDevices, true); - MockDevice mockDevice(**platformDevices); + MockDevice mockDevice; PreambleHelper::programPreamble(&linearStream, mockDevice, l3Config, ThreadArbitrationPolicy::RoundRobin, nullptr); @@ -94,7 +94,8 @@ SKLTEST_F(ThreadArbitration, givenPreambleWhenItIsProgrammedThenThreadArbitratio EXPECT_EQ(0xE404u, lri.getRegisterOffset()); EXPECT_EQ(0x100u, lri.getDataDword()); - EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(MockDevice(*platformDevices[0]))); + MockDevice device; + EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(device)); EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM) + sizeof(PIPE_CONTROL), PreambleHelper::getThreadArbitrationCommandsSize()); } @@ -104,9 +105,9 @@ SKLTEST_F(ThreadArbitration, defaultArbitrationPolicy) { GEN9TEST_F(PreambleVfeState, WaOff) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - testWaTable.waSendMIFLUSHBeforeVFE = 0; + testWaTable->waSendMIFLUSHBeforeVFE = 0; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, **platformDevices, 0, 0); + PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0); parseCommands(cs); @@ -122,9 +123,9 @@ GEN9TEST_F(PreambleVfeState, WaOff) { GEN9TEST_F(PreambleVfeState, WaOn) { typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - testWaTable.waSendMIFLUSHBeforeVFE = 1; + testWaTable->waSendMIFLUSHBeforeVFE = 1; LinearStream &cs = linearStream; - PreambleHelper::programVFEState(&linearStream, **platformDevices, 0, 0); + PreambleHelper::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0); parseCommands(cs); diff --git a/unit_tests/gen9/skl/test_sample_skl.cpp b/unit_tests/gen9/skl/test_sample_skl.cpp index c0165abd4e..129f59a079 100644 --- a/unit_tests/gen9/skl/test_sample_skl.cpp +++ b/unit_tests/gen9/skl/test_sample_skl.cpp @@ -13,5 +13,5 @@ using namespace NEO; typedef Test SkylakeOnlyTest; SKLTEST_F(SkylakeOnlyTest, shouldPassOnSkl) { - EXPECT_EQ(IGFX_SKYLAKE, pDevice->getHardwareInfo().pPlatform->eProductFamily); + EXPECT_EQ(IGFX_SKYLAKE, pDevice->getHardwareInfo().pPlatform.eProductFamily); } diff --git a/unit_tests/gen9/skl/windows/hw_info_config_tests_skl.cpp b/unit_tests/gen9/skl/windows/hw_info_config_tests_skl.cpp index 9cc2d2108f..ed3da94d3b 100644 --- a/unit_tests/gen9/skl/windows/hw_info_config_tests_skl.cpp +++ b/unit_tests/gen9/skl/windows/hw_info_config_tests_skl.cpp @@ -16,8 +16,9 @@ using HwInfoConfigTestWindowsSkl = HwInfoConfigTestWindows; SKLTEST_F(HwInfoConfigTestWindowsSkl, whenCallAdjustPlatformThenDoNothing) { EXPECT_EQ(IGFX_SKYLAKE, productFamily); auto hwInfoConfig = HwInfoConfig::get(productFamily); - hwInfoConfig->adjustPlatformForProductFamily(&testHwInfo); + outHwInfo = pInHwInfo; + hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo); - int ret = memcmp(outHwInfo.pPlatform, testHwInfo.pPlatform, sizeof(PLATFORM)); + int ret = memcmp(&outHwInfo.pPlatform, &pInHwInfo.pPlatform, sizeof(PLATFORM)); EXPECT_EQ(0, ret); } diff --git a/unit_tests/gen9/test_device_caps_gen9.cpp b/unit_tests/gen9/test_device_caps_gen9.cpp index 839a2f0e87..2e790c524f 100644 --- a/unit_tests/gen9/test_device_caps_gen9.cpp +++ b/unit_tests/gen9/test_device_caps_gen9.cpp @@ -46,10 +46,10 @@ GEN9TEST_F(Gen9DeviceCaps, compression) { GEN9TEST_F(Gen9DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) { const auto &hwInfo = pDevice->getHardwareInfo(); - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily); - uint32_t expectedValue = hwInfo.pSysInfo->MaxSubSlicesSupported * hwInfo.pSysInfo->MaxEuPerSubSlice * - hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount; + uint32_t expectedValue = hwInfo.pSysInfo.MaxSubSlicesSupported * hwInfo.pSysInfo.MaxEuPerSubSlice * + hwInfo.pSysInfo.ThreadCount / hwInfo.pSysInfo.EUCount; EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo)); EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch); diff --git a/unit_tests/gen9/test_platform_caps_gen9.cpp b/unit_tests/gen9/test_platform_caps_gen9.cpp index a71edb697d..620bfd5f4e 100644 --- a/unit_tests/gen9/test_platform_caps_gen9.cpp +++ b/unit_tests/gen9/test_platform_caps_gen9.cpp @@ -34,7 +34,7 @@ GEN9TEST_F(Gen9PlatformCaps, allSkusSupportFP64) { GEN9TEST_F(Gen9PlatformCaps, SKLVersion) { char *paramValue = new char[12]; cl_int retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_VERSION, 12, paramValue, nullptr); - if (pPlatform->getDevice(0)->getHardwareInfo().pPlatform->eProductFamily == IGFX_SKYLAKE) { + if (pPlatform->getDevice(0)->getHardwareInfo().pPlatform.eProductFamily == IGFX_SKYLAKE) { EXPECT_STREQ(paramValue, "OpenCL 2.1 "); } EXPECT_EQ(retVal, CL_SUCCESS); @@ -44,7 +44,7 @@ GEN9TEST_F(Gen9PlatformCaps, SKLVersion) { GEN9TEST_F(Gen9PlatformCaps, BXTVersion) { char *paramValue = new char[12]; cl_int retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_VERSION, 12, paramValue, nullptr); - if (pPlatform->getDevice(0)->getHardwareInfo().pPlatform->eProductFamily == IGFX_BROXTON) { + if (pPlatform->getDevice(0)->getHardwareInfo().pPlatform.eProductFamily == IGFX_BROXTON) { EXPECT_STREQ(paramValue, "OpenCL 1.2 "); } EXPECT_EQ(retVal, CL_SUCCESS); diff --git a/unit_tests/gen9/test_preemption_gen9.cpp b/unit_tests/gen9/test_preemption_gen9.cpp index d1b5023711..898f0a008d 100644 --- a/unit_tests/gen9/test_preemption_gen9.cpp +++ b/unit_tests/gen9/test_preemption_gen9.cpp @@ -63,7 +63,7 @@ GEN9TEST_F(Gen9PreemptionTests, whenMidThreadPreemptionIsAvailableThenStateSipIs device->setPreemptionMode(PreemptionMode::MidThread); executionEnvironment->DisableMidThreadPreemption = 0; - size_t minCsrSize = device->getHardwareInfo().pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; + size_t minCsrSize = device->getHardwareInfo().pSysInfo.CsrSizeInMb * MemoryConstants::megaByte; uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte; MockGraphicsAllocation csrSurface((void *)minCsrAlignment, minCsrSize); @@ -541,6 +541,6 @@ GEN9TEST_F(Gen9PreemptionTests, givenMidThreadPreemptionModeWhenStateSipIsProgra auto cmd = hwParserOnlyPreemption.getCommand(); EXPECT_NE(nullptr, cmd); - auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform->eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform.eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); EXPECT_EQ(mockDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *mockDevice).getSipAllocation()->getGpuAddressToPatch(), cmd->getSystemInstructionPointer()); } diff --git a/unit_tests/gen9/windows/os_interface_tests_gen9.cpp b/unit_tests/gen9/windows/os_interface_tests_gen9.cpp index bc99ca0ca5..7817da483c 100644 --- a/unit_tests/gen9/windows/os_interface_tests_gen9.cpp +++ b/unit_tests/gen9/windows/os_interface_tests_gen9.cpp @@ -13,15 +13,15 @@ typedef OsInterfaceTest OsInterfaceTestSkl; GEN9TEST_F(OsInterfaceTestSkl, askKmdIfPreemptionRegisterWhitelisted) { - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); + auto hwInfo = executionEnvironment->getHardwareInfo(); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); EXPECT_TRUE(success); for (size_t i = 0u; i < numDevices; i++) { - if (hwInfo[i].pWaTable->waEnablePreemptionGranularityControlByUMD) { + if (hwInfo[i].pWaTable.waEnablePreemptionGranularityControlByUMD) { EXPECT_TRUE(hwInfo[i].capabilityTable.whitelistedRegisters.csChicken1_0x2580); } else { EXPECT_FALSE(hwInfo[i].capabilityTable.whitelistedRegisters.csChicken1_0x2580); diff --git a/unit_tests/gen_common/gen_commands_common_validation.h b/unit_tests/gen_common/gen_commands_common_validation.h index 8dffe7ce3a..d8a1f55d1a 100644 --- a/unit_tests/gen_common/gen_commands_common_validation.h +++ b/unit_tests/gen_common/gen_commands_common_validation.h @@ -93,9 +93,9 @@ void validateMediaVFEState(const HardwareInfo *hwInfo, void *cmdMediaVfeState, G auto *cmd = (MEDIA_VFE_STATE *)cmdMediaVfeState; ASSERT_NE(nullptr, cmd); - uint32_t threadPerEU = (hwInfo->pSysInfo->ThreadCount / hwInfo->pSysInfo->EUCount) + hwInfo->capabilityTable.extraQuantityThreadsPerEU; + uint32_t threadPerEU = (hwInfo->pSysInfo.ThreadCount / hwInfo->pSysInfo.EUCount) + hwInfo->capabilityTable.extraQuantityThreadsPerEU; - uint32_t expected = hwInfo->pSysInfo->EUCount * threadPerEU; + uint32_t expected = hwInfo->pSysInfo.EUCount * threadPerEU; EXPECT_EQ(expected, cmd->getMaximumNumberOfThreads()); EXPECT_NE(0u, cmd->getNumberOfUrbEntries()); EXPECT_NE(0u, cmd->getUrbEntryAllocationSize()); diff --git a/unit_tests/global_environment.cpp b/unit_tests/global_environment.cpp index 7ae3e3679e..e2f68b0035 100644 --- a/unit_tests/global_environment.cpp +++ b/unit_tests/global_environment.cpp @@ -23,7 +23,9 @@ void TestEnvironment::SetUp() { fclPushDebugVars(fclDefaultDebugVars); igcPushDebugVars(igcDefaultDebugVars); if (libraryOS == nullptr) { - libraryOS = setAdapterInfo(hwInfoDefaultDebugVars.pPlatform, hwInfoDefaultDebugVars.pSysInfo, hwInfoDefaultDebugVars.capabilityTable.gpuAddressSpace); + libraryOS = setAdapterInfo(&hwInfoDefaultDebugVars.pPlatform, + &hwInfoDefaultDebugVars.pSysInfo, + hwInfoDefaultDebugVars.capabilityTable.gpuAddressSpace); } } diff --git a/unit_tests/gmm_helper/gmm_helper_tests.cpp b/unit_tests/gmm_helper/gmm_helper_tests.cpp index 101694e3a7..399d609720 100644 --- a/unit_tests/gmm_helper/gmm_helper_tests.cpp +++ b/unit_tests/gmm_helper/gmm_helper_tests.cpp @@ -155,7 +155,7 @@ TEST_F(GmmTests, validImageTypeQuery) { EXPECT_GT(imgInfo.size, minSize); EXPECT_GT(imgInfo.rowPitch, 0u); EXPECT_GT(imgInfo.slicePitch, 0u); - if (hwinfo->pPlatform->eRenderCoreFamily == IGFX_GEN8_CORE) { + if (hwinfo->pPlatform.eRenderCoreFamily == IGFX_GEN8_CORE) { EXPECT_EQ(imgInfo.qPitch, 0u); } else { EXPECT_GT(imgInfo.qPitch, 0u); @@ -251,7 +251,7 @@ TEST_F(GmmTests, givenTilableImageWhenEnableForceLinearImagesThenYTilingIsDisabl auto queryGmm = MockGmm::queryImgParams(imgInfo); - auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform.eRenderCoreFamily); bool supportsYTiling = hwHelper.supportsYTiling(); if (!supportsYTiling) { @@ -306,7 +306,7 @@ TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet imgInfo.tilingMode = TilingMode::TILE_Y; auto gmm = std::make_unique(imgInfo); - auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform.eRenderCoreFamily); bool supportsYTiling = hwHelper.supportsYTiling(); if (!supportsYTiling) { @@ -700,9 +700,8 @@ TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThe } TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedTheSetThisHwInfoToGmmHelper) { - HardwareInfo localHwInfo = **platformDevices; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); - EXPECT_EQ(&localHwInfo, device->getGmmHelper()->getHardwareInfo()); + std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + EXPECT_EQ(device->getExecutionEnvironment()->getHardwareInfo(), device->getGmmHelper()->getHardwareInfo()); } TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) { diff --git a/unit_tests/gtpin/gtpin_tests.cpp b/unit_tests/gtpin/gtpin_tests.cpp index 9425ef1a9d..4e50f35d27 100644 --- a/unit_tests/gtpin/gtpin_tests.cpp +++ b/unit_tests/gtpin/gtpin_tests.cpp @@ -840,7 +840,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelWithoutSSHIsUsedThenK SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)pBin; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + pBHdr->Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; @@ -928,7 +928,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelWithExecEnvIsUsedThen SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)pBin; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + pBHdr->Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; @@ -1934,7 +1934,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenLowMemoryConditionOccursThe SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)pBin; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + pBHdr->Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; @@ -2083,7 +2083,7 @@ TEST_F(GTPinTests, givenKernelWithSSHThenVerifyThatSSHResizeWorksWell) { size_t offsetBTS1 = pKernel->getBindingTableOffset(); EXPECT_NE(0u, offsetBTS1); - GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; GTPinHwHelper >pinHelper = GTPinHwHelper::get(genFamily); void *pSS1 = gtpinHelper.getSurfaceState(pKernel, 0); EXPECT_NE(nullptr, pSS1); @@ -2210,7 +2210,7 @@ TEST_F(GTPinTests, givenKernelThenVerifyThatKernelCodeSubstitutionWorksWell) { } TEST_F(GTPinTests, checkWhetherGTPinHwHelperGetterWorksWell) { - GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + GFXCORE_FAMILY genFamily = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; GTPinHwHelper *pGTPinHelper = >PinHwHelper::get(genFamily); EXPECT_NE(nullptr, pGTPinHelper); } @@ -2302,7 +2302,7 @@ TEST_F(ProgramTests, givenGenBinaryWithGtpinInfoWhenProcessGenBinaryCalledThenGt SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)pBin; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + pBHdr->Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; diff --git a/unit_tests/helpers/CMakeLists.txt b/unit_tests/helpers/CMakeLists.txt index 10c9e8084d..b69ff01132 100644 --- a/unit_tests/helpers/CMakeLists.txt +++ b/unit_tests/helpers/CMakeLists.txt @@ -30,7 +30,6 @@ set(IGDRCL_SRCS_tests_helpers ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_default_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.h - ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_parse.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_parse.inl ${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands_tests.cpp diff --git a/unit_tests/helpers/execution_environment_helper.cpp b/unit_tests/helpers/execution_environment_helper.cpp index 6f29f44a0e..78e12fa2e8 100644 --- a/unit_tests/helpers/execution_environment_helper.cpp +++ b/unit_tests/helpers/execution_environment_helper.cpp @@ -16,7 +16,8 @@ ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); size_t numDevicesReturned = 0; hwInfo = nullptr; - DeviceFactory::getDevices(&hwInfo, numDevicesReturned, *executionEnvironment); + DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment); + hwInfo = executionEnvironment->getMutableHardwareInfo(); executionEnvironment->initializeMemoryManager(); return executionEnvironment; diff --git a/unit_tests/helpers/hw_helper_tests.cpp b/unit_tests/helpers/hw_helper_tests.cpp index 7a96fa5afa..a75985d31b 100644 --- a/unit_tests/helpers/hw_helper_tests.cpp +++ b/unit_tests/helpers/hw_helper_tests.cpp @@ -24,7 +24,10 @@ #include #include +using namespace NEO; + void HwHelperFixture::SetUp() { + hwInfoHelper = *platformDevices[0]; DeviceFixture::SetUp(); } void HwHelperFixture::TearDown() { @@ -118,7 +121,7 @@ TEST_F(HwHelperTest, givenEngineTypeRcsWhenCsTraitsAreQueiredThenCorrectNameInTr HWTEST_F(HwHelperTest, givenHwHelperWhenAskedForPageTableManagerSupportThenReturnCorrectValue) { auto &helper = HwHelper::get(renderCoreFamily); - EXPECT_EQ(helper.isPageTableManagerSupported(hwInfoHelper.hwInfo), UnitTestHelper::isPageTableManagerSupported(hwInfoHelper.hwInfo)); + EXPECT_EQ(helper.isPageTableManagerSupported(hwInfoHelper), UnitTestHelper::isPageTableManagerSupported(hwInfoHelper)); } TEST(DwordBuilderTest, setNonMaskedBits) { @@ -635,25 +638,25 @@ TEST_F(HwHelperTest, givenEnableLocalMemoryDebugVarAndOsEnableLocalMemoryWhenSet auto &helper = HwHelper::get(renderCoreFamily); DebugManager.flags.EnableLocalMemory.set(0); - EXPECT_FALSE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo)); + EXPECT_FALSE(helper.getEnableLocalMemory(hwInfoHelper)); DebugManager.flags.EnableLocalMemory.set(1); - EXPECT_TRUE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo)); + EXPECT_TRUE(helper.getEnableLocalMemory(hwInfoHelper)); DebugManager.flags.EnableLocalMemory.set(-1); OSInterface::osEnableLocalMemory = false; - EXPECT_FALSE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo)); + EXPECT_FALSE(helper.getEnableLocalMemory(hwInfoHelper)); OSInterface::osEnableLocalMemory = true; - EXPECT_EQ(helper.isLocalMemoryEnabled(hwInfoHelper.hwInfo), helper.getEnableLocalMemory(hwInfoHelper.hwInfo)); + EXPECT_EQ(helper.isLocalMemoryEnabled(hwInfoHelper), helper.getEnableLocalMemory(hwInfoHelper)); } TEST_F(HwHelperTest, givenAUBDumpForceAllToLocalMemoryDebugVarWhenSetThenGetEnableLocalMemoryReturnsCorrectValue) { DebugManagerStateRestore dbgRestore; - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfoHelper.hwInfo)); + std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&hwInfoHelper)); auto &helper = HwHelper::get(renderCoreFamily); DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true); - EXPECT_TRUE(helper.getEnableLocalMemory(hwInfoHelper.hwInfo)); + EXPECT_TRUE(helper.getEnableLocalMemory(hwInfoHelper)); } diff --git a/unit_tests/helpers/hw_helper_tests.h b/unit_tests/helpers/hw_helper_tests.h index 00c3e7bd33..0dcd0a616f 100644 --- a/unit_tests/helpers/hw_helper_tests.h +++ b/unit_tests/helpers/hw_helper_tests.h @@ -11,7 +11,6 @@ #include "runtime/helpers/hw_helper.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" -#include "unit_tests/helpers/hw_info_helper.h" using namespace NEO; @@ -19,7 +18,7 @@ class HwHelperFixture : public DeviceFixture { protected: void SetUp(); void TearDown(); - HwInfoHelper hwInfoHelper; + HardwareInfo hwInfoHelper; }; using HwHelperTest = Test; diff --git a/unit_tests/helpers/hw_info_helper.h b/unit_tests/helpers/hw_info_helper.h deleted file mode 100644 index 06c275f507..0000000000 --- a/unit_tests/helpers/hw_info_helper.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2018-2019 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#pragma once -#include "runtime/helpers/hw_info.h" -#include "runtime/helpers/options.h" - -using namespace NEO; - -struct HwInfoHelper { - HwInfoHelper() { - memcpy(&testPlatform, platformDevices[0]->pPlatform, sizeof(testPlatform)); - memcpy(&testFtrTable, platformDevices[0]->pSkuTable, sizeof(testFtrTable)); - memcpy(&testWaTable, platformDevices[0]->pWaTable, sizeof(testWaTable)); - memcpy(&testSysInfo, platformDevices[0]->pSysInfo, sizeof(testSysInfo)); - hwInfo.capabilityTable = platformDevices[0]->capabilityTable; - hwInfo.pPlatform = &testPlatform; - hwInfo.pSkuTable = &testFtrTable; - hwInfo.pSysInfo = &testSysInfo; - hwInfo.pWaTable = &testWaTable; - } - - PLATFORM testPlatform; - FeatureTable testFtrTable; - WorkaroundTable testWaTable; - GT_SYSTEM_INFO testSysInfo; - HardwareInfo hwInfo; -}; diff --git a/unit_tests/helpers/kmd_notify_tests.cpp b/unit_tests/helpers/kmd_notify_tests.cpp index 8170643425..f2fee49bd1 100644 --- a/unit_tests/helpers/kmd_notify_tests.cpp +++ b/unit_tests/helpers/kmd_notify_tests.cpp @@ -24,7 +24,8 @@ using namespace NEO; struct KmdNotifyTests : public ::testing::Test { void SetUp() override { - device.reset(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); + device.reset(MockDevice::createWithNewExecutionEnvironment(nullptr)); + hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); cmdQ.reset(new MockCommandQueue(&context, device.get(), nullptr)); *device->getDefaultEngine().commandStreamReceiver->getTagAddress() = taskCountToWait; cmdQ->getCommandStreamReceiver().waitForFlushStamp(flushStampToWait); @@ -34,7 +35,7 @@ struct KmdNotifyTests : public ::testing::Test { void overrideKmdNotifyParams(bool kmdNotifyEnable, int64_t kmdNotifyDelay, bool quickKmdSleepEnable, int64_t quickKmdSleepDelay, bool quickKmdSleepEnableForSporadicWaits, int64_t quickKmdSleepDelayForSporadicWaits) { - auto &properties = localHwInfo.capabilityTable.kmdNotifyProperties; + auto &properties = hwInfo->capabilityTable.kmdNotifyProperties; properties.enableKmdNotify = kmdNotifyEnable; properties.delayKmdNotifyMicroseconds = kmdNotifyDelay; properties.enableQuickKmdSleep = quickKmdSleepEnable; @@ -87,7 +88,7 @@ struct KmdNotifyTests : public ::testing::Test { } MockKmdNotifyHelper *mockKmdNotifyHelper = nullptr; - HardwareInfo localHwInfo = **platformDevices; + HardwareInfo *hwInfo = nullptr; MockContext context; std::unique_ptr device; std::unique_ptr cmdQ; @@ -281,7 +282,7 @@ HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWithDisabledSporadicWa } HWTEST_F(KmdNotifyTests, givenNewHelperWhenItsSetToCsrThenUpdateAcLineStatus) { - auto helper = new MockKmdNotifyHelper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + auto helper = new MockKmdNotifyHelper(&(hwInfo->capabilityTable.kmdNotifyProperties)); EXPECT_EQ(0u, helper->updateAcLineStatusCalled); auto csr = createMockCsr(); @@ -290,8 +291,8 @@ HWTEST_F(KmdNotifyTests, givenNewHelperWhenItsSetToCsrThenUpdateAcLineStatus) { } TEST_F(KmdNotifyTests, givenTaskCountDiffLowerThanMinimumToCheckAcLineWhenObtainingTimeoutPropertiesThenDontCheck) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = false; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); uint32_t hwTag = 9; uint32_t taskCountToWait = 10; @@ -305,8 +306,8 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffLowerThanMinimumToCheckAcLineWhenObtain } TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndDisabledKmdNotifyWhenObtainingTimeoutPropertiesThenCheck) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = false; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); uint32_t hwTag = 10; uint32_t taskCountToWait = 21; @@ -320,8 +321,8 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndDisab } TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndEnabledKmdNotifyWhenObtainingTimeoutPropertiesThenDontCheck) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = true; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = true; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); uint32_t hwTag = 10; uint32_t taskCountToWait = 21; @@ -335,8 +336,8 @@ TEST_F(KmdNotifyTests, givenTaskCountDiffGreaterThanMinimumToCheckAcLineAndEnabl } TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenAcLineIsDisconnectedThenForceEnableTimeout) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = false; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); helper.acLineConnected = false; int64_t timeout = 0; @@ -348,21 +349,21 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenAcLineIsDisconnectedTh } TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenAcLineIsDisconnectedThenDontChangeTimeoutValue) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = true; - localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = 5; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = true; + hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = 5; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); helper.acLineConnected = false; int64_t timeout = 0; bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, 2, false); EXPECT_TRUE(timeoutEnabled); - EXPECT_EQ(localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, timeout); + EXPECT_EQ(hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, timeout); } TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismAndFlushStampIsZeroWhenAcLineIsDisconnectedThenDontForceEnableTimeout) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = false; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); helper.acLineConnected = false; int64_t timeout = 0; @@ -375,8 +376,8 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismAndFlushStampIsZeroWhenAcL TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsSetThenKmdNotifyMechanismIsUsedAndReturnsShortestWaitingTimePossible) { DebugManagerStateRestore stateRestore; DebugManager.flags.PowerSavingMode.set(1u); - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = false; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); helper.acLineConnected = false; int64_t timeout = 0; @@ -387,8 +388,8 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsSetTh } TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsRequestedThenKmdNotifyMechanismIsUsedAndReturnsShortestWaitingTimePossible) { - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = false; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = false; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); int64_t timeout = 0; FlushStamp flushStampToWait = 1; @@ -400,8 +401,8 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenPowerSavingModeIsReque TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenPowerSavingModeIsSetAndNoFlushStampProvidedWhenParametersAreObtainedThenFalseIsReturned) { DebugManagerStateRestore stateRestore; DebugManager.flags.PowerSavingMode.set(1u); - localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = true; - MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties)); + hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = true; + MockKmdNotifyHelper helper(&(hwInfo->capabilityTable.kmdNotifyProperties)); helper.acLineConnected = false; int64_t timeout = 0; diff --git a/unit_tests/helpers/timestamp_packet_tests.cpp b/unit_tests/helpers/timestamp_packet_tests.cpp index b0298688a2..6943dc82ba 100644 --- a/unit_tests/helpers/timestamp_packet_tests.cpp +++ b/unit_tests/helpers/timestamp_packet_tests.cpp @@ -46,7 +46,7 @@ struct TimestampPacketSimpleTests : public ::testing::Test { struct TimestampPacketTests : public TimestampPacketSimpleTests { void SetUp() override { executionEnvironment = platformImpl->peekExecutionEnvironment(); - device = std::unique_ptr(Device::create(nullptr, executionEnvironment, 0u)); + device = std::unique_ptr(Device::create(executionEnvironment, 0u)); context = new MockContext(device.get()); kernel = std::make_unique(*device, context); mockCmdQ = new MockCommandQueue(context, device.get(), nullptr); @@ -496,7 +496,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe } HWTEST_F(TimestampPacketTests, givenEventsRequestWhenEstimatingStreamSizeForCsrThenAddSizeForSemaphores) { - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); MockContext context2(device2.get()); auto cmdQ2 = std::make_unique>(&context2, device2.get(), nullptr); @@ -583,7 +583,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; using MI_ATOMIC = typename FamilyType::MI_ATOMIC; - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -694,7 +694,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledOnDifferentCSRsFr HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingBlockedThenProgramSemaphoresOnCsrStreamOnFlush) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -739,7 +739,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingBlo HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledOnDifferentCSRsFromOneDeviceWhenEnqueueingBlockedThenProgramSemaphoresOnCsrStreamOnFlush) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; @@ -786,7 +786,7 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenDispatchingTh using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; using WALKER = WALKER_TYPE; - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); device->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; device2->getUltCommandStreamReceiver().timestampPacketWriteEnabled = true; MockContext context2(device2.get()); @@ -1120,7 +1120,7 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim HWTEST_F(TimestampPacketTests, givenEventsWaitlistFromDifferentDevicesWhenEnqueueingThenMakeAllTimestampsResident) { TagAllocator tagAllocator(executionEnvironment->memoryManager.get(), 1, 1); - auto device2 = std::unique_ptr(Device::create(nullptr, executionEnvironment, 1u)); + auto device2 = std::unique_ptr(Device::create(executionEnvironment, 1u)); auto &ultCsr = device->getUltCommandStreamReceiver(); ultCsr.timestampPacketWriteEnabled = true; diff --git a/unit_tests/kernel/debug_kernel_tests.cpp b/unit_tests/kernel/debug_kernel_tests.cpp index 0fdbcb1767..74830c01a1 100644 --- a/unit_tests/kernel/debug_kernel_tests.cpp +++ b/unit_tests/kernel/debug_kernel_tests.cpp @@ -16,7 +16,7 @@ using namespace NEO; TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) { - auto device = std::make_unique(*platformDevices[0]); + auto device = std::make_unique(); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); @@ -25,7 +25,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCal } TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) { - auto device = std::make_unique(*platformDevices[0]); + auto device = std::make_unique(); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); @@ -34,7 +34,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThrea } TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) { - auto device = std::make_unique(*platformDevices[0]); + auto device = std::make_unique(); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); @@ -43,7 +43,7 @@ TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledT } TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) { - auto device = std::make_unique(*platformDevices[0]); + auto device = std::make_unique(); MockProgram program(*device->getExecutionEnvironment()); program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); diff --git a/unit_tests/kernel/kernel_reflection_surface_tests.cpp b/unit_tests/kernel/kernel_reflection_surface_tests.cpp index 2767e645d5..ab0ac6e06f 100644 --- a/unit_tests/kernel/kernel_reflection_surface_tests.cpp +++ b/unit_tests/kernel/kernel_reflection_surface_tests.cpp @@ -605,7 +605,7 @@ TEST_P(KernelReflectionSurfaceTest, getCurbeParamsReturnsTokenMask) { } TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNonParentKernelDoesNotCreateReflectionSurface) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockProgram program(*device.getExecutionEnvironment()); KernelInfo info; MockKernel kernel(&program, info, device); @@ -623,7 +623,7 @@ TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNon DebugManagerStateRestore dbgRestorer; DebugManager.flags.ForceDispatchScheduler.set(true); - MockDevice device(*platformDevices[0]); + MockDevice device; MockProgram program(*device.getExecutionEnvironment()); KernelInfo info; MockKernel kernel(&program, info, device); diff --git a/unit_tests/kernel/kernel_tests.cpp b/unit_tests/kernel/kernel_tests.cpp index 8991925dea..6646282e0f 100644 --- a/unit_tests/kernel/kernel_tests.cpp +++ b/unit_tests/kernel/kernel_tests.cpp @@ -2288,10 +2288,8 @@ TEST(KernelTest, givenKernelWhenDebugFlagToUseMaxSimdForCalculationsIsUsedThenMa DebugManagerStateRestore dbgStateRestore; DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.set(true); - GT_SYSTEM_INFO mySysInfo = *platformDevices[0]->pSysInfo; - FeatureTable mySkuTable = *platformDevices[0]->pSkuTable; - HardwareInfo myHwInfo = {platformDevices[0]->pPlatform, &mySkuTable, platformDevices[0]->pWaTable, - &mySysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo myHwInfo = *platformDevices[0]; + GT_SYSTEM_INFO &mySysInfo = myHwInfo.pSysInfo; mySysInfo.EUCount = 24; mySysInfo.SubSliceCount = 3; @@ -2337,16 +2335,16 @@ TEST(KernelTest, givenKernelWithKernelInfoWith64bitPointerSizeThenReport64bit) { } TEST(KernelTest, givenFtrRenderCompressedBuffersWhenInitializingArgsWithNonStatefulAccessThenMarkKernelForAuxTranslation) { - HardwareInfo localHwInfo = *platformDevices[0]; - - std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(&localHwInfo)); + std::unique_ptr device(MockDevice::createWithNewExecutionEnvironment(nullptr)); + auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); + auto &capabilityTable = hwInfo->capabilityTable; auto context = clUniquePtr(new MockContext(device.get())); context->setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE); MockKernelWithInternals kernel(*device, context.get()); kernel.kernelInfo.kernelArgInfo.resize(1); kernel.kernelInfo.kernelArgInfo.at(0).typeStr = "char *"; - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; + capabilityTable.ftrRenderCompressedBuffers = false; kernel.kernelInfo.kernelArgInfo.at(0).pureStatefulBufferAccess = true; kernel.mockKernel->initialize(); EXPECT_FALSE(kernel.mockKernel->isAuxTranslationRequired()); @@ -2355,7 +2353,7 @@ TEST(KernelTest, givenFtrRenderCompressedBuffersWhenInitializingArgsWithNonState kernel.mockKernel->initialize(); EXPECT_FALSE(kernel.mockKernel->isAuxTranslationRequired()); - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + capabilityTable.ftrRenderCompressedBuffers = true; kernel.mockKernel->initialize(); EXPECT_TRUE(kernel.mockKernel->isAuxTranslationRequired()); } diff --git a/unit_tests/kernel/parent_kernel_tests.cpp b/unit_tests/kernel/parent_kernel_tests.cpp index 07414a48d8..3cd4888471 100644 --- a/unit_tests/kernel/parent_kernel_tests.cpp +++ b/unit_tests/kernel/parent_kernel_tests.cpp @@ -36,7 +36,7 @@ class MockKernelWithArgumentAccess : public Kernel { TEST(ParentKernelTest, GetObjectCounts) { KernelInfo info; - MockDevice *device = new MockDevice(*platformDevices[0]); + MockDevice *device = new MockDevice; MockProgram program(*device->getExecutionEnvironment()); SPatchExecutionEnvironment environment = {}; @@ -65,7 +65,7 @@ TEST(ParentKernelTest, GetObjectCounts) { } TEST(ParentKernelTest, patchBlocksSimdSize) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context, true)); MockProgram *program = (MockProgram *)parentKernel->mockProgram; @@ -79,7 +79,7 @@ TEST(ParentKernelTest, patchBlocksSimdSize) { } TEST(ParentKernelTest, hasDeviceEnqueue) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context)); @@ -87,14 +87,14 @@ TEST(ParentKernelTest, hasDeviceEnqueue) { } TEST(ParentKernelTest, doesnthaveDeviceEnqueue) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockKernelWithInternals kernel(device); EXPECT_FALSE(kernel.kernelInfo.hasDeviceEnqueue()); } TEST(ParentKernelTest, initializeOnParentKernelPatchesBlocksSimdSize) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context, true)); MockProgram *program = (MockProgram *)parentKernel->mockProgram; @@ -108,7 +108,7 @@ TEST(ParentKernelTest, initializeOnParentKernelPatchesBlocksSimdSize) { } TEST(ParentKernelTest, initializeOnParentKernelAllocatesPrivateMemoryForBlocks) { - MockDevice device(*platformDevices[0]); + MockDevice device; MockContext context(&device); std::unique_ptr parentKernel(MockParentKernel::create(context, true)); MockProgram *program = (MockProgram *)parentKernel->mockProgram; diff --git a/unit_tests/libult/create_command_stream.cpp b/unit_tests/libult/create_command_stream.cpp index 95e23b8d54..0892cc99f2 100644 --- a/unit_tests/libult/create_command_stream.cpp +++ b/unit_tests/libult/create_command_stream.cpp @@ -25,10 +25,9 @@ bool overrideDeviceWithDefaultHardwareInfo = true; CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment) { CommandStreamReceiver *commandStreamReceiver = nullptr; auto hwInfo = executionEnvironment.getHardwareInfo(); - assert(nullptr != hwInfo->pPlatform); auto offset = !overrideCommandStreamReceiverCreation ? IGFX_MAX_CORE : 0; if (offset != 0) { - auto funcCreate = commandStreamReceiverFactory[offset + hwInfo->pPlatform->eRenderCoreFamily]; + auto funcCreate = commandStreamReceiverFactory[offset + hwInfo->pPlatform.eRenderCoreFamily]; if (funcCreate) { commandStreamReceiver = funcCreate(false, executionEnvironment); } @@ -38,14 +37,12 @@ CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnviro return commandStreamReceiver; } -bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) { +bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) { if (overrideDeviceWithDefaultHardwareInfo) { - *hwInfo = const_cast(*platformDevices); - executionEnvironment.setHwInfo(*hwInfo); numDevicesReturned = numPlatformDevices; return getDevicesResult; } - return getDevicesImpl(hwInfo, numDevicesReturned, executionEnvironment); + return getDevicesImpl(numDevicesReturned, executionEnvironment); } } // namespace NEO diff --git a/unit_tests/libult/create_command_stream.h b/unit_tests/libult/create_command_stream.h index 9bb4242688..40aa744d60 100644 --- a/unit_tests/libult/create_command_stream.h +++ b/unit_tests/libult/create_command_stream.h @@ -13,5 +13,5 @@ extern bool overrideDeviceWithDefaultHardwareInfo; extern bool overrideMemoryManagerCreation; extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment); -extern bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); +extern bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); } // namespace NEO diff --git a/unit_tests/linux/main_linux_dll.cpp b/unit_tests/linux/main_linux_dll.cpp index 0561831141..873d2d4ba8 100644 --- a/unit_tests/linux/main_linux_dll.cpp +++ b/unit_tests/linux/main_linux_dll.cpp @@ -41,7 +41,7 @@ typedef Test DrmTests; void initializeTestedDevice() { for (uint32_t i = 0; deviceDescriptorTable[i].eGtType != GTTYPE::GTTYPE_UNDEFINED; i++) { - if (platformDevices[0]->pPlatform->eProductFamily == deviceDescriptorTable[i].pHwInfo->pPlatform->eProductFamily) { + if (platformDevices[0]->pPlatform.eProductFamily == deviceDescriptorTable[i].pHwInfo->pPlatform.eProductFamily) { deviceId = deviceDescriptorTable[i].deviceId; break; } diff --git a/unit_tests/main.cpp b/unit_tests/main.cpp index d5d5560e6d..df994146a0 100644 --- a/unit_tests/main.cpp +++ b/unit_tests/main.cpp @@ -147,7 +147,7 @@ void cleanTestHelpers() { } std::string getHardwarePrefix() { - std::string s = hardwarePrefix[platformDevices[0]->pPlatform->eProductFamily]; + std::string s = hardwarePrefix[platformDevices[0]->pPlatform.eProductFamily]; return s; } @@ -196,17 +196,17 @@ int main(int argc, char **argv) { std::string hwInfoConfig = "default"; auto numDevices = numPlatformDevices; HardwareInfo device = DEFAULT_TEST_PLATFORM::hwInfo; - hardwareInfoSetup[device.pPlatform->eProductFamily](&device, setupFeatureTableAndWorkaroundTable, hwInfoConfig); - GT_SYSTEM_INFO gtSystemInfo = *device.pSysInfo; - FeatureTable featureTable = *device.pSkuTable; - WorkaroundTable workaroundTable = *device.pWaTable; + hardwareInfoSetup[device.pPlatform.eProductFamily](&device, setupFeatureTableAndWorkaroundTable, hwInfoConfig); + GT_SYSTEM_INFO gtSystemInfo = device.pSysInfo; + FeatureTable featureTable = device.pSkuTable; + WorkaroundTable workaroundTable = device.pWaTable; - size_t revisionId = device.pPlatform->usRevId; + size_t revisionId = device.pPlatform.usRevId; uint32_t euPerSubSlice = 0; uint32_t sliceCount = 0; uint32_t subSlicePerSliceCount = 0; int dieRecovery = 0; - ::productFamily = device.pPlatform->eProductFamily; + ::productFamily = device.pPlatform.eProductFamily; for (int i = 1; i < argc; ++i) { if (!strcmp("--disable_default_listener", argv[i])) { @@ -307,15 +307,15 @@ int main(int argc, char **argv) { if (!hardwareInfo) { return -1; } - platform = *hardwareInfo->pPlatform; + platform = hardwareInfo->pPlatform; platform.usRevId = (uint16_t)revisionId; HardwareInfo hwInfo = *hardwareInfo; // set Gt and FeatureTable to initial state hardwareInfoSetup[productFamily](&hwInfo, setupFeatureTableAndWorkaroundTable, hwInfoConfig); - featureTable = *hwInfo.pSkuTable; - gtSystemInfo = *hwInfo.pSysInfo; - workaroundTable = *hwInfo.pWaTable; + featureTable = hwInfo.pSkuTable; + gtSystemInfo = hwInfo.pSysInfo; + workaroundTable = hwInfo.pWaTable; // and adjust dynamic values if not secified sliceCount = sliceCount > 0 ? sliceCount : gtSystemInfo.SliceCount; @@ -335,13 +335,13 @@ int main(int argc, char **argv) { ::productFamily = platform.eProductFamily; ::renderCoreFamily = platform.eRenderCoreFamily; - device.pPlatform = &platform; - device.pSysInfo = >SystemInfo; - device.pSkuTable = &featureTable; - device.pWaTable = &workaroundTable; + device.pPlatform = platform; + device.pSysInfo = gtSystemInfo; + device.pSkuTable = featureTable; + device.pWaTable = workaroundTable; device.capabilityTable = hardwareInfo->capabilityTable; - binaryNameSuffix.append(familyName[device.pPlatform->eRenderCoreFamily]); + binaryNameSuffix.append(familyName[device.pPlatform.eRenderCoreFamily]); binaryNameSuffix.append(getPlatformType(device)); std::string nBinaryKernelFiles = getRunPath(argv[0]); diff --git a/unit_tests/mem_obj/buffer_tests.cpp b/unit_tests/mem_obj/buffer_tests.cpp index 7269156d3a..8b3eaf0686 100644 --- a/unit_tests/mem_obj/buffer_tests.cpp +++ b/unit_tests/mem_obj/buffer_tests.cpp @@ -409,7 +409,7 @@ TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInS EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) .WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool)); - std::unique_ptr device(MockDevice::create(*platformDevices, executionEnvironment, 0)); + std::unique_ptr device(MockDevice::create(executionEnvironment, 0)); MockContext ctx(device.get()); EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) @@ -428,15 +428,15 @@ TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInS } struct RenderCompressedBuffersTests : public ::testing::Test { void SetUp() override { - localHwInfo = *platformDevices[0]; ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - device.reset(Device::create(&localHwInfo, executionEnvironment, 0u)); + hwInfo = executionEnvironment->getMutableHardwareInfo(); + device.reset(Device::create(executionEnvironment, 0u)); context = std::make_unique(device.get(), true); context->setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE); } cl_int retVal = CL_SUCCESS; - HardwareInfo localHwInfo = {}; + HardwareInfo *hwInfo = nullptr; std::unique_ptr device; std::unique_ptr context; std::unique_ptr buffer; @@ -446,7 +446,7 @@ struct RenderCompressedBuffersTests : public ::testing::Test { }; TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyHostPtrWhenCheckingMemoryPropertiesThenUseHostPtrAndDontAllocateStorage) { - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = false; void *cacheAlignedHostPtr = alignedMalloc(MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize); @@ -467,7 +467,7 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH dest[i] = pattern[i]; } - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal)); EXPECT_EQ(cacheAlignedHostPtr, buffer->getGraphicsAllocation()->getUnderlyingBuffer()); EXPECT_TRUE(buffer->isMemObjZeroCopy()); @@ -486,7 +486,7 @@ TEST_F(RenderCompressedBuffersTests, givenAllocationCreatedWithForceSharedPhysic } TEST_F(RenderCompressedBuffersTests, givenRenderCompressedBuffersAndAllocationCreatedWithForceSharedPhysicalMemoryWhenItIsCreatedItIsZeroCopy) { - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; buffer.reset(Buffer::create(context.get(), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL, 1u, nullptr, retVal)); EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY); EXPECT_TRUE(buffer->isMemObjZeroCopy()); @@ -494,7 +494,7 @@ TEST_F(RenderCompressedBuffersTests, givenRenderCompressedBuffersAndAllocationCr } TEST_F(RenderCompressedBuffersTests, givenBufferNotCompressedAllocationAndNoHostPtrWhenCheckingMemoryPropertiesThenForceDisableZeroCopy) { - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = false; buffer.reset(Buffer::create(context.get(), 0, bufferSize, nullptr, retVal)); EXPECT_TRUE(buffer->isMemObjZeroCopy()); @@ -504,13 +504,13 @@ TEST_F(RenderCompressedBuffersTests, givenBufferNotCompressedAllocationAndNoHost EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER); } - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; buffer.reset(Buffer::create(context.get(), 0, bufferSize, nullptr, retVal)); if (is32bit) { EXPECT_TRUE(buffer->isMemObjZeroCopy()); EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY); } else { - if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { + if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { EXPECT_FALSE(buffer->isMemObjZeroCopy()); EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); } else { @@ -521,14 +521,14 @@ TEST_F(RenderCompressedBuffersTests, givenBufferNotCompressedAllocationAndNoHost } TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationWhenSharedContextIsUsedThenForceDisableCompression) { - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; context->isSharedContext = false; buffer.reset(Buffer::create(context.get(), CL_MEM_READ_WRITE, bufferSize, nullptr, retVal)); if (is32bit) { EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY); } else { - if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { + if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); } else { EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY); @@ -542,14 +542,14 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationWhenSharedCo TEST_F(RenderCompressedBuffersTests, givenDebugVariableSetWhenHwFlagIsNotSetThenSelectOptionFromDebugFlag) { DebugManagerStateRestore restore; - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = false; DebugManager.flags.RenderCompressedBuffersEnabled.set(1); buffer.reset(Buffer::create(context.get(), 0, bufferSize, nullptr, retVal)); if (is32bit) { EXPECT_NE(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); } else { - if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { + if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); } else { EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY); @@ -562,7 +562,7 @@ TEST_F(RenderCompressedBuffersTests, givenDebugVariableSetWhenHwFlagIsNotSetThen } TEST_F(RenderCompressedBuffersTests, givenSvmAllocationWhenCreatingBufferThenForceDisableCompression) { - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; auto svmPtr = context->getSVMAllocsManager()->createSVMAlloc(sizeof(uint32_t), {}); auto expectedAllocationType = context->getSVMAllocsManager()->getSVMAlloc(svmPtr)->gpuAllocation->getAllocationType(); @@ -589,10 +589,10 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWh if (is32bit) { return; } - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; buffer.reset(Buffer::create(context.get(), CL_MEM_COPY_HOST_PTR, bufferSize, hostPtr, retVal)); - if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { + if (HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { EXPECT_EQ(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); EXPECT_EQ(1u, mockCmdQ->writeBufferCounter); EXPECT_TRUE(mockCmdQ->writeBufferBlocking); @@ -643,7 +643,7 @@ HWTEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenBufferWithInitializati } TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenNonRenderCompressedBufferWhenCopyFromHostPtrIsRequiredThenDontCallWriteBuffer) { - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = false; buffer.reset(Buffer::create(context.get(), CL_MEM_COPY_HOST_PTR, sizeof(uint32_t), &hostPtr, retVal)); EXPECT_NE(buffer->getGraphicsAllocation()->getAllocationType(), GraphicsAllocation::AllocationType::BUFFER_COMPRESSED); @@ -654,10 +654,10 @@ TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenNonRenderCompressedBuffe } TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenRenderCompressedBufferWhenWriteBufferFailsThenReturnErrorCode) { - if (is32bit || !HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { + if (is32bit || !HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(bufferSize)) { return; } - localHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + hwInfo->capabilityTable.ftrRenderCompressedBuffers = true; mockCmdQ->writeBufferRetValue = CL_INVALID_VALUE; buffer.reset(Buffer::create(context.get(), CL_MEM_COPY_HOST_PTR, bufferSize, hostPtr, retVal)); diff --git a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp index ce5ef894ca..86974fc99b 100644 --- a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp +++ b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp @@ -406,7 +406,7 @@ HWTEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBuf } }; - auto raiiFactory = RAIIHwHelperFactory(context.getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily); + auto raiiFactory = RAIIHwHelperFactory(context.getDevice(0)->getHardwareInfo().pPlatform.eRenderCoreFamily); cl_int errCode = CL_SUCCESS; auto buffer = Buffer::create(&context, 0, 1, nullptr, errCode); diff --git a/unit_tests/mem_obj/image_tests.cpp b/unit_tests/mem_obj/image_tests.cpp index 931f57239c..7f8b6ed4f9 100644 --- a/unit_tests/mem_obj/image_tests.cpp +++ b/unit_tests/mem_obj/image_tests.cpp @@ -1309,7 +1309,7 @@ TEST(ImageTest, givenClMemCopyHostPointerPassedToImageCreateWhenAllocationIsNotI EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) .WillRepeatedly(::testing::Invoke(memoryManager, &GMockMemoryManagerFailFirstAllocation::baseAllocateGraphicsMemoryInDevicePool)); - std::unique_ptr device(MockDevice::create(*platformDevices, executionEnvironment, 0)); + std::unique_ptr device(MockDevice::create(executionEnvironment, 0)); MockContext ctx(device.get()); EXPECT_CALL(*memoryManager, allocateGraphicsMemoryInDevicePool(::testing::_, ::testing::_)) diff --git a/unit_tests/mem_obj/mem_obj_destruction_tests.cpp b/unit_tests/mem_obj/mem_obj_destruction_tests.cpp index 3f2ad21f38..7c76a6ea20 100644 --- a/unit_tests/mem_obj/mem_obj_destruction_tests.cpp +++ b/unit_tests/mem_obj/mem_obj_destruction_tests.cpp @@ -33,7 +33,7 @@ class MemObjDestructionTest : public ::testing::TestWithParam { executionEnvironment = platformImpl->peekExecutionEnvironment(); memoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device.reset(MockDevice::create(*platformDevices, executionEnvironment, 0)); + device.reset(MockDevice::create(executionEnvironment, 0)); context.reset(new MockContext(device.get())); allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size}); diff --git a/unit_tests/mem_obj/mem_obj_tests.cpp b/unit_tests/mem_obj/mem_obj_tests.cpp index fcd77e40d6..20491f11af 100644 --- a/unit_tests/mem_obj/mem_obj_tests.cpp +++ b/unit_tests/mem_obj/mem_obj_tests.cpp @@ -163,7 +163,7 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAllocationIsNotAddedToMemoryManagerAllocationList) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - auto device = std::unique_ptr(MockDevice::create(*platformDevices, executionEnvironment, 0)); + auto device = std::unique_ptr(MockDevice::create(executionEnvironment, 0)); MockContext context(device.get()); auto memoryManager = executionEnvironment->memoryManager.get(); diff --git a/unit_tests/memory_manager/deferrable_allocation_deletion_tests.cpp b/unit_tests/memory_manager/deferrable_allocation_deletion_tests.cpp index 300c97c691..8a37426e2b 100644 --- a/unit_tests/memory_manager/deferrable_allocation_deletion_tests.cpp +++ b/unit_tests/memory_manager/deferrable_allocation_deletion_tests.cpp @@ -40,7 +40,7 @@ struct DeferrableAllocationDeletionTest : ::testing::Test { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); memoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device.reset(Device::create(nullptr, executionEnvironment, 0u)); + device.reset(Device::create(executionEnvironment, 0u)); hwTag = device->getDefaultEngine().commandStreamReceiver->getTagAddress(); defaultOsContextId = device->getDefaultEngine().osContext->getContextId(); asyncDeleter = std::make_unique(); diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 4481008086..e796fec0cb 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -182,7 +182,7 @@ TEST_F(MemoryAllocatorTest, allocateSystemAligned) { TEST_F(MemoryAllocatorTest, allocateGraphics) { unsigned int alignment = 4096; - memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -1295,7 +1295,7 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche } TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) { - memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -1479,7 +1479,7 @@ HWTEST_F(GraphicsAllocationTests, givenAllocationUsedOnlyByNonDefaultCsrWhenChec HWTEST_F(GraphicsAllocationTests, givenAllocationUsedOnlyByNonDefaultDeviceWhenCheckingUsageBeforeDestroyThenStoreItAsTemporaryAllocation) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - auto device = std::unique_ptr(Device::create(platformDevices[0], executionEnvironment, 0u)); + auto device = std::unique_ptr(Device::create(executionEnvironment, 0u)); auto &defaultCommandStreamReceiver = device->getCommandStreamReceiver(); auto &nonDefaultCommandStreamReceiver = static_cast &>(*executionEnvironment->commandStreamReceivers[0][1]); auto memoryManager = executionEnvironment->memoryManager.get(); @@ -1507,7 +1507,7 @@ HWTEST_F(GraphicsAllocationTests, givenAllocationUsedByManyOsContextsWhenCheckin multiContextDestructor->expectDrainBlockingValue(false); memoryManager->multiContextResourceDestructor.reset(multiContextDestructor); - auto device = std::unique_ptr(MockDevice::create(platformDevices[0], executionEnvironment, 0u)); + auto device = std::unique_ptr(MockDevice::create(executionEnvironment, 0u)); auto nonDefaultOsContext = device->engines[HwHelper::lowPriorityGpgpuEngineIndex].osContext; auto nonDefaultCsr = static_cast *>(device->engines[HwHelper::lowPriorityGpgpuEngineIndex].commandStreamReceiver); auto defaultCsr = static_cast *>(device->getDefaultEngine().commandStreamReceiver); @@ -1543,7 +1543,7 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) { MockExecutionEnvironment executionEnvironment(*platformDevices); MockMemoryManager memoryManager(false, false, executionEnvironment); - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); EXPECT_EQ(1u, memoryManager.getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager.registeredEngines[0].osContext->getRefInternalCount()); @@ -1554,7 +1554,7 @@ TEST(ResidencyDataTest, givenDeviceBitfieldWhenCreatingOsContextThenSetValidValu MockMemoryManager memoryManager(false, false, executionEnvironment); DeviceBitfield deviceBitfield = getDeviceBitfieldForNDevices(2); PreemptionMode preemptionMode = PreemptionMode::MidThread; - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], deviceBitfield, preemptionMode, false); EXPECT_EQ(2u, memoryManager.registeredEngines[0].osContext->getNumSupportedDevices()); EXPECT_EQ(deviceBitfield, memoryManager.registeredEngines[0].osContext->getDeviceBitfield()); @@ -1564,9 +1564,9 @@ TEST(ResidencyDataTest, givenDeviceBitfieldWhenCreatingOsContextThenSetValidValu TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegisteredFromHigherToLowerThenProperSizeIsReturned) { MockExecutionEnvironment executionEnvironment(*platformDevices); MockMemoryManager memoryManager(false, false, executionEnvironment); - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[1], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); EXPECT_EQ(2u, memoryManager.getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager.registeredEngines[0].osContext->getRefInternalCount()); @@ -1574,7 +1574,7 @@ TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegisteredFromHigherToLower } TEST(ResidencyDataTest, givenGpgpuEnginesWhenAskedForMaxOscontextCountThenValueIsGreaterOrEqual) { - auto &engines = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances(); + auto &engines = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances(); EXPECT_TRUE(maxOsContextCount >= engines.size()); } @@ -1585,8 +1585,8 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt MockResidencyData residency; - MockOsContext osContext(0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); - MockOsContext osContext2(1u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + MockOsContext osContext(0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + MockOsContext osContext2(1u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto lastFenceValue = 45llu; auto lastFenceValue2 = 23llu; diff --git a/unit_tests/memory_manager/surface_tests.cpp b/unit_tests/memory_manager/surface_tests.cpp index 3d892b4b37..da9876933d 100644 --- a/unit_tests/memory_manager/surface_tests.cpp +++ b/unit_tests/memory_manager/surface_tests.cpp @@ -66,7 +66,7 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves MockCsr *csr = new MockCsr(execStamp, *executionEnvironment); executionEnvironment->commandStreamReceivers[0].push_back(std::unique_ptr(csr)); executionEnvironment->initializeMemoryManager(); - auto engine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto engine = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); diff --git a/unit_tests/mocks/mock_device.cpp b/unit_tests/mocks/mock_device.cpp index 71f20cb82e..79345a7faf 100644 --- a/unit_tests/mocks/mock_device.cpp +++ b/unit_tests/mocks/mock_device.cpp @@ -16,8 +16,8 @@ using namespace NEO; -MockDevice::MockDevice(const HardwareInfo &hwInfo) - : MockDevice(hwInfo, new MockExecutionEnvironment(&hwInfo), 0u) { +MockDevice::MockDevice() + : MockDevice(new MockExecutionEnvironment(), 0u) { CommandStreamReceiver *commandStreamReceiver = createCommandStream(*this->executionEnvironment); executionEnvironment->commandStreamReceivers.resize(getDeviceIndex() + 1); executionEnvironment->commandStreamReceivers[getDeviceIndex()].resize(defaultEngineIndex + 1); @@ -26,13 +26,15 @@ MockDevice::MockDevice(const HardwareInfo &hwInfo) this->engines.resize(defaultEngineIndex + 1); this->engines[defaultEngineIndex] = {commandStreamReceiver, nullptr}; } -MockDevice::MockDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) - : Device(hwInfo, executionEnvironment, deviceIndex) { - bool enableLocalMemory = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily).getEnableLocalMemory(hwInfo); + +MockDevice::MockDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) + : Device(executionEnvironment, deviceIndex) { + auto &hwInfo = getHardwareInfo(); + bool enableLocalMemory = HwHelper::get(hwInfo.pPlatform.eRenderCoreFamily).getEnableLocalMemory(hwInfo); bool aubUsage = (testMode == TestMode::AubTests) || (testMode == TestMode::AubTestsWithTbx); this->mockMemoryManager.reset(new MemoryManagerCreate(false, enableLocalMemory, aubUsage, *executionEnvironment)); this->osTime = MockOSTime::create(); - mockWaTable = *hwInfo.pWaTable; + mockWaTable = hwInfo.pWaTable; executionEnvironment->setHwInfo(&hwInfo); executionEnvironment->initializeMemoryManager(); } @@ -69,14 +71,14 @@ void MockDevice::resetCommandStreamReceiver(CommandStreamReceiver *newCsr, uint3 UNRECOVERABLE_IF(getDeviceIndex() != 0u); } -MockAlignedMallocManagerDevice::MockAlignedMallocManagerDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) : MockDevice(hwInfo, executionEnvironment, deviceIndex) { +MockAlignedMallocManagerDevice::MockAlignedMallocManagerDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) : MockDevice(executionEnvironment, deviceIndex) { this->mockMemoryManager.reset(new MockAllocSysMemAgnosticMemoryManager(*executionEnvironment)); } -FailDevice::FailDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) - : MockDevice(hwInfo, executionEnvironment, deviceIndex) { +FailDevice::FailDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) + : MockDevice(executionEnvironment, deviceIndex) { this->mockMemoryManager.reset(new FailMemoryManager(*executionEnvironment)); } -FailDeviceAfterOne::FailDeviceAfterOne(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) - : MockDevice(hwInfo, executionEnvironment, deviceIndex) { +FailDeviceAfterOne::FailDeviceAfterOne(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) + : MockDevice(executionEnvironment, deviceIndex) { this->mockMemoryManager.reset(new FailMemoryManager(1, *executionEnvironment)); } diff --git a/unit_tests/mocks/mock_device.h b/unit_tests/mocks/mock_device.h index 7d467a50d5..a224581b51 100644 --- a/unit_tests/mocks/mock_device.h +++ b/unit_tests/mocks/mock_device.h @@ -32,8 +32,8 @@ class MockDevice : public Device { void *peekSlmWindowStartAddress() const { return this->slmWindowStartAddress; } - MockDevice(const HardwareInfo &hwInfo); - MockDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); + MockDevice(); + MockDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); DeviceInfo *getDeviceInfoToModify() { return &this->deviceInfo; @@ -85,16 +85,17 @@ class MockDevice : public Device { template static T *createWithExecutionEnvironment(const HardwareInfo *pHwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) { - pHwInfo = getDeviceInitHwInfo(pHwInfo); + pHwInfo = pHwInfo ? pHwInfo : platformDevices[0]; executionEnvironment->setHwInfo(pHwInfo); - T *device = new T(*pHwInfo, executionEnvironment, deviceIndex); + T *device = new T(executionEnvironment, deviceIndex); executionEnvironment->memoryManager = std::move(device->mockMemoryManager); - return createDeviceInternals(pHwInfo, device); + return createDeviceInternals(device); } template static T *createWithNewExecutionEnvironment(const HardwareInfo *pHwInfo) { ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment(); + pHwInfo = pHwInfo ? pHwInfo : platformDevices[0]; executionEnvironment->setHwInfo(pHwInfo); return createWithExecutionEnvironment(pHwInfo, executionEnvironment, 0u); } @@ -119,23 +120,24 @@ template <> inline Device *MockDevice::createWithNewExecutionEnvironment(const HardwareInfo *pHwInfo) { auto executionEnvironment = new ExecutionEnvironment(); MockAubCenterFixture::setMockAubCenter(executionEnvironment); - executionEnvironment->setHwInfo(*platformDevices); + auto hwInfo = pHwInfo ? pHwInfo : *platformDevices; + executionEnvironment->setHwInfo(hwInfo); executionEnvironment->initializeMemoryManager(); - return Device::create(pHwInfo, executionEnvironment, 0u); + return Device::create(executionEnvironment, 0u); } class FailDevice : public MockDevice { public: - FailDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); + FailDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); }; class FailDeviceAfterOne : public MockDevice { public: - FailDeviceAfterOne(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); + FailDeviceAfterOne(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); }; class MockAlignedMallocManagerDevice : public MockDevice { public: - MockAlignedMallocManagerDevice(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); + MockAlignedMallocManagerDevice(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex); }; } // namespace NEO diff --git a/unit_tests/mocks/mock_execution_environment.h b/unit_tests/mocks/mock_execution_environment.h index 2093d4f57f..87950d063d 100644 --- a/unit_tests/mocks/mock_execution_environment.h +++ b/unit_tests/mocks/mock_execution_environment.h @@ -16,7 +16,9 @@ struct MockExecutionEnvironment : ExecutionEnvironment { MockExecutionEnvironment() = default; MockExecutionEnvironment(const HardwareInfo *hwInfo) : MockExecutionEnvironment(hwInfo, true) {} MockExecutionEnvironment(const HardwareInfo *hwInfo, bool useMockAubCenter) : useMockAubCenter(useMockAubCenter) { - setHwInfo(hwInfo); + if (hwInfo) { + setHwInfo(hwInfo); + } } void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) override { if (!initAubCenterCalled) { diff --git a/unit_tests/mocks/mock_program.cpp b/unit_tests/mocks/mock_program.cpp index c5bdcf5299..e36bfed455 100644 --- a/unit_tests/mocks/mock_program.cpp +++ b/unit_tests/mocks/mock_program.cpp @@ -78,7 +78,7 @@ Program *GlobalMockSipProgram::getSipProgramWithCustomBinary() { SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)binary; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = platformDevices[0]->pPlatform->eRenderCoreFamily; + pBHdr->Device = platformDevices[0]->pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; diff --git a/unit_tests/offline_compiler/offline_compiler_tests.cpp b/unit_tests/offline_compiler/offline_compiler_tests.cpp index 973373310d..dfc2998a41 100644 --- a/unit_tests/offline_compiler/offline_compiler_tests.cpp +++ b/unit_tests/offline_compiler/offline_compiler_tests.cpp @@ -568,7 +568,7 @@ TEST(OfflineCompilerTest, generateElfBinary) { memset(&binHeader, 0, sizeof(binHeader)); binHeader.Magic = iOpenCL::MAGIC_CL; binHeader.Version = iOpenCL::CURRENT_ICBE_VERSION - 3; - binHeader.Device = platformDevices[0]->pPlatform->eRenderCoreFamily; + binHeader.Device = platformDevices[0]->pPlatform.eRenderCoreFamily; binHeader.GPUPointerSizeInBytes = 8; binHeader.NumberOfKernels = 0; binHeader.SteppingId = 0; diff --git a/unit_tests/os_interface/device_factory_tests.cpp b/unit_tests/os_interface/device_factory_tests.cpp index 9bb2c67cb4..95f8cc7f66 100644 --- a/unit_tests/os_interface/device_factory_tests.cpp +++ b/unit_tests/os_interface/device_factory_tests.cpp @@ -23,9 +23,9 @@ OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSyst struct DeviceFactoryTest : public ::testing::Test { public: void SetUp() override { - const HardwareInfo hwInfo = *platformDevices[0]; + const HardwareInfo *hwInfo = platformDevices[0]; executionEnvironment = platformImpl->peekExecutionEnvironment(); - mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace); + mockGdiDll = setAdapterInfo(&hwInfo->pPlatform, &hwInfo->pSysInfo, hwInfo->capabilityTable.gpuAddressSpace); } void TearDown() override { @@ -39,43 +39,32 @@ struct DeviceFactoryTest : public ::testing::Test { TEST_F(DeviceFactoryTest, GetDevices_Expect_True_If_Returned) { DeviceFactoryCleaner cleaner; - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); EXPECT_TRUE((numDevices > 0) ? success : !success); } TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Null) { DeviceFactoryCleaner cleaner; - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); EXPECT_TRUE((numDevices > 0) ? success : !success); - - if (numDevices > 0) { - ASSERT_NE(hwInfo, nullptr); - EXPECT_NE(hwInfo->pPlatform, nullptr); - EXPECT_NE(hwInfo->pSkuTable, nullptr); - EXPECT_NE(hwInfo->pSysInfo, nullptr); - EXPECT_NE(hwInfo->pWaTable, nullptr); - } } TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Platform) { DeviceFactoryCleaner cleaner; - HardwareInfo *hwInfo = nullptr; const HardwareInfo *refHwinfo = *platformDevices; size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); + const HardwareInfo *hwInfo = executionEnvironment->getHardwareInfo(); + EXPECT_TRUE((numDevices > 0) ? success : !success); if (numDevices > 0) { - ASSERT_NE(hwInfo, nullptr); - EXPECT_NE(hwInfo->pPlatform, nullptr); - EXPECT_EQ(refHwinfo->pPlatform->eDisplayCoreFamily, hwInfo->pPlatform->eDisplayCoreFamily); + EXPECT_EQ(refHwinfo->pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily); } } @@ -83,18 +72,17 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) { DeviceFactoryCleaner cleaner; DebugManagerStateRestore stateRestore; - HardwareInfo *hwInfoReference = nullptr; - HardwareInfo *hwInfoOverriden = nullptr; size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfoReference, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); + auto hwInfo = executionEnvironment->getHardwareInfo(); ASSERT_TRUE(success); - auto refEnableKmdNotify = hwInfoReference->capabilityTable.kmdNotifyProperties.enableKmdNotify; - auto refDelayKmdNotifyMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds; - auto refEnableQuickKmdSleep = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep; - auto refDelayQuickKmdSleepMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds; - auto refEnableQuickKmdSleepForSporadicWaits = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits; - auto refDelayQuickKmdSleepForSporadicWaitsMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds; + auto refEnableKmdNotify = hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify; + auto refDelayKmdNotifyMicroseconds = hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds; + auto refEnableQuickKmdSleep = hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep; + auto refDelayQuickKmdSleepMicroseconds = hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds; + auto refEnableQuickKmdSleepForSporadicWaits = hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits; + auto refDelayQuickKmdSleepForSporadicWaitsMicroseconds = hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds; DeviceFactory::releaseDevices(); DebugManager.flags.OverrideEnableKmdNotify.set(!refEnableKmdNotify); @@ -106,19 +94,20 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) { DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.set(!refEnableQuickKmdSleepForSporadicWaits); DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.set(static_cast(refDelayQuickKmdSleepForSporadicWaitsMicroseconds) + 12); - success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices, *executionEnvironment); + success = DeviceFactory::getDevices(numDevices, *executionEnvironment); ASSERT_TRUE(success); + hwInfo = executionEnvironment->getHardwareInfo(); - EXPECT_EQ(!refEnableKmdNotify, hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableKmdNotify); - EXPECT_EQ(refDelayKmdNotifyMicroseconds + 10, hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); + EXPECT_EQ(!refEnableKmdNotify, hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify); + EXPECT_EQ(refDelayKmdNotifyMicroseconds + 10, hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); - EXPECT_EQ(!refEnableQuickKmdSleep, hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep); - EXPECT_EQ(refDelayQuickKmdSleepMicroseconds + 11, hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds); + EXPECT_EQ(!refEnableQuickKmdSleep, hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep); + EXPECT_EQ(refDelayQuickKmdSleepMicroseconds + 11, hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds); EXPECT_EQ(!refEnableQuickKmdSleepForSporadicWaits, - hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits); + hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits); EXPECT_EQ(refDelayQuickKmdSleepForSporadicWaitsMicroseconds + 12, - hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds); + hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds); } TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) { @@ -126,24 +115,25 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) { DebugManagerStateRestore dbgRestorer; int32_t debugEngineType = 2; DebugManager.flags.NodeOrdinal.set(debugEngineType); - HardwareInfo *hwInfoOverriden = nullptr; + size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); ASSERT_TRUE(success); - ASSERT_NE(nullptr, hwInfoOverriden); - int32_t actualEngineType = static_cast(hwInfoOverriden->capabilityTable.defaultEngineType); + auto hwInfo = executionEnvironment->getHardwareInfo(); + + int32_t actualEngineType = static_cast(hwInfo->capabilityTable.defaultEngineType); EXPECT_EQ(debugEngineType, actualEngineType); } TEST_F(DeviceFactoryTest, givenPointerToHwInfoWhenGetDevicedCalledThenRequiedSurfaceSizeIsSettedProperly) { DeviceFactoryCleaner cleaner; - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); ASSERT_TRUE(success); + auto hwInfo = executionEnvironment->getHardwareInfo(); - EXPECT_EQ(hwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte, hwInfo->capabilityTable.requiredPreemptionSurfaceSize); + EXPECT_EQ(hwInfo->pSysInfo.CsrSizeInMb * MemoryConstants::megaByte, hwInfo->capabilityTable.requiredPreemptionSurfaceSize); } TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesIsCalledThenNumberOfReturnedDevicesIsEqualToDebugVariable) { @@ -151,15 +141,9 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesIsCal DebugManagerStateRestore stateRestore; auto requiredDeviceCount = 2u; DebugManager.flags.CreateMultipleDevices.set(requiredDeviceCount); - HardwareInfo *hwInfo = nullptr; - size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); - ASSERT_NE(nullptr, hwInfo); - EXPECT_NE(nullptr, hwInfo->pPlatform); - EXPECT_NE(nullptr, hwInfo->pSkuTable); - EXPECT_NE(nullptr, hwInfo->pSysInfo); - EXPECT_NE(nullptr, hwInfo->pWaTable); + size_t numDevices = 0; + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); ASSERT_TRUE(success); EXPECT_EQ(requiredDeviceCount, numDevices); @@ -170,15 +154,9 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesForPr DebugManagerStateRestore stateRestore; auto requiredDeviceCount = 2u; DebugManager.flags.CreateMultipleDevices.set(requiredDeviceCount); - HardwareInfo *hwInfo = nullptr; - size_t numDevices = 0; - bool success = DeviceFactory::getDevicesForProductFamilyOverride(&hwInfo, numDevices, *executionEnvironment); - ASSERT_NE(nullptr, hwInfo); - EXPECT_NE(nullptr, hwInfo->pPlatform); - EXPECT_NE(nullptr, hwInfo->pSkuTable); - EXPECT_NE(nullptr, hwInfo->pSysInfo); - EXPECT_NE(nullptr, hwInfo->pWaTable); + size_t numDevices = 0; + bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, *executionEnvironment); ASSERT_TRUE(success); EXPECT_EQ(requiredDeviceCount, numDevices); @@ -186,9 +164,9 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesForPr TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAllocated) { DeviceFactoryCleaner cleaner; - HardwareInfo *hwInfo = nullptr; + size_t numDevices = 0; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment); EXPECT_TRUE(success); EXPECT_NE(nullptr, executionEnvironment->osInterface); } diff --git a/unit_tests/os_interface/hw_info_config_tests.cpp b/unit_tests/os_interface/hw_info_config_tests.cpp index 6503500d4a..4c821e5c9b 100644 --- a/unit_tests/os_interface/hw_info_config_tests.cpp +++ b/unit_tests/os_interface/hw_info_config_tests.cpp @@ -16,58 +16,16 @@ using namespace std; void HwInfoConfigTest::SetUp() { PlatformFixture::SetUp(); - const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - pInHwInfo = const_cast(&hwInfo); + pInHwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - originalCapTable = pInHwInfo->capabilityTable; - - pOldPlatform = pInHwInfo->pPlatform; - memcpy(&testPlatform, pOldPlatform, sizeof(testPlatform)); - pInHwInfo->pPlatform = &testPlatform; - - pOldSkuTable = pInHwInfo->pSkuTable; - memcpy(&testSkuTable, pOldSkuTable, sizeof(testSkuTable)); - pInHwInfo->pSkuTable = &testSkuTable; - - pOldWaTable = pInHwInfo->pWaTable; - memcpy(&testWaTable, pOldWaTable, sizeof(testWaTable)); - pInHwInfo->pWaTable = &testWaTable; - - pOldSysInfo = pInHwInfo->pSysInfo; - memcpy(&testSysInfo, pOldSysInfo, sizeof(testSysInfo)); - pInHwInfo->pSysInfo = &testSysInfo; + testPlatform = &pInHwInfo.pPlatform; + testSkuTable = &pInHwInfo.pSkuTable; + testWaTable = &pInHwInfo.pWaTable; + testSysInfo = &pInHwInfo.pSysInfo; outHwInfo = {}; } void HwInfoConfigTest::TearDown() { - ReleaseOutHwInfoStructs(); - - pInHwInfo->pPlatform = pOldPlatform; - pInHwInfo->pSkuTable = pOldSkuTable; - pInHwInfo->pWaTable = pOldWaTable; - pInHwInfo->pSysInfo = pOldSysInfo; - - pInHwInfo->capabilityTable = originalCapTable; - PlatformFixture::TearDown(); } - -void HwInfoConfigTest::ReleaseOutHwInfoStructs() { - if (outHwInfo.pPlatform != nullptr) { - delete outHwInfo.pPlatform; - outHwInfo.pPlatform = nullptr; - } - if (outHwInfo.pSkuTable != nullptr) { - delete outHwInfo.pSkuTable; - outHwInfo.pSkuTable = nullptr; - } - if (outHwInfo.pWaTable != nullptr) { - delete outHwInfo.pWaTable; - outHwInfo.pWaTable = nullptr; - } - if (outHwInfo.pSysInfo != nullptr) { - delete outHwInfo.pSysInfo; - outHwInfo.pSysInfo = nullptr; - } -} diff --git a/unit_tests/os_interface/hw_info_config_tests.h b/unit_tests/os_interface/hw_info_config_tests.h index ca3ce625b8..11d3ce0215 100644 --- a/unit_tests/os_interface/hw_info_config_tests.h +++ b/unit_tests/os_interface/hw_info_config_tests.h @@ -20,22 +20,12 @@ struct HwInfoConfigTest : public ::testing::Test, public PlatformFixture { void SetUp() override; void TearDown() override; - void ReleaseOutHwInfoStructs(); - HardwareInfo *pInHwInfo; + HardwareInfo pInHwInfo; HardwareInfo outHwInfo; - RuntimeCapabilityTable originalCapTable; - - const PLATFORM *pOldPlatform; - PLATFORM testPlatform; - - const FeatureTable *pOldSkuTable; - FeatureTable testSkuTable; - - const WorkaroundTable *pOldWaTable; - WorkaroundTable testWaTable; - - const GT_SYSTEM_INFO *pOldSysInfo; - GT_SYSTEM_INFO testSysInfo; + PLATFORM *testPlatform = nullptr; + FeatureTable *testSkuTable = nullptr; + WorkaroundTable *testWaTable = nullptr; + GT_SYSTEM_INFO *testSysInfo = nullptr; }; diff --git a/unit_tests/os_interface/linux/device_command_stream_fixture.h b/unit_tests/os_interface/linux/device_command_stream_fixture.h index 3ed043c526..614fc7af43 100644 --- a/unit_tests/os_interface/linux/device_command_stream_fixture.h +++ b/unit_tests/os_interface/linux/device_command_stream_fixture.h @@ -285,7 +285,7 @@ class DrmMockCustom : public Drm { DrmMockCustom() : Drm(mockFd) { reset(); - ioctl_expected.contextCreate = static_cast(NEO::HwHelper::get(NEO::platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size()); + ioctl_expected.contextCreate = static_cast(NEO::HwHelper::get(NEO::platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances().size()); ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load(); } int getErrno() override { diff --git a/unit_tests/os_interface/linux/device_factory_tests.cpp b/unit_tests/os_interface/linux/device_factory_tests.cpp index 90aaa7ee07..b9708aa08f 100644 --- a/unit_tests/os_interface/linux/device_factory_tests.cpp +++ b/unit_tests/os_interface/linux/device_factory_tests.cpp @@ -11,48 +11,44 @@ #include "runtime/os_interface/os_interface.h" TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) { - HardwareInfo *hwInfo = nullptr; const HardwareInfo *refHwinfo = *platformDevices; size_t numDevices = 0; pDrm->StoredEUVal = 11; pDrm->StoredSSVal = 8; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); + auto hwInfo = executionEnvironment.getHardwareInfo(); EXPECT_TRUE(success); EXPECT_EQ((int)numDevices, 1); EXPECT_NE(hwInfo, nullptr); - EXPECT_NE(hwInfo->pPlatform, nullptr); - EXPECT_NE(hwInfo->pSysInfo, nullptr); - EXPECT_EQ(refHwinfo->pPlatform->eDisplayCoreFamily, hwInfo->pPlatform->eDisplayCoreFamily); - EXPECT_EQ((int)hwInfo->pSysInfo->EUCount, 11); - EXPECT_EQ((int)hwInfo->pSysInfo->SubSliceCount, 8); + EXPECT_EQ(refHwinfo->pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily); + EXPECT_EQ((int)hwInfo->pSysInfo.EUCount, 11); + EXPECT_EQ((int)hwInfo->pSysInfo.SubSliceCount, 8); //temporararily return GT2. - EXPECT_EQ(1u, hwInfo->pSkuTable->ftrGT2); + EXPECT_EQ(1u, hwInfo->pSkuTable.ftrGT2); DeviceFactory::releaseDevices(); } TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailed) { - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; pushDrmMock(nullptr); - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_FALSE(success); popDrmMock(); } TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) { - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; pDrm->StoredRetValForDeviceID = -1; - bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = DeviceFactory::getDevices(numDevices, executionEnvironment); EXPECT_FALSE(success); pDrm->StoredRetValForDeviceID = 0; @@ -60,7 +56,6 @@ TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) { TEST_F(DeviceFactoryLinuxTest, ReleaseDevices) { MockDeviceFactory mockDeviceFactory; - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; pDrm->StoredDeviceID = 0x5A84; @@ -71,7 +66,7 @@ TEST_F(DeviceFactoryLinuxTest, ReleaseDevices) { pDrm->StoredMinEUinPool = 9; pDrm->StoredRetVal = -1; - bool success = mockDeviceFactory.getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = mockDeviceFactory.getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); mockDeviceFactory.releaseDevices(); @@ -81,9 +76,8 @@ TEST_F(DeviceFactoryLinuxTest, ReleaseDevices) { TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAllocatedAndItContainDrm) { MockDeviceFactory mockDeviceFactory; - HardwareInfo *hwInfo = nullptr; size_t numDevices = 0; - bool success = mockDeviceFactory.getDevices(&hwInfo, numDevices, executionEnvironment); + bool success = mockDeviceFactory.getDevices(numDevices, executionEnvironment); EXPECT_TRUE(success); EXPECT_NE(nullptr, executionEnvironment.osInterface); EXPECT_EQ(pDrm, executionEnvironment.osInterface->get()->getDrm()); diff --git a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp index 9ea0c8a1b4..d539ae62a8 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -43,7 +43,7 @@ class DrmCommandStreamFixture { executionEnvironment.osInterface = std::make_unique(); executionEnvironment.osInterface->get()->setDrm(mock.get()); - osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr = new DrmCommandStreamReceiver(executionEnvironment, gemCloseWorkerMode::gemCloseWorkerActive); @@ -259,7 +259,7 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff .RetiresOnSaturation(); osContext = std::make_unique(*mock, 1, 1, - HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); @@ -589,7 +589,7 @@ class DrmCommandStreamEnhancedFixture *executionEnvironment); ASSERT_NE(nullptr, mm); executionEnvironment->memoryManager.reset(mm); - device.reset(MockDevice::create(platformDevices[0], executionEnvironment, 0u)); + device.reset(MockDevice::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(tCsr); ASSERT_NE(nullptr, device); } diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp index 31140a952a..800adf7c77 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp @@ -1632,7 +1632,7 @@ TEST_F(DrmMemoryManagerTest, givenOsHandleWithNonTiledObjectWhenCreateFromShared } TEST_F(DrmMemoryManagerTest, givenOsHandleWithTileYObjectWhenCreateFromSharedHandleIsCalledThenTileYGmmIsCreatedAndSetInAllocation) { - auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform.eRenderCoreFamily); if (hwHelper.supportsYTiling()) { mock->ioctl_expected.primeFdToHandle = 1; diff --git a/unit_tests/os_interface/linux/hw_info_config_linux_tests.cpp b/unit_tests/os_interface/linux/hw_info_config_linux_tests.cpp index ac69360888..b5e8e0d8b4 100644 --- a/unit_tests/os_interface/linux/hw_info_config_linux_tests.cpp +++ b/unit_tests/os_interface/linux/hw_info_config_linux_tests.cpp @@ -21,22 +21,22 @@ constexpr uint32_t hwConfigTestMidBatchBit = 1 << 10; template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { - FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); + FeatureTable *pSkuTable = &hwInfo->pSkuTable; - if (hwInfo->pPlatform->usDeviceID == 30) { - GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); + if (hwInfo->pPlatform.usDeviceID == 30) { + GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo; pSysInfo->EdramSizeInKb = 128 * 1000; } - if (hwInfo->pPlatform->usDeviceID & hwConfigTestMidThreadBit) { + if (hwInfo->pPlatform.usDeviceID & hwConfigTestMidThreadBit) { pSkuTable->ftrGpGpuMidThreadLevelPreempt = 1; } - if (hwInfo->pPlatform->usDeviceID & hwConfigTestThreadGroupBit) { + if (hwInfo->pPlatform.usDeviceID & hwConfigTestThreadGroupBit) { pSkuTable->ftrGpGpuThreadGroupLevelPreempt = 1; } - if (hwInfo->pPlatform->usDeviceID & hwConfigTestMidBatchBit) { + if (hwInfo->pPlatform.usDeviceID & hwConfigTestMidBatchBit) { pSkuTable->ftrGpGpuMidBatchPreempt = 1; } - return (hwInfo->pPlatform->usDeviceID == 10) ? -1 : 0; + return (hwInfo->pPlatform.usDeviceID == 10) ? -1 : 0; } template <> @@ -60,14 +60,13 @@ void HwInfoConfigTestLinux::SetUp() { drm = new DrmMock(); osInterface->get()->setDrm(static_cast(drm)); - drm->StoredDeviceID = pOldPlatform->usDeviceID; + drm->StoredDeviceID = pInHwInfo.pPlatform.usDeviceID; drm->StoredDeviceRevID = 0; - drm->StoredEUVal = pOldSysInfo->EUCount; - drm->StoredSSVal = pOldSysInfo->SubSliceCount; + drm->StoredEUVal = pInHwInfo.pSysInfo.EUCount; + drm->StoredSSVal = pInHwInfo.pSysInfo.SubSliceCount; rt_cpuidex_func = CpuInfo::cpuidexFunc; CpuInfo::cpuidexFunc = mockCpuidex; - testHwInfo = *pInHwInfo; } void HwInfoConfigTestLinux::TearDown() { @@ -97,7 +96,7 @@ struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux { drm->StoredDeviceID = 1; drm->setGtType(GTTYPE_GT0); - testPlatform.eRenderCoreFamily = platformDevices[0]->pPlatform->eRenderCoreFamily; + testPlatform->eRenderCoreFamily = platformDevices[0]->pPlatform.eRenderCoreFamily; } void TearDown() override { @@ -108,7 +107,7 @@ struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux { }; TEST_F(HwInfoConfigTestLinuxDummy, dummyConfig) { - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); } @@ -116,71 +115,67 @@ GTTYPE GtTypes[] = { GTTYPE_GT1, GTTYPE_GT2, GTTYPE_GT1_5, GTTYPE_GT2_5, GTTYPE_GT3, GTTYPE_GT4, GTTYPE_GTA, GTTYPE_GTC, GTTYPE_GTX}; TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigGtTypes) { - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(GTTYPE_GT0, outHwInfo.pPlatform->eGTType); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2_5); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC); - EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + EXPECT_EQ(GTTYPE_GT0, outHwInfo.pPlatform.eGTType); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2_5); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC); + EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX); size_t arrSize = sizeof(GtTypes) / sizeof(GTTYPE); uint32_t FtrSum = 0; for (uint32_t i = 0; i < arrSize; i++) { drm->setGtType(GtTypes[i]); - ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(GtTypes[i], outHwInfo.pPlatform->eGTType); - bool FtrPresent = (outHwInfo.pSkuTable->ftrGT1 || - outHwInfo.pSkuTable->ftrGT1_5 || - outHwInfo.pSkuTable->ftrGT2 || - outHwInfo.pSkuTable->ftrGT2_5 || - outHwInfo.pSkuTable->ftrGT3 || - outHwInfo.pSkuTable->ftrGT4 || - outHwInfo.pSkuTable->ftrGTA || - outHwInfo.pSkuTable->ftrGTC || - outHwInfo.pSkuTable->ftrGTX); + EXPECT_EQ(GtTypes[i], outHwInfo.pPlatform.eGTType); + bool FtrPresent = (outHwInfo.pSkuTable.ftrGT1 || + outHwInfo.pSkuTable.ftrGT1_5 || + outHwInfo.pSkuTable.ftrGT2 || + outHwInfo.pSkuTable.ftrGT2_5 || + outHwInfo.pSkuTable.ftrGT3 || + outHwInfo.pSkuTable.ftrGT4 || + outHwInfo.pSkuTable.ftrGTA || + outHwInfo.pSkuTable.ftrGTC || + outHwInfo.pSkuTable.ftrGTX); EXPECT_TRUE(FtrPresent); - FtrSum += (outHwInfo.pSkuTable->ftrGT1 + - outHwInfo.pSkuTable->ftrGT1_5 + - outHwInfo.pSkuTable->ftrGT2 + - outHwInfo.pSkuTable->ftrGT2_5 + - outHwInfo.pSkuTable->ftrGT3 + - outHwInfo.pSkuTable->ftrGT4 + - outHwInfo.pSkuTable->ftrGTA + - outHwInfo.pSkuTable->ftrGTC + - outHwInfo.pSkuTable->ftrGTX); - - ReleaseOutHwInfoStructs(); + FtrSum += (outHwInfo.pSkuTable.ftrGT1 + + outHwInfo.pSkuTable.ftrGT1_5 + + outHwInfo.pSkuTable.ftrGT2 + + outHwInfo.pSkuTable.ftrGT2_5 + + outHwInfo.pSkuTable.ftrGT3 + + outHwInfo.pSkuTable.ftrGT4 + + outHwInfo.pSkuTable.ftrGTA + + outHwInfo.pSkuTable.ftrGTC + + outHwInfo.pSkuTable.ftrGTX); } EXPECT_EQ(arrSize, FtrSum); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigEdramDetection) { drm->StoredDeviceID = 30; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram); + EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram); } TEST_F(HwInfoConfigTestLinuxDummy, givenEnabledPlatformCoherencyWhenConfiguringHwInfoThenIgnoreAndSetAsDisabled) { drm->StoredDeviceID = 21; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency); } TEST_F(HwInfoConfigTestLinuxDummy, givenDisabledPlatformCoherencyWhenConfiguringHwInfoThenSetValidCapability) { drm->StoredDeviceID = 20; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency); } @@ -188,49 +183,49 @@ TEST_F(HwInfoConfigTestLinuxDummy, givenDisabledPlatformCoherencyWhenConfiguring TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeUnknownGtType) { drm->setGtType(GTTYPE_UNDEFINED); - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeUnknownDevId) { drm->StoredDeviceID = 0; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeFailGetDevId) { drm->StoredRetValForDeviceID = -2; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-2, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummydummyNegativeFailGetDevRevId) { drm->StoredRetValForDeviceRevID = -3; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-3, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummydummyNegativeFailGetEuCount) { drm->StoredRetValForEUVal = -4; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-4, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummydummyNegativeFailGetSsCount) { drm->StoredRetValForSSVal = -5; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-5, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeFailingConfigureCustom) { drm->StoredDeviceID = 10; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } @@ -239,123 +234,123 @@ TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeUnknownDeviceId) { drm->setGtType(GTTYPE_GT1); auto hwConfig = DummyHwConfig{}; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(-1, ret); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledMidThreadOn) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = hwConfigTestMidThreadBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::MidThread, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledThreadGroupOn) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = hwConfigTestThreadGroupBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::ThreadGroup, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledMidBatchOn) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = hwConfigTestMidBatchBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::MidBatch, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledNoPreemption) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = 1; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmDisabledAllPreemption) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; drm->StoredPreemptionSupport = 0; drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_FALSE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionDriverThreadGroup) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::ThreadGroup; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::ThreadGroup; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::ThreadGroup, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionDriverMidBatch) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidBatch; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidBatch; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::MidBatch, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionDriverDisabled) { - pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled; + pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled; drm->StoredPreemptionSupport = I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PREEMPTION; drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_TRUE(drm->isPreemptionSupported()); } TEST_F(HwInfoConfigTestLinuxDummy, givenPlatformEnabledFtrCompressionWhenInitializingThenForceDisable) { - pInHwInfo->capabilityTable.ftrRenderCompressedBuffers = true; - pInHwInfo->capabilityTable.ftrRenderCompressedImages = true; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + pInHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; + pInHwInfo.capabilityTable.ftrRenderCompressedImages = true; + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages); } TEST_F(HwInfoConfigTestLinuxDummy, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) { - EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo->capabilityTable.requiredPreemptionSurfaceSize); - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface); + EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo.capabilityTable.requiredPreemptionSurfaceSize); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface); EXPECT_EQ(0, ret); - EXPECT_EQ(outHwInfo.pSysInfo->CsrSizeInMb * MemoryConstants::megaByte, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize); + EXPECT_EQ(outHwInfo.pSysInfo.CsrSizeInMb * MemoryConstants::megaByte, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize); } diff --git a/unit_tests/os_interface/linux/hw_info_config_linux_tests.h b/unit_tests/os_interface/linux/hw_info_config_linux_tests.h index 6c6b8dfa4b..d262a7c5f8 100644 --- a/unit_tests/os_interface/linux/hw_info_config_linux_tests.h +++ b/unit_tests/os_interface/linux/hw_info_config_linux_tests.h @@ -25,6 +25,4 @@ struct HwInfoConfigTestLinux : public HwInfoConfigTest { DrmMock *drm; void (*rt_cpuidex_func)(int *, int, int); - - HardwareInfo testHwInfo; }; diff --git a/unit_tests/os_interface/performance_counters_gen_tests.cpp b/unit_tests/os_interface/performance_counters_gen_tests.cpp index 3e53630035..09b73b1800 100644 --- a/unit_tests/os_interface/performance_counters_gen_tests.cpp +++ b/unit_tests/os_interface/performance_counters_gen_tests.cpp @@ -33,7 +33,7 @@ class MockPerformanceCountersGen : public PerformanceCounters { }; HWTEST_F(PerformanceCountersGenTest, givenPerfCountersWhenInitializedWithoutGenSpecificThenDefaultFunctionIsUsed) { - auto gfxCore = platformDevices[0]->pPlatform->eRenderCoreFamily; + auto gfxCore = platformDevices[0]->pPlatform.eRenderCoreFamily; VariableBackup bkp(&getPerfCountersQueryDataFactory[gfxCore], nullptr); @@ -49,7 +49,7 @@ HWTEST_F(PerformanceCountersGenTest, givenPerfCountersWhenInitializedWithoutGenS } HWTEST_F(PerformanceCountersGenTest, givenPerfCountersWhenInitializedWithGenSpecificThenGenFunctionIsUsed) { - VariableBackup bkp(&getPerfCountersQueryDataFactory[platformDevices[0]->pPlatform->eRenderCoreFamily]); + VariableBackup bkp(&getPerfCountersQueryDataFactory[platformDevices[0]->pPlatform.eRenderCoreFamily]); auto mockFn = []( InstrEscCbData cbData, diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index d8d8343614..ff13463518 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -65,7 +65,7 @@ class WddmCommandStreamFixture { memoryManager = new MockWddmMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device.reset(MockDevice::create(platformDevices[0], executionEnvironment, 0u)); + device.reset(MockDevice::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(csr); ASSERT_NE(nullptr, device); } @@ -125,7 +125,7 @@ class WddmCommandStreamWithMockGdiFixture { memoryManager = new WddmMemoryManager(*executionEnvironment); ASSERT_NE(nullptr, memoryManager); executionEnvironment->memoryManager.reset(memoryManager); - device = std::unique_ptr(Device::create(platformDevices[0], executionEnvironment, 0u)); + device = std::unique_ptr(Device::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(this->csr); ASSERT_NE(nullptr, device); this->csr->overrideRecorededCommandBuffer(*device); @@ -248,7 +248,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf executionEnvironment->commandStreamReceivers[0].push_back(std::make_unique>(*executionEnvironment)); executionEnvironment->memoryManager.reset(new MemoryManagerCreate(false, false, *executionEnvironment)); executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); - OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext); @@ -274,7 +274,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn executionEnvironment->commandStreamReceivers[0].push_back(std::make_unique>(*executionEnvironment)); executionEnvironment->memoryManager.reset(new MemoryManagerCreate(false, false, *executionEnvironment)); executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); - OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext); @@ -789,7 +789,7 @@ using WddmSimpleTest = ::testing::Test; HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedOn) { DebugManager.flags.CsrDispatchMode.set(0); ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - std::unique_ptr device(Device::create(platformDevices[0], executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); auto wddm = Wddm::createWddm(); executionEnvironment->osInterface = std::make_unique(); executionEnvironment->osInterface->get()->setWddm(wddm); @@ -798,9 +798,6 @@ HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedO } HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVersionBasingOnFtrFlag) { - HardwareInfo myHwInfo = *platformDevices[0]; - FeatureTable myFtrTable = *myHwInfo.pSkuTable; - myHwInfo.pSkuTable = &myFtrTable; auto wddm = Wddm::createWddm(); pDevice->executionEnvironment->osInterface = std::make_unique(); pDevice->executionEnvironment->osInterface->get()->setWddm(wddm); @@ -832,7 +829,7 @@ struct WddmCsrCompressionParameterizedTest : WddmCsrCompressionTests, ::testing: HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) { ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo); - std::unique_ptr device(Device::create(hwInfo, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); setCompressionEnabled(compressionEnabled, !compressionEnabled); myMockWddm = static_cast(executionEnvironment->osInterface->get()->getWddm()); EXPECT_EQ(nullptr, myMockWddm->getPageTableManager()); @@ -880,7 +877,7 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitial HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) { ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo); - std::unique_ptr device(Device::create(hwInfo, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); setCompressionEnabled(false, false); myMockWddm = static_cast(executionEnvironment->osInterface->get()->getWddm()); MockWddmCsr mockWddmCsr(*executionEnvironment); @@ -897,7 +894,7 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenFlushin executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment)); auto mockMngr = reinterpret_cast(myMockWddm->getPageTableManager()); - std::unique_ptr device(Device::create(hwInfo, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(mockWddmCsr); auto memoryManager = executionEnvironment->memoryManager.get(); @@ -942,7 +939,7 @@ HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontIn mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch); executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment)); - std::unique_ptr device(Device::create(hwInfo, executionEnvironment, 0u)); + std::unique_ptr device(Device::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(mockWddmCsr); auto memoryManager = executionEnvironment->memoryManager.get(); diff --git a/unit_tests/os_interface/windows/driver_info_tests.cpp b/unit_tests/os_interface/windows/driver_info_tests.cpp index 0ca5352287..49228eb99d 100644 --- a/unit_tests/os_interface/windows/driver_info_tests.cpp +++ b/unit_tests/os_interface/windows/driver_info_tests.cpp @@ -33,12 +33,12 @@ class DriverInfoDeviceTest : public ::testing::Test { public: void SetUp() { hwInfo = platformDevices[0]; - commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily]; - commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily] = createMockCommandStreamReceiver; + commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily]; + commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily] = createMockCommandStreamReceiver; } void TearDown() { - commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily] = commandStreamReceiverCreateFunc; + commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily] = commandStreamReceiverCreateFunc; } CommandStreamReceiverCreateFunc commandStreamReceiverCreateFunc; diff --git a/unit_tests/os_interface/windows/gdi_dll_fixture.h b/unit_tests/os_interface/windows/gdi_dll_fixture.h index 235973ed75..8e9dd3bde5 100644 --- a/unit_tests/os_interface/windows/gdi_dll_fixture.h +++ b/unit_tests/os_interface/windows/gdi_dll_fixture.h @@ -17,8 +17,8 @@ OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSyst struct GdiDllFixture { virtual void SetUp() { - const HardwareInfo hwInfo = *platformDevices[0]; - mockGdiDll.reset(setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace)); + const HardwareInfo *hwInfo = platformDevices[0]; + mockGdiDll.reset(setAdapterInfo(&hwInfo->pPlatform, &hwInfo->pSysInfo, hwInfo->capabilityTable.gpuAddressSpace)); setSizesFcn = reinterpret_cast(mockGdiDll->getProcAddress("MockSetSizes")); getSizesFcn = reinterpret_cast(mockGdiDll->getProcAddress("GetMockSizes")); diff --git a/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp b/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp index 2e0046cd1e..618c839597 100644 --- a/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp +++ b/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp @@ -326,7 +326,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza FailSignalSyncObjectMock::reset(); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.serverSynchronizationObject = 0x5cU; @@ -385,7 +385,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza FailSignalSyncObjectMock::reset(); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.submissionSynchronizationObject = 0x7cU; diff --git a/unit_tests/os_interface/windows/hw_info_config_win_tests.cpp b/unit_tests/os_interface/windows/hw_info_config_win_tests.cpp index 6dfb627472..937f0eea87 100644 --- a/unit_tests/os_interface/windows/hw_info_config_win_tests.cpp +++ b/unit_tests/os_interface/windows/hw_info_config_win_tests.cpp @@ -29,7 +29,6 @@ void HwInfoConfigTestWindows::SetUp() { std::unique_ptr wddm(Wddm::createWddm()); wddm->enumAdapters(outHwInfo); - testHwInfo = outHwInfo; } void HwInfoConfigTestWindows::TearDown() { @@ -37,14 +36,14 @@ void HwInfoConfigTestWindows::TearDown() { } TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenReturnSuccess) { - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get()); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get()); EXPECT_EQ(0, ret); } TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenSetFtrSvmCorrectly) { - auto ftrSvm = outHwInfo.pSkuTable->ftrSVM; + auto ftrSvm = outHwInfo.pSkuTable.ftrSVM; - int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get()); + int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get()); ASSERT_EQ(0, ret); EXPECT_EQ(outHwInfo.capabilityTable.ftrSvm, ftrSvm); @@ -54,12 +53,12 @@ TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabl int ret; outHwInfo.capabilityTable.instrumentationEnabled = false; - ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get()); + ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get()); ASSERT_EQ(0, ret); EXPECT_FALSE(outHwInfo.capabilityTable.instrumentationEnabled); outHwInfo.capabilityTable.instrumentationEnabled = true; - ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get()); + ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get()); ASSERT_EQ(0, ret); EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled == haveInstrumentation); } diff --git a/unit_tests/os_interface/windows/hw_info_config_win_tests.h b/unit_tests/os_interface/windows/hw_info_config_win_tests.h index 45b39c4a69..e8cc0cd9db 100644 --- a/unit_tests/os_interface/windows/hw_info_config_win_tests.h +++ b/unit_tests/os_interface/windows/hw_info_config_win_tests.h @@ -22,7 +22,6 @@ struct HwInfoConfigTestWindows : public HwInfoConfigTest { void TearDown() override; std::unique_ptr osInterface; - HardwareInfo testHwInfo; DummyHwConfig hwConfig; }; diff --git a/unit_tests/os_interface/windows/os_interface_win_tests.cpp b/unit_tests/os_interface/windows/os_interface_win_tests.cpp index 2b051f1d8e..144aab720f 100644 --- a/unit_tests/os_interface/windows/os_interface_win_tests.cpp +++ b/unit_tests/os_interface/windows/os_interface_win_tests.cpp @@ -30,7 +30,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextBeforeInitWddmThenOsContextIsNot auto wddm = new WddmMock; OSInterface osInterface; osInterface.get()->setWddm(wddm); - EXPECT_THROW(OsContextWin(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + EXPECT_THROW(OsContextWin(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false), std::exception); } @@ -42,7 +42,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called); - auto osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + auto osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); EXPECT_TRUE(osContext->isInitialized()); EXPECT_EQ(osContext->getWddm(), wddm); EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called); diff --git a/unit_tests/os_interface/windows/wddm20_tests.cpp b/unit_tests/os_interface/windows/wddm20_tests.cpp index 08ebb963f1..56ccb603c0 100644 --- a/unit_tests/os_interface/windows/wddm20_tests.cpp +++ b/unit_tests/os_interface/windows/wddm20_tests.cpp @@ -89,81 +89,59 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp TEST(Wddm20EnumAdaptersTest, expectTrue) { HardwareInfo outHwInfo; - const HardwareInfo hwInfo = *platformDevices[0]; - OsLibrary *mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace); + const HardwareInfo *hwInfo = platformDevices[0]; + std::unique_ptr mockGdiDll(setAdapterInfo(&hwInfo->pPlatform, + &hwInfo->pSysInfo, + hwInfo->capabilityTable.gpuAddressSpace)); std::unique_ptr wddm(Wddm::createWddm()); bool success = wddm->enumAdapters(outHwInfo); EXPECT_TRUE(success); - const HardwareInfo *hwinfo = *platformDevices; - - ASSERT_NE(nullptr, outHwInfo.pPlatform); - EXPECT_EQ(outHwInfo.pPlatform->eDisplayCoreFamily, hwinfo->pPlatform->eDisplayCoreFamily); - delete mockGdiDll; - - delete outHwInfo.pPlatform; - delete outHwInfo.pSkuTable; - delete outHwInfo.pSysInfo; - delete outHwInfo.pWaTable; + EXPECT_EQ(outHwInfo.pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily); } TEST(Wddm20EnumAdaptersTest, givenEmptyHardwareInfoWhenEnumAdapterIsCalledThenCapabilityTableIsSet) { HardwareInfo outHwInfo = {}; - auto hwInfo = *platformDevices[0]; - std::unique_ptr mockGdiDll(setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace)); + const HardwareInfo *hwInfo = platformDevices[0]; + std::unique_ptr mockGdiDll(setAdapterInfo(&hwInfo->pPlatform, + &hwInfo->pSysInfo, + hwInfo->capabilityTable.gpuAddressSpace)); std::unique_ptr wddm(Wddm::createWddm()); bool success = wddm->enumAdapters(outHwInfo); EXPECT_TRUE(success); - const HardwareInfo *hwinfo = *platformDevices; + EXPECT_EQ(outHwInfo.pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily); - ASSERT_NE(nullptr, outHwInfo.pPlatform); - EXPECT_EQ(outHwInfo.pPlatform->eDisplayCoreFamily, hwinfo->pPlatform->eDisplayCoreFamily); - - EXPECT_EQ(outHwInfo.capabilityTable.defaultProfilingTimerResolution, hwInfo.capabilityTable.defaultProfilingTimerResolution); - EXPECT_EQ(outHwInfo.capabilityTable.clVersionSupport, hwInfo.capabilityTable.clVersionSupport); - EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify, hwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify); - EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, hwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); - EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleep, hwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleep); - EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds, hwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds); - - delete outHwInfo.pPlatform; - delete outHwInfo.pSkuTable; - delete outHwInfo.pSysInfo; - delete outHwInfo.pWaTable; + EXPECT_EQ(outHwInfo.capabilityTable.defaultProfilingTimerResolution, hwInfo->capabilityTable.defaultProfilingTimerResolution); + EXPECT_EQ(outHwInfo.capabilityTable.clVersionSupport, hwInfo->capabilityTable.clVersionSupport); + EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify, hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify); + EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds); + EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleep, hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep); + EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds, hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds); } TEST(Wddm20EnumAdaptersTest, givenUnknownPlatformWhenEnumAdapterIsCalledThenFalseIsReturnedAndOutputIsEmpty) { - HardwareInfo outHwInfo; - - memset(&outHwInfo, 0, sizeof(outHwInfo)); + HardwareInfo outHwInfo = {}; HardwareInfo hwInfo = *platformDevices[0]; - auto bkp = hwInfo.pPlatform->eProductFamily; - PLATFORM platform = *(hwInfo.pPlatform); - platform.eProductFamily = IGFX_UNKNOWN; + hwInfo.pPlatform.eProductFamily = IGFX_UNKNOWN; + std::unique_ptr mockGdiDll(setAdapterInfo(&hwInfo.pPlatform, + &hwInfo.pSysInfo, + hwInfo.capabilityTable.gpuAddressSpace)); - std::unique_ptr> mockGdiDll( - setAdapterInfo(&platform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace), - [&](OsLibrary *ptr) { - platform.eProductFamily = bkp; - typedef void(__stdcall * pfSetAdapterInfo)(const void *, const void *, uint64_t); - pfSetAdapterInfo fSetAdpaterInfo = reinterpret_cast(ptr->getProcAddress("MockSetAdapterInfo")); - - fSetAdpaterInfo(&platform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace); - delete ptr; - }); std::unique_ptr wddm(Wddm::createWddm()); auto ret = wddm->enumAdapters(outHwInfo); EXPECT_FALSE(ret); - EXPECT_EQ(nullptr, outHwInfo.pPlatform); - EXPECT_EQ(nullptr, outHwInfo.pSkuTable); - EXPECT_EQ(nullptr, outHwInfo.pSysInfo); - EXPECT_EQ(nullptr, outHwInfo.pWaTable); + + // reset mock gdi + hwInfo = *platformDevices[0]; + mockGdiDll.reset(setAdapterInfo(&hwInfo.pPlatform, + &hwInfo.pSysInfo, + hwInfo.capabilityTable.gpuAddressSpace)); } TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) { @@ -454,7 +432,7 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) { D3DKMT_HANDLE adapterHandle = ADAPTER_HANDLE; D3DKMT_HANDLE deviceHandle = DEVICE_HANDLE; const HardwareInfo hwInfo = *platformDevices[0]; - BOOLEAN FtrL3IACoherency = hwInfo.pSkuTable->ftrL3IACoherency ? 1 : 0; + BOOLEAN FtrL3IACoherency = hwInfo.pSkuTable.ftrL3IACoherency ? 1 : 0; uintptr_t maxAddr = hwInfo.capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress ? reinterpret_cast(sysInfo.lpMaximumApplicationAddress) + 1 : 0; @@ -530,7 +508,7 @@ TEST_F(Wddm20WithMockGdiDllTestsWithoutWddmInit, givenUseNoRingFlushesKmdModeDeb TEST_F(Wddm20WithMockGdiDllTestsWithoutWddmInit, givenEngineTypeWhenCreatingContextThenPassCorrectNodeOrdinal) { init(); auto createContextParams = this->getCreateContextDataFcn(); - UINT expected = WddmEngineMapper::engineNodeMap(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]); + UINT expected = WddmEngineMapper::engineNodeMap(HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]); EXPECT_EQ(expected, createContextParams->NodeOrdinal); } diff --git a/unit_tests/os_interface/windows/wddm23_tests.cpp b/unit_tests/os_interface/windows/wddm23_tests.cpp index 3f6d7c6f89..e6f7e5f48d 100644 --- a/unit_tests/os_interface/windows/wddm23_tests.cpp +++ b/unit_tests/os_interface/windows/wddm23_tests.cpp @@ -38,7 +38,7 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture { void init() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); EXPECT_TRUE(wddm->init(preemptionMode)); - osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); } void TearDown() override { @@ -66,7 +66,7 @@ TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) { } TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) { - auto defaultEngine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; + auto defaultEngine = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]; OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled, false); OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch, false); diff --git a/unit_tests/os_interface/windows/wddm_fixture.h b/unit_tests/os_interface/windows/wddm_fixture.h index 681263b7a6..13f354c47c 100644 --- a/unit_tests/os_interface/windows/wddm_fixture.h +++ b/unit_tests/os_interface/windows/wddm_fixture.h @@ -33,7 +33,7 @@ struct WddmFixture : ::testing::Test { wddm->gdi.reset(gdi); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); ASSERT_TRUE(wddm->isInitialized()); } @@ -58,7 +58,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture { void init() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); EXPECT_TRUE(wddm->init(preemptionMode)); - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); ASSERT_TRUE(wddm->isInitialized()); } diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index f2d690ac4d..cc45552095 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -326,7 +326,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSingleEngineRegister } TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForEachEngine) { - memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], + memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[1], 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); @@ -344,7 +344,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi } TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForTheseEngines) { - memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], + memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[1], 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.h b/unit_tests/os_interface/windows/wddm_memory_manager_tests.h index 3144dfb71f..d25fafc109 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.h +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.h @@ -56,7 +56,7 @@ class MockWddmMemoryManagerFixture { executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(*executionEnvironment); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); osContext->incRefInternal(); @@ -101,7 +101,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture memoryManager = new (std::nothrow) MockWddmMemoryManager(*executionEnvironment); //assert we have memory manager ASSERT_NE(nullptr, memoryManager); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false); + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false); osContext->incRefInternal(); diff --git a/unit_tests/os_interface/windows/wddm_preemption_tests.cpp b/unit_tests/os_interface/windows/wddm_preemption_tests.cpp index edecae3b91..1ad9d11181 100644 --- a/unit_tests/os_interface/windows/wddm_preemption_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_preemption_tests.cpp @@ -37,7 +37,7 @@ class WddmPreemptionTests : public Test { regReader->forceRetValue = forceReturnPreemptionRegKeyValue; auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfoTest); wddm->init(preemptionMode); - osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); + osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); } DebugManagerStateRestore *dbgRestorer = nullptr; diff --git a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp index adceb85b80..60f13689aa 100644 --- a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp @@ -92,7 +92,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(*executionEnvironment); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false); + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false); osContext->incRefInternal(); residencyController = &static_cast(osContext)->getResidencyController(); @@ -123,7 +123,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(*executionEnvironment); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); osContext->incRefInternal(); diff --git a/unit_tests/platform/platform_tests.cpp b/unit_tests/platform/platform_tests.cpp index cfdfe1e56f..626305ecdb 100644 --- a/unit_tests/platform/platform_tests.cpp +++ b/unit_tests/platform/platform_tests.cpp @@ -188,12 +188,12 @@ class PlatformFailingTest : public PlatformTest { void SetUp() override { PlatformTest::SetUp(); hwInfo = platformDevices[0]; - commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily]; - commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily] = createMockCommandStreamReceiver; + commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily]; + commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily] = createMockCommandStreamReceiver; } void TearDown() override { - commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily] = commandStreamReceiverCreateFunc; + commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily] = commandStreamReceiverCreateFunc; PlatformTest::TearDown(); } diff --git a/unit_tests/preamble/preamble_fixture.h b/unit_tests/preamble/preamble_fixture.h index 986919ae67..f99321c99a 100644 --- a/unit_tests/preamble/preamble_fixture.h +++ b/unit_tests/preamble/preamble_fixture.h @@ -40,22 +40,14 @@ class PreambleVfeState : public PlatformFixture, LinearStreamFixture::SetUp(); HardwareParse::SetUp(); PlatformFixture::SetUp(); - const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - HardwareInfo *pHwInfo = const_cast(&hwInfo); - pOldWaTable = pHwInfo->pWaTable; - memcpy(&testWaTable, pOldWaTable, sizeof(testWaTable)); - pHwInfo->pWaTable = &testWaTable; + testWaTable = &pPlatform->peekExecutionEnvironment()->getMutableHardwareInfo()->pWaTable; } void TearDown() override { - const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo(); - HardwareInfo *pHwInfo = const_cast(&hwInfo); - pHwInfo->pWaTable = pOldWaTable; PlatformFixture::TearDown(); HardwareParse::TearDown(); LinearStreamFixture::TearDown(); ::testing::Test::TearDown(); } - WorkaroundTable testWaTable; - const WorkaroundTable *pOldWaTable; + WorkaroundTable *testWaTable; }; diff --git a/unit_tests/preamble/preamble_tests.cpp b/unit_tests/preamble/preamble_tests.cpp index 87e0f83ce2..88e04012ba 100644 --- a/unit_tests/preamble/preamble_tests.cpp +++ b/unit_tests/preamble/preamble_tests.cpp @@ -182,9 +182,9 @@ HWTEST_F(PreambleTest, givenKernelDebuggingActiveAndMidThreadPreemptionWhenGetAd HWTEST_F(PreambleTest, givenDefaultPreambleWhenGetThreadsMaxNumberIsCalledThenMaximumNumberOfThreadsIsReturned) { const HardwareInfo &hwInfo = **platformDevices; - uint32_t threadsPerEU = (hwInfo.pSysInfo->ThreadCount / hwInfo.pSysInfo->EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU; + uint32_t threadsPerEU = (hwInfo.pSysInfo.ThreadCount / hwInfo.pSysInfo.EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU; uint32_t value = PreambleHelper::getMaxThreadsForVfe(hwInfo); - uint32_t expected = hwInfo.pSysInfo->EUCount * threadsPerEU; + uint32_t expected = hwInfo.pSysInfo.EUCount * threadsPerEU; EXPECT_EQ(expected, value); } diff --git a/unit_tests/preemption/preemption_tests.cpp b/unit_tests/preemption/preemption_tests.cpp index b34169428e..8741a29830 100644 --- a/unit_tests/preemption/preemption_tests.cpp +++ b/unit_tests/preemption/preemption_tests.cpp @@ -337,7 +337,7 @@ HWTEST_P(PreemptionHwTest, getRequiredCmdStreamSizeReturnsSizeOfMiLoadRegisterIm auto mockDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); - size_t minCsrSize = mockDevice->getHardwareInfo().pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; + size_t minCsrSize = mockDevice->getHardwareInfo().pSysInfo.CsrSizeInMb * MemoryConstants::megaByte; uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte; MockGraphicsAllocation csrSurface((void *)minCsrAlignment, minCsrSize); @@ -372,7 +372,7 @@ HWTEST_P(PreemptionHwTest, programCmdStreamAddsProperMiLoadRegisterImmCommandToT StackVec buffer(requiredSize); LinearStream cmdStream(buffer.begin(), buffer.size()); - size_t minCsrSize = mockDevice->getHardwareInfo().pSysInfo->CsrSizeInMb * MemoryConstants::megaByte; + size_t minCsrSize = mockDevice->getHardwareInfo().pSysInfo.CsrSizeInMb * MemoryConstants::megaByte; uint64_t minCsrAlignment = 2 * 256 * MemoryConstants::kiloByte; MockGraphicsAllocation csrSurface((void *)minCsrAlignment, minCsrSize); @@ -445,12 +445,10 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values(PreemptionMode::Disabled, PreemptionMode::MidBatch, PreemptionMode::ThreadGroup)); HWTEST_F(MidThreadPreemptionTests, createCsrSurfaceNoWa) { - const WorkaroundTable *waTable = platformDevices[0]->pWaTable; - WorkaroundTable tmpWaTable; - tmpWaTable.waCSRUncachable = false; - const_cast(platformDevices[0])->pWaTable = &tmpWaTable; + HardwareInfo hwInfo = *platformDevices[0]; + hwInfo.pWaTable.waCSRUncachable = false; - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); ASSERT_NE(nullptr, mockDevice.get()); auto &csr = mockDevice->getUltCommandStreamReceiver(); @@ -460,8 +458,6 @@ HWTEST_F(MidThreadPreemptionTests, createCsrSurfaceNoWa) { GraphicsAllocation *devCsrSurface = mockDevice->getPreemptionAllocation(); EXPECT_EQ(csrSurface, devCsrSurface); - - const_cast(platformDevices[0])->pWaTable = waTable; } HWTEST_F(MidThreadPreemptionTests, givenMidThreadPreemptionWhenFailingOnCsrSurfaceAllocationThenFailToCreateDevice) { @@ -470,7 +466,7 @@ HWTEST_F(MidThreadPreemptionTests, givenMidThreadPreemptionWhenFailingOnCsrSurfa FailingMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(executionEnvironment) {} GraphicsAllocation *allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) override { - if (++allocateGraphicsMemoryCount > HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size()) { + if (++allocateGraphicsMemoryCount > HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances().size()) { return nullptr; } return OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment(allocationData); @@ -481,17 +477,15 @@ HWTEST_F(MidThreadPreemptionTests, givenMidThreadPreemptionWhenFailingOnCsrSurfa ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); executionEnvironment->memoryManager = std::make_unique(*executionEnvironment); - std::unique_ptr mockDevice(MockDevice::create(platformDevices[0], executionEnvironment, 0)); + std::unique_ptr mockDevice(MockDevice::create(executionEnvironment, 0)); EXPECT_EQ(nullptr, mockDevice.get()); } HWTEST_F(MidThreadPreemptionTests, createCsrSurfaceWa) { - const WorkaroundTable *waTable = platformDevices[0]->pWaTable; - WorkaroundTable tmpWaTable; - tmpWaTable.waCSRUncachable = true; - const_cast(platformDevices[0])->pWaTable = &tmpWaTable; + HardwareInfo hwInfo = *platformDevices[0]; + hwInfo.pWaTable.waCSRUncachable = true; - std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(platformDevices[0])); + std::unique_ptr mockDevice(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); ASSERT_NE(nullptr, mockDevice.get()); auto &csr = mockDevice->getUltCommandStreamReceiver(); @@ -501,8 +495,6 @@ HWTEST_F(MidThreadPreemptionTests, createCsrSurfaceWa) { GraphicsAllocation *devCsrSurface = mockDevice->getPreemptionAllocation(); EXPECT_EQ(csrSurface, devCsrSurface); - - const_cast(platformDevices[0])->pWaTable = waTable; } HWCMDTEST_F(IGFX_GEN8_CORE, MidThreadPreemptionTests, givenDirtyCsrStateWhenStateBaseAddressIsProgrammedThenStateSipIsAdded) { diff --git a/unit_tests/program/program_data_tests.cpp b/unit_tests/program/program_data_tests.cpp index 803bff21d6..87b5370439 100644 --- a/unit_tests/program/program_data_tests.cpp +++ b/unit_tests/program/program_data_tests.cpp @@ -127,7 +127,7 @@ void ProgramDataTest::buildAndDecodeProgramPatchList() { cl_int error = CL_SUCCESS; programBinaryHeader.Magic = 0x494E5443; programBinaryHeader.Version = CURRENT_ICBE_VERSION; - programBinaryHeader.Device = platformDevices[0]->pPlatform->eRenderCoreFamily; + programBinaryHeader.Device = platformDevices[0]->pPlatform.eRenderCoreFamily; programBinaryHeader.GPUPointerSizeInBytes = 8; programBinaryHeader.NumberOfKernels = 0; programBinaryHeader.PatchListSize = programPatchListSize; diff --git a/unit_tests/program/program_nonuniform.cpp b/unit_tests/program/program_nonuniform.cpp index ad1651ac15..6c5d6bfc89 100644 --- a/unit_tests/program/program_nonuniform.cpp +++ b/unit_tests/program/program_nonuniform.cpp @@ -103,7 +103,7 @@ TEST(ProgramNonUniform, UpdateAllowNonUniform21UniformFlag) { TEST(KernelNonUniform, GetAllowNonUniformFlag) { KernelInfo ki; - MockDevice d(*platformDevices[0]); + MockDevice d; MockProgram pm(*d.getExecutionEnvironment()); struct KernelMock : Kernel { KernelMock(Program *p, KernelInfo &ki, Device &d) diff --git a/unit_tests/program/program_tests.cpp b/unit_tests/program/program_tests.cpp index 7aa1b7a57b..6a0986e5f0 100644 --- a/unit_tests/program/program_tests.cpp +++ b/unit_tests/program/program_tests.cpp @@ -1545,7 +1545,7 @@ TEST(ProgramFromBinaryTests, givenBinaryWithInvalidICBEThenErrorIsReturned) { memset(&binHeader, 0, sizeof(binHeader)); binHeader.Magic = iOpenCL::MAGIC_CL; binHeader.Version = iOpenCL::CURRENT_ICBE_VERSION - 3; - binHeader.Device = platformDevices[0]->pPlatform->eRenderCoreFamily; + binHeader.Device = platformDevices[0]->pPlatform.eRenderCoreFamily; binHeader.GPUPointerSizeInBytes = 8; binHeader.NumberOfKernels = 0; binHeader.SteppingId = 0; @@ -1597,7 +1597,7 @@ TEST(ProgramFromBinaryTests, CreateWithBinary_FailRecompile) { memset(&binHeader, 0, sizeof(binHeader)); binHeader.Magic = iOpenCL::MAGIC_CL; binHeader.Version = iOpenCL::CURRENT_ICBE_VERSION; - binHeader.Device = platformDevices[0]->pPlatform->eRenderCoreFamily; + binHeader.Device = platformDevices[0]->pPlatform.eRenderCoreFamily; binHeader.GPUPointerSizeInBytes = 8; binHeader.NumberOfKernels = 0; binHeader.SteppingId = 0; @@ -1633,7 +1633,7 @@ TEST(ProgramFromBinaryTests, givenEmptyProgramThenErrorIsReturned) { memset(&binHeader, 0, sizeof(binHeader)); binHeader.Magic = iOpenCL::MAGIC_CL; binHeader.Version = iOpenCL::CURRENT_ICBE_VERSION; - binHeader.Device = platformDevices[0]->pPlatform->eRenderCoreFamily; + binHeader.Device = platformDevices[0]->pPlatform.eRenderCoreFamily; binHeader.GPUPointerSizeInBytes = 8; binHeader.NumberOfKernels = 0; binHeader.SteppingId = 0; @@ -2007,7 +2007,7 @@ TEST_F(ProgramTests, ProgramFromGenBinaryWithPATCH_TOKEN_GLOBAL_MEMORY_OBJECT_KE SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)pBin; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + pBHdr->Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; @@ -2072,7 +2072,7 @@ TEST_F(ProgramTests, ProgramFromGenBinaryWithPATCH_TOKEN_GTPIN_FREE_GRF_INFO) { SProgramBinaryHeader *pBHdr = (SProgramBinaryHeader *)pBin; pBHdr->Magic = iOpenCL::MAGIC_CL; pBHdr->Version = iOpenCL::CURRENT_ICBE_VERSION; - pBHdr->Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + pBHdr->Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; pBHdr->GPUPointerSizeInBytes = 8; pBHdr->NumberOfKernels = 1; pBHdr->SteppingId = 0; @@ -2347,7 +2347,7 @@ TEST_F(ProgramTests, GetProgramCompilerVersion) { struct SProgramBinaryHeader prgHdr; prgHdr.Magic = iOpenCL::MAGIC_CL; prgHdr.Version = 12; - prgHdr.Device = pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily; + prgHdr.Device = pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily; prgHdr.GPUPointerSizeInBytes = 8; prgHdr.NumberOfKernels = 1; prgHdr.SteppingId = 0; @@ -2515,7 +2515,7 @@ TEST_F(ProgramTests, givenNewProgramTheStatelessToStatefulBufferOffsetOtimizatio auto it = internalOpts.find("-cl-intel-has-buffer-offset-arg "); HardwareCapabilities hwCaps = {0}; - HwHelper::get(prog.getDevice(0).getHardwareInfo().pPlatform->eRenderCoreFamily).setupHardwareCapabilities(&hwCaps, prog.getDevice(0).getHardwareInfo()); + HwHelper::get(prog.getDevice(0).getHardwareInfo().pPlatform.eRenderCoreFamily).setupHardwareCapabilities(&hwCaps, prog.getDevice(0).getHardwareInfo()); if (hwCaps.isStatelesToStatefullWithOffsetSupported) { EXPECT_NE(std::string::npos, it); } else { diff --git a/unit_tests/program/program_with_kernel_debug_tests.cpp b/unit_tests/program/program_with_kernel_debug_tests.cpp index 34cf49b33a..43d308f607 100644 --- a/unit_tests/program/program_with_kernel_debug_tests.cpp +++ b/unit_tests/program/program_with_kernel_debug_tests.cpp @@ -65,7 +65,7 @@ class ProgramWithKernelDebuggingTest : public ProgramSimpleFixture, }; TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDebugFlag) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { std::string receivedInternalOptions; auto debugVars = NEO::getFclDebugVars(); @@ -84,7 +84,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDashGFlag) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { cl_int retVal = pProgram->compile(1, &device, nullptr, 0, nullptr, nullptr, nullptr, @@ -96,7 +96,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhenProgramIsCompiledThenOptionsIncludeClOptDisableFlag) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; sourceLevelDebugger->isOptDisabled = true; @@ -112,7 +112,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhen } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenOptionsStartsWithDashSFilename) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; sourceLevelDebugger->sourceCodeFilename = "debugFileName"; pDevice->executionEnvironment->sourceLevelDebugger.reset(sourceLevelDebugger); @@ -127,7 +127,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenInternalOptionsIncludeDebugFlag) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { std::string receivedInternalOptions; auto debugVars = NEO::getFclDebugVars(); @@ -143,7 +143,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenOptionsIncludeDashGFlag) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_THAT(pProgram->getOptions(), ::testing::HasSubstr("-g")); @@ -151,7 +151,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhenProgramIsBuiltThenOptionsIncludeClOptDisableFlag) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; sourceLevelDebugger->isOptDisabled = true; @@ -164,7 +164,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhen } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenOptionsStartsWithDashSFilename) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; sourceLevelDebugger->sourceCodeFilename = "debugFileName"; @@ -177,7 +177,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinkedThenKernelDebugOptionsAreAppended) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; pDevice->executionEnvironment->sourceLevelDebugger.reset(sourceLevelDebugger); @@ -197,7 +197,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenDebuggerIsNotifiedWithKernelDebugData) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { GMockSourceLevelDebugger *sourceLevelDebugger = new GMockSourceLevelDebugger(nullptr); ON_CALL(*sourceLevelDebugger, notifySourceCode(::testing::_, ::testing::_, ::testing::_)).WillByDefault(::testing::Return(false)); @@ -216,7 +216,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt } TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinkedThenDebuggerIsNotifiedWithKernelDebugData) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { GMockSourceLevelDebugger *sourceLevelDebugger = new GMockSourceLevelDebugger(nullptr); ON_CALL(*sourceLevelDebugger, notifySourceCode(::testing::_, ::testing::_, ::testing::_)).WillByDefault(::testing::Return(false)); @@ -243,7 +243,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke } TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenBuiltThenPatchTokenAllocateSipSurfaceHasSizeGreaterThanZero) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { retVal = pProgram->build(1, &device, CompilerOptions::debugKernelEnable, nullptr, nullptr, false); EXPECT_EQ(CL_SUCCESS, retVal); @@ -253,7 +253,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenBui } TEST_F(ProgramWithKernelDebuggingTest, givenKernelDebugEnabledWhenProgramIsBuiltThenDebugDataIsStored) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); size_t debugDataSize = 0; @@ -264,7 +264,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenKernelDebugEnabledWhenProgramIsBuilt } TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenProcessDebugDataIsCalledThenKernelInfosAreFilledWithDebugData) { - if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) { + if (pDevice->getHardwareInfo().pPlatform.eRenderCoreFamily >= IGFX_GEN9_CORE) { retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); EXPECT_EQ(CL_SUCCESS, retVal); diff --git a/unit_tests/scenarios/windows/enqueue_read_write_buffer_scenarios_windows_tests.cpp b/unit_tests/scenarios/windows/enqueue_read_write_buffer_scenarios_windows_tests.cpp index bdadc01da1..96cf9026e0 100644 --- a/unit_tests/scenarios/windows/enqueue_read_write_buffer_scenarios_windows_tests.cpp +++ b/unit_tests/scenarios/windows/enqueue_read_write_buffer_scenarios_windows_tests.cpp @@ -11,7 +11,6 @@ #include "test.h" #include "unit_tests/fixtures/buffer_fixture.h" #include "unit_tests/helpers/execution_environment_helper.h" -#include "unit_tests/helpers/hw_info_helper.h" #include "unit_tests/helpers/hw_parse.h" #include "unit_tests/mocks/mock_command_queue.h" #include "unit_tests/mocks/mock_device.h" @@ -43,7 +42,7 @@ struct EnqueueBufferWindowsTest : public HardwareParse, memoryManager = new MockWddmMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); - device = std::unique_ptr(Device::create(hwInfo, executionEnvironment, 0)); + device = std::unique_ptr(Device::create(executionEnvironment, 0)); context = std::make_unique(device.get()); @@ -62,7 +61,7 @@ struct EnqueueBufferWindowsTest : public HardwareParse, } protected: - HwInfoHelper hwInfoHelper; + HardwareInfo hwInfoHelper; HardwareInfo *hwInfo = nullptr; ExecutionEnvironment *executionEnvironment; cl_queue_properties properties = {}; diff --git a/unit_tests/scheduler/scheduler_kernel_tests.cpp b/unit_tests/scheduler/scheduler_kernel_tests.cpp index b391c04c88..7c3410e86c 100644 --- a/unit_tests/scheduler/scheduler_kernel_tests.cpp +++ b/unit_tests/scheduler/scheduler_kernel_tests.cpp @@ -77,7 +77,7 @@ TEST(SchedulerKernelTest, getGws) { const size_t hwThreads = 3; const size_t simdSize = 8; - size_t maxGws = platformDevices[0]->pSysInfo->EUCount * hwThreads * simdSize; + size_t maxGws = platformDevices[0]->pSysInfo.EUCount * hwThreads * simdSize; size_t gws = kernel.getGws(); EXPECT_GE(maxGws, gws); @@ -301,10 +301,8 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableWhenSchedulerKer } TEST(SchedulerKernelTest, givenSimulationModeWhenSchedulerKernelIsCreatedThenGwsIsSetToOneWorkgroup) { - FeatureTable skuTable = *platformDevices[0]->pSkuTable; - skuTable.ftrSimulationMode = true; - HardwareInfo hwInfo = {platformDevices[0]->pPlatform, &skuTable, platformDevices[0]->pWaTable, - platformDevices[0]->pSysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo hwInfo = *platformDevices[0]; + hwInfo.pSkuTable.ftrSimulationMode = true; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); MockProgram program(*device->getExecutionEnvironment()); @@ -319,10 +317,8 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableAndSimulationMod DebugManagerStateRestore dbgRestorer; DebugManager.flags.SchedulerGWS.set(48); - FeatureTable skuTable = *platformDevices[0]->pSkuTable; - skuTable.ftrSimulationMode = true; - HardwareInfo hwInfo = {platformDevices[0]->pPlatform, &skuTable, platformDevices[0]->pWaTable, - platformDevices[0]->pSysInfo, platformDevices[0]->capabilityTable}; + HardwareInfo hwInfo = *platformDevices[0]; + hwInfo.pSkuTable.ftrSimulationMode = true; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); MockProgram program(*device->getExecutionEnvironment()); diff --git a/unit_tests/sharings/gl/gl_arb_sync_event_tests.cpp b/unit_tests/sharings/gl/gl_arb_sync_event_tests.cpp index 627c94b5d5..27ecb53f45 100644 --- a/unit_tests/sharings/gl/gl_arb_sync_event_tests.cpp +++ b/unit_tests/sharings/gl/gl_arb_sync_event_tests.cpp @@ -67,7 +67,7 @@ struct GlArbSyncEventTest : public ::testing::Test { executionEnvironment = platformImpl->peekExecutionEnvironment(); auto mockCsr = new MockCommandStreamReceiver(*executionEnvironment); executionEnvironment->memoryManager = std::make_unique(*executionEnvironment); - device.reset(MockDevice::create(nullptr, executionEnvironment, 0u)); + device.reset(MockDevice::create(executionEnvironment, 0u)); device->resetCommandStreamReceiver(mockCsr); ctx.reset(new MockContext); cmdQ.reset(new MockCommandQueue(ctx.get(), device.get(), nullptr)); diff --git a/unit_tests/sharings/gl/gl_texture_tests.cpp b/unit_tests/sharings/gl/gl_texture_tests.cpp index 4ef8fc6688..54b2583e35 100644 --- a/unit_tests/sharings/gl/gl_texture_tests.cpp +++ b/unit_tests/sharings/gl/gl_texture_tests.cpp @@ -57,7 +57,7 @@ class GlSharingTextureTests : public ::testing::Test { tempMM = new TempMM(*executionEnvironment); executionEnvironment->memoryManager.reset(tempMM); - device.reset(MockDevice::create(*platformDevices, executionEnvironment, 0)); + device.reset(MockDevice::create(executionEnvironment, 0)); clContext = std::make_unique(device.get()); mockGlSharingFunctions = glSharing->sharingFunctions.release(); diff --git a/unit_tests/sharings/sharing_factory_tests.cpp b/unit_tests/sharings/sharing_factory_tests.cpp index c13fcbcf32..00e0d405e8 100644 --- a/unit_tests/sharings/sharing_factory_tests.cpp +++ b/unit_tests/sharings/sharing_factory_tests.cpp @@ -213,7 +213,7 @@ TEST(Context, givenMockSharingBuilderWhenContextWithInvalidPropertiesThenContext stateRestore.clearCurrentState(); stateRestore.registerSharing(SharingType::CLGL_SHARING); - auto device = std::make_unique(*platformDevices[0]); + auto device = std::make_unique(); cl_device_id clDevice = static_cast(device.get()); auto deviceVector = DeviceVector(&clDevice, 1); cl_int retVal; diff --git a/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp b/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp index 9e7f7fa76b..84ccbc729e 100644 --- a/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp +++ b/unit_tests/source_level_debugger/source_level_debugger_csr_tests.cpp @@ -35,7 +35,7 @@ class CommandStreamReceiverWithActiveDebuggerTest : public ::testing::Test { auto mockMemoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(mockMemoryManager); - device.reset(Device::create(&hwInfo[0], executionEnvironment, 0)); + device.reset(Device::create(executionEnvironment, 0)); device->setSourceLevelDebuggerActive(true); return mockCsr; @@ -70,7 +70,7 @@ HWTEST_F(CommandStreamReceiverWithActiveDebuggerTest, givenCsrWithActiveDebugger dispatchFlags, *device); - auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().pPlatform->eRenderCoreFamily, true); + auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().pPlatform.eRenderCoreFamily, true); auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *device).getSipAllocation(); bool found = false; for (auto allocation : mockCsr->copyOfAllocations) { @@ -111,7 +111,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs dispatchFlags, *device); - auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().pPlatform->eRenderCoreFamily, true); + auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().pPlatform.eRenderCoreFamily, true); auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *device).getSipAllocation(); HardwareParse hwParser; @@ -174,7 +174,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverWithActiveDebuggerTest, givenCs dispatchFlags, *device); - auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().pPlatform->eRenderCoreFamily, true); + auto sipType = SipKernel::getSipKernelType(device->getHardwareInfo().pPlatform.eRenderCoreFamily, true); auto sipAllocation = device->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *device).getSipAllocation(); HardwareParse hwParser; diff --git a/unit_tests/source_level_debugger/source_level_debugger_device_tests.cpp b/unit_tests/source_level_debugger/source_level_debugger_device_tests.cpp index 21ff2562ab..1757c5da61 100644 --- a/unit_tests/source_level_debugger/source_level_debugger_device_tests.cpp +++ b/unit_tests/source_level_debugger/source_level_debugger_device_tests.cpp @@ -29,7 +29,7 @@ class MockOsLibrary : public OsLibrary { class MockDeviceWithDebuggerActive : public MockDevice { public: - MockDeviceWithDebuggerActive(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) : MockDevice(hwInfo, executionEnvironment, deviceIndex) {} + MockDeviceWithDebuggerActive(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex) : MockDevice(executionEnvironment, deviceIndex) {} void initializeCaps() override { MockDevice::initializeCaps(); this->setSourceLevelDebuggerActive(true); @@ -40,7 +40,7 @@ TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhen ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); auto gmock = new ::testing::NiceMock(new MockOsLibrary); executionEnvironment->sourceLevelDebugger.reset(gmock); - auto device = std::unique_ptr(MockDevice::create(nullptr, executionEnvironment, 0u)); + auto device = std::unique_ptr(MockDevice::create(executionEnvironment, 0u)); EXPECT_CALL(*gmock, notifyDeviceDestruction()).Times(1); } @@ -48,7 +48,7 @@ TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhen TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsCreatedThenPreemptionIsDisabled) { ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); executionEnvironment->sourceLevelDebugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary)); - auto device = std::unique_ptr(MockDevice::create(nullptr, executionEnvironment, 0u)); + auto device = std::unique_ptr(MockDevice::create(executionEnvironment, 0u)); EXPECT_EQ(PreemptionMode::Disabled, device->getPreemptionMode()); } diff --git a/unit_tests/source_level_debugger/source_level_debugger_preamble_test.inl b/unit_tests/source_level_debugger/source_level_debugger_preamble_test.inl index 3976e90782..b7f8bab28e 100644 --- a/unit_tests/source_level_debugger/source_level_debugger_preamble_test.inl +++ b/unit_tests/source_level_debugger/source_level_debugger_preamble_test.inl @@ -29,7 +29,7 @@ void SourceLevelDebuggerPreambleTest::givenMidThreadPreemptionAndDebu STATE_SIP *stateSipCmd = (STATE_SIP *)*itorStateSip; auto sipAddress = stateSipCmd->getSystemInstructionPointer(); - auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform->eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform.eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); EXPECT_EQ(mockDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *mockDevice).getSipAllocation()->getGpuAddressToPatch(), sipAddress); } @@ -55,7 +55,7 @@ void SourceLevelDebuggerPreambleTest::givenMidThreadPreemptionAndDisa STATE_SIP *stateSipCmd = (STATE_SIP *)*itorStateSip; auto sipAddress = stateSipCmd->getSystemInstructionPointer(); - auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform->eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform.eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); EXPECT_EQ(mockDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *mockDevice).getSipAllocation()->getGpuAddressToPatch(), sipAddress); } @@ -81,7 +81,7 @@ void SourceLevelDebuggerPreambleTest::givenPreemptionDisabledAndDebug STATE_SIP *stateSipCmd = (STATE_SIP *)*itorStateSip; auto sipAddress = stateSipCmd->getSystemInstructionPointer(); - auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform->eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); + auto sipType = SipKernel::getSipKernelType(mockDevice->getHardwareInfo().pPlatform.eRenderCoreFamily, mockDevice->isSourceLevelDebuggerActive()); EXPECT_EQ(mockDevice->getExecutionEnvironment()->getBuiltIns()->getSipKernel(sipType, *mockDevice).getSipAllocation()->getGpuAddressToPatch(), sipAddress); } diff --git a/unit_tests/source_level_debugger/source_level_debugger_tests.cpp b/unit_tests/source_level_debugger/source_level_debugger_tests.cpp index 760f1ac0bb..3e00909df5 100644 --- a/unit_tests/source_level_debugger/source_level_debugger_tests.cpp +++ b/unit_tests/source_level_debugger/source_level_debugger_tests.cpp @@ -458,7 +458,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceIsConstructe DebuggerLibrary::setDebuggerActive(true); DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor); - unique_ptr device(new MockDevice(*platformDevices[0])); + unique_ptr device(new MockDevice()); EXPECT_TRUE(interceptor.initCalled); } } @@ -494,7 +494,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo); hwInfo->capabilityTable.instrumentationEnabled = true; - unique_ptr device(Device::create(&hwInfo[0], executionEnvironment, 0)); + unique_ptr device(Device::create(executionEnvironment, 0)); ASSERT_NE(nullptr, device->getCommandStreamReceiver().getOSInterface()); @@ -530,12 +530,12 @@ TEST(SourceLevelDebugger, givenTwoDevicesWhenSecondIsCreatedThenNotCreatingNewSo ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - std::unique_ptr device1(Device::create(nullptr, executionEnvironment, 0u)); + std::unique_ptr device1(Device::create(executionEnvironment, 0u)); EXPECT_NE(nullptr, executionEnvironment->memoryManager); EXPECT_TRUE(interceptor.initCalled); interceptor.initCalled = false; - std::unique_ptr device2(Device::create(nullptr, executionEnvironment, 1u)); + std::unique_ptr device2(Device::create(executionEnvironment, 1u)); EXPECT_NE(nullptr, executionEnvironment->memoryManager); EXPECT_FALSE(interceptor.initCalled); } @@ -549,9 +549,9 @@ TEST(SourceLevelDebugger, givenMultipleDevicesWhenTheyAreCreatedTheyAllReuseTheS DebuggerLibrary::setDebuggerActive(true); ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); - std::unique_ptr device1(Device::create(nullptr, executionEnvironment, 0u)); + std::unique_ptr device1(Device::create(executionEnvironment, 0u)); auto sourceLevelDebugger = device1->getSourceLevelDebugger(); - std::unique_ptr device2(Device::create(nullptr, executionEnvironment, 1u)); + std::unique_ptr device2(Device::create(executionEnvironment, 1u)); EXPECT_EQ(sourceLevelDebugger, device2->getSourceLevelDebugger()); } } diff --git a/unit_tests/tbx/main_tbx.cpp b/unit_tests/tbx/main_tbx.cpp index d6562ca801..41d2867a43 100644 --- a/unit_tests/tbx/main_tbx.cpp +++ b/unit_tests/tbx/main_tbx.cpp @@ -14,28 +14,26 @@ using namespace NEO; namespace NEO { -bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); +bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); } // namespace NEO TEST(CSRTests, getDevices) { - HardwareInfo *hwInfo = nullptr; size_t numDevicesReturned = 0; DebugManagerStateRestore dbgState; DebugManager.flags.SetCommandStreamReceiver.set(2); ExecutionEnvironment executionEnvironment; - NEO::getDevices(&hwInfo, numDevicesReturned, executionEnvironment); + NEO::getDevices(numDevicesReturned, executionEnvironment); - ASSERT_NE(nullptr, hwInfo); - ASSERT_NE(nullptr, hwInfo->pSysInfo); + auto hwInfo = executionEnvironment.getHardwareInfo(); - EXPECT_GT_VAL(hwInfo->pSysInfo->EUCount, 0u); - EXPECT_GT_VAL(hwInfo->pSysInfo->ThreadCount, 0u); - EXPECT_GT_VAL(hwInfo->pSysInfo->SliceCount, 0u); - EXPECT_GT_VAL(hwInfo->pSysInfo->SubSliceCount, 0u); - EXPECT_GT_VAL(hwInfo->pSysInfo->L3CacheSizeInKb, 0u); - EXPECT_EQ_VAL(hwInfo->pSysInfo->CsrSizeInMb, 8u); - EXPECT_FALSE(hwInfo->pSysInfo->IsDynamicallyPopulated); + EXPECT_GT_VAL(hwInfo->pSysInfo.EUCount, 0u); + EXPECT_GT_VAL(hwInfo->pSysInfo.ThreadCount, 0u); + EXPECT_GT_VAL(hwInfo->pSysInfo.SliceCount, 0u); + EXPECT_GT_VAL(hwInfo->pSysInfo.SubSliceCount, 0u); + EXPECT_GT_VAL(hwInfo->pSysInfo.L3CacheSizeInKb, 0u); + EXPECT_EQ_VAL(hwInfo->pSysInfo.CsrSizeInMb, 8u); + EXPECT_FALSE(hwInfo->pSysInfo.IsDynamicallyPopulated); } int main(int argc, char **argv) { diff --git a/unit_tests/windows/get_devices_tests.cpp b/unit_tests/windows/get_devices_tests.cpp index 32e1ffe4ee..c145ce4bda 100644 --- a/unit_tests/windows/get_devices_tests.cpp +++ b/unit_tests/windows/get_devices_tests.cpp @@ -10,16 +10,15 @@ #include "test.h" namespace NEO { -bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); +bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); } // namespace NEO using GetDevicesTests = ::testing::Test; HWTEST_F(GetDevicesTests, WhenGetDevicesIsCalledThenSuccessIsReturned) { - NEO::HardwareInfo *hwInfo; size_t numDevicesReturned = 0; NEO::ExecutionEnvironment executionEnviornment; - auto returnValue = NEO::getDevices(&hwInfo, numDevicesReturned, executionEnviornment); + auto returnValue = NEO::getDevices(numDevicesReturned, executionEnviornment); EXPECT_EQ(true, returnValue); }